Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/netinet6 Pull up revision 1.35 (requested by itojun):



details:   https://anonhg.NetBSD.org/src/rev/b826521c371a
branches:  netbsd-1-5
changeset: 491305:b826521c371a
user:      he <he%NetBSD.org@localhost>
date:      Sun Apr 22 18:11:17 2001 +0000

description:
Pull up revision 1.35 (requested by itojun):
  Disallow addresses that are not supposed to be put into IPv6
  source, on IPV6_PKTINFO setsockopt.

diffstat:

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

diffs (35 lines):

diff -r 419c353722ac -r b826521c371a sys/netinet6/ip6_output.c
--- a/sys/netinet6/ip6_output.c Sun Apr 22 18:09:24 2001 +0000
+++ b/sys/netinet6/ip6_output.c Sun Apr 22 18:11:17 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip6_output.c,v 1.23.2.4 2001/04/06 00:28:02 he Exp $   */
+/*     $NetBSD: ip6_output.c,v 1.23.2.5 2001/04/22 18:11:17 he Exp $   */
 /*     $KAME: ip6_output.c,v 1.109 2000/05/31 05:03:09 jinmei Exp $    */
 
 /*
@@ -1997,10 +1997,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));
@@ -2015,6 +2017,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