Bug#646961: please use FreeBSD route on Debian GNU/kFreeBSD
Package: udhcpc
Version: 1.18.5-1
Severity: wishlist
Tags: patch
User: debian-bsd@lists.debian.org
Usertags: kfreebsd
Debian GNU/kFreeBSD provides two route implementations, /lib/freebsd/route
which is the FreeBSD version of route, and /sbin/route which is a shell
wrapper that attempts to provide a Linux-like CLI.
As the /sbin/route wrapper is very incomplete / unreliable, and applications
tend to expect /sbin/route to provide FreeBSD CLI more often than not, in
the near future we're going to install FreeBSD route into /sbin/route (and
remove the wrapper or put it elsewhere). See:
http://lists.debian.org/debian-bsd/2011/10/msg00242.html
Attached patch adjusts udhcpc to use FreeBSD route CLI when running on
GNU/kFreeBSD, and to use /lib/freebsd/route instead of /sbin/route. The
latter is meant to be temporary and allow us to do this switch without
causing any breakage.
-- System Information:
Debian Release: 6.0.3
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: kfreebsd-amd64 (x86_64)
Kernel: kFreeBSD 8.1-1-amd64
Locale: LANG=ca_AD.UTF-8, LC_CTYPE=ca_AD.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
=== modified file 'debian/tree/udhcpc/usr/share/udhcpc/default.script'
--- debian/tree/udhcpc/usr/share/udhcpc/default.script 2011-10-28 18:07:16 +0000
+++ debian/tree/udhcpc/usr/share/udhcpc/default.script 2011-10-28 18:07:25 +0000
@@ -6,6 +6,8 @@
RESOLV_CONF="/etc/resolv.conf"
+uname="$(uname)"
+
case $1 in
bound|renew)
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
@@ -15,11 +17,19 @@ case $1 in
if [ -n "$router" ]; then
echo "$0: Resetting default routes"
- while /sbin/route del default gw 0.0.0.0 dev $interface; do :; done
+ if [ ${uname} = "GNU/kFreeBSD" ] ; then
+ /lib/freebsd/route -q flush
+ else
+ while /sbin/route del default gw 0.0.0.0 dev $interface; do :; done
+ fi
metric=0
for i in $router; do
- /sbin/route add default gw $i dev $interface metric $metric
+ if [ ${uname} = "GNU/kFreeBSD" ] ; then
+ /lib/freebsd/route add -net 0.0.0.0 $i dev $interface metric $metric
+ else
+ /sbin/route add default gw $i dev $interface metric $metric
+ fi
metric=$(($metric + 1))
done
fi
Reply to: