diff options
author | 2016-09-02 13:53:44 +0000 | |
---|---|---|
committer | 2016-09-02 13:53:44 +0000 | |
commit | 55c24ba0b79c58eeac66677759c128a1b1426a01 (patch) | |
tree | a21404332d33412d3b7160bda9711174cd1b2027 | |
parent | use imsg_read_nofd() implementation from bgpd. (diff) | |
download | wireguard-openbsd-55c24ba0b79c58eeac66677759c128a1b1426a01.tar.xz wireguard-openbsd-55c24ba0b79c58eeac66677759c128a1b1426a01.zip |
in6_selectroute should never get a valid struct route * filled with something
else than AF_INET6.
Ok florian@
-rw-r--r-- | sys/netinet6/in6_src.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index 1e47e75f636..36fb922c638 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_src.c,v 1.79 2016/08/04 20:46:24 vgross Exp $ */ +/* $OpenBSD: in6_src.c,v 1.80 2016/09/02 13:53:44 vgross Exp $ */ /* $KAME: in6_src.c,v 1.36 2001/02/06 04:08:17 itojun Exp $ */ /* @@ -302,13 +302,13 @@ in6_selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, /* * Use a cached route if it exists and is valid, else try to allocate - * a new one. Note that we should check the address family of the - * cached destination, in case of sharing the cache with IPv4. + * a new one. */ if (ro) { + if (rtisvalid(ro->ro_rt)) + KASSERT(sin6tosa(&ro->ro_dst)->sa_family == AF_INET6); if (!rtisvalid(ro->ro_rt) || - sin6tosa(&ro->ro_dst)->sa_family != AF_INET6 || - !IN6_ARE_ADDR_EQUAL(&ro->ro_dst.sin6_addr, dst)) { + !IN6_ARE_ADDR_EQUAL(&ro->ro_dst.sin6_addr, dst)) { rtfree(ro->ro_rt); ro->ro_rt = NULL; } |