summaryrefslogtreecommitdiff
path: root/sys/netinet/raw_ip.c
diff options
context:
space:
mode:
authorVitaliy Makkoveev <mvs@cvs.openbsd.org>2022-08-28 18:44:18 +0000
committerVitaliy Makkoveev <mvs@cvs.openbsd.org>2022-08-28 18:44:18 +0000
commit7cf93c0df658ac4ed0ffb76abe6741d99501477a (patch)
tree319723c6d59cbc6a272ce7fcf38655ff7048128e /sys/netinet/raw_ip.c
parent5edcdacdf523ba0d449de8e32b954c4a9aee8437 (diff)
Move PRU_ABORT request to (*pru_abort)().
We abort only the sockets which are linked to `so_q' or `so_q0' queues of listening socket. Such sockets have no corresponding file descriptor and are not accessed from userland, so PRU_ABORT used to destroy them on listening socket destruction. Currently all our sockets support PRU_ABORT request, but actually it required only for tcp(4) and unix(4) sockets, so i should be optional. However, they will be removed with separate diff, and this time PRU_ABORT requests were converted as is. Also, the socket should be destroyed on PRU_ABORT request, but route and key management sockets leave it alive. This was also converted as is, because this wrong code never called. ok bluhm@
Diffstat (limited to 'sys/netinet/raw_ip.c')
-rw-r--r--sys/netinet/raw_ip.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index 958c5dddbb2..14d8b23e06c 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip.c,v 1.139 2022/08/27 20:28:01 mvs Exp $ */
+/* $OpenBSD: raw_ip.c,v 1.140 2022/08/28 18:44:16 mvs Exp $ */
/* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */
/*
@@ -112,6 +112,7 @@ const struct pr_usrreqs rip_usrreqs = {
.pru_disconnect = rip_disconnect,
.pru_shutdown = rip_shutdown,
.pru_send = rip_send,
+ .pru_abort = rip_abort,
};
/*
@@ -477,17 +478,6 @@ rip_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
switch (req) {
- case PRU_ABORT:
- soisdisconnected(so);
- if (inp == NULL)
- panic("rip_abort");
-#ifdef MROUTING
- if (so == ip_mrouter[inp->inp_rtableid])
- ip_mrouter_done(so);
-#endif
- in_pcbdetach(inp);
- break;
-
case PRU_CONNECT2:
error = EOPNOTSUPP;
break;
@@ -685,3 +675,19 @@ out:
return (error);
}
+int
+rip_abort(struct socket *so)
+{
+ struct inpcb *inp = sotoinpcb(so);
+
+ soassertlocked(so);
+
+ soisdisconnected(so);
+#ifdef MROUTING
+ if (so == ip_mrouter[inp->inp_rtableid])
+ ip_mrouter_done(so);
+#endif
+ in_pcbdetach(inp);
+
+ return (0);
+}