Until we remove libnl-1.x and libnl-2.x support, it should be
possible to choose the libnl version at build time. This is
mostly important for testing legacy libnl support but it also
helps distributions that ship other tools built agains them.
(https://bugs.gentoo.org/show_bug.cgi?id=441750)
If we want to support vlan without libnl3,
then we can use ioctl.
Changelog:
V2: fix identation and comments.
Signed-off-by: Weiping Pan <wpan@redhat.com>
First make it build on libnl1/2. Second, the VLAN
virtual interface name might not always be given in the
NMConnection (if the master is a UUID and thus the name
is determined automatically) so just take the interface
name instead. And make sure we verify it's a VLAN
interface before deleting it.
Lastly, construct the VLAN interface name if it's not
given in the NMConnection. This means we need to know
the master interface name when creating the connection,
which we always will since you can't create the VLAN
interface without it's master being present. That also
means we need to return the name to the caller so it
can be used to create the NMDevice for the VLAN interface
after we've created it in the kernel.
I only install libnl-3.2.3 on my system, and I met an error:
In file included from ../../src/nm-netlink-monitor.h:93:0,
from nm-vpn-connection.c:48:
../../src/nm-netlink-compat.h:210:5: error: "HAVE_LIBNL1" is not defined
../../src/nm-netlink-compat.h:210:20: error: "HAVE_LIBNL2" is not defined
make[5]: *** [libvpn_manager_la-nm-vpn-connection.lo] Error 1
Signed-off-by: Weiping Pan <wpan@redhat.com>
Based on a patch for iw by Johannes Berg <johannes.berg@intel.com>
This simplifies the code quite a bit since we don't need
an nl_cache or nl_family anymore.
genl_ctrl_resolve() is available in libnl1.1, libnl2 and libnl3.
Cc: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Thomas Graf <tgraf@redhat.com>
Code is written generic enough to allow easy addition of further master/slave
relationships such as bridging relations.
Signed-off-by: Thomas Graf <tgraf@redhat.com>
(whitespace cleanups and libnl compat by dcbw)
A bonding device is like a virtual ethernet device. We therefore reuse
nm-device-ethernet and add some special handling to detect bonding
connections.
Changes v2:
- Fixed memory leak
Signed-off-by: Thomas Graf <tgraf@redhat.com>
Creates virtual kernel devices as needed. Since the manager is
initialized after the connections have been loaded no
CONNECTIONS_ADDED notification is received for connections parsed
at startup.
Therefore walks the loaded connections looking for bonding
connections.
Connections added on the fly are handled via the notifications.
Connection renaming and deleting is not supported yet.
Signed-off-by: Thomas Graf <tgraf@redhat.com>