[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#690660: unblock: ifupdown/0.7.3



Hello,

On Tue, 16 Oct 2012 10:07:01 +0200
Julien Cristau <jcristau@debian.org> wrote:

> What about 679549?

I'm fine with that. A new debdiff attached.

-- 
WBR, Andrew
diff -Nru ifupdown-0.7.2/debian/changelog ifupdown-0.7.3/debian/changelog
--- ifupdown-0.7.2/debian/changelog	2012-08-16 23:23:03.000000000 +0200
+++ ifupdown-0.7.3/debian/changelog	2012-10-16 10:42:05.000000000 +0200
@@ -1,3 +1,13 @@
+ifupdown (0.7.3) unstable; urgency=low
+
+  * Fix the calculation of broadcast addresses of obsolete scheme;
+    previously, a network mask was mistakenly used instead of them.
+  * Follow RFC 3021 regarding broadcast addresses in /31 subnets:
+    they should use limited broadcast address (Closes: #690561).
+  * Add upstart support (patch provided by Steve Langasek, closes: #679549).
+
+ -- Andrew O. Shadura <bugzilla@tut.by>  Tue, 16 Oct 2012 10:39:24 +0200
+
 ifupdown (0.7.2) unstable; urgency=low
 
   * Don't install /etc/default/networking as executable (Closes: #679623).
diff -Nru ifupdown-0.7.2/debian/control ifupdown-0.7.3/debian/control
--- ifupdown-0.7.2/debian/control	2012-06-22 00:05:10.000000000 +0200
+++ ifupdown-0.7.3/debian/control	2012-10-16 10:38:55.000000000 +0200
@@ -4,7 +4,7 @@
 Maintainer: Andrew O. Shadura <bugzilla@tut.by>
 Uploaders: Petter Reinholdtsen <pere@debian.org>
 Standards-Version: 3.9.3
-Build-Depends: debhelper (>= 8.1.0~), noweb
+Build-Depends: debhelper (>= 9.20120410~), noweb
 Vcs-Hg: http://anonscm.debian.org/hg/collab-maint/ifupdown/
 Vcs-Browser: http://anonscm.debian.org/hg/collab-maint/ifupdown/
 
diff -Nru ifupdown-0.7.2/debian/ifupdown.networking.upstart ifupdown-0.7.3/debian/ifupdown.networking.upstart
--- ifupdown-0.7.2/debian/ifupdown.networking.upstart	1970-01-01 01:00:00.000000000 +0100
+++ ifupdown-0.7.3/debian/ifupdown.networking.upstart	2012-10-16 10:38:55.000000000 +0200
@@ -0,0 +1,66 @@
+# networking - configure virtual network devices
+#
+# This task causes virtual network devices that do not have an associated
+# kernel object to be started on boot.
+
+description	"configure virtual network devices"
+
+emits static-network-up
+emits net-device-up
+
+start on (local-filesystems
+      and (stopped udevtrigger or container))
+stop on unmounted-remote-filesystems
+
+pre-start script
+    mkdir -p /run/network
+    ifup -a
+end script
+
+post-stop script
+    log_warning_msg() {
+        echo $*
+    }
+
+    # These checks were taken from the Debian ifupdown.networking.init script
+    check_network_file_systems() {
+        [ -e /proc/mounts ] || return 0
+
+        if [ -e /etc/iscsi/iscsi.initramfs ]; then
+            log_warning_msg "not deconfiguring network interfaces: iSCSI root is mounted."
+            exit 0
+        fi
+
+        while read DEV MTPT FSTYPE REST; do
+            case $DEV in
+            /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*)
+                log_warning_msg "not deconfiguring network interfaces: network devices still mounted."
+                exit 0
+                ;;
+            esac
+            case $FSTYPE in
+            nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs|pvfs|pvfs2|fuse.httpfs|fuse.curlftpfs)
+                log_warning_msg "not deconfiguring network interfaces: network file systems still mounted."
+                exit 0
+                ;;
+            esac
+        done < /proc/mounts
+    }
+
+    check_network_swap() {
+        [ -e /proc/swaps ] || return 0
+
+        while read DEV MTPT FSTYPE REST; do
+            case $DEV in
+            /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*)
+                log_warning_msg "not deconfiguring network interfaces: network swap still mounted."
+                exit 0
+                ;;
+            esac
+        done < /proc/swaps
+    }
+
+    check_network_file_systems
+    check_network_swap
+    ifdown -a
+end script
diff -Nru ifupdown-0.7.2/debian/ifupdown.network-interface-container.upstart ifupdown-0.7.3/debian/ifupdown.network-interface-container.upstart
--- ifupdown-0.7.2/debian/ifupdown.network-interface-container.upstart	1970-01-01 01:00:00.000000000 +0100
+++ ifupdown-0.7.3/debian/ifupdown.network-interface-container.upstart	2012-10-16 10:38:55.000000000 +0200
@@ -0,0 +1,19 @@
+# network-interface-container - woarkound for missing events in container
+#
+# This service emits missing net-device-added events for containers.
+# It's needed in cases where devices are created before the container
+# starts and so won't get a udev event.
+
+description "workaround for missing events in container"
+start on container
+
+emits net-device-added
+
+task
+script
+    case "$CONTAINER" in
+        lxc|lxc-libvirt)
+            initctl emit --no-wait net-device-added INTERFACE=lo || true
+        ;;
+    esac
+end script
diff -Nru ifupdown-0.7.2/debian/ifupdown.network-interface-security.upstart ifupdown-0.7.3/debian/ifupdown.network-interface-security.upstart
--- ifupdown-0.7.2/debian/ifupdown.network-interface-security.upstart	1970-01-01 01:00:00.000000000 +0100
+++ ifupdown-0.7.3/debian/ifupdown.network-interface-security.upstart	2012-10-16 10:38:55.000000000 +0200
@@ -0,0 +1,34 @@
+# network-interface-security - configure network device security
+#
+# This is a one-time start-up script to load AppArmor profiles needed
+# before the network comes up.
+
+description	"configure network device security"
+
+# In order to avoid upstart bug LP: #447654, we cannot have an AND
+# statement here (with the ORs).  An "and virtual-filesystems" is desired
+# here to make sure that the securityfs is mounted, but since each of the
+# ORed services already require virtual-filesystems be mounted, this is safe:
+start on (starting network-interface
+          or starting network-manager
+          or starting networking)
+
+# In order to handle the lack of upstart feature LP: #568860, we need to
+# run multiple times, for each of the above "starting" service instances, or
+# else another one might run while we're running, and not wait for us to
+# finish.
+instance $JOB${INTERFACE:+/}${INTERFACE:-}
+
+# Since we need these profiles to be loaded before any of the above services
+# begin running, this service must be a pre-start so that its pre-start
+# script finishes before the above services' start scripts begin.
+pre-start script
+    [ -f /run/network-interface-security ] && exit 0 # already ran
+    [ -d /rofs/etc/apparmor.d ]  && exit 0 # do not load on liveCD
+    [ -d /sys/module/apparmor ]  || exit 0 # do not load without AppArmor
+    [ -x /sbin/apparmor_parser ] || exit 0 # do not load without parser
+    for link in /etc/apparmor/init/network-interface-security/* ; do
+        [ -L $link ] && /sbin/apparmor_parser -r -W $link || true
+    done
+    > /run/network-interface-security
+end script
diff -Nru ifupdown-0.7.2/debian/ifupdown.network-interface.upstart ifupdown-0.7.3/debian/ifupdown.network-interface.upstart
--- ifupdown-0.7.2/debian/ifupdown.network-interface.upstart	1970-01-01 01:00:00.000000000 +0100
+++ ifupdown-0.7.3/debian/ifupdown.network-interface.upstart	2012-10-16 10:38:55.000000000 +0200
@@ -0,0 +1,30 @@
+# network-interface - configure network device
+#
+# This service causes network devices to be brought up or down as a result
+# of hardware being added or removed, including that which isn't ordinarily
+# removable.
+
+description	"configure network device"
+
+emits net-device-up
+emits net-device-down
+emits static-network-up
+
+start on net-device-added
+stop on net-device-removed INTERFACE=$INTERFACE
+
+instance $INTERFACE
+export INTERFACE
+
+pre-start script
+    if [ "$INTERFACE" = lo ]; then
+	# bring this up even if /etc/network/interfaces is broken
+	ifconfig lo 127.0.0.1 up || true
+	initctl emit -n net-device-up \
+	    IFACE=lo LOGICAL=lo ADDRFAM=inet METHOD=loopback || true
+    fi
+    mkdir -p /run/network
+    exec ifup --allow auto $INTERFACE
+end script
+
+post-stop exec ifdown --allow auto $INTERFACE
diff -Nru ifupdown-0.7.2/debian/ifupdown.upstart.if-down ifupdown-0.7.3/debian/ifupdown.upstart.if-down
--- ifupdown-0.7.2/debian/ifupdown.upstart.if-down	1970-01-01 01:00:00.000000000 +0100
+++ ifupdown-0.7.3/debian/ifupdown.upstart.if-down	2012-10-16 10:38:55.000000000 +0200
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+set -e
+
+initctl emit -n net-device-down \
+	"IFACE=$IFACE" \
+	"LOGICAL=$LOGICAL" \
+	"ADDRFAM=$ADDRFAM" \
+	"METHOD=$METHOD"
diff -Nru ifupdown-0.7.2/debian/ifupdown.upstart.if-up ifupdown-0.7.3/debian/ifupdown.upstart.if-up
--- ifupdown-0.7.2/debian/ifupdown.upstart.if-up	1970-01-01 01:00:00.000000000 +0100
+++ ifupdown-0.7.3/debian/ifupdown.upstart.if-up	2012-10-16 10:38:55.000000000 +0200
@@ -0,0 +1,48 @@
+#!/bin/sh
+MARK_DEV_PREFIX="/run/network/ifup."
+MARK_STATIC_NETWORK_EMITTED="/run/network/static-network-up-emitted"
+
+set -e
+
+# Let's ignore meta entries (ifup -a)
+if [ "$ADDRFAM" = "meta" ]; then
+    return 0
+fi
+
+# lo emission handled by /etc/init/network-interface.conf
+if [ "$IFACE" != lo ]; then
+    initctl emit -n net-device-up \
+        "IFACE=$IFACE" \
+        "LOGICAL=$LOGICAL" \
+        "ADDRFAM=$ADDRFAM" \
+        "METHOD=$METHOD"
+fi
+
+get_auto_interfaces() {
+	# write to stdout a list of interfaces configured as 'auto' in interfaces(5)
+	local found=""
+	# stderr redirected as it outputs things like:
+	# Ignoring unknown interface eth0=eth0.
+	found=$(ifquery --list --allow auto 2>/dev/null) || return
+	set -- ${found}
+	echo "$@"
+}
+
+all_interfaces_up() {
+	# return true if all interfaces listed in /etc/network/interfaces as 'auto'
+	# are up.  if no interfaces are found there, then "all [given] were up"
+	local prefix="$1" iface=""
+	for iface in $(get_auto_interfaces); do
+		# if cur interface does is not up, then all have not been brought up
+		[ -f "${prefix}${iface}" ] || return 1
+	done
+	return 0
+}
+
+# touch our own "marker" indicating that this interface has been brought up.
+: > "${MARK_DEV_PREFIX}$IFACE"
+
+if all_interfaces_up "${MARK_DEV_PREFIX}" &&
+	mkdir "${MARK_STATIC_NETWORK_EMITTED}" 2>/dev/null; then
+	initctl emit --no-wait static-network-up
+fi
diff -Nru ifupdown-0.7.2/debian/networking.init ifupdown-0.7.3/debian/networking.init
--- ifupdown-0.7.2/debian/networking.init	2012-08-16 23:21:03.000000000 +0200
+++ ifupdown-0.7.3/debian/networking.init	2012-10-16 10:38:55.000000000 +0200
@@ -114,6 +114,9 @@
 
 case "$1" in
 start)
+	if init_is_upstart; then
+		exit 1
+	fi
 	process_options
 	check_ifstate
 
@@ -134,6 +137,9 @@
 	;;
 
 stop)
+	if init_is_upstart; then
+		exit 0
+	fi
 	check_network_file_systems
 	check_network_swap
 
@@ -159,6 +165,9 @@
 	;;
 
 force-reload|restart)
+	if init_is_upstart; then
+		exit 1
+	fi
 	process_options
 
 	log_warning_msg "Running $0 $1 is deprecated because it may not re-enable some interfaces"
diff -Nru ifupdown-0.7.2/debian/rules ifupdown-0.7.3/debian/rules
--- ifupdown-0.7.2/debian/rules	2012-08-16 23:20:54.000000000 +0200
+++ ifupdown-0.7.3/debian/rules	2012-10-16 10:38:55.000000000 +0200
@@ -52,6 +52,13 @@
 override_dh_installinit:
 	dh_installinit --name=networking --no-start -- start 40 S . start 35 0 6 .
 	install -p -m 0644 debian/networking.defaults $(DESTDIR)/etc/default/networking
+	dh_installinit --name=network-interface-container --noscripts
+	dh_installinit --name=network-interface-security --noscripts
+	dh_installinit --name=network-interface --noscripts
+	dh_installinit --name=networking --noscripts
+
+override_dh_installifupdown:
+	dh_installifupdown --name=upstart
 
 override_dh_auto_clean:
 	$(MAKE) clean
diff -Nru ifupdown-0.7.2/debian/testbuild-linux ifupdown-0.7.3/debian/testbuild-linux
--- ifupdown-0.7.2/debian/testbuild-linux	2012-08-15 12:17:16.000000000 +0200
+++ ifupdown-0.7.3/debian/testbuild-linux	2012-10-16 10:38:04.000000000 +0200
@@ -4,7 +4,7 @@
 mkdir tests
 cat >tests/testcase.1 <<EOF
 # RUN: -a
-auto eth0 eth1 eth2
+auto eth0 eth1 eth2 eth3
 iface eth0 inet static
   address 1.2.3.4
   netmask 255.255.255.0
@@ -24,6 +24,25 @@
   broadcast 1.2.3.127
   up echo hi
   post-up echo hello
+
+iface eth3 inet static
+  address 1.2.3.4/24
+  broadcast -
+  up true
+
+iface eth3 inet static
+  address 1.2.3.4/30
+  broadcast -
+  up true
+
+iface eth3 inet static
+  address 1.2.3.4/31
+  up true
+
+iface eth3 inet static
+  address 1.2.3.4/31
+  broadcast -
+  up true
 EOF
 cat >tests/up.1 <<EOF
 ====stdout====
@@ -53,6 +72,34 @@
 echo hi
 echo hello
 run-parts --verbose /etc/network/if-up.d
+Configuring interface eth3=eth3 (inet)
+run-parts --verbose /etc/network/if-pre-up.d
+ip addr add 1.2.3.4/255.255.255.0 broadcast 1.2.3.0 	  dev eth3 label eth3
+ip link set dev eth3   up
+
+true
+run-parts --verbose /etc/network/if-up.d
+Configuring interface eth3=eth3 (inet)
+run-parts --verbose /etc/network/if-pre-up.d
+ip addr add 1.2.3.4/255.255.255.252 broadcast 1.2.3.4 	  dev eth3 label eth3
+ip link set dev eth3   up
+
+true
+run-parts --verbose /etc/network/if-up.d
+Configuring interface eth3=eth3 (inet)
+run-parts --verbose /etc/network/if-pre-up.d
+ip addr add 1.2.3.4/255.255.255.254 broadcast 255.255.255.255 	  dev eth3 label eth3
+ip link set dev eth3   up
+
+true
+run-parts --verbose /etc/network/if-up.d
+Configuring interface eth3=eth3 (inet)
+run-parts --verbose /etc/network/if-pre-up.d
+ip addr add 1.2.3.4/255.255.255.254 broadcast 0.0.0.0 	  dev eth3 label eth3
+ip link set dev eth3   up
+
+true
+run-parts --verbose /etc/network/if-up.d
 run-parts --verbose /etc/network/if-up.d
 EOF
 
diff -Nru ifupdown-0.7.2/ifupdown.nw ifupdown-0.7.3/ifupdown.nw
--- ifupdown-0.7.2/ifupdown.nw	2012-08-13 20:20:19.000000000 +0200
+++ ifupdown-0.7.3/ifupdown.nw	2012-10-16 10:38:04.000000000 +0200
@@ -4793,12 +4793,22 @@
 	free(s);
 	if (r != 1) return;
 
-	if (!strcmp(*pparam, "+")) {
-	    addr.s_addr |=  ~mask.s_addr;
-	}
+	if (mask.s_addr != htonl(0xfffffffe)) {
+	    if (!strcmp(*pparam, "+")) {
+		addr.s_addr |= ~mask.s_addr;
+	    }
+
+	    if (!strcmp(*pparam, "-")) {
+		addr.s_addr &= mask.s_addr;
+	    }
+	} else {
+	    if (!strcmp(*pparam, "+")) {
+		addr.s_addr = 0xffffffff;
+	    }
 
-	if (!strcmp(*pparam, "-")) {
-	    addr.s_addr |=  mask.s_addr;
+	    if (!strcmp(*pparam, "-")) {
+		addr.s_addr = 0;
+	    }
 	}
 
 	char buffer[INET_ADDRSTRLEN + 1];
diff -Nru ifupdown-0.7.2/Makefile ifupdown-0.7.3/Makefile
--- ifupdown-0.7.2/Makefile	2012-08-13 20:20:24.000000000 +0200
+++ ifupdown-0.7.3/Makefile	2012-10-16 10:38:04.000000000 +0200
@@ -13,7 +13,7 @@
 	$(patsubst %.defn,%.o,$(DEFNFILES)) arch$(ARCH).o meta.o link.o
 
 MAN := $(patsubst %.defn,%.man,$(DEFNFILES))
-DEFNFILES += meta.defn
+DEFNFILES += meta.defn link.defn
 
 default : executables
 all : executables docs

Attachment: signature.asc
Description: PGP signature


Reply to: