On 2026-11-18, Heinrich Rebehn <[email protected]> wrote:
> Hello all,
>
> I experienced some strangeness setting the description on an interface:
>
> root@gateway [~] # ifconfig tap0 create
>================
> root@gateway [~] # ifconfig tap0 inet 1.2.3.4
>================
> root@gateway [~] # ifconfig tap0
> tap0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
> lladdr fe:e1:ba:d2:33:56
> index 9 priority 0 llprio 3
> groups: tap
> status: no carrier
> inet 1.2.3.4 netmask 0xff000000 broadcast 1.255.255.255
>================
> root@gateway [~] # ifconfig tap0 description iPhone 14
>================
> root@gateway [~] #  ================
> root@gateway [~] # ifconfig tap0
> tap0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
> lladdr fe:e1:ba:d2:33:56
> description: iPhone
> index 9 priority 0 llprio 3
> groups: tap
> status: no carrier
> inet 0.0.0.14 netmask 0xff000000 broadcast 0.255.255.255
>================
>
> Note that the last command changed the net address from 1.2.3.4 to 0.0.0.14
> Of course, I should have put iPhone 14 in quotes. But anyway, the address 
> change should not have happened.
> According to “man ifconfig”:
>
> SYNOPSIS
>      ifconfig [-AaC] [-M lladdr] [interface] [address_family]
>               [address [dest_address]] [parameters]
>
> The command string after the interface definition is “description iPhone 14”. 
> Obviously, the 14 has been interpreted as an inet address, hence -> 0.0.0.14. 
> But then “iPhone” would need to be the address family, given the order of 
> parameters defined by the man page. But it has been taken as “description” 
> and shown in the ifconfig output above. Or, to put it otherwise, no address 
> specification should be accepted after “description”.

Address family and address are optional.

"description iPhone 14" is parsed as parameters and as expected, because
there are no quotes, it is just using the first word of the intended
description "iPhone" and going on to parse 14 as whatever (had it been
a keyword it would have picked that up instead).

Changing it so that addresses cannot be configured after other parameters
is extremely likely to break networking on many installed systems.

It might be reasonable to reject bare numbers as addresses, a similar
change was made for connecting to / pinging addresses (things like
"ping 0" or "telnet 0x7f000001 22" used to be accepted and aren't
any more), again this may break things, though much less likely...



> This may seem a bit of nitpicking and I am not sure if this a bug, a 
> documentation bug or a misunderstanding on my side.
>
> Anyway, since altering the address of an interface might well render your 
> system unreachable, I figured this issue worth noting.
>
> OpenBSD 7.9, running under FreeBSD bhyve.
>
>
> Kind regards,
>
>       Heinrich
>
>
>


-- 
Please keep replies on the mailing list.

Reply via email to