Date: Thu, 21 Feb 2019 17:22:21 +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-X5KNi5uOUM@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-235920-227@https.bugs.freebsd.org/bugzilla/> References: <bug-235920-227@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D235920 --- Comment #1 from olevole@olevole.ru --- We can test that the interface is actually renamed via ioctl() via: #include <stdio.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <net/if.h> #include <sys/ioctl.h> ------- int list_devices() { char data[4096]; struct ifconf ifc; struct ifreq *ifr; int sk,length; unsigned int idx; sk =3D socket(AF_INET, SOCK_DGRAM, 0); if(sk < 0) { perror("socket"); return 0; } ifc.ifc_len =3D sizeof(data); ifc.ifc_buf =3D (caddr_t)data; if(ioctl(sk, SIOCGIFCONF, &ifc) < 0) { perror("ioctl(SIOCGIFCONF)"); return 0; } ifr =3D (struct ifreq*)data; for(int i=3D0;i<ifc.ifc_len;) { length=3DIFNAMSIZ + ifr->ifr_addr.sa_len; idx=3Dif_nametoindex(ifr->ifr_name); printf("Found: %s [index: %d]\n", ifr->ifr_name,idx); ifr=3D(struct ifr*)((char*)ifr+length); i+=3Dlength; } return 0; } ---------- ifr->ifr_name is changing, but the index is the same (and this is normal?). However, some information remains from the old interface, and this affects http://man.freebsd.org/alloc_unr_specific/9 --=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-X5KNi5uOUM>