]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: fix routing socket AF_LINK handling on NETMASK
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Thu, 17 Jan 2019 22:46:11 +0000 (20:46 -0200)
committerRafael Zalamena <rzalamena@opensourcerouting.org>
Mon, 21 Jan 2019 12:24:37 +0000 (10:24 -0200)
IPv6 netmasks use AF_LINK family type and puts the correct amount of
set bits in the data structure. If we only copy the SDL header we
won't get all IPv6 address length, we must copy the whole extension of
the `sockaddr_in6` struct (which is provided in `destlen` parameter).

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
zebra/kernel_socket.c

index 84b06e579f91c661a09aee2ab30560a8b8e53073..6a20ab8d1faaa85f9ccd7a1f5a54f45c21088e03 100644 (file)
@@ -273,7 +273,7 @@ size_t _rta_get(caddr_t sap, void *destp, size_t destlen, bool checkaf)
                if (sa->sa_family == AF_LINK) {
                        sdl = (struct sockaddr_dl *)sa;
                        if (sdl->sdl_index == 0 || sdl->sdl_nlen == 0)
-                               copylen = sizeof(*sdl) - sizeof(sdl->sdl_data);
+                               copylen = destlen;
                }
 
                if (copylen > destlen) {