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

Function udp_disconnect

freebsd/netinet/udp_usrreq.c:1711–1734  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1709}
1710
1711static int
1712udp_disconnect(struct socket *so)
1713{
1714 struct inpcb *inp;
1715 struct inpcbinfo *pcbinfo;
1716
1717 pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol);
1718 inp = sotoinpcb(so);
1719 KASSERT(inp != NULL, ("udp_disconnect: inp == NULL"));
1720 INP_WLOCK(inp);
1721 if (inp->inp_faddr.s_addr == INADDR_ANY) {
1722 INP_WUNLOCK(inp);
1723 return (ENOTCONN);
1724 }
1725 INP_HASH_WLOCK(pcbinfo);
1726 in_pcbdisconnect(inp);
1727 inp->inp_laddr.s_addr = INADDR_ANY;
1728 INP_HASH_WUNLOCK(pcbinfo);
1729 SOCK_LOCK(so);
1730 so->so_state &= ~SS_ISCONNECTED; /* XXX */
1731 SOCK_UNLOCK(so);
1732 INP_WUNLOCK(inp);
1733 return (0);
1734}
1735
1736static int
1737udp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr,

Callers

nothing calls this directly

Calls 2

in_pcbdisconnectFunction · 0.85
udp_get_inpcbinfoFunction · 0.70

Tested by

no test coverage detected