Bug 225362 - error creating VLAN
Summary: error creating VLAN
Status: Closed Works As Intended
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 11.1-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-net (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-21 18:55 UTC by Slawomir Wojciech Wojtczak
Modified: 2018-05-24 13:02 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Slawomir Wojciech Wojtczak 2018-01-21 18:55:37 UTC
Look at this command:

# ifconfig em0.4 create vlan 2 vlandev em0 inet 10.0.0.1/24

Theoretically it should create interface 'em0.4' with VLAN '2', but it creates interface 'em0.4' with VLAN '4'.

# ifconfig em0.4
em0.4: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=103<RXCSUM,TXCSUM,TSO4>
        ether xx:xx:xx:xx:xx:xx
        inet 10.0.0.1 netmask 0xffffff00 broadcast 10.0.0.255 
        inet6 fe80::f2de:f1ff:febd:51ae%em0.4 prefixlen 64 scopeid 0x6 
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: no carrier
        vlan: 4 vlanpcp: 0 parent interface: em0
        groups: vlan 

Is that a bug?

Regards.
Comment 1 Allan Jude freebsd_committer freebsd_triage 2018-05-24 12:43:52 UTC
This is not a bug. The vlan id is taken from the device name (em0.4), it is a shortcut so you don't have to specify the vlan and vlandev parameters.
Comment 2 Slawomir Wojciech Wojtczak 2018-05-24 12:48:30 UTC
Shouldn't this be explained in man pages or FreeBSD Handbook?
Comment 3 amvandemore 2018-05-24 12:49:15 UTC
How is that not a bug?  vlan 2 was explicit.  It is at least a POLA issue.
Comment 4 Rodney W. Grimes freebsd_committer freebsd_triage 2018-05-24 13:02:44 UTC
(In reply to Allan Jude from comment #1)
One could argue that the normal unix situation of the later on the command line overrides the former that this -is- a bug, as vlan 2 was specified after vlan 4.

One could also argue that ifconfig could of spit out an error of "ambigous vlan id specified".

Either way this is poorly documented.