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

Function in_pcbbind_check_bindmulti

freebsd/netinet/in_pcb.c:969–988  ·  view source on GitHub ↗

* Check if a new BINDMULTI socket is allowed to be created. * * ni points to the new inp. * oi points to the exisitng inp. * * This checks whether the existing inp also has BINDMULTI and * whether the credentials match. */

Source from the content-addressed store, hash-verified

967 * whether the credentials match.
968 */
969int
970in_pcbbind_check_bindmulti(const struct inpcb *ni, const struct inpcb *oi)
971{
972 /* Check permissions match */
973 if ((ni->inp_flags2 & INP_BINDMULTI) &&
974 (ni->inp_cred->cr_uid !=
975 oi->inp_cred->cr_uid))
976 return (0);
977
978 /* Check the existing inp has BINDMULTI set */
979 if ((ni->inp_flags2 & INP_BINDMULTI) &&
980 ((oi->inp_flags2 & INP_BINDMULTI) == 0))
981 return (0);
982
983 /*
984 * We're okay - either INP_BINDMULTI isn't set on ni, or
985 * it is and it matches the checks.
986 */
987 return (1);
988}
989
990#ifdef INET
991/*

Callers 2

in_pcbbind_setupFunction · 0.85
in6_pcbbindFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected