[Bug 102502] [netgraph] [patch] ifconfig name does't rename netgraph node in network.subr
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 20 Nov 2022 17:37:00 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=102502
Aleksandr Fedorov <afedorov@FreeBSD.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |afedorov@FreeBSD.org
--- Comment #7 from Aleksandr Fedorov <afedorov@FreeBSD.org> ---
I think thi bug should be closed.
root@xenon:/home/XeNoN # ifconfig tap create
tap0
root@xenon:/home/XeNoN # ngctl ls
There are 5 total nodes:
Name: ngeth0 Type: eiface ID: 00000002 Num hooks: 1
Name: ngeth1 Type: eiface ID: 00000004 Num hooks: 1
Name: re0 Type: ether ID: 00000006 Num hooks: 0
Name: tap0 Type: ether ID: 0000000a Num hooks: 0
Name: ngctl44711 Type: socket ID: 0000000b Num hooks: 0
root@xenon:/home/XeNoN # ifconfig tap0 name renamed0
renamed0
root@xenon:/home/XeNoN # ngctl ls
There are 5 total nodes:
Name: ngeth0 Type: eiface ID: 00000002 Num hooks: 1
Name: ngeth1 Type: eiface ID: 00000004 Num hooks: 1
Name: re0 Type: ether ID: 00000006 Num hooks: 0
Name: renamed0 Type: ether ID: 0000000a Num hooks: 0
Name: ngctl44841 Type: socket ID: 0000000c Num hooks: 0
root@xenon:/home/XeNoN #
ng_ether:
*
* Interface arrival notification handler.
* The notification is produced in two cases:
* o a new interface arrives
* o an existing interface got renamed
* Currently the first case is handled by ng_ether_attach via special
* hook ng_ether_attach_p.
*/
static void
ng_ether_ifnet_arrival_event(void *arg __unused, struct ifnet *ifp)
{
char name[IFNAMSIZ];
node_p node;
/* Only ethernet interfaces are of interest. */
if (ifp->if_type != IFT_ETHER &&
ifp->if_type != IFT_L2VLAN &&
ifp->if_type != IFT_BRIDGE)
return;
/*
* Just return if it's a new interface without an ng_ether companion.
*/
node = IFP2NG(ifp);
if (node == NULL)
return;
/* Try to give the node the same name as the new interface name */
ng_ether_sanitize_ifname(ifp->if_xname, name);
if (ng_name_node(node, name) != 0)
log(LOG_WARNING, "%s: can't re-name node %s\n", __func__,
name);
}
--
You are receiving this mail because:
You are the assignee for the bug.