diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2019-08-31 13:46:15 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2019-08-31 13:46:15 +0000 |
commit | 5570f58b2c83bdae25a6971746eb7e6bc669f58c (patch) | |
tree | 1a1dd34a999a016a311358ba2c340ce6a0d8579f /sbin/route/route.c | |
parent | c11d303f41f15a1a25dbf1ffcbebf91b86ef9556 (diff) |
The algorithm creating the routing addresses in route(8) and arp(6)
were still not correct. While the values written to the kernel are
fine, the bytes for padding were taken from memory after the sockaddr
structs.
In route(8) the union of sockaddrs can be made larger, so that the
padding is taken from there.
In arp(8) the size of the struct is known. Copy only the struct
and advance over the padding. The memory has been zeroed before.
Merge all address size fixes from arp(8) into ndp(8).
OK claudio@
Diffstat (limited to 'sbin/route/route.c')
-rw-r--r-- | sbin/route/route.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c index 1ee0b197a3f..787244d2cbf 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.232 2019/08/29 22:42:16 bluhm Exp $ */ +/* $OpenBSD: route.c,v 1.233 2019/08/31 13:46:14 bluhm Exp $ */ /* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */ /* @@ -484,7 +484,7 @@ newroute(int argc, char **argv) break; case K_SA: af = PF_ROUTE; - aflen = sizeof(union sockunion); + aflen = sizeof(struct sockaddr_storage) - 1; break; case K_MPLS: af = AF_MPLS; @@ -908,7 +908,7 @@ getaddr(int which, int af, char *s, struct hostent **hpp) case AF_MPLS: errx(1, "mpls labels require -in or -out switch"); case PF_ROUTE: - su->sa.sa_len = sizeof(*su); + su->sa.sa_len = sizeof(struct sockaddr_storage) - 1; sockaddr(s, &su->sa); return (1); |