Source-Changes-HG archive

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

[src/trunk]: src/sys Disallow input to detached addresses because they are no...



details:   https://anonhg.NetBSD.org/src/rev/0e9d725cd19e
branches:  trunk
changeset: 347631:0e9d725cd19e
user:      roy <roy%NetBSD.org@localhost>
date:      Wed Sep 07 15:41:44 2016 +0000

description:
Disallow input to detached addresses because they are not yet valid.

diffstat:

 sys/netinet/ip_input.c   |  9 +++++----
 sys/netinet6/ip6_input.c |  6 +++---
 2 files changed, 8 insertions(+), 7 deletions(-)

diffs (64 lines):

diff -r 4be6600e1f0e -r 0e9d725cd19e sys/netinet/ip_input.c
--- a/sys/netinet/ip_input.c    Wed Sep 07 14:41:33 2016 +0000
+++ b/sys/netinet/ip_input.c    Wed Sep 07 15:41:44 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_input.c,v 1.340 2016/08/31 09:14:47 ozaki-r Exp $   */
+/*     $NetBSD: ip_input.c,v 1.341 2016/09/07 15:41:44 roy Exp $       */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.340 2016/08/31 09:14:47 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.341 2016/09/07 15:41:44 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -382,7 +382,8 @@
                                continue;
                        if (checkif && ia->ia_ifp != ifp)
                                continue;
-                       if ((ia->ia_ifp->if_flags & IFF_UP) != 0)
+                       if ((ia->ia_ifp->if_flags & IFF_UP) != 0 &&
+                           (ia->ia4_flags & IN_IFF_DETACHED) == 0)
                                break;
                        else
                                (*downmatch)++;
@@ -402,7 +403,7 @@
                if (ifa->ifa_addr->sa_family != AF_INET)
                        continue;
                ia = ifatoia(ifa);
-               if (ia->ia4_flags & IN_IFF_NOTREADY)
+               if (ia->ia4_flags & (IN_IFF_NOTREADY | IN_IFF_DETACHED))
                        continue;
                if (in_hosteq(ip->ip_dst, ia->ia_broadaddr.sin_addr) ||
                    in_hosteq(ip->ip_dst, ia->ia_netbroadcast) ||
diff -r 4be6600e1f0e -r 0e9d725cd19e sys/netinet6/ip6_input.c
--- a/sys/netinet6/ip6_input.c  Wed Sep 07 14:41:33 2016 +0000
+++ b/sys/netinet6/ip6_input.c  Wed Sep 07 15:41:44 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip6_input.c,v 1.167 2016/08/31 09:14:47 ozaki-r Exp $  */
+/*     $NetBSD: ip6_input.c,v 1.168 2016/09/07 15:41:44 roy Exp $      */
 /*     $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $     */
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.167 2016/08/31 09:14:47 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.168 2016/09/07 15:41:44 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_gateway.h"
@@ -504,7 +504,7 @@
                 * packets to a tentative, duplicated, or somehow invalid
                 * address must not be accepted.
                 */
-               if (!(ia6->ia6_flags & IN6_IFF_NOTREADY)) {
+               if (!(ia6->ia6_flags & (IN6_IFF_NOTREADY | IN6_IFF_DETACHED))) {
                        /* this address is ready */
                        ours = 1;
                        deliverifp = ia6->ia_ifp;       /* correct? */



Home | Main Index | Thread Index | Old Index