NetBSD Problem Report #43292

From www@NetBSD.org  Wed May 12 07:37:51 2010
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id B34CC63BA59
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 12 May 2010 07:37:51 +0000 (UTC)
Message-Id: <20100512073751.45B2163B8FE@www.NetBSD.org>
Date: Wed, 12 May 2010 07:37:51 +0000 (UTC)
From: sogabe@iij.ad.jp
Reply-To: sogabe@iij.ad.jp
To: gnats-bugs@NetBSD.org
Subject: Issue with assigning overlapping networks
X-Send-Pr-Version: www-1.0

>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

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.