From: Rafael Zalamena Date: Thu, 17 Jan 2019 22:46:11 +0000 (-0200) Subject: zebra: fix routing socket AF_LINK handling on NETMASK X-Git-Tag: frr-7.0~27^2~5 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=691e903879bcf88c872d74f6317784bd2187f3ca;p=mirror%2Ffrr.git zebra: fix routing socket AF_LINK handling on NETMASK 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 --- diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index 84b06e579f..6a20ab8d1f 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -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) {