On Tue, 2012-05-22 at 17:13 +0200, Andrew Shadura wrote: > Hello, > > On Tue, 22 May 2012 17:07:20 +0200 > Svante Signell <svante.sign...@telia.com> wrote: > > > FYI: Porting of 0.7~rc3 to GNU/Hurd is almost complete. The patches > > will be submitted to this bug number, #672212, when they have been > > reviewed a second time. Is that OK, or should a separate bug report > > be created? > > Yes, that's fine.
Attached are the patches of ifupdown-0.7~rc3 for supporting GNU/Hurd: patch0: Fix some spelling errors in ifupdown.nw patch1: Add a dependency on inetutils-tools to dh_gencontrol patch2: Add a new file: testbuild-hurd for the tests patch3: Changes to ifupdown.nw for the port. Thanks, Svante
diff -ur ifupdown-0.7~rc3.orig/ifupdown.nw ifupdown-0.7~rc3/ifupdown.nw --- ifupdown-0.7~rc3.orig/ifupdown.nw 2012-05-14 21:49:57.000000000 +0200 +++ ifupdown-0.7~rc3/ifupdown.nw 2012-05-22 10:05:09.000000000 +0200 @@ -553,7 +553,7 @@ use strict; -<<determine the target architecrure>> +<<determine the target architecture>> # declarations <<defn2c variables>> @@ -568,7 +568,7 @@ @ First of all, we determine the target architecture by calling [[dpkg-architecture]] and stripping the trailing newline: -<<determine the target architecrure>>= +<<determine the target architecture>>= my $DEB_HOST_ARCH_OS = `dpkg-architecture -qDEB_HOST_ARCH_OS`; $DEB_HOST_ARCH_OS =~ s/\n//; @@ -977,7 +977,7 @@ use strict; -<<determine the target architecrure>> +<<determine the target architecture>> # declarations <<defn2man variables>>
--- ifupdown-0.7~rc3.orig/debian/rules 2012-05-14 21:49:57.000000000 +0200 +++ ifupdown-0.7~rc3/debian/rules 2012-05-24 11:58:29.000000000 +0200 @@ -77,6 +77,8 @@ override_dh_gencontrol: ifeq ($(DEB_HOST_ARCH_OS),linux) dh_gencontrol -- -V'net:Depends=iproute (>= 20071016-1)' -V'net:Suggests=net-tools' -else +else ifeq ($(DEB_HOST_ARCH_OS),kfreebsd) dh_gencontrol -- -V'net:Depends=net-tools' -V'net:Suggests=' +else ifeq ($(DEB_HOST_ARCH_OS),hurd) + dh_gencontrol -- -V'net:Depends=inetutils-tools' -V'net:Suggests=' endif
--- /dev/null 2012-04-02 18:20:02.000000000 +0200 +++ ifupdown-0.7~rc3/debian/testbuild-hurd 2012-05-22 11:08:35.000000000 +0200 @@ -0,0 +1,281 @@ +#!/bin/sh -e + +rm -rf tests/ +mkdir tests +cat >tests/testcase.1 <<EOF +# RUN: -a +auto eth0 +iface eth0 inet static + address 1.2.3.4 + netmask 255.255.255.0 + up echo hi + post-up echo hello +EOF +cat >tests/up.1 <<EOF +====stdout==== +====stderr==== +run-parts --verbose /etc/network/if-pre-up.d +Configuring interface eth0=eth0 (inet) +run-parts --verbose /etc/network/if-pre-up.d + +inetutils-ifconfig --interface eth0 --address 1.2.3.4 --netmask 255.255.255.0 --up + +echo hi +echo hello +run-parts --verbose /etc/network/if-up.d +run-parts --verbose /etc/network/if-up.d +EOF + +cat >tests/testcase.2 <<EOF +# RUN: -a +auto eth0 eth1 eth2 +auto eth3 eth4 eth5 +allow-hotplug eth6 +iface eth0 inet static + address 1.2.3.4 + netmask 255.255.255.0 +iface eth1 inet static + address 1.3.4.5 + netmask 255.255.255.0 +iface eth2 inet static + address 1.4.5.6 + netmask 255.255.255.0 +iface eth3 inet static + address 1.5.6.7 + netmask 255.255.255.0 +iface eth4 inet static + address 1.7.8.9 + netmask 255.255.255.0 +iface eth5 inet static + address 1.8.9.10 + netmask 255.255.255.0 +iface eth6 inet static + address 1.11.12.13 + netmask 255.255.255.0 +iface eth7 inet static + address 1.14.15.16 + netmask 255.255.255.0 +EOF +cat >tests/up.2 <<EOF +====stdout==== +====stderr==== +run-parts --verbose /etc/network/if-pre-up.d +Configuring interface eth0=eth0 (inet) +run-parts --verbose /etc/network/if-pre-up.d + +inetutils-ifconfig --interface eth0 --address 1.2.3.4 --netmask 255.255.255.0 --up + +run-parts --verbose /etc/network/if-up.d +Configuring interface eth1=eth1 (inet) +run-parts --verbose /etc/network/if-pre-up.d + +inetutils-ifconfig --interface eth1 --address 1.3.4.5 --netmask 255.255.255.0 --up + +run-parts --verbose /etc/network/if-up.d +Configuring interface eth2=eth2 (inet) +run-parts --verbose /etc/network/if-pre-up.d + +inetutils-ifconfig --interface eth2 --address 1.4.5.6 --netmask 255.255.255.0 --up + +run-parts --verbose /etc/network/if-up.d +Configuring interface eth3=eth3 (inet) +run-parts --verbose /etc/network/if-pre-up.d + +inetutils-ifconfig --interface eth3 --address 1.5.6.7 --netmask 255.255.255.0 --up + +run-parts --verbose /etc/network/if-up.d +Configuring interface eth4=eth4 (inet) +run-parts --verbose /etc/network/if-pre-up.d + +inetutils-ifconfig --interface eth4 --address 1.7.8.9 --netmask 255.255.255.0 --up + +run-parts --verbose /etc/network/if-up.d +Configuring interface eth5=eth5 (inet) +run-parts --verbose /etc/network/if-pre-up.d + +inetutils-ifconfig --interface eth5 --address 1.8.9.10 --netmask 255.255.255.0 --up + +run-parts --verbose /etc/network/if-up.d +run-parts --verbose /etc/network/if-up.d +EOF + +cat >tests/testcase.3 <<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 +EOF +cat >tests/up.3 <<EOF +====stdout==== +====stderr==== +run-parts --verbose /etc/network/if-pre-up.d +Configuring interface eth0=eth0 (inet) +run-parts --verbose /etc/network/if-pre-up.d + +inetutils-ifconfig --interface eth0 --address 1.2.3.4 --netmask 255.255.255.0 --up + +run-parts --verbose /etc/network/if-up.d +Configuring interface eth0=eth0 (inet6) +run-parts --verbose /etc/network/if-pre-up.d +FIXME: Add proper commands here for ipv6 + + +run-parts --verbose /etc/network/if-up.d +run-parts --verbose /etc/network/if-up.d +EOF + +cat >tests/testcase.4 <<EOF +# RUN: eth0=work +mapping eth0 + script tests/map.eth0.work +iface work inet static + address 1.2.3.4 + netmask 255.255.255.0 + up echo hi + post-up echo hello +EOF +cat >tests/up.4 <<EOF +====stdout==== +====stderr==== +Configuring interface eth0=work (inet) +run-parts --verbose /etc/network/if-pre-up.d + +inetutils-ifconfig --interface eth0 --address 1.2.3.4 --netmask 255.255.255.0 --up + +echo hi +echo hello +run-parts --verbose /etc/network/if-up.d +EOF + +cat >tests/testcase.5 <<EOF +# RUN: -a +auto eth0 +iface eth0 inet static + address 1.2.3.4 + netmask 255.255.255.0 + hwaddress ether 00:DE:AD:00:BE:AF +EOF +cat >tests/up.5 <<EOF +====stdout==== +====stderr==== +run-parts --verbose /etc/network/if-pre-up.d +Configuring interface eth0=eth0 (inet) +run-parts --verbose /etc/network/if-pre-up.d +Warning: Option hwaddress: 00:DE:AD:00:BE:AF not yet supported +inetutils-ifconfig --interface eth0 --address 1.2.3.4 --netmask 255.255.255.0 --up + +run-parts --verbose /etc/network/if-up.d +run-parts --verbose /etc/network/if-up.d +EOF + +cat >tests/testcase.6 <<EOF +# RUN: -a +auto eth0 +iface eth0 inet static + address 1.2.3.4 + netmask 255.255.255.0 + hwaddress 00:DE:AD:00:BE:AF +EOF +cat >tests/up.6 <<EOF +====stdout==== +====stderr==== +run-parts --verbose /etc/network/if-pre-up.d +Configuring interface eth0=eth0 (inet) +run-parts --verbose /etc/network/if-pre-up.d +Warning: Option hwaddress: 00:DE:AD:00:BE:AF not yet supported +inetutils-ifconfig --interface eth0 --address 1.2.3.4 --netmask 255.255.255.0 --up + +run-parts --verbose /etc/network/if-up.d +run-parts --verbose /etc/network/if-up.d +EOF + +cat >tests/testcase.7 <<EOF +# RUN: -a +auto eth0 eth0.1 tunnel +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 + accept_ra 0 +iface eth0.1 inet6 static + address 3ffe:ffff:120:f101::1 + netmask 64 +iface tunnel inet6 6to4 + local 1.2.3.4 +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 +modprobe -q net-pf-10 > /dev/null 2>&1 || true # ignore failure. +sysctl net.ipv6.conf.eth0.use_tempaddr=2 +sysctl net.ipv6.conf.eth0.accept_ra=0 +sysctl net.ipv6.conf.eth0.autoconf=0 + +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 +Configuring interface eth0.1=eth0.1 (inet6) +run-parts --verbose /etc/network/if-pre-up.d +modprobe -q net-pf-10 > /dev/null 2>&1 || true # ignore failure. + + +sysctl net.ipv6.conf.eth0/1.autoconf=0 + +ip link set dev eth0.1 up +ip -6 addr add 3ffe:ffff:120:f101::1/64 dev eth0.1 + +run-parts --verbose /etc/network/if-up.d +Configuring interface tunnel=tunnel (inet6) +run-parts --verbose /etc/network/if-pre-up.d +modprobe -q net-pf-10 > /dev/null 2>&1 || true # ignore failure. +ip tunnel add tunnel mode sit remote any local 1.2.3.4 +ip link set tunnel up +ip addr add 2002:0102:0304::1/16 dev tunnel +ip route add 2000::/3 via ::192.88.99.1 dev tunnel +run-parts --verbose /etc/network/if-up.d +EOF + +# Note: Testcase 7 is not run on GNU/Hurd, tunnel is not yet implemented. +result=true +for test in 1 2 3 4 5 6; 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 || + true + (echo "====stdout===="; cat tests/up-res-out.$test + echo "====stderr===="; cat tests/up-res-err.$test) > tests/up-res.$test + + echo "Testcase $test: $args" + + if diff -ub tests/up.$test tests/up-res.$test; then + echo "(okay)" + else + echo "(failed)" + result=false + fi + echo "==========" +done + +if $result; then + echo "(okay overall)" + exit 0 +else + echo "(failed overall)" + exit 1 +fi
--- ifupdown-0.7~rc3.orig/ifupdown.nw 2012-05-14 21:49:57.000000000 +0200 +++ ifupdown-0.7~rc3/ifupdown.nw 2012-05-22 11:01:57.000000000 +0200 @@ -4753,6 +4753,26 @@ <<common functions implementations>> @ +\subsection{Hurd-specific functions} + +<<archhurd.h>>= +/* no OS-specific functions yet */ +<<common functions declarations>> +@ + +<<archhurd.c>>= +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/utsname.h> +#include <sys/stat.h> + +#include "archhurd.h" + +<<common functions implementations>> +@ + \section{Linux Address Families} \subsection{IPv4 Address Family} @@ -5452,6 +5472,189 @@ @ +\section{Hurd Address Families} +\subsection{IPv4 Address Family} + +<<inet.defn>>= +architecture hurd + +<<Hurd inet methods>> +@ + +<<Hurd inet methods>>= +<<Hurd inet methods: loopback>> + +<<Hurd inet methods: static>> + +<<inet methods: manual>> + +<<Hurd inet methods: dhcp>> + +<<inet methods: bootp>> + +<<inet methods: ppp>> + +<<inet methods: wvdial>> + +<<inet methods: ipv4ll>> +@ + +<<Hurd inet methods: loopback>>= +method loopback + description + This method may be used to define the IPv4 loopback interface. + + up + inetutils-ifconfig --interface %iface% 127.0.0.1 --up + + down + inetutils-ifconfig --interface %iface% --down +@ + +<<Hurd inet methods: static>>= +method static + description + This method may be used to define Ethernet interfaces with statically + allocated IPv4 addresses. + + options + address address -- Address (dotted quad/netmask) *required* + netmask mask -- Netmask (dotted quad or CIDR) + broadcast broadcast_address -- Broadcast address (dotted quad) + metric metric -- Routing metric for default gateway (integer) + gateway address -- Default gateway (dotted quad) + pointopoint address -- Address of other end point (dotted quad). \ + Note the spelling of "point-to". + hwaddress address -- Link local address (Not yet supported) + mtu size -- MTU size + + conversion + hwaddress cleanup_hwaddress + + up + [[Warning: Option hwaddress: %hwaddress% not yet supported]] + inetutils-ifconfig --interface %iface% --address %address% [[--netmask %netmask%]] \ + [[--broadcast %broadcast%]] [[--mtu %mtu%]] --up + [[fsysopts /servers/socket/2 $(showtrans /servers/socket/2) --gateway %gateway% ]] + + down + inetutils-ifconfig --interface %iface% --down +@ + +<<Hurd inet methods: dhcp>>= +method dhcp + description + This method may be used to obtain an address via DHCP with any of + the tools: dhclient, udhcpc, dhcpcd. + (They have been listed in their order of precedence.) + If you have a complicated DHCP setup you should + note that some of these clients use their own configuration files + and do not obtain their configuration information via *ifup*. + + options + hostname hostname -- Hostname to be requested (dhcpcd, udhcpc) + leasetime leasetime -- Preferred lease time in seconds (dhcpcd) + vendor vendor -- Vendor class identifier (dhcpcd) + client client -- Client identifier (dhcpcd, udhcpc) + hwaddress address -- Hardware Address (Not yet supported) + + conversion + hwaddress cleanup_hwaddress + + up + [[Warning: Option hwaddress: %hwaddress% not yet supported]] + dhclient -1 -v -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases %iface% \ + if (execable("/sbin/dhclient")) + udhcpc -n -p /run/udhcpc.%iface%.pid -i %iface% [[-H %hostname%]] \ + [[-c %client%]] \ + elsif (execable("/sbin/udhcpc")) + dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \ + [[-l %leasetime%]] %iface% \ + elsif (execable("/sbin/dhcpcd")) + + down + dhclient -v -r -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases %iface% \ + if (execable("/sbin/dhclient")) + kill -USR2 $(cat /run/udhcpc.%iface%.pid); kill -TERM $(cat /run/udhcpc.%iface%.pid) \ + elsif (execable("/sbin/udhcpc")) + dhcpcd -k %iface% \ + elsif (execable("/sbin/dhcpcd")) + + ifconfig --interface %iface% --down +@ + +\subsection{IPv6 Address Family} + +<<inet6.defn>>= +architecture hurd + +method loopback + description + This method may be used to define the IPv6 loopback interface. + up + [[FIXME: Add proper commands here for ipv6]] + down + [[FIXME: Add proper commands here for ipv6]] + +method static + description + This method may be used to define interfaces with statically assigned + IPv6 addresses. + + options + 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 address -- Hardware address (Not yet supported) + mtu size -- MTU size + + conversion + hwaddress cleanup_hwaddress + + up + [[FIXME: Add proper commands here for ipv6]] + [[Warning: Option media: %media% not yet supported]] + [[Warning: Option hwaddress: %hwaddress% not yet supported]] + + down + [[FIXME: Add proper commands here for ipv6]] + +method manual + description + This method may be used to define interfaces for which no configuration + is done by default. Such interfaces can be configured manually by + means of *up* and *down* commands or /etc/network/if-*.d scripts. + + up + + down + +method dhcp + description + This method may be used to obtain network interface configuration via + stateful DHCPv6 with dhclient. In stateful DHCPv6, the DHCP server is + responsible for assigning addresses to clients. + + options + hwaddress address -- Hardware address (Not yet supported) + + conversion + hwaddress cleanup_hwaddress + + up + [[Warning: Option hwaddress: %hwaddress% not yet supported]] + inetutils-ifconfig --interface %iface% --up + dhclient -6 -1 -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases %iface% \ + if (execable("/sbin/dhclient")) + + down + dhclient -6 -r -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases %iface% \ + if (execable("/sbin/dhclient")) + inetutils-ifconfig --interface %iface% --down + +@ + \section{Internal address metafamily} <<address family declarations>>= @@ -5501,6 +5704,13 @@ method none description + up + down + +architecture hurd + +method none + description up down