Package: ifupdown
Version: 0.6.8+nmu1
Severity: wishlist
Tags: patch

The attached patch (based on 0.7~alpha3) adds support for a "privext" option
for IPv6 static, manual & v4tunnel, taking an integer parameter exactly as
for the net.ipv6.conf.$INTERFACE.use_privaddr sysctl.

I've tested only manual (I'm using radvd). I find that the 'inet6'
configuration for a given interface must be before the corresponding 'inet'
configuration (if present) else the "privext" option won't take effect until
the interface is *next* brought up (based on brief testing by taking the
interface down then bringing it up again a second or so later). Not sure
where/how to document this...

-- 
| Darren Salt    | linux or ds at              | nr. Ashington, | Toon
| RISC OS, Linux | youmustbejoking,demon,co,uk | Northumberland | Army
| + Lobby friends, family, business, government.    WE'RE KILLING THE PLANET.

Watch carefully; the special effects are very expensive.

diff -ur ifupdown-0.7~alpha3/debian/testbuild ifupdown-0.7~alpha3+ds1/debian/testbuild
--- ifupdown-0.7~alpha3/debian/testbuild	2007-12-21 14:24:07.000000000 +0000
+++ ifupdown-0.7~alpha3+ds1/debian/testbuild	2009-03-21 00:36:48.000000000 +0000
@@ -116,6 +116,7 @@
 run-parts --verbose /etc/network/if-up.d
 Configuring interface eth0=eth0 (inet6)
 run-parts --verbose /etc/network/if-pre-up.d
+
 ip link set dev eth0	up
 ip -6 addr add 3ffe:ffff:100:f101::1/64 dev eth0
 
@@ -183,10 +184,38 @@
 run-parts --verbose /etc/network/if-up.d
 EOF
 
+cat >tests/testcase.7 <<EOF
+# RUN: -a
+auto eth0
+iface eth0 inet static
+  address 1.2.3.4
+  netmask 255.255.255.0
+iface eth0 inet6 static
+  address 3ffe:ffff:100:f101::1
+  netmask 64
+  privext 2
+EOF
+cat >tests/up.7 <<EOF
+====stdout====
+====stderr====
+Configuring interface eth0=eth0 (inet)
+run-parts --verbose /etc/network/if-pre-up.d
+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 eth0=eth0 (inet6)
+run-parts --verbose /etc/network/if-pre-up.d
+sysctl net.ipv6.conf.eth0.use_tempaddr=2 
+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
 
 
 result=true
-for test in 1 2 3 4 5 6; do
+for test in 1 2 3 4 5 6 7; do
         args="$(cat tests/testcase.$test | sed -n 's/^# RUN: //p')"
         ./ifup -nv --force -i tests/testcase.$test $args \
                 >tests/up-res-out.$test 2>tests/up-res-err.$test || 
diff -ur ifupdown-0.7~alpha3/ifupdown.nw ifupdown-0.7~alpha3+ds1/ifupdown.nw
--- ifupdown-0.7~alpha3/ifupdown.nw	2007-12-21 14:22:19.000000000 +0000
+++ ifupdown-0.7~alpha3+ds1/ifupdown.nw	2009-03-21 00:38:11.000000000 +0000
@@ -4246,11 +4246,13 @@
     media type             -- Medium type, driver dependent
     hwaddress address      -- Hardware address
     mtu size               -- MTU size
+    privext int            -- Privacy extensions (RFC3041) (0=off, 1=assign, 2=prefer)
 
   conversion
     hwaddress cleanup_hwaddress_for_iproute
 
   up
+    [[sysctl net.ipv6.conf.%iface%.use_tempaddr=%privext%]]
     ip link set dev %iface% [[mtu %mtu%]] [[address %hwaddress%]] up
     ip -6 addr add %address%[[/%netmask%]] dev %iface%
     [[ ip -6 route add default via %gateway% dev %iface% ]]
@@ -4265,7 +4267,11 @@
     is done by default.  Such interfaces can be configured manually by
     means of *up* and *down* commands or /etc/network/if-*.d scripts.
 
+  options
+    privext int            -- Privacy extensions (RFC3041) (0=off, 1=assign, 2=prefer)
+
   up
+    [[sysctl net.ipv6.conf.%iface%.use_tempaddr=%privext%]]
 
   down
 
@@ -4283,8 +4289,10 @@
                              dotted quad)
     gateway address       -- Default gateway (colon delimited)
     ttl time              -- TTL setting
+    privext int            -- Privacy extensions (RFC3041) (0=off, 1=assign, 2=prefer)
 
   up
+    [[sysctl net.ipv6.conf.%iface%.use_tempaddr=%privext%]]
     ip tunnel add %iface% mode sit remote %endpoint% [[local %local%]] \
        [[ttl %ttl%]]
     ip link set %iface% up
diff -ur ifupdown-0.7~alpha3/inet6.defn ifupdown-0.7~alpha3+ds1/inet6.defn
--- ifupdown-0.7~alpha3/inet6.defn	2007-12-21 14:29:51.000000000 +0000
+++ ifupdown-0.7~alpha3+ds1/inet6.defn	2009-03-21 00:38:20.000000000 +0000
@@ -23,11 +23,13 @@
     media type             -- Medium type, driver dependent
     hwaddress address      -- Hardware address
     mtu size               -- MTU size
+    privext int            -- Privacy extensions (RFC3041) (0=off, 1=assign, 2=prefer)
 
   conversion
     hwaddress cleanup_hwaddress_for_iproute
 
   up
+    [[sysctl net.ipv6.conf.%iface%.use_tempaddr=%privext%]]
     ip link set dev %iface% [[mtu %mtu%]] [[address %hwaddress%]] up
     ip -6 addr add %address%[[/%netmask%]] dev %iface%
     [[ ip -6 route add default via %gateway% dev %iface% ]]
@@ -42,7 +44,11 @@
     is done by default.  Such interfaces can be configured manually by
     means of *up* and *down* commands or /etc/network/if-*.d scripts.
 
+  options
+    privext int            -- Privacy extensions (RFC3041) (0=off, 1=assign, 2=prefer)
+
   up
+    [[sysctl net.ipv6.conf.%iface%.use_tempaddr=%privext%]]
 
   down
 
@@ -60,8 +66,10 @@
                              dotted quad)
     gateway address       -- Default gateway (colon delimited)
     ttl time              -- TTL setting
+    privext int            -- Privacy extensions (RFC3041) (0=off, 1=assign, 2=prefer)
 
   up
+    [[sysctl net.ipv6.conf.%iface%.use_tempaddr=%privext%]]
     ip tunnel add %iface% mode sit remote %endpoint% [[local %local%]] \
        [[ttl %ttl%]]
     ip link set %iface% up

Reply via email to