Package: ifupdown
Version: 0.7~alpha2
Severity: wishlist

Hello!

Here's a bunch of patches to improve ifupdown 0.7~alpha2 (the current version
in experimental).
This fixes some minor issues like typos, finilizes the transition away
from ifconfig/route, and (most importantly IMHO) reinstates the support for
using "netmask" in /etc/network/interfaces for backwards compatibility
purposes.

Description for each patch available in the top of the file...

(For additional backwards compatibility looking at #359618 might be
interesting, since people might have those old pesky ethX:Y virtual
interfaces in their /e/n/i which ifconfig required because it can't handle
adding several ip-adresses to the same interface.)

-- 
Regards,
Andreas Henriksson
>From d374dc2554f92fcbdc27a05b0394844aed96f957 Mon Sep 17 00:00:00 2001
From: Andreas Henriksson <[EMAIL PROTECTED]>
Date: Wed, 12 Dec 2007 20:26:23 +0100
Subject: [PATCH] Fix "aadr" typo

---
 ifupdown.nw |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ifupdown.nw b/ifupdown.nw
index 075cecc..1c8e6c8 100644
--- a/ifupdown.nw
+++ b/ifupdown.nw
@@ -4154,7 +4154,7 @@ method loopback
     This method may be used to define the IPv6 loopback interface.
   up
     ip link set dev %iface% up
-    ip aadr add dev %iface% ::1
+    ip addr add dev %iface% ::1
   down
     ip addr del dev %iface% ::1
     ip link set dev %iface% down
-- 
debian.1.5.3.7.1-dirty

>From b3f32a4456ebc734f164aec640c8110775cdcd26 Mon Sep 17 00:00:00 2001
From: Andreas Henriksson <[EMAIL PROTECTED]>
Date: Wed, 12 Dec 2007 20:29:57 +0100
Subject: [PATCH] Add netmask option to inet static for backwards compability.

Add a note about it being *obsolete* to the help text.
Add a note to address help text about the posibility to specify netmask.

Also add a versioned dependency on iproute 20071016-1, which was the first
debian package version to support dotted-quad netmasks (which was
previously the required format in /etc/network/interfaces).
---
 debian/control |    2 +-
 ifupdown.nw    |    5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/debian/control b/debian/control
index 9222ed3..95e80e4 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,7 @@ Build-Depends: debhelper (>= 4.1.68), nowebm, po-debconf
 
 Package: ifupdown
 Architecture: any
-Depends: net-tools, iproute, debconf (>= 1.2.0) | debconf-2.0, lsb-base, ${shlibs:Depends}
+Depends: net-tools, iproute (>= 20071016-1), debconf (>= 1.2.0) | debconf-2.0, lsb-base, ${shlibs:Depends}
 Suggests: dhcp3-client | dhcp-client, ppp
 Replaces: netbase (<< 4.00)
 Description: high level tools to configure network interfaces
diff --git a/ifupdown.nw b/ifupdown.nw
index 1c8e6c8..3611cd1 100644
--- a/ifupdown.nw
+++ b/ifupdown.nw
@@ -4001,7 +4001,8 @@ method static
     allocated IPv4 addresses.
       
   options
-    address address             -- Address (dotted quad) *required*
+    address address             -- Address (dotted quad/netmask) *required*
+    netmask mask                -- Netmask (dotted quad or CIDR) *obsolete*
     broadcast broadcast_address -- Broadcast address (dotted quad)
     metric metric               -- Routing metric for default gateway (integer)
     gateway address             -- Default gateway (dotted quad)
@@ -4011,7 +4012,7 @@ method static
     mtu size                    -- MTU size
 
   up
-    ip addr add %address% [[broadcast %broadcast%]] \
+    ip addr add %address%[[/%netmask%]] [[broadcast %broadcast%]] \
 	[[peer %pointtopoint%]] dev %iface%
     ip link set dev %iface% [[mtu %mtu%]] [[address %lladdress%]] up
 
-- 
debian.1.5.3.7.1-dirty

>From 882d34d30981f86eb781e0d80287267f41edad7c Mon Sep 17 00:00:00 2001
From: Andreas Henriksson <[EMAIL PROTECTED]>
Date: Wed, 12 Dec 2007 21:05:17 +0100
Subject: [PATCH] Flush addresses when taking down a static inet interface.

Addresses won't be automagically removed when taking a link down via iproute2.
To not fail to add them next time ifup runs for this interface we flush all
adresses on the interface before taking down the link.
---
 ifupdown.nw |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/ifupdown.nw b/ifupdown.nw
