Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jun 1995 10:50:01 -0700
From:      peter@haywire.dialix.com
To:        freebsd-bugs
Subject:   kern/555: net/if.c can possibly choose incorrect net i/face.
Message-ID:  <199506231750.KAA18879@freefall.cdrom.com>
In-Reply-To: Your message of Sat, 24 Jun 1995 01:42:16 %2B0800 <199506231742.BAA00998@jhome.DIALix.COM>

next in thread | previous in thread | raw e-mail | index | archive | help

>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:





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199506231750.KAA18879>