MCPcopy Create free account
hub / github.com/F-Stack/f-stack / getnbrinfo

Function getnbrinfo

tools/ndp/ndp.c:850–871  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

848}
849
850static struct in6_nbrinfo *
851getnbrinfo(struct in6_addr *addr, int ifindex, int warning)
852{
853 static struct in6_nbrinfo nbi;
854 int sock;
855
856 if ((sock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
857 err(1, "socket");
858
859 bzero(&nbi, sizeof(nbi));
860 if_indextoname(ifindex, nbi.ifname);
861 nbi.addr = *addr;
862 if (ioctl(sock, SIOCGNBRINFO_IN6, (caddr_t)&nbi) < 0) {
863 if (warning)
864 warn("ioctl(SIOCGNBRINFO_IN6)");
865 close(sock);
866 return(NULL);
867 }
868
869 close(sock);
870 return(&nbi);
871}
872
873static char *
874ether_str(struct sockaddr_dl *sdl)

Callers 1

plistFunction · 0.85

Calls 5

bzeroFunction · 0.85
if_indextonameFunction · 0.85
socketClass · 0.50
ioctlFunction · 0.50
closeFunction · 0.50

Tested by

no test coverage detected