ndp: don't scan netlink attributes in case of netlink route event
authorHans Dedecker <dedeckeh@gmail.com>
Sat, 21 Jan 2017 14:40:13 +0000 (15:40 +0100)
committerHans Dedecker <dedeckeh@gmail.com>
Sat, 21 Jan 2017 14:47:20 +0000 (15:47 +0100)
In case a netlink route event is received for a default route
netlink data attributes were faulty processed as neigbor netlink
data. Fix this by not processing any netlink attribute for
any route event.

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
src/ndp.c

index 95eb18fce5a57e78474352435f9b03e6646e75d9..f9e04051c73c3018c3b9197a51e2ab2148f88b3c 100644 (file)
--- a/src/ndp.c
+++ b/src/ndp.c
@@ -358,11 +358,13 @@ static void handle_rtnetlink(_unused void *addr, void *data, size_t len,
                                || ndm->ndm_family != AF_INET6)
                        continue;
 
-               // Inform about a change in default route
-               if (is_route && rtm->rtm_dst_len == 0)
-                       raise(SIGUSR1);
-               else if (is_route)
+               if (is_route) {
+                       // Inform about a change in default route
+                       if (rtm->rtm_dst_len == 0)
+                               raise(SIGUSR1);
+
                        continue;
+               }
 
                // Data to retrieve
                size_t rta_offset = (is_addr) ? sizeof(struct ifaddrmsg) : sizeof(*ndm);