Subject: bin/10911: ifconfig requires address to set netmask, broadcast
To: None <gnats-bugs@gnats.netbsd.org>
From: John Hawkinson <jhawk@mit.edu>
List: netbsd-bugs
Date: 08/29/2000 18:09:21
>Number:         10911
>Category:       bin
>Synopsis:       ifconfig requires address to set netmask, broadcast
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 29 18:10:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     John Hawkinson
>Release:        -current of 28 Aug 2000
>Organization:
MIT
>Environment:
	
System: NetBSD zorkmid.mit.edu 1.5E NetBSD 1.5E (ZORKMID-$Revision: 1.2 $) #54: Fri Aug 18 01:53:49 EDT 2000 jhawk@zorkmid.mit.edu:/usr/local/netbsd-current/src/sys/arch/i386/compile/ZORKMID i386


>Description:
	ifconfig(8) requires the IP address of an interface to be
specified (or changed) in order to set the netmask or broadcast
address. If unspecified, it silently fails.

>How-To-Repeat:
	
zorkmid# ifconfig wi0
wi0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        nwid "NetBSD IBSS"
        media: IEEE802.11 autoselect
        status: active
        inet 1.2.3.4 netmask 0xff000000 broadcast 1.255.255.255
        inet6 fe80::260:1dff:fe1e:73c9%wi0 prefixlen 64 scopeid 0x15
zorkmid# ifconfig wi0 netmask 0xffff0000
zorkmid# ifconfig wi0
wi0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        nwid "NetBSD IBSS"
        media: IEEE802.11 autoselect
        status: active
        inet 1.2.3.4 netmask 0xff000000 broadcast 1.255.255.255
        inet6 fe80::260:1dff:fe1e:73c9%wi0 prefixlen 64 scopeid 0x15
zorkmid# ifconfig wi0 1.2.3.4 netmask 0xffff0000
zorkmid# ifconfig wi0
wi0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        nwid "NetBSD IBSS"
        media: IEEE802.11 autoselect
        status: active
        inet 1.2.3.4 netmask 0xffff0000 broadcast 1.2.255.255
        inet6 fe80::260:1dff:fe1e:73c9%wi0 prefixlen 64 scopeid 0x15

>Fix:
	Workaround: always respecifiy the IP address when configuring the netmask.


	Fix: ifconfig is a festering pile of ooze. This bug appears to have been
	present back in 4.4lite, and probably some time previous. It apalls me that
	no one seems to have noticed, though.

	Unfortunately, the non-deprecated for changing interface characteristics,
	SIOCAIFADDR requires the caller to specify the IP address to change the
	mask of, so ifconfig needs to SIOCGIFCONF the interface, in this case where
	no IP address is specified. Perhaps it should do so in all cases...
>Release-Note:
>Audit-Trail:
>Unformatted: