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

Function rip_attach

freebsd/netinet/raw_ip.c:880–911  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

878}
879
880static int
881rip_attach(struct socket *so, int proto, struct thread *td)
882{
883 struct inpcb *inp;
884 int error;
885
886 inp = sotoinpcb(so);
887 KASSERT(inp == NULL, ("rip_attach: inp != NULL"));
888
889 error = priv_check(td, PRIV_NETINET_RAW);
890 if (error)
891 return (error);
892 if (proto >= IPPROTO_MAX || proto < 0)
893 return EPROTONOSUPPORT;
894 error = soreserve(so, rip_sendspace, rip_recvspace);
895 if (error)
896 return (error);
897 INP_INFO_WLOCK(&V_ripcbinfo);
898 error = in_pcballoc(so, &V_ripcbinfo);
899 if (error) {
900 INP_INFO_WUNLOCK(&V_ripcbinfo);
901 return (error);
902 }
903 inp = (struct inpcb *)so->so_pcb;
904 inp->inp_vflag |= INP_IPV4;
905 inp->inp_ip_p = proto;
906 inp->inp_ip_ttl = V_ip_defttl;
907 rip_inshash(inp);
908 INP_INFO_WUNLOCK(&V_ripcbinfo);
909 INP_WUNLOCK(inp);
910 return (0);
911}
912
913static void
914rip_detach(struct socket *so)

Callers

nothing calls this directly

Calls 4

soreserveFunction · 0.85
in_pcballocFunction · 0.85
rip_inshashFunction · 0.85
priv_checkFunction · 0.50

Tested by

no test coverage detected