(Resending since original never reached its goal.) I have a refinement to the proposed wrapper, and also a new wrapper for "ifconfig".
The binary /sbin/ifconfig is pushed to /lib/freebsd/ifconfig. Taken together, the two wrappers are able to boot my single homed system from only /etc/network/interfaces, containing one static IPv4 and one static IPv6 assignement. Immediately at first login, I am able to successfully execute $ ping -c1 www.google.com $ ping6 -c1 ipv6.google.com The changes to my previous script /sbin/route is a more restrictive detection of "gw-state", thus hopefully letting administrators use "gw" as host name! Best regards, Mats E A --------------------------------------------- #!/bin/sh # # /sbin/ifconfig # # Experimental wrapper for /lib/freebsd/ifconfig. # # The invocation of "ifconfig" from "ifup/ifdown" # needs corrections in GNU/kFreeBSD. set -e # Is this call intended to set an IPv6 address # without using "-inet6"? if [ $# -eq 3 -a "$2" = "add" ] ; then echo $3 | egrep -q '.*:.*/[0-9]+' if [ $? -eq 0 ] ; then # "add" is is to be deleted, and "inet6" must be augmented. # TODO: Should "alias" be appended? exec /lib/freebsd/ifconfig $1 inet6 $3 fi fi # The general case, pass everything. exec /lib/freebsd/ifconfig $@ ---------------------------------------------------------- --- /sbin/route.orig +++ /sbin/route @@ -74,7 +74,7 @@ while [ $# -gt 0 ]; do if [ -n "$HAVE_SEEN_GW" ] ; then if [ $# -eq 1 ] ; then - # We have reach the end. An interface name + # We have reached the end. An interface name # appears as last argument, since we are in # a state caused by a call from ifupdown. # We simply discard the interface name. @@ -87,7 +87,9 @@ args="${args} $1" fi else - if [ "$1" = "gw" ] ; then + # Ifup and ifdown use "gw" only in two forms. + if [ "$1" = "gw" -a \( $# -eq 3 -o \( $# -eq 5 -a "$3" = "metric" \) \) ] + then # Change state and discard "gw", # hoping that no administrator ever # names a host or a network as "gw".
signature.asc
Description: Digital signature