| 167 | } |
| 168 | |
| 169 | void |
| 170 | nd6_status(int s) |
| 171 | { |
| 172 | struct in6_ndireq nd; |
| 173 | int s6; |
| 174 | int error; |
| 175 | int isdefif; |
| 176 | |
| 177 | memset(&nd, 0, sizeof(nd)); |
| 178 | strlcpy(nd.ifname, ifr.ifr_name, sizeof(nd.ifname)); |
| 179 | if ((s6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { |
| 180 | if (errno != EAFNOSUPPORT && errno != EPROTONOSUPPORT) |
| 181 | warn("socket(AF_INET6, SOCK_DGRAM)"); |
| 182 | return; |
| 183 | } |
| 184 | |
| 185 | #ifndef FSTACK |
| 186 | error = ioctl(s6, SIOCGIFINFO_IN6, &nd); |
| 187 | #else |
| 188 | error = ioctl_va(s, SIOCGIFINFO_IN6, (caddr_t)&nd, 1, AF_INET6); |
| 189 | #endif |
| 190 | if (error) { |
| 191 | if (errno != EPFNOSUPPORT) |
| 192 | warn("ioctl(SIOCGIFINFO_IN6)"); |
| 193 | close(s6); |
| 194 | return; |
| 195 | } |
| 196 | isdefif = isnd6defif(s6); |
| 197 | close(s6); |
| 198 | if (nd.ndi.flags == 0 && !isdefif) |
| 199 | return; |
| 200 | printb("\tnd6 options", |
| 201 | (unsigned int)(nd.ndi.flags | (isdefif << 15)), ND6BITS); |
| 202 | putchar('\n'); |
| 203 | } |