Date: Thu, 21 Feb 2019 17:18:07 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 235920] ifconfig: unable to create another interface after renaming the previous one with the same name Message-ID: <bug-235920-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D235920 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@FreeBSD.org Reporter: olevole@olevole.ru Tested on: 12.0-RELEASE, 13-CURRENT (r344398) When I try to create an interface (via ifconfig), then rename it (via ifcon= fig name) and create another one with the same name, this causes an error. E.g: 1) Create and rename interface:=20 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() ->=20 ... 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 =3D priv_check(td, PRIV_NET_IFCREATE); if (error =3D=3D 0) error =3D if_clone_create(ifr->ifr_name, sizeof(ifr->ifr_name), cmd =3D=3D 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 =3D ifc_simple_create(ifc, name, len, params); .. e) src/sys/net/if_clone.c: ifc_simple_create() -> .. err =3D ifc_alloc_unit(ifc, &unit); .. f) src/sys/net/if_clone.c: ifc_alloc_unit() -> .. if (alloc_unr_specific(ifc->ifc_unrhdr, *unit) =3D=3D -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); --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-235920-227>