Bug 37486

Summary: Bug in network stack in sending broadcast packets
Product: Base System Reporter: Dave Duchscher <daved>
Component: kernAssignee: Bruce M Simpson <bms>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.5-STABLE   
Hardware: Any   
OS: Any   

Description Dave Duchscher 2002-04-26 15:37:45 UTC
>Number:         37486
>Category:       kern
>Synopsis:       Bug in network stack in sending broadcast packets
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          analyzed
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 26 07:40:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     David J Duchscher
>Release:        FreeBSD 4.5-STABLE i386
>Organization:
Texas A&M University
>Environment:
System: FreeBSD wolf.tamu.edu 4.5-STABLE FreeBSD 4.5-STABLE #3: Thu Apr 18 16:15:06 CDT 2002 root@wolf.tamu.edu:/usr/obj/usr/src/sys/CUSTOM i386

>Description:

	Found that after using ifconfig to reconfigure the interface,
	all ones broadcast (255.255.255.255) can be sent.  Before
	being reconfigured, the all ones broadcasts would be converted
	to a subnet broadcast which I believe is the desired behavior.

>How-To-Repeat:

	Just reconfigure the interface and you will be able to send
	all ones broadcast packets.  You do not have to change the
	configuration of the interface, just issuing an ifconfig with
	the same settings will work.  The steps I took on
	reconfiguring the interface where:

	  ifconfig fxp0 inet 10.1.4.1 broadcast 255.255.255.0
	  add route default 10.1.4.1

	I used the following perl code to send the broadcast packets:

	  use IO::Socket;

	  $sock = new IO::Socket::INET ( LocalPort => 10000,
		                         Proto     => 'udp');
          $sock->sockopt(SO_BROADCAST, 1);
	  $dest = sockaddr_in(10000, inet_aton("255.255.255.255"));
	  $sock->send("weeee", undef, $dest);

	Used tcpdump to on same machine and another machine to
	confirm.  I have not found a way return to the behavior of
	sending out subnet broadcast packets besides the obvious
	reboot.

>Fix:

	
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Comment 1 Dave Duchscher 2002-04-26 15:40:01 UTC
	Found that after using ifconfig to reconfigure the interface,
	all ones broadcast (255.255.255.255) can be sent.  Before
	being reconfigured, the all ones broadcasts would be converted
	to a subnet broadcast which I believe is the desired behavior.

How-To-Repeat: 
	Just reconfigure the interface and you will be able to send
	all ones broadcast packets.  You do not have to change the
	configuration of the interface, just issuing an ifconfig with
	the same settings will work.  The steps I took on
	reconfiguring the interface where:

	  ifconfig fxp0 inet 10.1.4.1 broadcast 255.255.255.0
	  add route default 10.1.4.1

	I used the following perl code to send the broadcast packets:

	  use IO::Socket;

	  $sock = new IO::Socket::INET ( LocalPort => 10000,
		                         Proto     => 'udp');
          $sock->sockopt(SO_BROADCAST, 1);
	  $dest = sockaddr_in(10000, inet_aton("255.255.255.255"));
	  $sock->send("weeee", undef, $dest);

	Used tcpdump to on same machine and another machine to
	confirm.  I have not found a way return to the behavior of
	sending out subnet broadcast packets besides the obvious
	reboot.
Comment 2 Kris Kennaway freebsd_committer freebsd_triage 2003-07-14 12:20:31 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-net

Assign to net mailing list for evaluation
Comment 3 Wes Peters freebsd_committer freebsd_triage 2003-07-16 19:26:15 UTC
Responsible Changed
From-To: freebsd-net->wes

I'm working on all-call broadcasting code already, I'll fix this.
Comment 4 Wes Peters freebsd_committer freebsd_triage 2003-08-22 06:36:04 UTC
Responsible Changed
From-To: wes->bms

Bruce has already fixed this in -current and will soon MFC. 
Or at least something like it.
Comment 5 Bruce M Simpson freebsd_committer freebsd_triage 2003-09-03 03:46:16 UTC
State Changed
From-To: open->patched

I've committed a fix for the fix. -CURRENT's behaviour is correct in 
this regard. I am seeking permission from re@ to MFC this.
Comment 6 Bruce M Simpson freebsd_committer freebsd_triage 2003-09-09 20:10:42 UTC
State Changed
From-To: patched->closed

The fix has been approved by re@ today and MFC'd. Please use the new socket 
option to get the correct behaviour in your applications.