[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]



I've recently found (and filed) two bugs that expose severe problems
with route management on Debian GNU/kFreeBSD:

Bug#645502: isc-dhcp-client: Resync dhclient-script with FreeBSD version
Bug#646221: openvpn: /sbin/route wrapper doesn't provide FreeBSD CLI as expected

In both cases, I proposed using /lib/freebsd/route as solution.  The
situation with using /sbin/route wrapper seems unsustainable to me.

On one hand, it's incomplete, and it's unlikely that it can ever
replicate all route functionality.  On the other, upstream code tends
to expect FreeBSD-style CLI much more often than Linux-style CLI when
it comes to /sbin/route.

I propose that /sbin/route is replaced with FreeBSD route.  Then we
could keep the wrapper elsewhere in case it's useful (e.g. to shell

Some caveats:

- The proposed change would require #645502 to be fixed first if we
don't want to break isc-dhcp-client even further.
- The proposed change would automatically fix #646221 in Sid, but not
in Squeeze (so in either case, my patch for OpenVPN is still useful)
- The proposed change would also require adjustments in ifupdown.
Attached patch makes ifupdown work either with or without the proposed
change by using /lib/freebsd/route instead (just a proof of concept,
some kernel brand checks would still be needed not to break Linux).

Please comment.

Robert Millan
=== modified file 'ifupdown.nw'
--- ifupdown.nw	2011-10-22 11:19:53 +0000
+++ ifupdown.nw	2011-10-22 11:26:37 +0000
@@ -3925,10 +3925,10 @@ method static
     route add -net %network%  \
         if ( mylinuxver() < mylinux(2,1,100) )
-    [[ route add default gw %gateway% [[metric %metric%]] %iface% ]]
+    [[ /lib/freebsd/route add default %gateway% ]]
-    [[ route del default gw %gateway% [[metric %metric%]] %iface% ]]
+    [[ /lib/freebsd/route del default %gateway% ]]
     ifconfig %iface% down
@@ -4086,7 +4086,7 @@ method static
     modprobe -q net-pf-10 > /dev/null 2>&1 || true # ignore failure.
     ifconfig %iface% [[media %media%]] [[hw %hwaddress%]] [[mtu %mtu%]] up
     ifconfig %iface% add %address%/%netmask%
-    [[ route -A inet6 add ::/0 gw %gateway% %iface% ]] 
+    [[ /lib/freebsd/route add -inet6 ::/0 %gateway% ]]
     ifconfig %iface% down

Reply to: