Bug in Network-Manager with virtual interfaces / new plugin

2014-10-27 Thread Nicolas Boulicault
Hi there,
Michael asked to forward this to the list, so here it is...

The patch 0005-Mark-virtual-ethernet-interfaces-as-unmanaged.patch
(debian Jessie) messes up with my virtual interfaces (vmware
vmnet1/vmnet8).
Even if I set them manually unmanaged (from /etc/network/interfaces or
using keyfile plugin), they finally appear connected and make me lose my
internet connection if my ethernet link is down and I'm using WIFI.
I'm not sure exactly what's going on with the internals of
Network-Manager in this case but setting the default unmanaged flag on
the interfaces seems to have some negative side effects.
However, I think the idea of not managing the virtual interfaces is OK,
in particular for not expert users.
You'll find enclosed a small plugin that detects those virtual
interfaces and adds them to the unmanaged list. This is based on the
keyfile plugin.
Please feel free to use it (or not).
(0005-Mark-virtual-ethernet-interfaces-as-unmanaged.patch has to be
reverted for this plugin to work)

Thanks for your work anyway.

Nicolas
From 0fbcb8c9aecd652926c58553f401de2e5be1e785 Mon Sep 17 00:00:00 2001
From: boul bou...@gmail.com
Date: Sun, 12 Oct 2014 23:56:03 +0200
Subject: [PATCH 1/1] Added ifvirt plugin

---
 configure.ac|   5 +
 src/settings/plugins/Makefile.am|   4 +
 src/settings/plugins/ifvirt/Makefile.am |  41 +
 src/settings/plugins/ifvirt/plugin.c| 271 
 src/settings/plugins/ifvirt/plugin.h|  50 ++
 5 files changed, 371 insertions(+)
 create mode 100644 src/settings/plugins/ifvirt/Makefile.am
 create mode 100644 src/settings/plugins/ifvirt/plugin.c
 create mode 100644 src/settings/plugins/ifvirt/plugin.h

