| 111 | } |
| 112 | |
| 113 | void |
| 114 | setnd6defif(const char *dummyaddr __unused, |
| 115 | int d, int s, |
| 116 | const struct afswtch *afp) |
| 117 | { |
| 118 | struct in6_ndifreq ndifreq; |
| 119 | int ifindex; |
| 120 | int error; |
| 121 | |
| 122 | memset(&ndifreq, 0, sizeof(ndifreq)); |
| 123 | strlcpy(ndifreq.ifname, ifr.ifr_name, sizeof(ndifreq.ifname)); |
| 124 | |
| 125 | if (d < 0) { |
| 126 | if (isnd6defif(s)) { |
| 127 | /* ifindex = 0 means to remove default if */ |
| 128 | ifindex = 0; |
| 129 | } else |
| 130 | return; |
| 131 | } else if ((ifindex = if_nametoindex(ndifreq.ifname)) == 0) { |
| 132 | warn("if_nametoindex(%s)", ndifreq.ifname); |
| 133 | return; |
| 134 | } |
| 135 | |
| 136 | ndifreq.ifindex = ifindex; |
| 137 | #ifndef FSTACK |
| 138 | error = ioctl(s, SIOCSDEFIFACE_IN6, (caddr_t)&ndifreq); |
| 139 | #else |
| 140 | error = ioctl_va(s, SIOCSDEFIFACE_IN6, (caddr_t)&ndifreq, 1, AF_INET6); |
| 141 | #endif |
| 142 | if (error) |
| 143 | warn("ioctl(SIOCSDEFIFACE_IN6)"); |
| 144 | } |
| 145 | |
| 146 | static int |
| 147 | isnd6defif(int s) |
nothing calls this directly
no test coverage detected