[Babel-users] [PATCH] Flush ipv4 addresses and routes when ipv6 link layer addr is lost

Dave Taht dave.taht at gmail.com
Thu Feb 2 23:16:13 UTC 2017


When an ipv6 LL address disappears, flush babeld's internal notions of
any ipv4 address and ipv4 routes on that interface, and mark it as
internally down, until it re-appears, at which point babeld's normal
interface init logic will kick in.

To reproduce the bug:

Normally, when an interface comes up without an ipv6 fe80:: LL...
babel's ::1 33123 admin interface will show:

add interface enp2s0 up false

And poll fairly regularly until it gets one, and then do its other
magic. It doesn't care if there is ipv4 on it, or not, it does not go
"up" until it gets fe80::.

After getting that...

4: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
    inet6 fe80::6f0:21ff:fe1f:36e2/64 scope link
    inet 172.26.16.220/24 brd 172.26.16.255 scope global enp4s0

The admin interface will show babel in an "up" state, with these
addresses attached.

add interface enp4s0 up true ipv6 fe80::6f0:21ff:fe1f:36e2 ipv4 172.26.130.1

Fully flush that interface

ip -6 address flush dev enp4s0

(A correct line (or daemon) would append "scope global" here)

and this flushes all the ipv6 addresses including the fe80 link layer
address. (and: the only way I've found to get it back was to down/up
the interface or add manually)

This leaves babel in a state that looked like this:

add interface enp4s0 up true ipv4 172.26.16.220

And polling somewhat heavily, and confused about what ipv4s to advertise.

---
 interface.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/interface.c b/interface.c
index 11b4f6a..e33f521 100644
--- a/interface.c
+++ b/interface.c
@@ -237,6 +237,15 @@ check_link_local_addresses(struct interface *ifp)
             ifp->numll = 0;
             ifp->ll = NULL;
         }
+       /* If we have a ipv4 address, flush that too to confuse babel less */
+        if(ifp->ipv4) {
+            debugf("Lost ipv6 link local must wipe ipv4 also for %s.\n",
+                   ifp->name);
+            flush_interface_routes(ifp, 0);
+            free(ifp->ipv4);
+            ifp->ipv4 = NULL;
+        }
+        ifp->flags &= ~IF_UP;
         local_notify_interface(ifp, LOCAL_CHANGE);
         /* Most probably DAD hasn't finished yet.  Reschedule us
            real soon. */
--
2.7.4


-- 
Dave Täht
Let's go make home routers and wifi faster! With better software!
http://blog.cerowrt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Flush-ipv4-addresses-and-routes-when-ipv6-link-layer.patch
Type: text/x-patch
Size: 2463 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/babel-users/attachments/20170202/51b3f463/attachment.bin>


More information about the Babel-users mailing list