summaryrefslogtreecommitdiff
path: root/zebra/kernel_socket.c
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@opensourcerouting.org>2019-01-17 20:46:11 -0200
committerRafael Zalamena <rzalamena@opensourcerouting.org>2019-01-22 09:33:38 -0200
commite0f741f46607399736ea0e8e87a4a34923a6dd0b (patch)
tree61068ad05f0ea182e96eb27b1efe0936f722b4b2 /zebra/kernel_socket.c
parentb04f70c1b87dd2f11a7c07e18b3cabb68a8628ce (diff)
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 <rzalamena@opensourcerouting.org> (cherry picked from commit 691e903879bcf88c872d74f6317784bd2187f3ca)
Diffstat (limited to 'zebra/kernel_socket.c')
-rw-r--r--zebra/kernel_socket.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c
index f290d456d6..48db481515 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -274,7 +274,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) {