| 394 | } |
| 395 | |
| 396 | static void |
| 397 | gre_delete_tunnel(struct gre_softc *sc) |
| 398 | { |
| 399 | struct gre_socket *gs; |
| 400 | |
| 401 | sx_assert(&gre_ioctl_sx, SA_XLOCKED); |
| 402 | if (sc->gre_family != 0) { |
| 403 | CK_LIST_REMOVE(sc, chain); |
| 404 | CK_LIST_REMOVE(sc, srchash); |
| 405 | GRE_WAIT(); |
| 406 | free(sc->gre_hdr, M_GRE); |
| 407 | sc->gre_family = 0; |
| 408 | } |
| 409 | /* |
| 410 | * If this Tunnel was the last one that could use UDP socket, |
| 411 | * we should unlink socket from hash table and close it. |
| 412 | */ |
| 413 | if ((gs = sc->gre_so) != NULL && CK_LIST_EMPTY(&gs->list)) { |
| 414 | CK_LIST_REMOVE(gs, chain); |
| 415 | soclose(gs->so); |
| 416 | NET_EPOCH_CALL(gre_sofree, &gs->epoch_ctx); |
| 417 | sc->gre_so = NULL; |
| 418 | } |
| 419 | GRE2IFP(sc)->if_drv_flags &= ~IFF_DRV_RUNNING; |
| 420 | if_link_state_change(GRE2IFP(sc), LINK_STATE_DOWN); |
| 421 | } |
| 422 | |
| 423 | struct gre_list * |
| 424 | gre_hashinit(void) |
no test coverage detected