diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2001-04-11 04:49:24 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2001-04-11 04:49:24 +0000 |
commit | d5899701b128b2697fa4ef936fd3c9e1a3bd5920 (patch) | |
tree | 573fe909bda86a325ef8052d9f7d5967d128466b | |
parent | 9969fe02a6be0ebee3194139edf86d23b6bd6773 (diff) |
disallow userland programs from specifying addresses with IPV6_PKTINFO
setsockopt, if:
- the address is not verified by DAD (= not ready)
- the address is an anycast address (= not permitted as source)
sync with kame
-rw-r--r-- | sys/netinet6/ip6_output.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index e1fe3342f2a..26b3cd730ea 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_output.c,v 1.30 2001/03/30 11:09:02 itojun Exp $ */ +/* $OpenBSD: ip6_output.c,v 1.31 2001/04/11 04:49:23 itojun Exp $ */ /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ /* @@ -2151,10 +2151,12 @@ ip6_setpktoptions(control, opt, priv) /* * Check if the requested source address is indeed a - * unicast address assigned to the node. + * unicast address assigned to the node, and can be + * used as the packet's source address. */ if (!IN6_IS_ADDR_UNSPECIFIED(&opt->ip6po_pktinfo->ipi6_addr)) { struct ifaddr *ia; + struct in6_ifaddr *ia6; struct sockaddr_in6 sin6; bzero(&sin6, sizeof(sin6)); @@ -2169,6 +2171,11 @@ ip6_setpktoptions(control, opt, priv) opt->ip6po_pktinfo->ipi6_ifindex))) { return(EADDRNOTAVAIL); } + ia6 = (struct in6_ifaddr *)ia; + if ((ia6->ia6_flags & (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY)) != 0) { + return(EADDRNOTAVAIL); + } + /* * Check if the requested source address is * indeed a unicast address assigned to the |