Bug#665773: ifupdown failing IPv6 on kfreebsd.
Tags: patch sid
Justification: IPv6 failure kills also IPv4 initialisation
I need to point to three reasons why ifupdown fails for GNU/kFreeBSD.
1) Version 0.7~beta2 fails to build for kfreebsd, which 0.7~beta1 does.
2) ifupdown consistently finalises its tasks by running
be it for IPv4, or IPv6. This is a GNU-ism, which is illegal for BSD
and Solaris, where the correct invokations are
/lib/freebsd/route -n get -inet 0.0.0.0
/lib/freebsd/route -n get -inet6 ::
for displaying the default route. Their utility route cannot display
the full routing table, and "route -n" returns status 1 and a usage
The GNU forms
route -n -A inet
route -n -A inet6
print their corresponding tables.
I have not been able to tell with which mechanism ifup(8) and ifdown(8)
calls "route -n", but it does so once for IPv4 and once for IPv6; in the
latter case even ignoring that the output only contains IPv4. Presently
the usage output is harmless, but annoying, so it better be remedied.
3) The call sequence for IPv6 is erroneous on GNU/kFreeBSD. The patch below
is able to raise static IPv6 and to close IPv6, but not to idempotently
raise IPv6 immediately again. I will explain the important reasons.
As long as the closing down of the adapter is not running
/lib/freebsd/route -n del -inet ::/0
the route remains in the kernel, thus the next time an effort to raise
the adapter is made, the call
/lib/freebsd/route -n add -inet6 ::/0 %gateway%
(this is the native form, not the form of the removed wrapper!) will fail
since the old default route cannot be overritten. It could be overwritten
using "change" instead of "add", but a fresh default route cannot
be instantiated using "change", so this short-cut remains unusable.
Of reasons unknown to me, "ifupdown.nw" accepted a text "route -n del ...",
but it never get to be run in practice, even without "[[ ]]".
QUESTION: How to enforce route deletion at closing time?
This must be done before the implementation can be fully functional,
but the patch below contains the native commands for raising and
Note as a side remark for future reference, that the standard idiom is
ifconfig bge0 inet6 2001:abcd:1234::1/64 alias (or "add")
but that it would imply a non-circumventable
ifconfig bge0 inet6 2001:abcd:1234::1 -alias (or "delete")
when bringing the adapter down, which "ifupdown.nw" never is effectuating:
[[ ifconfig %iface% inet6 %address% -alias ]]
never caused any execution. Running with a null-command, i.e., neither
"add", nor "alias", does instantiate a first address though, which can
be overwritten by the next similar call.
Mats Erik Andersson, DM
--- ifupdown-0.7~beta1.orig/ifupdown.nw 2011-08-25 10:05:08.000000000 +0200
+++ ifupdown-0.7~beta1/ifupdown.nw 2012-03-25 22:13:42.677482622 +0200
@@ -4912,9 +4912,10 @@
ifconfig %iface% [[media %media%]] [[link %hwaddress%]] [[mtu %mtu%]] up
ifconfig %iface% inet6 %address%/%netmask%
- [[ route -A inet6 add ::/0 gw %gateway% %iface% ]]
+ [[ /lib/freebsd/route add -inet6 ::/0 %gateway% ]]
+ [[ /lib/freebsd/route -n del -inet6 ::/0 ]]
ifconfig %iface% down