[Bug 235920] ifconfig: unable to create another interface after renaming the previous one with the same name
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Thu Feb 21 17:18:10 UTC 2019
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=235920
Bug ID: 235920
Summary: ifconfig: unable to create another interface after
renaming the previous one with the same name
Product: Base System
Version: CURRENT
Hardware: Any
OS: Any
Status: New
Severity: Affects Many People
Priority: ---
Component: kern
Assignee: bugs at FreeBSD.org
Reporter: olevole at olevole.ru
Tested on: 12.0-RELEASE, 13-CURRENT (r344398)
When I try to create an interface (via ifconfig), then rename it (via ifconfig
name) and create another one with the same name, this causes an error. E.g:
1) Create and rename interface:
ifconfig tap100 create name xxx
or:
ifconfig tap100 create && ifconfig tap100 name xxx
2) check that the interface original interface is missing now:
ifconfig tap100
ifconfig: interface tap100 does not exist
3) great! we can create another one:
ifconfig tap100 create
ifconfig: SIOCIFCREATE2: File exists
As far as I can see, the problem is in the UNR(9) area (alloc_unr_specific)
The path to the error that I see:
a)
src/sbin/ifconfig/ifconfig.c:
setifname() ->
...
if (ioctl(s, SIOCSIFNAME, (caddr_t)&ifr) < 0) {
free(newname);
err(1, "ioctl SIOCSIFNAME (set name)");
}
...
b)
src/sys/net/if.c:
ifioctl() ->
...
case SIOCIFCREATE:
case SIOCIFCREATE2:
error = priv_check(td, PRIV_NET_IFCREATE);
if (error == 0)
error = if_clone_create(ifr->ifr_name,
sizeof(ifr->ifr_name), cmd == SIOCIFCREATE2 ?
ifr_data_get_ptr(ifr) : NULL);
goto out_noref;
...
c)
src/sys/net/if_clone.c:
if_clone_create() ->
..
return (if_clone_createif(ifc, name, len, params));
..
d)
src/sys/net/if_clone.c:
if_clone_createif() ->
..
err = ifc_simple_create(ifc, name, len, params);
..
e)
src/sys/net/if_clone.c:
ifc_simple_create() ->
..
err = ifc_alloc_unit(ifc, &unit);
..
f)
src/sys/net/if_clone.c:
ifc_alloc_unit() ->
..
if (alloc_unr_specific(ifc->ifc_unrhdr, *unit) == -1) {
return (EEXIST);
}
..
If we create an interface for the first time, this function ends with:
IF_CLONE_ADDREF(ifc);
When we create an interface a second time, we get:
return (EEXIST);
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list