MCPcopy Create free account
hub / github.com/F-Stack/f-stack / prison_check_ip4

Function prison_check_ip4

freebsd/netinet/in_jail.c:406–431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

404}
405
406int
407prison_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}

Callers 15

sctp_choose_boundallFunction · 0.70
sctp_local_addr_countFunction · 0.70
sctp_setoptFunction · 0.70
in_pcbladdrFunction · 0.70
in_pcbconnect_setupFunction · 0.70
in_pcblookup_groupFunction · 0.70

Calls 3

prison_check_ip4_lockedFunction · 0.85
mtx_lockFunction · 0.50
mtx_unlockFunction · 0.50

Tested by

no test coverage detected