| 315 | }; |
| 316 | |
| 317 | static int |
| 318 | send_modevent(module_t mod, int type, void *unused) |
| 319 | { |
| 320 | #ifdef __notyet__ |
| 321 | VNET_ITERATOR_DECL(vnet_iter); |
| 322 | #endif |
| 323 | int error; |
| 324 | |
| 325 | switch (type) { |
| 326 | case MOD_LOAD: |
| 327 | SEND_LOCK_INIT(); |
| 328 | |
| 329 | error = pf_proto_register(PF_INET6, &send_protosw); |
| 330 | if (error != 0) { |
| 331 | printf("%s:%d: MOD_LOAD pf_proto_register(): %d\n", |
| 332 | __func__, __LINE__, error); |
| 333 | SEND_LOCK_DESTROY(); |
| 334 | break; |
| 335 | } |
| 336 | send_sendso_input_hook = send_input; |
| 337 | break; |
| 338 | case MOD_UNLOAD: |
| 339 | /* Do not allow unloading w/o locking. */ |
| 340 | return (EBUSY); |
| 341 | #ifdef __notyet__ |
| 342 | VNET_LIST_RLOCK_NOSLEEP(); |
| 343 | SEND_LOCK(); |
| 344 | VNET_FOREACH(vnet_iter) { |
| 345 | CURVNET_SET(vnet_iter); |
| 346 | if (V_send_so != NULL) { |
| 347 | CURVNET_RESTORE(); |
| 348 | SEND_UNLOCK(); |
| 349 | VNET_LIST_RUNLOCK_NOSLEEP(); |
| 350 | return (EBUSY); |
| 351 | } |
| 352 | CURVNET_RESTORE(); |
| 353 | } |
| 354 | SEND_UNLOCK(); |
| 355 | VNET_LIST_RUNLOCK_NOSLEEP(); |
| 356 | error = pf_proto_unregister(PF_INET6, IPPROTO_SEND, SOCK_RAW); |
| 357 | if (error == 0) |
| 358 | SEND_LOCK_DESTROY(); |
| 359 | send_sendso_input_hook = NULL; |
| 360 | break; |
| 361 | #endif |
| 362 | default: |
| 363 | error = 0; |
| 364 | break; |
| 365 | } |
| 366 | |
| 367 | return (error); |
| 368 | } |
| 369 | |
| 370 | static moduledata_t sendmod = { |
| 371 | "send", |
nothing calls this directly
no test coverage detected