NetBSD-Bugs archive

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

kern/43292: Issue with assigning overlapping networks



>Number:         43292
>Category:       kern
>Synopsis:       Issue with assigning overlapping networks
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 12 07:40:01 +0000 2010
>Originator:     Takashi Sogabe
>Release:        current
>Organization:
Internet Initiative Japan., Inc.
>Environment:
>Description:
In openbsd, following problem is fixed.

--------
sys/netinet/in.c:
revision 1.40
date: 2005/03/07 10:40:42;  author: claudio;  state: Exp;  lines: +9 -7
branches:  1.40.2;
Correctly compare routes in in_addprefix. If a netmask is supplied it needs
to be compared too -- 10/8 and 10/24 are not equal. This fixes a problem
with overlapping networks reported by Simon Slaytor.
OK henning@
--------

We hope the patch is applied in netbsd, too.

>How-To-Repeat:

>Fix:
Index: in.c
===================================================================
RCS file: /cvs/src/sys/netinet/in.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- in.c        15 Jan 2005 09:09:27 -0000      1.39
+++ in.c        7 Mar 2005 10:40:42 -0000       1.40
@@ -1,4 +1,4 @@
-/*     $OpenBSD: in.c,v 1.39 2005/01/15 09:09:27 pascoe Exp $  */
+/*     $OpenBSD: in.c,v 1.40 2005/03/07 10:40:42 claudio Exp $ */
 /*     $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */

 /*
@@ -778,16 +778,18 @@
                prefix.s_addr &= mask.s_addr;
        }

-       for (ia = in_ifaddr.tqh_first; ia; ia = ia->ia_list.tqe_next) {
-               if (rtinitflags(ia))
+       TAILQ_FOREACH(ia, &in_ifaddr, ia_list) {
+               if (rtinitflags(ia)) {
                        p = ia->ia_dstaddr.sin_addr;
-               else {
+                       if (prefix.s_addr != p.s_addr)
+                               continue;
+               } else {
                        p = ia->ia_addr.sin_addr;
                        p.s_addr &= ia->ia_sockmask.sin_addr.s_addr;
+                       if (prefix.s_addr != p.s_addr ||
+                           mask.s_addr != ia->ia_sockmask.sin_addr.s_addr)
+                               continue;
                }
-
-               if (prefix.s_addr != p.s_addr)
-                       continue;

                /*
                 * if we got a matching prefix route inserted by other



Home | Main Index | Thread Index | Old Index