index 3611cd1..0e68f00 100644
--- a/ifupdown.nw
+++ b/ifupdown.nw
@@ -4019,6 +4019,7 @@ method static
     [[ ip route add default via %gateway% [[metric %metric%]] dev %iface% ]]
 
   down
+    ip addr flush dev %iface%
     [[ ip route del default via %gateway% [[metric %metric%]] dev %iface% ]]
     ip link set dev %iface% down
 @
-- 
debian.1.5.3.7.1-dirty

>From ce4029bc1102a7f137c751abd6fe1912dd69f67f Mon Sep 17 00:00:00 2001
From: Andreas Henriksson <[EMAIL PROTECTED]>
Date: Wed, 12 Dec 2007 22:01:07 +0100
Subject: [PATCH] Replace remaining ifconfig parts with iproute2

inet dhcp:
- replace "hwaddress class address" with "lladdress address"
- switch from ifconfig to iproute2

inet6 static:
- drop support for setting media type
  (old deprecated driver-dependent interface in ifconfig doesn't have
   anything equal anywhere, people should use ethtool!)
- replace "hwaddress class address" with "lladdress address"
- switch from ifconfig to iproute2
---
 ifupdown.nw |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/ifupdown.nw b/ifupdown.nw
index 0e68f00..96e69cc 100644
--- a/ifupdown.nw
+++ b/ifupdown.nw
@@ -4052,12 +4052,10 @@ method dhcp
     leasetime leasetime     -- Preferred lease time in seconds (dhcpcd)
     vendor vendor           -- Vendor class identifier (dhcpcd)
     client client           -- Client identifier (dhcpcd, udhcpc)
-    hwaddress class address -- Hardware Address. /class/ is one of \
-                                *ether*, *ax25*, *ARCnet* or *netrom*. \
-                                /address/ is dependent on this choice.
+    lladdress address       -- Link local address. (Replaces hwaddress)
 
   up
-    [[ifconfig %iface% hw %hwaddress%]]
+    [[ip link set dev %iface% address %lladdress%]]
     dhclient3 -pf /var/run/dhclient.%iface%.pid -lf /var/lib/dhcp3/dhclient.%iface%.leases %iface% \
         if (execable("/sbin/dhclient3"))
     dhclient -e -pf /var/run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases %iface% \
@@ -4170,18 +4168,16 @@ method static
     address address        -- Address (colon delimited) *required*
     netmask mask           -- Netmask (number of bits, eg 64) *required*
     gateway address        -- Default gateway (colon delimited)
-    media type             -- Medium type, driver dependent
-    hwaddress class address -- Hardware Address. /class/ is one of \
-                                 *ether*, *ax25*, *ARCnet* or *netrom*. \
-                                 /address/ is dependent on this choice.
+    lladdress address      -- Link local address. (Replaces hwaddress)
     mtu size               -- MTU size
   up
-    ifconfig %iface% [[media %media%]] [[hw %hwaddress%]] [[mtu %mtu%]] up
-    ifconfig %iface% add %address%/%netmask%
-    [[ route -A inet6 add ::/0 gw %gateway% %iface% ]] 
+    ip link set dev %iface% [[mtu %mtu%]] [[address %lladdress%]] up
+    ip -6 addr add %address%[[/%netmask%]] dev %iface%
+    [[ ip -6 route add default via %gateway% dev %iface% ]] 
 
   down
-    ifconfig %iface% down
+    ip -6 addr flush dev %iface% scope global
+    ip link set dev %iface% down
 
 method manual
   description
-- 
debian.1.5.3.7.1-dirty

>From 4b843397a2542c22a768b9efc98aef80ee31202c Mon Sep 17 00:00:00 2001
From: Andreas Henriksson <[EMAIL PROTECTED]>
Date: Wed, 12 Dec 2007 20:34:47 +0100
Subject: [PATCH] Update/fix tests for (obsolete) netmask support.

---
 debian/testbuild |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
 mode change 100644 => 100755 debian/testbuild

diff --git a/debian/testbuild b/debian/testbuild
old mode 100644
new mode 100755
index f988697..1eee062
--- a/debian/testbuild
+++ b/debian/testbuild
@@ -16,7 +16,7 @@ cat >tests/up.1 <<EOF
 ====stderr====
 Configuring interface eth0=eth0 (inet)
 run-parts --verbose /etc/network/if-pre-up.d
-ip addr add 1.2.3.4  	 dev eth0
+ip addr add 1.2.3.4/255.255.255.0  	 dev eth0
 ip link set dev eth0   up
 
 echo hi
