| 848 | } |
| 849 | |
| 850 | static struct in6_nbrinfo * |
| 851 | getnbrinfo(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 | |
| 873 | static char * |
| 874 | ether_str(struct sockaddr_dl *sdl) |