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=235920 --- 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 = socket(AF_INET, SOCK_DGRAM, 0); if(sk < 0) { perror("socket"); return 0; } ifc.ifc_len = sizeof(data); ifc.ifc_buf = (caddr_t)data; if(ioctl(sk, SIOCGIFCONF, &ifc) < 0) { perror("ioctl(SIOCGIFCONF)"); return 0; } ifr = (struct ifreq*)data; for(int i=0;i<ifc.ifc_len;) { length=IFNAMSIZ + ifr->ifr_addr.sa_len; idx=if_nametoindex(ifr->ifr_name); printf("Found: %s [index: %d]\n", ifr->ifr_name,idx); ifr=(struct ifr*)((char*)ifr+length); i+=length; } 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 -- 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>
