On Thu, 2016-02-04 at 12:21 +0100, Stjepan Groš wrote:
Hi! Is anyone working on network namespaces support in NetworkManager? Or was thinking what is a "proper way" of implementing them? I'm experimenting with adding support to NM and what I implemented so far is: 1. Added objects NMNetnsController which would control all network namespaces managed by NM. 2. Each network namespace is represented with an object NMNetns and exposed on DBus. There are no methods so far but only a property name which contains network namespace's name on the filesystem. 3. NMNetnsController exposes object NetworkNamespacesController with methods AddNetworkNamepace and ListNetworkNamespaces. The first one take a name as an argument and creates a new (iproute2 compatible) network namespace, while the second one provides a list of existing namespaces. 4. When new network namespace is created (using AddNetworkNamepace method) a new, private, platform layer is instantiated and loopback interface within namespace activated. Note that new platform layer has to be created because once a socket is opened in one network namespace it is bound to the given namespace no matter which namespace is active so current singleton object wouldn't work without heavy refactoring! What I intend to do next is: 1. NM has to monitor devices/IP addresses in new network namespaces properly. 2. Methods that would allow an IPv4 or IPv6 address to be assigned in some network namespace. All the code is here: https://github.com/sgros/MIF_NetworkManager and since this is PoC, there are A LOT OF BUGS AND MISSING FEATURES. So, what do you think? Any comments, suggestions, critiques, etc? SG P.S. To be able to run patched NM you also need patched libndp library available here: https://github.com/sgros/MIF_libndp
Hi Sjepan, I think adding namespace support to platform needs to be more elaborate. There is also udev, ethtool, sysctl, which must be considered and the NMPlatform instance must transparently switch namespace as needed. I did that here: https://cgit.freedesktop.org/NetworkManager/NetworkManager/log/?h=th/platform-netns Thomas
Attachment:
signature.asc
Description: This is a digitally signed message part