Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet6 disallow userland programs from specifying addr...



details:   https://anonhg.NetBSD.org/src/rev/9af26a977856
branches:  trunk
changeset: 508400:9af26a977856
user:      itojun <itojun%NetBSD.org@localhost>
date:      Wed Apr 11 04:57:53 2001 +0000

description:
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:

 sys/netinet6/ip6_output.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r f15ec59bc2a3 -r 9af26a977856 sys/netinet6/ip6_output.c
--- a/sys/netinet6/ip6_output.c Wed Apr 11 03:55:16 2001 +0000
+++ b/sys/netinet6/ip6_output.c Wed Apr 11 04:57:53 2001 +0000
@@ -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 @@
 
                        /*
                         * 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 @@
                                      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



Home | Main Index | Thread Index | Old Index