| 404 | } |
| 405 | |
| 406 | int |
| 407 | prison_check_ip4(const struct ucred *cred, const struct in_addr *ia) |
| 408 | { |
| 409 | struct prison *pr; |
| 410 | int error; |
| 411 | |
| 412 | KASSERT(cred != NULL, ("%s: cred is NULL", __func__)); |
| 413 | KASSERT(ia != NULL, ("%s: ia is NULL", __func__)); |
| 414 | |
| 415 | pr = cred->cr_prison; |
| 416 | if (!(pr->pr_flags & PR_IP4)) |
| 417 | return (0); |
| 418 | mtx_lock(&pr->pr_mtx); |
| 419 | if (!(pr->pr_flags & PR_IP4)) { |
| 420 | mtx_unlock(&pr->pr_mtx); |
| 421 | return (0); |
| 422 | } |
| 423 | if (pr->pr_ip4 == NULL) { |
| 424 | mtx_unlock(&pr->pr_mtx); |
| 425 | return (EAFNOSUPPORT); |
| 426 | } |
| 427 | |
| 428 | error = prison_check_ip4_locked(pr, ia); |
| 429 | mtx_unlock(&pr->pr_mtx); |
| 430 | return (error); |
| 431 | } |
no test coverage detected