[Bug 275586] Undocumented feature of ifconfig UP

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 07 Dec 2023 04:16:26 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=275586

            Bug ID: 275586
           Summary: Undocumented feature of ifconfig UP
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: standards
          Assignee: standards@FreeBSD.org
          Reporter: on@cs.ait.ac.th

I am not sure whether it is an undocumented feature or a bug but "ifconfig UP"
behaves differently from "ifconfig up". I cannot say for how long this
behaviour has been going on, I only recently discovered it, but it is affecting
any 13.2-p5 RELEASE system I have tested.

To reproduce the problem:

"ifconfig up" is working as documented/expected:

$ ifconfig tap0 create
$ ifconfig tap0 up
$ ifconfig tap0
tap0: flags=8803<UP,BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80000<LINKSTATE>
        ether 58:9c:fc:10:a4:65
        groups: tap
        media: Ethernet autoselect
        status: no carrier
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
$ arp -a | grep 192.41.170.42

While "ifconfig UP" is acting up:

Reboot the system, then...
$ ifconfig tap0 create
$ ifconfig tap0 UP
ifconfig: WARNING: setting interface address without mask is deprecated,
default mask may not be correct.
$ ifconfig tap0
tap0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80000<LINKSTATE>
        ether 58:9c:fc:10:a4:65
        inet 192.41.170.42 netmask 0xffffff00 broadcast 192.41.170.255
        groups: tap
        media: Ethernet autoselect
        status: no carrier
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
$ arp -a | grep 192.41.170.42
www.cs.ait.ac.th (192.41.170.42) at 58:9c:fc:10:a4:65 on tap0 permanent
[ethernet]

An IP address has been assigned to the tap0 interface (it happens to be the IP
of my web server, why?) even though the tap0 interface is not yet connected to
anything.

As a corollary, the machine may respond to ARP requests, giving a bogus MAC
address for the IP 192.41.170.42 and causing problems on my network.

Solution:

Always use "ifconfig up". But if it gives weird results and if not documented,
why keeping "ifconfig UP".

I have not tested it, but it seems there is also a problem with "ifconfig DOWN"
vs. "ifconfig down".

-- 
You are receiving this mail because:
You are the assignee for the bug.