Subject: kern/4441: disabled sin_family check in in_pcbbind
To: None <gnats-bugs@gnats.netbsd.org>
From: Luke Mewburn <lukem@karybdis.cs.rmit.edu.au>
List: netbsd-bugs
Date: 11/07/1997 00:31:06
>Number:         4441
>Category:       kern
>Synopsis:       disabled sin_family check in in_pcbbind
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   lm
>Arrival-Date:   Thu Nov  6 05:35:03 1997
>Last-Modified:
>Originator:     Luke Mewburn
>Organization:
NetBSD code grunts
>Release:        NetBSD-971026
>Environment:
System: NetBSD karybdis 1.3A NetBSD 1.3A (LUKEM) #3: Sun Oct 26 01:13:48 EST 1997 lukem@karybdis:/z/src/current/src/sys/arch/i386/compile/LUKEM i386

>Description:
	Steven's "TCP/IP Illustrated, Volume 2", page 730, notes that
	in_pcbbind() has the check which determines if sin_family == AF_INET
	commented out, but the same check in in_pcbconnect() is still
	active.

	either both functions should perform the check, or neither;
	there shouldn't be any inconsistency.

	my feeling is that the check should be reenabled in in_pcbbind.

>How-To-Repeat:
	by inspect of the source code.

>Fix:
	apply this patch

Index: in_pcb.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/in_pcb.c,v
retrieving revision 1.39
diff -c -r1.39 in_pcb.c
***************
*** 136,149 ****
  	sin = mtod(nam, struct sockaddr_in *);
  	if (nam->m_len != sizeof (*sin))
  		return (EINVAL);
- #ifdef notdef
- 	/*
- 	 * We should check the family, but old programs
- 	 * incorrectly fail to initialize it.
- 	 */
  	if (sin->sin_family != AF_INET)
  		return (EAFNOSUPPORT);
- #endif
  	lport = sin->sin_port;
  	if (IN_MULTICAST(sin->sin_addr.s_addr)) {
  		/*
--- 136,143 ----
>Audit-Trail:
>Unformatted: