Bug 105925 - problems with ifconfig(8) and vlan(4) [regression]
Summary: problems with ifconfig(8) and vlan(4) [regression]
Status: Closed Overcome By Events
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 7.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: Eugene Grosbein
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-27 22:50 UTC by Yar Tikhiy
Modified: 2017-12-01 19:07 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yar Tikhiy 2006-11-27 22:50:13 UTC
	After the introduction of SIOCSIFCREATE2 and respective changes
	to ifconfig(8), some valid ifconfig command lines started to fail.

How-To-Repeat: 
Checked out ifconfig dated just before the change: 2006.07.09.00.00.00.
Compiled it all right.
Using it:

	dg# ./ifconfig vlan77 create vlan 77 vlandev xl0 up
	dg# ./ifconfig vlan77
	vlan77: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
		ether 00:50:04:9d:be:f1
		media: Ethernet autoselect (100baseTX <full-duplex>)
		status: active
		vlan: 77 parent interface: xl0
	dg# ./ifconfig vlan77 destroy

	dg# ./ifconfig vlan77 create vlan 77 vlandev xl0 mtu 1006 up
	dg# ./ifconfig vlan77
	vlan77: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1006
		ether 00:50:04:9d:be:f1
		media: Ethernet autoselect (100baseTX <full-duplex>)
		status: active
		vlan: 77 parent interface: xl0
	dg# ./ifconfig vlan77 destroy

All OK...

Now using the stock ifconfig:

	dg# ifconfig vlan77 create vlan 77 vlandev xl0 up
	ifconfig: ioctl (SIOCGIFFLAGS): no such interface

	dg# ifconfig vlan77 create vlan 77 vlandev xl0 mtu 1006 up
	ifconfig: ioctl (set mtu): Device not configured
	ifconfig: ioctl (SIOCGIFFLAGS): no such interface

	dg# ifconfig vlan77
	ifconfig: interface vlan77 does not exist

Total failure, the interface wasn't created at all.
Comment 1 Yar Tikhiy 2006-11-27 23:23:15 UTC
In addition, it can be proved that the bug is caused or triggered
by the SIOCSIFCREATE2 change and not another change: cvs update of
ifconfig to time right after the change results in the buggy behaviour
described in this PR.

-- 
Yar
Comment 2 Bruce M Simpson 2007-02-10 20:14:47 UTC
Any progress on this change?

P.S. For the GNATS record it is spelt SIOCIFCREATE2

BMS
Comment 3 Yar Tikhiy 2007-06-02 16:43:42 UTC
It appears that this problem is not limited to vlan(4), any cloned
interface can suffer from it.  The cause of the problem hides in
rev. 1.2 of sbin/ifconfig/ifclone.c.  Due to that change, interface
creation is handled now by a callback, which is invoked after all
parameters were processed.  E.g., if one writes "ifconfig lo5 create
mtu 1500 up", ifconfig will try to set the mtu and flags from the
main command loop and fail before the create callback has a chance
to bring the interface into existence.

A possible workaround for vlan(4) is to avoid such parameters as
"mtu" or "up" in "ifconfig vlanX create ...".  The "vlan" and
"vlandev" parameters are processed from a callback, too, so they
don't fail.  I.e., the following command will work:

ifconfig vlan55 create 10.55.55.1/24 vlan 55 vlandev em0

Note that you don't need an explicit "up" as long as an IP address
is assigned to the interface -- the IP layer will bring it up anyway.

-- 
Yar
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2008-05-05 02:10:38 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-net

Over to maintainer(s).
Comment 5 Fernando Apesteguía freebsd_committer freebsd_triage 2017-12-01 18:39:38 UTC
This ancient PR seems to be fixed now:

fernape@beastie:~/test$ sudo ifconfig vlan77 create vlan 77 vlandev re0 up
Password:
fernape@beastie:~/test$ ifconfig vlan77
vlan77: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80001<RXCSUM,LINKSTATE>
        ether 00:1e:8c:b5:fc:3b
        inet6 fe80::21e:8cff:feb5:fc3b%vlan77 prefixlen 64 scopeid 0x5 
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        vlan: 77 vlanpcp: 0 parent interface: re0
        groups: vlan 
fernape@beastie:~/test$ uname -a
FreeBSD beastie 11.1-RELEASE-p4 FreeBSD 11.1-RELEASE-p4 #0: Tue Nov 14 06:12:40 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
Comment 6 Eugene Grosbein freebsd_committer freebsd_triage 2017-12-01 19:07:47 UTC
Fixed long time ago.