@@ -59,37 +59,37 @@ cat >tests/up.2 <<EOF
 ====stderr====
 Configuring interface eth0=eth0 (inet)
 run-parts --verbose /etc/network/if-pre-up.d
-ip addr add 1.2.3.4  	 dev eth0
+ip addr add 1.2.3.4/255.255.255.0  	 dev eth0
 ip link set dev eth0   up
 
 run-parts --verbose /etc/network/if-up.d
 Configuring interface eth1=eth1 (inet)
 run-parts --verbose /etc/network/if-pre-up.d
-ip addr add 1.3.4.5  	 dev eth1
+ip addr add 1.3.4.5/255.255.255.0  	 dev eth1
 ip link set dev eth1   up
 
 run-parts --verbose /etc/network/if-up.d
 Configuring interface eth2=eth2 (inet)
 run-parts --verbose /etc/network/if-pre-up.d
-ip addr add 1.4.5.6  	 dev eth2
+ip addr add 1.4.5.6/255.255.255.0  	 dev eth2
 ip link set dev eth2   up
 
 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.5.6.7  	 dev eth3
+ip addr add 1.5.6.7/255.255.255.0  	 dev eth3
 ip link set dev eth3   up
 
 run-parts --verbose /etc/network/if-up.d
 Configuring interface eth4=eth4 (inet)
 run-parts --verbose /etc/network/if-pre-up.d
-ip addr add 1.7.8.9  	 dev eth4
+ip addr add 1.7.8.9/255.255.255.0  	 dev eth4
 ip link set dev eth4   up
 
 run-parts --verbose /etc/network/if-up.d
 Configuring interface eth5=eth5 (inet)
 run-parts --verbose /etc/network/if-pre-up.d
-ip addr add 1.8.9.10  	 dev eth5
+ip addr add 1.8.9.10/255.255.255.0  	 dev eth5
 ip link set dev eth5   up
 
 run-parts --verbose /etc/network/if-up.d
@@ -110,7 +110,7 @@ cat >tests/up.3 <<EOF
 ====stderr====
 Configuring interface eth0=eth0 (inet)
 run-parts --verbose /etc/network/if-pre-up.d
-ip addr add 1.2.3.4  	 dev eth0
+ip addr add 1.2.3.4/255.255.255.0  	 dev eth0
 ip link set dev eth0   up
 
 run-parts --verbose /etc/network/if-up.d
@@ -137,7 +137,7 @@ cat >tests/up.4 <<EOF
 ====stderr====
 Configuring interface eth0=work (inet)
 run-parts --verbose /etc/network/if-pre-up.d
-ip addr add 1.2.3.4  	 dev eth0
+ip addr add 1.2.3.4/255.255.255.0  	 dev eth0
 ip link set dev eth0   up
 
 echo hi
-- 
debian.1.5.3.7.1-dirty

>From 6a193abec8afd0e63f20358646596b7b9b7790ba Mon Sep 17 00:00:00 2001
From: Andreas Henriksson <[EMAIL PROTECTED]>
Date: Wed, 12 Dec 2007 22:06:22 +0100
Subject: [PATCH] Update tests for inet6 static after conversion to iproute2

---
 debian/testbuild |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/debian/testbuild b/debian/testbuild
index 1eee062..89910c7 100755
--- a/debian/testbuild
+++ b/debian/testbuild
@@ -116,8 +116,8 @@ ip link set dev eth0   up
 run-parts --verbose /etc/network/if-up.d
 Configuring interface eth0=eth0 (inet6)
 run-parts --verbose /etc/network/if-pre-up.d
-ifconfig eth0    up
-ifconfig eth0 add 3ffe:ffff:100:f101::1/64
+ip link set dev eth0   up
+ip -6 addr add 3ffe:ffff:100:f101::1/64 dev eth0
 
 run-parts --verbose /etc/network/if-up.d
 EOF
-- 
debian.1.5.3.7.1-dirty

>From 1c4c493473304ff585f2c0f0e691224c23a6f1de Mon Sep 17 00:00:00 2001
From: Andreas Henriksson <[EMAIL PROTECTED]>
Date: Wed, 12 Dec 2007 20:35:53 +0100
Subject: [PATCH] Rebuild sources by fakeroot debian/rules clean

---
 addrfam.c  |    4 ++--
 inet.defn  |   12 ++++++------
 inet6.defn |   16 +++++++---------
 3 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/addrfam.c b/addrfam.c
index 9a6788b..e7fd4bd 100644
--- a/addrfam.c
+++ b/addrfam.c
@@ -6,7 +6,7 @@
 extern address_family addr_inet;
 #line 4141 "ifupdown.nw"
 extern address_family addr_inet6;
