Subject: bin/30694: ifconfig(8) brings the interface up when assigning an IP, even when "down" is also specified
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <krille@users.sf.net>
List: netbsd-bugs
Date: 07/08/2005 12:27:00
>Number:         30694
>Category:       bin
>Synopsis:       ifconfig(8) brings the interface up when assigning an IP, even when "down" is also specified
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 08 12:27:00 +0000 2005
>Originator:     Christian Hattemer
>Release:        3.0_BETA
>Organization:
>Environment:
NetBSD lahksa 3.0_BETA NetBSD 3.0_BETA (SPARC-TEST) #0: Wed Jun 15 16:21:50 CEST 2005
>Description:
Sometimes you want to configure an interface completly including assigning an IP, but keep it down. E. g. prepare a pppoe interface to go up on demand later.

But it will always go up when assigning the IP and ignore the "down" parameter.

It turns out that ifconfig pretends to work as expected in 2.0. However it archives that by setting the interface down again after it has come up. Since this isn't the correct way this code was removed again shortly after 2.0 was branched.

See Rev. 1.142 of src/sbin/ifconfig/ifconfig.c for that.


PS: I'm going on vacation for two weeks this afternoon.
>How-To-Repeat:
# ifconfig le0
le0: flags=8862<BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        address: 00:40:dc:01:04:d6
        media: Ethernet autoselect
# ifconfig le0 192.168.5.5 down
# ifconfig le0
le0: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        address: 00:40:dc:01:04:d6
        media: Ethernet autoselect (10baseT)
        status: active
        inet 192.168.5.5 netmask 0xffffff00 broadcast 192.168.5.255

>Fix:
As that log message of the above mentioned revision states:
"If we don't want the kernel to automatically bring up interfaces, then we should move that code into ifconfig(8) and out of the kernel, not cycle the interface up and down."