diff --git a/configure.ac b/configure.ac
index 94b0758..0e1caf7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,6 +95,7 @@ AC_ARG_ENABLE(ifcfg-rh, AS_HELP_STRING([--enable-ifcfg-rh], [enable ifcfg-rh con
 AC_ARG_ENABLE(ifcfg-suse, AS_HELP_STRING([--enable-ifcfg-suse], [enable ifcfg-suse configuration plugin (SUSE)]))
 AC_ARG_ENABLE(ifupdown, AS_HELP_STRING([--enable-ifupdown], [enable ifupdown configuration plugin (Debian/Ubuntu)]))
 AC_ARG_ENABLE(ifnet, AS_HELP_STRING([--enable-ifnet], [enable ifnet configuration plugin (Gentoo)]))
+AC_ARG_ENABLE(ifnet, AS_HELP_STRING([--enable-ifvirt], [enable ifvirt configuration plugin]))
 # Default alternative plugins by distribution
 AS_IF([test -z $enable_ifcfg_rh], AC_CHECK_FILE(/etc/redhat-release, enable_ifcfg_rh=yes))
 AS_IF([test -z $enable_ifcfg_rh], AC_CHECK_FILE(/etc/fedora-release, enable_ifcfg_rh=yes))
@@ -107,11 +108,13 @@ AS_IF([test -z $enable_ifcfg_rh], enable_ifcfg_rh=no)
 AS_IF([test -z $enable_ifcfg_suse], enable_ifcfg_suse=no)
 AS_IF([test -z $enable_ifupdown], enable_ifupdown=no)
 AS_IF([test -z $enable_ifnet], enable_ifnet=no)
+AS_IF([test -z $enable_ifvirt], enable_ifvirt=no)
 # Create automake conditionals
 AM_CONDITIONAL(CONFIG_PLUGIN_IFCFG_RH, test $enable_ifcfg_rh = yes)
 AM_CONDITIONAL(CONFIG_PLUGIN_IFCFG_SUSE, test $enable_ifcfg_suse = yes)
 AM_CONDITIONAL(CONFIG_PLUGIN_IFUPDOWN, test $enable_ifupdown = yes)
 AM_CONDITIONAL(CONFIG_PLUGIN_IFNET, test $enable_ifnet = yes)
+AM_CONDITIONAL(CONFIG_PLUGIN_IFVIRT, test $enable_ifvirt = yes)
 
 if test $enable_ifcfg_rh = yes; then
 DISTRO_NETWORK_SERVICE=network.service
@@ -794,6 +797,7 @@ src/settings/plugins/ifcfg-suse/Makefile
 src/settings/plugins/keyfile/Makefile
 src/settings/plugins/keyfile/tests/Makefile
 src/settings/plugins/keyfile/tests/keyfiles/Makefile
+src/settings/plugins/ifvirt/Makefile
 src/settings/plugins/example/Makefile
 src/settings/tests/Makefile
 src/platform/Makefile
@@ -906,6 +910,7 @@ echo   ifcfg-rh: ${enable_ifcfg_rh}
 echo   ifcfg-suse: ${enable_ifcfg_suse}
 echo   ifupdown: ${enable_ifupdown}
 echo   ifnet: ${enable_ifnet}
+echo   ifvirt: ${enable_ifvirt}
 echo
 
 echo Handlers for /etc/resolv.conf:
diff --git a/src/settings/plugins/Makefile.am b/src/settings/plugins/Makefile.am
index 41694e7..2ae7444 100644
--- a/src/settings/plugins/Makefile.am
+++ b/src/settings/plugins/Makefile.am
@@ -17,3 +17,7 @@ endif
 if CONFIG_PLUGIN_IFNET
 SUBDIRS+=ifnet
 endif
+
+if CONFIG_PLUGIN_IFVIRT
+SUBDIRS+=ifvirt
+endif
diff --git a/src/settings/plugins/ifvirt/Makefile.am b/src/settings/plugins/ifvirt/Makefile.am
new file mode 100644
index 000..ab15e55
--- /dev/null
+++ b/src/settings/plugins/ifvirt/Makefile.am
@@ -0,0 +1,41 @@
+SUBDIRS = .
+
+@GNOME_CODE_COVERAGE_RULES@
+
+AM_CPPFLAGS = \
+	-I$(top_srcdir)/src \
+	-I$(top_srcdir)/src/config \
+	-I$(top_srcdir)/src/logging \
+	-I$(top_srcdir)/src/settings \
+	-I$(top_srcdir)/include \
+	-I$(top_builddir)/include \
+	-I$(top_srcdir)/libnm-util \
+	-I$(top_builddir)/libnm-util \
+	-DG_LOG_DOMAIN=\NetworkManager-ifvirt\ \
+	-DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \
+	$(GLIB_CFLAGS) \
+	$(DBUS_CFLAGS) \
+	$(POLKIT_CFLAGS) \
+	$(GUDEV_CFLAGS) \
+	-DNMCONFDIR=\$(nmconfdir)\
+
+pkglib_LTLIBRARIES = 

Re: Bug in Network-Manager with virtual interfaces / new plugin

2014-10-27 Thread Dan Williams
On Fri, 2014-10-24 at 19:05 +0200, Nicolas Boulicault wrote:
 Hi there,
 Michael asked to forward this to the list, so here it is...
 
 The patch 0005-Mark-virtual-ethernet-interfaces-as-unmanaged.patch
 (debian Jessie) messes up with my virtual interfaces (vmware
 vmnet1/vmnet8).

Could you run NM with --log-level=debug and reproduce the issue so that
we can get an idea of what NM is doing?

The goal is to still recognize these interfaces, but *not* touch them,
simply represent their current external state through the NM APIs and
command-line tools.  So if NM is somehow screwing up those devices by
changing their configuration, that would be a bug in NM, and we need to
find it and fix it.

Thanks!
Dan

 Even if I set them manually unmanaged (from /etc/network/interfaces or
 using keyfile plugin), they finally appear connected and make me lose my
 internet connection if my ethernet link is down and I'm using WIFI.
 I'm not sure exactly what's going on with the internals of
 Network-Manager in this case but setting the default unmanaged flag on
 the interfaces seems to have some negative side effects.
 However, I think the idea of not managing the virtual interfaces is OK,
 in particular for not expert users.
 You'll find enclosed a small plugin that detects those virtual
 interfaces and adds them to the unmanaged list. This is based on the
 keyfile plugin.
 Please feel free to use it (or not).
 (0005-Mark-virtual-ethernet-interfaces-as-unmanaged.patch has to be
 reverted for this plugin to work)
 
 Thanks for your work anyway.
 
 Nicolas
 ___
 networkmanager-list mailing list
 networkmanager-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/networkmanager-list


___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list