-#line 4224 "ifupdown.nw"
+#line 4222 "ifupdown.nw"
 extern address_family addr_ipx;
 
 #line 448 "ifupdown.nw"
@@ -16,7 +16,7 @@ address_family *addr_fams[] = {
 &addr_inet, 
 #line 4145 "ifupdown.nw"
 &addr_inet6,
-#line 4228 "ifupdown.nw"
+#line 4226 "ifupdown.nw"
 &addr_ipx,
 #line 450 "ifupdown.nw"
 	NULL
diff --git a/inet.defn b/inet.defn
index f877bc2..153d01a 100644
--- a/inet.defn
+++ b/inet.defn
@@ -16,7 +16,8 @@ method static
     allocated IPv4 addresses.
       
   options
-    address address             -- Address (dotted quad) *required*
+    address address             -- Address (dotted quad/netmask) *required*
+    netmask mask                -- Netmask (dotted quad or CIDR) *obsolete*
     broadcast broadcast_address -- Broadcast address (dotted quad)
     metric metric               -- Routing metric for default gateway (integer)
     gateway address             -- Default gateway (dotted quad)
@@ -26,13 +27,14 @@ method static
     mtu size                    -- MTU size
 
   up
-    ip addr add %address% [[broadcast %broadcast%]] \
+    ip addr add %address%[[/%netmask%]] [[broadcast %broadcast%]] \
 	[[peer %pointtopoint%]] dev %iface%
     ip link set dev %iface% [[mtu %mtu%]] [[address %lladdress%]] up
 
     [[ ip route add default via %gateway% [[metric %metric%]] dev %iface% ]]
 
   down
+    ip addr flush dev %iface%
     [[ ip route del default via %gateway% [[metric %metric%]] dev %iface% ]]
     ip link set dev %iface% down
 method manual
@@ -59,12 +61,10 @@ method dhcp
     leasetime leasetime     -- Preferred lease time in seconds (dhcpcd)
     vendor vendor           -- Vendor class identifier (dhcpcd)
     client client           -- Client identifier (dhcpcd, udhcpc)
-    hwaddress class address -- Hardware Address. /class/ is one of \
-                                *ether*, *ax25*, *ARCnet* or *netrom*. \
-                                /address/ is dependent on this choice.
+    lladdress address       -- Link local address. (Replaces hwaddress)
 
   up
-    [[ifconfig %iface% hw %hwaddress%]]
+    [[ip link set dev %iface% address %lladdress%]]
     dhclient3 -pf /var/run/dhclient.%iface%.pid -lf /var/lib/dhcp3/dhclient.%iface%.leases %iface% \
         if (execable("/sbin/dhclient3"))
     dhclient -e -pf /var/run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases %iface% \
diff --git a/inet6.defn b/inet6.defn
index 64530f4..3bde004 100644
--- a/inet6.defn
+++ b/inet6.defn
@@ -6,7 +6,7 @@ method loopback
     This method may be used to define the IPv6 loopback interface.
   up
     ip link set dev %iface% up
-    ip aadr add dev %iface% ::1
+    ip addr add dev %iface% ::1
   down
     ip addr del dev %iface% ::1
     ip link set dev %iface% down
@@ -20,18 +20,16 @@ method static
     address address        -- Address (colon delimited) *required*
     netmask mask           -- Netmask (number of bits, eg 64) *required*
     gateway address        -- Default gateway (colon delimited)
-    media type             -- Medium type, driver dependent
-    hwaddress class address -- Hardware Address. /class/ is one of \
-                                 *ether*, *ax25*, *ARCnet* or *netrom*. \
-                                 /address/ is dependent on this choice.
+    lladdress address      -- Link local address. (Replaces hwaddress)
     mtu size               -- MTU size
   up
-    ifconfig %iface% [[media %media%]] [[hw %hwaddress%]] [[mtu %mtu%]] up
-    ifconfig %iface% add %address%/%netmask%
-    [[ route -A inet6 add ::/0 gw %gateway% %iface% ]] 
+    ip link set dev %iface% [[mtu %mtu%]] [[address %lladdress%]] up
+    ip -6 addr add %address%[[/%netmask%]] dev %iface%
+    [[ ip -6 route add default via %gateway% dev %iface% ]] 
 
   down
-    ifconfig %iface% down
+    ip -6 addr flush dev %iface% scope global
+    ip link set dev %iface% down
 
 method manual
   description
-- 
debian.1.5.3.7.1-dirty

Reply via email to