diff options
| author | itojun <itojun@NetBSD.org> | 2001-04-11 04:57:53 +0000 |
|---|---|---|
| committer | itojun <itojun@NetBSD.org> | 2001-04-11 04:57:53 +0000 |
| commit | f4e4c674a75b211ee031f709cb8f581308611db6 (patch) | |
| tree | b8168895dcf9b43eb213577d5321bdfa589b1aae /sys | |
| parent | 8dc1d7cbacf79f2831f526fb2d55a6e077f863a2 (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
Diffstat (limited to 'sys')
| -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 fd8c2692743..66fca23723e 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1,4 +1,4 @@ -/* $NetBSD: ip6_output.c,v 1.34 2001/03/30 11:08:57 itojun Exp $ */ +/* $NetBSD: ip6_output.c,v 1.35 2001/04/11 04:57:53 itojun Exp $ */ /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ /* @@ -2010,10 +2010,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)); @@ -2028,6 +2030,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 |
