| 326 | } |
| 327 | |
| 328 | int |
| 329 | ip6proto_unregister(short ip6proto) |
| 330 | { |
| 331 | struct protosw *pr; |
| 332 | |
| 333 | /* Sanity checks. */ |
| 334 | if (ip6proto <= 0 || ip6proto >= IPPROTO_MAX) |
| 335 | return (EPROTONOSUPPORT); |
| 336 | |
| 337 | /* Check if the protocol was indeed registered. */ |
| 338 | pr = pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW); |
| 339 | if (pr == NULL) |
| 340 | return (EPFNOSUPPORT); |
| 341 | if (ip6_protox[ip6proto] == pr - inet6sw) /* IPPROTO_RAW */ |
| 342 | return (ENOENT); |
| 343 | |
| 344 | /* Reset the protocol slot to IPPROTO_RAW. */ |
| 345 | ip6_protox[ip6proto] = pr - inet6sw; |
| 346 | return (0); |
| 347 | } |
| 348 | |
| 349 | #ifdef VIMAGE |
| 350 | static void |
no test coverage detected