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

Function rip_connect

freebsd/netinet/raw_ip.c:1026–1051  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1024}
1025
1026static int
1027rip_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
1028{
1029 struct sockaddr_in *addr = (struct sockaddr_in *)nam;
1030 struct inpcb *inp;
1031
1032 if (nam->sa_len != sizeof(*addr))
1033 return (EINVAL);
1034 if (CK_STAILQ_EMPTY(&V_ifnet))
1035 return (EADDRNOTAVAIL);
1036 if (addr->sin_family != AF_INET && addr->sin_family != AF_IMPLINK)
1037 return (EAFNOSUPPORT);
1038
1039 inp = sotoinpcb(so);
1040 KASSERT(inp != NULL, ("rip_connect: inp == NULL"));
1041
1042 INP_INFO_WLOCK(&V_ripcbinfo);
1043 INP_WLOCK(inp);
1044 rip_delhash(inp);
1045 inp->inp_faddr = addr->sin_addr;
1046 rip_inshash(inp);
1047 soisconnected(so);
1048 INP_WUNLOCK(inp);
1049 INP_INFO_WUNLOCK(&V_ripcbinfo);
1050 return (0);
1051}
1052
1053static int
1054rip_shutdown(struct socket *so)

Callers

nothing calls this directly

Calls 3

rip_delhashFunction · 0.85
rip_inshashFunction · 0.85
soisconnectedFunction · 0.85

Tested by

no test coverage detected