From owner-freebsd-bugs Fri Jun 23 10:50:02 1995 Return-Path: bugs-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id KAA18887 for bugs-outgoing; Fri, 23 Jun 1995 10:50:02 -0700 Received: (from gnats@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id KAA18879 ; Fri, 23 Jun 1995 10:50:01 -0700 Date: Fri, 23 Jun 1995 10:50:01 -0700 Message-Id: <199506231750.KAA18879@freefall.cdrom.com> From: peter@haywire.dialix.com Reply-To: peter@haywire.dialix.com To: freebsd-bugs Subject: kern/555: net/if.c can possibly choose incorrect net i/face. In-Reply-To: Your message of Sat, 24 Jun 1995 01:42:16 +0800 <199506231742.BAA00998@jhome.DIALix.COM> Sender: bugs-owner@FreeBSD.org Precedence: bulk >Number: 555 >Category: kern >Synopsis: net/if.c can possibly choose incorrect net i/face. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs (FreeBSD bugs mailing list) >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jun 23 10:50:00 1995 >Originator: Peter Wemm >Organization: DIALix Services >Release: FreeBSD 2.0-BUILT-19950616 i386 >Environment: FreeBSD jhome.DIALix.COM 2.0-BUILT-19950616 FreeBSD 2.0-BUILT-19950616 #0: Fri Jun 16 22:36:04 WST 1995 pwroot@jhome.DIALix.COM:/usr/src/sys/compile/JHOME i386 >Description: Although the current code solves the original problem [a program that attempts to broadcast to the local ethernet was causing the wrong output interface to be selected, by mistakenly applying the netmask to the local address of a point-to-point link], it still isn't quite correct. This is possibly because of a typo in the patch that I sent in originally. Although the current code does not appear to break anything as it stands, this is not a guarantee that it wont ever. Hence the low priority. Additionally, the code does not examine interfaces that have no netmask set, even though the netmask is meant to be meaningless for P2P interfaces. >How-To-Repeat: read the source >Fix: *** if.c.dist Fri Jun 16 15:12:44 1995 --- if.c Fri Jun 16 15:16:08 1995 *************** *** 238,247 **** register char *cp, *cp2, *cp3; ! if (ifa->ifa_addr->sa_family != af || ifa->ifa_netmask == 0) next: continue; if (ifp->if_flags & IFF_POINTOPOINT) { ! if (equal(addr, ifa->ifa_addr)) return (ifa); } else { cp = addr_data; cp2 = ifa->ifa_addr->sa_data; --- 238,249 ---- register char *cp, *cp2, *cp3; ! if (ifa->ifa_addr->sa_family != af) next: continue; if (ifp->if_flags & IFF_POINTOPOINT) { ! if (equal(addr, ifa->ifa_dstaddr)) return (ifa); } else { + if (ifa->ifa_netmask == 0) + continue; cp = addr_data; cp2 = ifa->ifa_addr->sa_data; >Audit-Trail: >Unformatted: