diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-11-28 14:14:40 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-11-28 14:14:40 +0000 |
commit | 13e8370e951b0f98f53aaec1eb7f2ca1ab17a106 (patch) | |
tree | 2bf98e129fc34bcb56290a8a9feb14d52e9d0919 /sys/netinet6/nd6.c | |
parent | 1a439092a5c231540051a3ffb68dcf3fbceec96d (diff) |
Explicitly initialize rti_ifa when automagically adding a route.
This will allow to strengthen checks when userland adds a route.
ok phessler@, bluhm@
Diffstat (limited to 'sys/netinet6/nd6.c')
-rw-r--r-- | sys/netinet6/nd6.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 960ef56cda7..707ca3c5894 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.c,v 1.196 2016/11/28 13:59:51 mpi Exp $ */ +/* $OpenBSD: nd6.c,v 1.197 2016/11/28 14:14:39 mpi Exp $ */ /* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */ /* @@ -583,6 +583,7 @@ nd6_lookup(struct in6_addr *addr6, int create, struct ifnet *ifp, if (rt == NULL) { if (create && ifp) { struct rt_addrinfo info; + struct ifaddr *ifa; int error; /* @@ -592,8 +593,7 @@ nd6_lookup(struct in6_addr *addr6, int create, struct ifnet *ifp, * This hack is necessary for a neighbor which can't * be covered by our own prefix. */ - struct ifaddr *ifa = - ifaof_ifpforaddr(sin6tosa(&sin6), ifp); + ifa = ifaof_ifpforaddr(sin6tosa(&sin6), ifp); if (ifa == NULL) return (NULL); @@ -604,6 +604,7 @@ nd6_lookup(struct in6_addr *addr6, int create, struct ifnet *ifp, * called in rtrequest. */ bzero(&info, sizeof(info)); + info.rti_ifa = ifa; info.rti_flags = RTF_HOST | RTF_LLINFO; info.rti_info[RTAX_DST] = sin6tosa(&sin6); info.rti_info[RTAX_GATEWAY] = sdltosa(ifp->if_sadl); |