From b3667afa22d01ac4834c12ea23dae182083b7971 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Mon, 26 Jan 2015 11:40:08 +0100 Subject: contrib: ensure udev rules from RPM package are applied We install udev rules and need to ensure that correct ones are in effect when the package is installed, updated or removed. --- contrib/fedora/rpm/NetworkManager.spec | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index f88ce95892..a488ca3648 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -489,6 +489,9 @@ make check %post +/usr/bin/udevadm control --reload-rules || : +/usr/bin/udevadm trigger --subsystem-match=net || : + %systemd_post NetworkManager.service NetworkManager-wait-online.service NetworkManager-dispatcher.service %preun @@ -502,6 +505,9 @@ fi %systemd_preun NetworkManager-wait-online.service NetworkManager-dispatcher.service %postun +/usr/bin/udevadm control --reload-rules || : +/usr/bin/udevadm trigger --subsystem-match=net || : + %systemd_postun -- cgit v1.2.1 From 4a0586955767537b7494f931ccaa93bbf59c36f9 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Fri, 21 Nov 2014 15:02:37 +0100 Subject: platform: don't wait for udev device initializaton if there's no udev There's no udev running in containers, it only starts if /sys is writable. If a hardware device is added to the container's namespace NM would not announce it. This also removes the software link special case -- the software links will now wait for udev initialization (in case udev is there) as well. There's no reason to treat them differently anymore. This makes it possible to use udev properties of the software links. https://bugzilla.gnome.org/show_bug.cgi?id=740526 --- src/platform/nm-fake-platform.c | 30 +++++++++++++++++++++-- src/platform/nm-linux-platform.c | 50 +++++++-------------------------------- src/platform/tests/test-address.c | 2 +- src/platform/tests/test-cleanup.c | 2 +- src/platform/tests/test-link.c | 8 +++---- src/platform/tests/test-route.c | 2 +- src/tests/test-route-manager.c | 4 ++-- 7 files changed, 45 insertions(+), 53 deletions(-) diff --git a/src/platform/nm-fake-platform.c b/src/platform/nm-fake-platform.c index b2878e3b0c..941d742a11 100644 --- a/src/platform/nm-fake-platform.c +++ b/src/platform/nm-fake-platform.c @@ -49,6 +49,11 @@ typedef struct { int vlan_id; } NMFakePlatformLink; +typedef struct { + int ifindex; + NMPlatform *platform; +} NMFakePlatformLinkData; + #define NM_FAKE_PLATFORM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_FAKE_PLATFORM, NMFakePlatformPrivate)) G_DEFINE_TYPE (NMFakePlatform, nm_fake_platform, NM_TYPE_PLATFORM) @@ -174,6 +179,23 @@ _nm_platform_link_get (NMPlatform *platform, int ifindex, NMPlatformLink *l) return !!device; } +static gboolean +_link_announce (NMFakePlatformLinkData *data) +{ + NMFakePlatformLink *device = link_get (data->platform, data->ifindex); + + if (device) + g_signal_emit_by_name (data->platform, + NM_PLATFORM_SIGNAL_LINK_CHANGED, + device->link.ifindex, + device, + NM_PLATFORM_SIGNAL_ADDED, + NM_PLATFORM_REASON_INTERNAL); + g_free (data); + + return FALSE; +} + static gboolean link_add (NMPlatform *platform, const char *name, NMLinkType type, const void *address, size_t address_len) { @@ -184,8 +206,12 @@ link_add (NMPlatform *platform, const char *name, NMLinkType type, const void *a g_array_append_val (priv->links, device); - if (device.link.ifindex) - g_signal_emit_by_name (platform, NM_PLATFORM_SIGNAL_LINK_CHANGED, device.link.ifindex, &device, NM_PLATFORM_SIGNAL_ADDED, NM_PLATFORM_REASON_INTERNAL); + if (device.link.ifindex) { + NMFakePlatformLinkData *data = g_new (NMFakePlatformLinkData, 1); + data->ifindex = device.link.ifindex; + data->platform = platform; + g_idle_add ((GSourceFunc) _link_announce, data); + } return TRUE; } diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index 47075f226f..f219898d87 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -780,41 +780,6 @@ link_type_from_udev (NMPlatform *platform, int ifindex, const char *ifname, int return_type (NM_LINK_TYPE_UNKNOWN, "unknown"); } -static gboolean -link_is_software (struct rtnl_link *rtnllink) -{ - const char *type; - - /* FIXME: replace somehow with NMLinkType or nm_platform_is_software(), but - * solve the infinite callstack problems that getting the type of a TUN/TAP - * device causes. - */ - - if ( rtnl_link_get_arptype (rtnllink) == ARPHRD_INFINIBAND - && strchr (rtnl_link_get_name (rtnllink), '.')) - return TRUE; - - type = rtnl_link_get_type (rtnllink); - if (type == NULL) - return FALSE; - - if (!strcmp (type, "dummy") || - !strcmp (type, "gre") || - !strcmp (type, "gretap") || - !strcmp (type, "macvlan") || - !strcmp (type, "macvtap") || - !strcmp (type, "tun") || - !strcmp (type, "veth") || - !strcmp (type, "vlan") || - !strcmp (type, "vxlan") || - !strcmp (type, "bridge") || - !strcmp (type, "bond") || - !strcmp (type, "team")) - return TRUE; - - return FALSE; -} - static const char * ethtool_get_driver (const char *ifname) { @@ -837,10 +802,6 @@ link_is_announceable (NMPlatform *platform, struct rtnl_link *rtnllink) { NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform); - /* Software devices are always visible outside the platform */ - if (link_is_software (rtnllink)) - return TRUE; - /* Hardware devices must be found by udev so rules get run and tags set */ if (g_hash_table_lookup (priv->udev_devices, GINT_TO_POINTER (rtnl_link_get_ifindex (rtnllink)))) @@ -1587,7 +1548,7 @@ announce_object (NMPlatform *platform, const struct nl_object *object, NMPlatfor if (!init_link (platform, &device, rtnl_link)) return; - /* Skip hardware devices not yet discovered by udev. They will be + /* Skip devices not yet discovered by udev. They will be * announced by udev_device_added(). This doesn't apply to removed * devices, as those come either from udev_device_removed(), * event_notification() or link_delete() which block the announcment @@ -1596,7 +1557,7 @@ announce_object (NMPlatform *platform, const struct nl_object *object, NMPlatfor switch (change_type) { case NM_PLATFORM_SIGNAL_ADDED: case NM_PLATFORM_SIGNAL_CHANGED: - if (!link_is_software (rtnl_link) && !device.driver) + if (!device.driver) return; break; default: @@ -4537,7 +4498,12 @@ setup (NMPlatform *platform) /* And read initial device list */ enumerator = g_udev_enumerator_new (priv->udev_client); g_udev_enumerator_add_match_subsystem (enumerator, "net"); - g_udev_enumerator_add_match_is_initialized (enumerator); + + /* Demand that the device is initialized (udev rules ran, + * device has a stable name now) in case udev is running + * (not in a container). */ + if (access ("/sys", W_OK) == 0) + g_udev_enumerator_add_match_is_initialized (enumerator); devices = g_udev_enumerator_execute (enumerator); for (iter = devices; iter; iter = g_list_next (iter)) { diff --git a/src/platform/tests/test-address.c b/src/platform/tests/test-address.c index 3ef13b8ec3..902b33ee59 100644 --- a/src/platform/tests/test-address.c +++ b/src/platform/tests/test-address.c @@ -254,7 +254,7 @@ setup_tests (void) nm_platform_link_delete (nm_platform_link_get_ifindex (DEVICE_NAME)); g_assert (!nm_platform_link_exists (DEVICE_NAME)); g_assert (nm_platform_dummy_add (DEVICE_NAME)); - accept_signal (link_added); + wait_signal (link_added); free_signal (link_added); g_test_add_func ("/address/internal/ip4", test_ip4_address); diff --git a/src/platform/tests/test-cleanup.c b/src/platform/tests/test-cleanup.c index afbb438cca..5d789d1bdf 100644 --- a/src/platform/tests/test-cleanup.c +++ b/src/platform/tests/test-cleanup.c @@ -36,7 +36,7 @@ test_cleanup_internal (void) /* Create and set up device */ g_assert (nm_platform_dummy_add (DEVICE_NAME)); - accept_signal (link_added); + wait_signal (link_added); free_signal (link_added); g_assert (nm_platform_link_set_up (nm_platform_link_get_ifindex (DEVICE_NAME))); ifindex = nm_platform_link_get_ifindex (DEVICE_NAME); diff --git a/src/platform/tests/test-link.c b/src/platform/tests/test-link.c index ec4f9ba203..0643b052cd 100644 --- a/src/platform/tests/test-link.c +++ b/src/platform/tests/test-link.c @@ -115,7 +115,7 @@ software_add (NMLinkType link_type, const char *name) /* Don't call link_callback for the bridge interface */ parent_added = add_signal_ifname (NM_PLATFORM_SIGNAL_LINK_CHANGED, NM_PLATFORM_SIGNAL_ADDED, link_callback, PARENT_NAME); if (nm_platform_bridge_add (PARENT_NAME, NULL, 0)) - accept_signal (parent_added); + wait_signal (parent_added); free_signal (parent_added); { @@ -148,7 +148,7 @@ test_slave (int master, int type, SignalData *master_changed) g_assert (ifindex > 0); link_changed = add_signal_ifindex (NM_PLATFORM_SIGNAL_LINK_CHANGED, NM_PLATFORM_SIGNAL_CHANGED, link_callback, ifindex); link_removed = add_signal_ifindex (NM_PLATFORM_SIGNAL_LINK_CHANGED, NM_PLATFORM_SIGNAL_REMOVED, link_callback, ifindex); - accept_signal (link_added); + wait_signal (link_added); /* Set the slave up to see whether master's IFF_LOWER_UP is set correctly. * @@ -263,7 +263,7 @@ test_software (NMLinkType link_type, const char *link_typename) link_added = add_signal_ifname (NM_PLATFORM_SIGNAL_LINK_CHANGED, NM_PLATFORM_SIGNAL_ADDED, link_callback, DEVICE_NAME); g_assert (software_add (link_type, DEVICE_NAME)); no_error (); - accept_signal (link_added); + wait_signal (link_added); g_assert (nm_platform_link_exists (DEVICE_NAME)); ifindex = nm_platform_link_get_ifindex (DEVICE_NAME); g_assert (ifindex >= 0); @@ -407,7 +407,7 @@ test_internal (void) /* Add device */ g_assert (nm_platform_dummy_add (DEVICE_NAME)); no_error (); - accept_signal (link_added); + wait_signal (link_added); /* Try to add again */ g_assert (!nm_platform_dummy_add (DEVICE_NAME)); diff --git a/src/platform/tests/test-route.c b/src/platform/tests/test-route.c index fec1e38d26..b6e99ab9fb 100644 --- a/src/platform/tests/test-route.c +++ b/src/platform/tests/test-route.c @@ -319,7 +319,7 @@ setup_tests (void) nm_platform_link_delete (nm_platform_link_get_ifindex (DEVICE_NAME)); g_assert (!nm_platform_link_exists (DEVICE_NAME)); g_assert (nm_platform_dummy_add (DEVICE_NAME)); - accept_signal (link_added); + wait_signal (link_added); free_signal (link_added); g_assert (nm_platform_link_set_up (nm_platform_link_get_ifindex (DEVICE_NAME))); diff --git a/src/tests/test-route-manager.c b/src/tests/test-route-manager.c index d6ada104d4..b93dbb18f5 100644 --- a/src/tests/test-route-manager.c +++ b/src/tests/test-route-manager.c @@ -648,7 +648,7 @@ fixture_setup (test_fixture *fixture, gconstpointer user_data) nm_platform_link_delete (nm_platform_link_get_ifindex ("nm-test-device0")); g_assert (!nm_platform_link_exists ("nm-test-device0")); g_assert (nm_platform_dummy_add ("nm-test-device0")); - accept_signal (link_added); + wait_signal (link_added); free_signal (link_added); fixture->ifindex0 = nm_platform_link_get_ifindex ("nm-test-device0"); g_assert (nm_platform_link_set_up (fixture->ifindex0)); @@ -660,7 +660,7 @@ fixture_setup (test_fixture *fixture, gconstpointer user_data) nm_platform_link_delete (nm_platform_link_get_ifindex ("nm-test-device1")); g_assert (!nm_platform_link_exists ("nm-test-device1")); g_assert (nm_platform_dummy_add ("nm-test-device1")); - accept_signal (link_added); + wait_signal (link_added); free_signal (link_added); fixture->ifindex1 = nm_platform_link_get_ifindex ("nm-test-device1"); g_assert (nm_platform_link_set_up (fixture->ifindex1)); -- cgit v1.2.1 From 85ee1f4a9c04cad8f2486f858efd5ca10cb09077 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Thu, 22 Jan 2015 16:41:15 +0100 Subject: platform: give the platform an opportunity to override default-unmanaged Some out of tree drivers add Ethernet devices that are supposed to be managed by other their tooling, e.g. VirtualBox or VMWare. Rather than hardcoding their drivers (at least VirtualBox doesn't even set a "driver" property in sysfs) or hardcoding a logic that identifies such devices let's just add a possibility to blacklist them in udev. This makes it possible for whoever who ships such a driver to ship rules that prevent NetworkManager from managing the device itself. Furthermore it makes it possible for the user with special needs leverage the flexibility of udev rules to override the defaults. In the end the user can decide to let NetworkManager manage default-unmanaged interfaces such as VEth or turn on default-unmanaged for devices on a particular bus. An udev rule for VirtualBox would look like this: SUBSYSTEM=="net", ENV{INTERFACE}=="vboxnet[0-9]*", ENV{NM_UNMANAGED}="1" --- man/NetworkManager.xml | 28 ++++++++++++++++++++++++++++ src/nm-manager.c | 5 ++++- src/platform/nm-fake-platform.c | 7 +++++++ src/platform/nm-linux-platform.c | 15 +++++++++++++++ src/platform/nm-platform.c | 19 +++++++++++++++++++ src/platform/nm-platform.h | 2 ++ 6 files changed, 75 insertions(+), 1 deletion(-) diff --git a/man/NetworkManager.xml b/man/NetworkManager.xml index aa54fe1524..ceb810e3b4 100644 --- a/man/NetworkManager.xml +++ b/man/NetworkManager.xml @@ -358,6 +358,33 @@ + + UDEV PROPERTIES + + + udev7 + device manager is used for the network device discovery. The following + property influences how NetworkManager manages the devices: + + + + + NM_UNMANAGED + + No default connection will be created and automatic activation + will not be attempted when this property of a device is set to a + true value ("1" or "true"). You will still be able to attach a + connection to the device manually or observe externally added + configuration such as addresses or routes. + + Create an udev rule that sets this property to prevent NetworkManager + from interfering with virtual Ethernet device interfaces that are + managed by virtualization tools. + + + + + DEBUGGING @@ -386,6 +413,7 @@ nm-settings5, nm-applet1, nm-connection-editor1 + udev7 diff --git a/src/nm-manager.c b/src/nm-manager.c index 4da0f315f6..9ccb7e44d2 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -1795,7 +1795,7 @@ add_device (NMManager *self, NMDevice *device, gboolean try_assume) NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); const char *iface, *driver, *type_desc; const GSList *unmanaged_specs; - gboolean user_unmanaged, sleeping; + gboolean user_unmanaged, sleeping, platform_unmanaged; gboolean enabled = FALSE; RfKillType rtype; GSList *iter, *remove = NULL; @@ -1871,6 +1871,9 @@ add_device (NMManager *self, NMDevice *device, gboolean try_assume) user_unmanaged = nm_device_spec_match_list (device, unmanaged_specs); nm_device_set_initial_unmanaged_flag (device, NM_UNMANAGED_USER, user_unmanaged); + if (nm_platform_link_get_unmanaged (nm_device_get_ifindex (device), &platform_unmanaged)) + nm_device_set_initial_unmanaged_flag (device, NM_UNMANAGED_DEFAULT, platform_unmanaged); + sleeping = manager_sleeping (self); nm_device_set_initial_unmanaged_flag (device, NM_UNMANAGED_INTERNAL, sleeping); diff --git a/src/platform/nm-fake-platform.c b/src/platform/nm-fake-platform.c index 941d742a11..7194707b29 100644 --- a/src/platform/nm-fake-platform.c +++ b/src/platform/nm-fake-platform.c @@ -299,6 +299,12 @@ link_get_type_name (NMPlatform *platform, int ifindex) return type_to_type_name (link_get_type (platform, ifindex)); } +static gboolean +link_get_unmanaged (NMPlatform *platform, int ifindex, gboolean *managed) +{ + return FALSE; +} + static void link_changed (NMPlatform *platform, NMFakePlatformLink *device) { @@ -1384,6 +1390,7 @@ nm_fake_platform_class_init (NMFakePlatformClass *klass) platform_class->link_get_name = link_get_name; platform_class->link_get_type = link_get_type; platform_class->link_get_type_name = link_get_type_name; + platform_class->link_get_unmanaged = link_get_unmanaged; platform_class->link_set_up = link_set_up; platform_class->link_set_down = link_set_down; diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index f219898d87..3a0bbe4d1c 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -2395,6 +2395,20 @@ link_get_type_name (NMPlatform *platform, int ifindex) return type; } +static gboolean +link_get_unmanaged (NMPlatform *platform, int ifindex, gboolean *managed) +{ + NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform); + GUdevDevice *udev_device = g_hash_table_lookup (priv->udev_devices, GINT_TO_POINTER (ifindex)); + + if (g_udev_device_get_property (udev_device, "NM_UNMANAGED")) { + *managed = g_udev_device_get_property_as_boolean (udev_device, "NM_UNMANAGED"); + return TRUE; + } + + return FALSE; +} + static guint32 link_get_flags (NMPlatform *platform, int ifindex) { @@ -4571,6 +4585,7 @@ nm_linux_platform_class_init (NMLinuxPlatformClass *klass) platform_class->link_get_name = link_get_name; platform_class->link_get_type = link_get_type; platform_class->link_get_type_name = link_get_type_name; + platform_class->link_get_unmanaged = link_get_unmanaged; platform_class->link_refresh = link_refresh; diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index 9500a75424..d51c142e04 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -652,6 +652,25 @@ nm_platform_link_get_type_name (int ifindex) return klass->link_get_type_name (platform, ifindex); } +/** + * nm_platform_link_get_unmanaged: + * @ifindex: Interface index. + * @managed: Management status in case %TRUE is returned + * + * Returns: %TRUE if platform overrides whether the device ought + * to be managed by default. %FALSE with @managed unmodified + * otherwise. + */ +gboolean +nm_platform_link_get_unmanaged (int ifindex, gboolean *managed) +{ + reset_error (); + + g_return_val_if_fail (klass->link_get_unmanaged, FALSE); + + return klass->link_get_unmanaged (platform, ifindex, managed); +} + /** * nm_platform_link_is_software: * @ifindex: Interface index. diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index c2dca4e585..bc7b84c9ff 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -351,6 +351,7 @@ typedef struct { const char *(*link_get_name) (NMPlatform *, int ifindex); NMLinkType (*link_get_type) (NMPlatform *, int ifindex); const char *(*link_get_type_name) (NMPlatform *, int ifindex); + gboolean (*link_get_unmanaged) (NMPlatform *, int ifindex, gboolean *managed); gboolean (*link_refresh) (NMPlatform *, int ifindex); @@ -498,6 +499,7 @@ int nm_platform_link_get_ifindex (const char *name); const char *nm_platform_link_get_name (int ifindex); NMLinkType nm_platform_link_get_type (int ifindex); const char *nm_platform_link_get_type_name (int ifindex); +gboolean nm_platform_link_get_unmanaged (int ifindex, gboolean *managed); gboolean nm_platform_link_is_software (int ifindex); gboolean nm_platform_link_supports_slaves (int ifindex); -- cgit v1.2.1 From 7ba30cfd265d5cde4afc96685f138cad23921138 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Thu, 22 Jan 2015 16:41:15 +0100 Subject: data: add udev rules to make emulated ethernet devices default unmanaged There are some out-of-tree drivers that create devices masquerading as ethernets which are supposed to use their own management tools. Avoid touching them. The rules should be run after 80-net-setup-link.rules, so that the ID_NET_DRIVER is set. --- data/85-nm-unmanaged.rules | 34 ++++++++++++++++++++++++++++++++++ data/Makefile.am | 6 ++++++ 2 files changed, 40 insertions(+) create mode 100644 data/85-nm-unmanaged.rules diff --git a/data/85-nm-unmanaged.rules b/data/85-nm-unmanaged.rules new file mode 100644 index 0000000000..aefab5c461 --- /dev/null +++ b/data/85-nm-unmanaged.rules @@ -0,0 +1,34 @@ +# Do not modify this file, it will get overwriten on updates. +# To override or extend the rules place a file in /etc/udev/rules.d + +SUBSYSTEM!="net", GOTO="nm_unmanaged_end" + +# Determine ID_NET_DRIVER if there's no ID_NET_DRIVER or DRIVERS (old udev?) +ENV{ID_NET_DRIVER}=="?*", GOTO="nm_unmanaged_driver" +DRIVERS=="?*", GOTO="nm_unmanaged_driver" +PROGRAM="/bin/sh -c '/usr/sbin/ethtool -i $env{INTERFACE} |/bin/sed -n s/^driver:\ //p'", RESULT=="?*", ENV{ID_NET_DRIVER}="%c" +LABEL="nm_unmanaged_driver" + +# VirtualBox host networking. Out-of-tree driver that looks like an ordinary +# Ethernet. No parent device (lives in /virtual/), no support for ethtool +# to identify the driver, MAC address defaults to 08:00:27:, but can be +# changed. Interface name will have to do, it's always vboxnet*. +ENV{INTERFACE}=="vboxnet[0-9]*", ENV{NM_UNMANAGED}="1" + +# VMWare host networking. Out-of-tree driver that looks like an ordinary +# Ethernet. No parent device (lives in /virtual/), no support for +# ethtool to identify the driver. They have their own MAC prefix that +# can not be changed. +PROGRAM="/bin/cat %S%p/address", RESULT=="00:50:56:*", ENV{INTERFACE}=="vmnet[0-9]*", ENV{NM_UNMANAGED}="1" + +# Parallels Workstation host networking. Out-of-tree driver that looks like +# an ordinary Ethernet. No parent device (lives in /virtual/), no support for +# ethtool to identify the driver and the interface name is too generic. +# However, they have their own MAC prefix that can not be changed. +PROGRAM="/bin/cat %S%p/address", RESULT=="00:1c:42:*", ENV{INTERFACE}=="vnic[0-9]*", ENV{NM_UNMANAGED}="1" + +# Virtual Ethernet device pair. Often used to communicate with a peer interface +# in another net namespace and managed by libvirt, Docker or the like. +ENV{ID_NET_DRIVER}=="veth", ENV{NM_UNMANAGED}="1" + +LABEL="nm_unmanaged_end" diff --git a/data/Makefile.am b/data/Makefile.am index e91361a71b..bd40089f6a 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -34,6 +34,11 @@ endif examplesdir = $(docdir)/examples examples_DATA = server.conf +if WITH_UDEV_DIR +udevrulesdir = $(UDEV_DIR)/rules.d +udevrules_DATA = 85-nm-unmanaged.rules +endif + server.conf: server.conf.in $(edit) $< >$@ @@ -51,6 +56,7 @@ EXTRA_DIST = \ NetworkManager-wait-online-systemd-pre200.service.in \ NetworkManager-dispatcher.service.in \ org.freedesktop.NetworkManager.service.in \ + 85-nm-unmanaged.rules \ server.conf.in CLEANFILES = \ -- cgit v1.2.1 From ceea3c678279a81daa3f28c4e549a7e37f04188e Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Thu, 22 Jan 2015 17:31:06 +0100 Subject: data: move OLPC MESH udev rules away from callouts No idea why was it there in the first place. This also fixes a bug that the rules file was conditionally included in dist depending on presence of udev dir at configure time. --- callouts/77-nm-olpc-mesh.rules | 6 ------ callouts/Makefile.am | 6 ------ data/77-nm-olpc-mesh.rules | 6 ++++++ data/Makefile.am | 5 ++++- 4 files changed, 10 insertions(+), 13 deletions(-) delete mode 100644 callouts/77-nm-olpc-mesh.rules create mode 100644 data/77-nm-olpc-mesh.rules diff --git a/callouts/77-nm-olpc-mesh.rules b/callouts/77-nm-olpc-mesh.rules deleted file mode 100644 index a1a1554c2b..0000000000 --- a/callouts/77-nm-olpc-mesh.rules +++ /dev/null @@ -1,6 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# The fact that this device is driven by libertas is not currently exposed -# in the sysfs tree..? -KERNEL=="msh*", SUBSYSTEM=="net", DRIVERS=="usb", ATTRS{idVendor}=="1286", ATTRS{idProduct}=="2001", ENV{ID_NM_OLPC_MESH}="1" - diff --git a/callouts/Makefile.am b/callouts/Makefile.am index f682579e91..cc38e01a82 100644 --- a/callouts/Makefile.am +++ b/callouts/Makefile.am @@ -87,11 +87,6 @@ libtest_dispatcher_envp_la_LIBADD = \ $(GLIB_LIBS) -if WITH_UDEV_DIR -udevrulesdir = $(UDEV_DIR)/rules.d -udevrules_DATA = 77-nm-olpc-mesh.rules -endif - dbusactivationdir = $(datadir)/dbus-1/system-services dbusactivation_in_files = org.freedesktop.nm_dispatcher.service.in dbusactivation_DATA = $(dbusactivation_in_files:.service.in=.service) @@ -115,7 +110,6 @@ CLEANFILES = $(nodist_libnmdbus_dispatcher_la_SOURCES) $(dbusactivation_DATA) EXTRA_DIST = \ $(dbusservice_DATA) \ - $(udevrules_DATA) \ $(dbusactivation_in_files) \ nm-dispatcher.xml diff --git a/data/77-nm-olpc-mesh.rules b/data/77-nm-olpc-mesh.rules new file mode 100644 index 0000000000..a1a1554c2b --- /dev/null +++ b/data/77-nm-olpc-mesh.rules @@ -0,0 +1,6 @@ +# do not edit this file, it will be overwritten on update + +# The fact that this device is driven by libertas is not currently exposed +# in the sysfs tree..? +KERNEL=="msh*", SUBSYSTEM=="net", DRIVERS=="usb", ATTRS{idVendor}=="1286", ATTRS{idProduct}=="2001", ENV{ID_NM_OLPC_MESH}="1" + diff --git a/data/Makefile.am b/data/Makefile.am index bd40089f6a..5a95ea2a42 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -36,7 +36,9 @@ examples_DATA = server.conf if WITH_UDEV_DIR udevrulesdir = $(UDEV_DIR)/rules.d -udevrules_DATA = 85-nm-unmanaged.rules +udevrules_DATA = \ + 85-nm-unmanaged.rules \ + 77-nm-olpc-mesh.rules endif server.conf: server.conf.in @@ -57,6 +59,7 @@ EXTRA_DIST = \ NetworkManager-dispatcher.service.in \ org.freedesktop.NetworkManager.service.in \ 85-nm-unmanaged.rules \ + 77-nm-olpc-mesh.rules \ server.conf.in CLEANFILES = \ -- cgit v1.2.1 From 498d45e85ff6d5ff86ba76c4e38b140cdce7d640 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Sun, 25 Jan 2015 23:59:20 +0100 Subject: Revert "core: make veth devices default-unmanaged for now" This reverts commit ebeaeaed4d3180c27cc059fe0ff199153fa9ec24. No need to hardwire these as unmanaged anymore, an udev rule will take care of it. --- src/devices/nm-device-veth.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/devices/nm-device-veth.c b/src/devices/nm-device-veth.c index db29c00d2f..6a05cc3214 100644 --- a/src/devices/nm-device-veth.c +++ b/src/devices/nm-device-veth.c @@ -102,7 +102,6 @@ get_peer (NMDeviceVeth *self) static void nm_device_veth_init (NMDeviceVeth *self) { - nm_device_set_initial_unmanaged_flag (NM_DEVICE (self), NM_UNMANAGED_DEFAULT, TRUE); } static void -- cgit v1.2.1