summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2013-01-29 00:42:16 +0100
committerMichael Biebl <biebl@debian.org>2013-01-29 00:42:20 +0100
commit6f0ae6b0f1bee0940528bb2de39527b65b1c204e (patch)
treec1c89d2238c159fac28607778d7f6cecd41e9e23
parent236b32e84d4e0c489499aa40899de70546512da1 (diff)
Change the ifupdown dispatcher script and set ADDRFAM to "inet" or "inet6"
depending on whether the connection has a valid IPv4 or IPv6 address.
Using "NetworkManager" as ADDRFAM type did confuse most ifupdown hook
scripts and e.g. broke async NFS mounts. (Closes: #475188, #656584)

Make sure to also remove "exec" when running run-parts, otherwise the
for loop would exit after the first iteration.
-rw-r--r--debian/changelog9
-rw-r--r--debian/network-manager-dispatcher.script88
2 files changed, 66 insertions, 31 deletions
diff --git a/debian/changelog b/debian/changelog
index cc2ead98..6c7753a6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+network-manager (0.9.4.0-9) UNRELEASED; urgency=low
+
+  * Change the ifupdown dispatcher script and set ADDRFAM to "inet" or "inet6"
+    depending on whether the connection has a valid IPv4 or IPv6 address.
+    Using "NetworkManager" as ADDRFAM type did confuse most ifupdown hook
+    scripts and e.g. broke async NFS mounts. (Closes: #475188, #656584)
+
+ -- Michael Biebl <biebl@debian.org>  Mon, 28 Jan 2013 18:25:50 +0100
+
 network-manager (0.9.4.0-8) unstable; urgency=low
 
   * Move the pkla file to /etc/polkit-1 as requested by the release team.
diff --git a/debian/network-manager-dispatcher.script b/debian/network-manager-dispatcher.script
index 5869bda5..ebadfd10 100644
--- a/debian/network-manager-dispatcher.script
+++ b/debian/network-manager-dispatcher.script
@@ -9,42 +9,68 @@ if [ -z "$1" ]; then
     exit 1;
 fi
 
+if [ -n "$IP4_NUM_ADDRESSES" ] && [ "$IP4_NUM_ADDRESSES" -gt 0 ]; then
+   ADDRESS_FAMILIES="$ADDRESS_FAMILIES inet"
+fi
+if [ -n "$IP6_NUM_ADDRESSES" ] && [ "$IP6_NUM_ADDRESSES" -gt 0 ]; then
+   ADDRESS_FAMILIES="$ADDRESS_FAMILIES inet6"
+fi
+
+# If we have a VPN connection ignore the underlying IP address(es)
+if [ "$2" = "vpn-up" ] || [ "$2" = "vpn-down" ]; then
+   ADDRESS_FAMILIES=""
+fi
+
+if [ -n "$VPN_IP4_NUM_ADDRESSES" ] && [ "$VPN_IP4_NUM_ADDRESSES" -gt 0 ]; then
+   ADDRESS_FAMILIES="$ADDRESS_FAMILIES inet"
+fi
+if [ -n "$VPN_IP6_NUM_ADDRESSES" ] && [ "$VPN_IP6_NUM_ADDRESSES" -gt 0 ]; then
+   ADDRESS_FAMILIES="$ADDRESS_FAMILIES inet6"
+fi
+
+# We're probably bringing the interface down.
+[ -n "$ADDRESS_FAMILIES" ] || ADDRESS_FAMILIES="inet"
+
 # Fake ifupdown environment
 export IFACE="$1"
 export LOGICAL="$1"
-export ADDRFAM="NetworkManager"
 export METHOD="NetworkManager"
 export VERBOSITY="0"
 
-# Run the right scripts
-case "$2" in
-    up|vpn-up)
-	export MODE="start"
-	export PHASE="post-up"
-	exec run-parts /etc/network/if-up.d
-	;;
-    down|vpn-down)
-	export MODE="stop"
-	export PHASE="post-down"
-	exec run-parts /etc/network/if-post-down.d
-	;;
+for i in $ADDRESS_FAMILIES; do
+
+    export ADDRFAM="$i"
+
+    # Run the right scripts
+    case "$2" in
+        up|vpn-up)
+            export MODE="start"
+            export PHASE="post-up"
+            run-parts /etc/network/if-up.d
+            ;;
+        down|vpn-down)
+            export MODE="stop"
+            export PHASE="post-down"
+            run-parts /etc/network/if-post-down.d
+            ;;
 # pre-up/pre-down not implemented. See
 # https://bugzilla.gnome.org/show_bug.cgi?id=387832
-#    pre-up)
-#	export MODE="start"
-#	export PHASE="pre-up"
-#	exec run-parts /etc/network/if-pre-up.d
-#	;;
-#    pre-down)
-#	export MODE="stop"
-#	export PHASE="pre-down"
-#	exec run-parts /etc/network/if-down.d
-#	;;
-    hostname|dhcp4-change|dhcp6-change)
-        # Do nothing
-	;;
-    *)
-	echo "$0: called with unknown action \`$2'" 1>&2
-	exit 1
-	;;
-esac
+#        pre-up)
+#            export MODE="start"
+#            export PHASE="pre-up"
+#            run-parts /etc/network/if-pre-up.d
+#            ;;
+#        pre-down)
+#            export MODE="stop"
+#            export PHASE="pre-down"
+#            run-parts /etc/network/if-down.d
+#            ;;
+        hostname|dhcp4-change|dhcp6-change)
+            # Do nothing
+            ;;
+        *)
+            echo "$0: called with unknown action \`$2'" 1>&2
+            exit 1
+            ;;
+    esac
+done