diff options
author | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2022-08-22 13:23:08 +0000 |
---|---|---|
committer | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2022-08-22 13:23:08 +0000 |
commit | f73a1785dbdf0e958fcb6cdb8dbc113e49d1cbdb (patch) | |
tree | 4b957eb6f507962db8bbb9927f8ebd5bd6d0b537 /sys | |
parent | dc64d5bf315a91c8d8bccd3a17f8a4c5b81f2b82 (diff) |
Move PRU_DISCONNECT request to (*pru_disconnect).
ok bluhm@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/uipc_usrreq.c | 16 | ||||
-rw-r--r-- | sys/net/pfkeyv2.c | 12 | ||||
-rw-r--r-- | sys/net/rtsock.c | 12 | ||||
-rw-r--r-- | sys/netinet/ip_divert.c | 3 | ||||
-rw-r--r-- | sys/netinet/ip_gre.c | 3 | ||||
-rw-r--r-- | sys/netinet/ip_var.h | 3 | ||||
-rw-r--r-- | sys/netinet/raw_ip.c | 27 | ||||
-rw-r--r-- | sys/netinet/tcp_usrreq.c | 58 | ||||
-rw-r--r-- | sys/netinet/tcp_var.h | 5 | ||||
-rw-r--r-- | sys/netinet/udp_usrreq.c | 61 | ||||
-rw-r--r-- | sys/netinet/udp_var.h | 3 | ||||
-rw-r--r-- | sys/netinet6/ip6_divert.c | 3 | ||||
-rw-r--r-- | sys/netinet6/ip6_var.h | 3 | ||||
-rw-r--r-- | sys/netinet6/raw_ip6.c | 27 | ||||
-rw-r--r-- | sys/sys/protosw.h | 8 | ||||
-rw-r--r-- | sys/sys/unpcb.h | 3 |
16 files changed, 159 insertions, 88 deletions
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index c927777482b..a2f827849a5 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_usrreq.c,v 1.172 2022/08/22 08:08:46 mvs Exp $ */ +/* $OpenBSD: uipc_usrreq.c,v 1.173 2022/08/22 13:23:06 mvs Exp $ */ /* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */ /* @@ -134,6 +134,7 @@ const struct pr_usrreqs uipc_usrreqs = { .pru_listen = uipc_listen, .pru_connect = uipc_connect, .pru_accept = uipc_accept, + .pru_disconnect = uipc_disconnect, }; void @@ -241,10 +242,6 @@ uipc_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, } break; - case PRU_DISCONNECT: - unp_disconnect(unp); - break; - case PRU_SHUTDOWN: socantsendmore(so); unp_shutdown(unp); @@ -559,6 +556,15 @@ uipc_accept(struct socket *so, struct mbuf *nam) } int +uipc_disconnect(struct socket *so) +{ + struct unpcb *unp = sotounpcb(so); + + unp_disconnect(unp); + return (0); +} + +int uipc_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, size_t newlen) { diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c index d0bef3e2227..193c6be10bc 100644 --- a/sys/net/pfkeyv2.c +++ b/sys/net/pfkeyv2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkeyv2.c,v 1.239 2022/08/22 08:08:46 mvs Exp $ */ +/* $OpenBSD: pfkeyv2.c,v 1.240 2022/08/22 13:23:06 mvs Exp $ */ /* * @(#)COPYRIGHT 1.1 (NRL) 17 January 1995 @@ -171,6 +171,7 @@ void pfkey_init(void); int pfkeyv2_attach(struct socket *, int); int pfkeyv2_detach(struct socket *); +int pfkeyv2_disconnect(struct socket *); int pfkeyv2_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *); int pfkeyv2_output(struct mbuf *, struct socket *, struct sockaddr *, @@ -203,6 +204,7 @@ const struct pr_usrreqs pfkeyv2_usrreqs = { .pru_usrreq = pfkeyv2_usrreq, .pru_attach = pfkeyv2_attach, .pru_detach = pfkeyv2_detach, + .pru_disconnect = pfkeyv2_disconnect, }; const struct protosw pfkeysw[] = { @@ -333,6 +335,13 @@ pfkeyv2_detach(struct socket *so) } int +pfkeyv2_disconnect(struct socket *so) +{ + soisdisconnected(so); + return (0); +} + +int pfkeyv2_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, struct mbuf *control, struct proc *p) { @@ -361,7 +370,6 @@ pfkeyv2_usrreq(struct socket *so, int req, struct mbuf *m, error = EOPNOTSUPP; break; - case PRU_DISCONNECT: case PRU_ABORT: soisdisconnected(so); break; diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 8350a4de16e..a9ad3b593a0 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.339 2022/08/22 08:08:46 mvs Exp $ */ +/* $OpenBSD: rtsock.c,v 1.340 2022/08/22 13:23:07 mvs Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -114,6 +114,7 @@ int route_output(struct mbuf *, struct socket *, struct sockaddr *, int route_ctloutput(int, struct socket *, int, int, struct mbuf *); int route_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *); +int route_disconnect(struct socket *); void route_input(struct mbuf *m0, struct socket *, sa_family_t); int route_arp_conflict(struct rtentry *, struct rt_addrinfo *); int route_cleargateway(struct rtentry *, void *, unsigned int); @@ -237,7 +238,6 @@ route_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, error = EOPNOTSUPP; break; - case PRU_DISCONNECT: case PRU_ABORT: soisdisconnected(so); break; @@ -363,6 +363,13 @@ route_detach(struct socket *so) } int +route_disconnect(struct socket *so) +{ + soisdisconnected(so); + return (0); +} + +int route_ctloutput(int op, struct socket *so, int level, int optname, struct mbuf *m) { @@ -2401,6 +2408,7 @@ const struct pr_usrreqs route_usrreqs = { .pru_usrreq = route_usrreq, .pru_attach = route_attach, .pru_detach = route_detach, + .pru_disconnect = route_disconnect, }; const struct protosw routesw[] = { diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 8eda87837c8..8447b4afbcc 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_divert.c,v 1.74 2022/08/22 08:08:46 mvs Exp $ */ +/* $OpenBSD: ip_divert.c,v 1.75 2022/08/22 13:23:07 mvs Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -292,7 +292,6 @@ divert_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr, break; case PRU_CONNECT2: - case PRU_DISCONNECT: case PRU_SENDOOB: case PRU_FASTTIMO: case PRU_SLOWTIMO: diff --git a/sys/netinet/ip_gre.c b/sys/netinet/ip_gre.c index 3b53a9a5366..597b702fb6f 100644 --- a/sys/netinet/ip_gre.c +++ b/sys/netinet/ip_gre.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_gre.c,v 1.77 2022/08/21 22:45:55 mvs Exp $ */ +/* $OpenBSD: ip_gre.c,v 1.78 2022/08/22 13:23:07 mvs Exp $ */ /* $NetBSD: ip_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */ /* @@ -67,6 +67,7 @@ const struct pr_usrreqs gre_usrreqs = { .pru_detach = rip_detach, .pru_bind = rip_bind, .pru_connect = rip_connect, + .pru_disconnect = rip_disconnect, }; int diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h index 823947db3ac..6ae3b26b796 100644 --- a/sys/netinet/ip_var.h +++ b/sys/netinet/ip_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_var.h,v 1.99 2022/08/21 22:45:55 mvs Exp $ */ +/* $OpenBSD: ip_var.h,v 1.100 2022/08/22 13:23:07 mvs Exp $ */ /* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */ /* @@ -262,6 +262,7 @@ int rip_attach(struct socket *, int); int rip_detach(struct socket *); int rip_bind(struct socket *so, struct mbuf *, struct proc *); int rip_connect(struct socket *, struct mbuf *); +int rip_disconnect(struct socket *); #ifdef MROUTING extern struct socket *ip_mrouter[]; /* multicast routing daemon */ #endif diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index b5368df1a5e..d6d0394612c 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_ip.c,v 1.135 2022/08/22 10:37:27 bluhm Exp $ */ +/* $OpenBSD: raw_ip.c,v 1.136 2022/08/22 13:23:07 mvs Exp $ */ /* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */ /* @@ -109,6 +109,7 @@ const struct pr_usrreqs rip_usrreqs = { .pru_detach = rip_detach, .pru_bind = rip_bind, .pru_connect = rip_connect, + .pru_disconnect = rip_disconnect, }; /* @@ -474,14 +475,6 @@ rip_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, switch (req) { - case PRU_DISCONNECT: - if ((so->so_state & SS_ISCONNECTED) == 0) { - error = ENOTCONN; - break; - } - soisdisconnected(so); - inp->inp_faddr.s_addr = INADDR_ANY; - break; case PRU_ABORT: soisdisconnected(so); if (inp == NULL) @@ -657,3 +650,19 @@ rip_connect(struct socket *so, struct mbuf *nam) return (0); } + +int +rip_disconnect(struct socket *so) +{ + struct inpcb *inp = sotoinpcb(so); + + soassertlocked(so); + + if ((so->so_state & SS_ISCONNECTED) == 0) + return (ENOTCONN); + + soisdisconnected(so); + inp->inp_faddr.s_addr = INADDR_ANY; + + return (0); +} diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 0834800503f..b1542ce376e 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_usrreq.c,v 1.192 2022/08/22 08:08:46 mvs Exp $ */ +/* $OpenBSD: tcp_usrreq.c,v 1.193 2022/08/22 13:23:07 mvs Exp $ */ /* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */ /* @@ -119,6 +119,7 @@ const struct pr_usrreqs tcp_usrreqs = { .pru_listen = tcp_listen, .pru_connect = tcp_connect, .pru_accept = tcp_accept, + .pru_disconnect = tcp_disconnect, }; static int pr_slowhz = PR_SLOWHZ; @@ -223,21 +224,6 @@ tcp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, break; /* - * Initiate disconnect from peer. - * If connection never passed embryonic stage, just drop; - * else if don't need to let data drain, then can just drop anyways, - * else have to begin TCP shutdown process: mark socket disconnecting, - * drain unread data, state switch to reflect user close, and - * send segment (e.g. FIN) to peer. Socket will be really disconnected - * when peer sends FIN and acks ours. - * - * SHOULD IMPLEMENT LATER PRU_CONNECT VIA REALLOC TCPCB. - */ - case PRU_DISCONNECT: - tp = tcp_disconnect(tp); - break; - - /* * Mark the connection as being incapable of further output. */ case PRU_SHUTDOWN: @@ -683,7 +669,7 @@ tcp_detach(struct socket *so) * which may finish later; embryonic TCB's can just * be discarded here. */ - tp = tcp_disconnect(tp); + tp = tcp_dodisconnect(tp); if (otp) tcp_trace(TA_USER, ostate, tp, otp, NULL, PRU_DETACH, 0); @@ -869,6 +855,42 @@ tcp_accept(struct socket *so, struct mbuf *nam) } /* + * Initiate disconnect from peer. + * If connection never passed embryonic stage, just drop; + * else if don't need to let data drain, then can just drop anyways, + * else have to begin TCP shutdown process: mark socket disconnecting, + * drain unread data, state switch to reflect user close, and + * send segment (e.g. FIN) to peer. Socket will be really disconnected + * when peer sends FIN and acks ours. + * + * SHOULD IMPLEMENT LATER PRU_CONNECT VIA REALLOC TCPCB. + */ +int +tcp_disconnect(struct socket *so) +{ + struct inpcb *inp; + struct tcpcb *tp, *otp = NULL; + int error; + short ostate; + + soassertlocked(so); + + if ((error = tcp_sogetpcb(so, &inp, &tp))) + return (error); + + if (so->so_options & SO_DEBUG) { + otp = tp; + ostate = tp->t_state; + } + + tp = tcp_dodisconnect(tp); + + if (otp) + tcp_trace(TA_USER, ostate, tp, otp, NULL, PRU_DISCONNECT, 0); + return (0); +} + +/* * Initiate (or continue) disconnect. * If embryonic state, just send reset (once). * If in ``let data drain'' option and linger null, just drop. @@ -877,7 +899,7 @@ tcp_accept(struct socket *so, struct mbuf *nam) * send segment to peer (with FIN). */ struct tcpcb * -tcp_disconnect(struct tcpcb *tp) +tcp_dodisconnect(struct tcpcb *tp) { struct socket *so = tp->t_inpcb->inp_socket; diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 56576270c5c..1184fb9be54 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_var.h,v 1.145 2022/08/22 08:08:46 mvs Exp $ */ +/* $OpenBSD: tcp_var.h,v 1.146 2022/08/22 13:23:07 mvs Exp $ */ /* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */ /* @@ -672,7 +672,7 @@ void tcp6_ctlinput(int, struct sockaddr *, u_int, void *); void tcp_ctlinput(int, struct sockaddr *, u_int, void *); int tcp_ctloutput(int, struct socket *, int, int, struct mbuf *); struct tcpcb * - tcp_disconnect(struct tcpcb *); + tcp_dodisconnect(struct tcpcb *); struct tcpcb * tcp_drop(struct tcpcb *, int); int tcp_dooptions(struct tcpcb *, u_char *, int, struct tcphdr *, @@ -718,6 +718,7 @@ int tcp_bind(struct socket *, struct mbuf *, struct proc *); int tcp_listen(struct socket *); int tcp_connect(struct socket *, struct mbuf *); int tcp_accept(struct socket *, struct mbuf *); +int tcp_disconnect(struct socket *); void tcp_xmit_timer(struct tcpcb *, int); void tcpdropoldhalfopen(struct tcpcb *, u_int16_t); void tcp_sack_option(struct tcpcb *,struct tcphdr *,u_char *,int); diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 5a0ade0fc76..317bb0a64c9 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udp_usrreq.c,v 1.287 2022/08/22 10:37:27 bluhm Exp $ */ +/* $OpenBSD: udp_usrreq.c,v 1.288 2022/08/22 13:23:07 mvs Exp $ */ /* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */ /* @@ -128,6 +128,7 @@ const struct pr_usrreqs udp_usrreqs = { .pru_detach = udp_detach, .pru_bind = udp_bind, .pru_connect = udp_connect, + .pru_disconnect = udp_disconnect, }; const struct sysctl_bounded_args udpctl_vars[] = { @@ -1084,33 +1085,6 @@ udp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr, error = EOPNOTSUPP; break; - case PRU_DISCONNECT: -#ifdef INET6 - if (inp->inp_flags & INP_IPV6) { - if (IN6_IS_ADDR_UNSPECIFIED(&inp->inp_faddr6)) { - error = ENOTCONN; - break; - } - } else -#endif /* INET6 */ - { - if (inp->inp_faddr.s_addr == INADDR_ANY) { - error = ENOTCONN; - break; - } - } - -#ifdef INET6 - if (inp->inp_flags & INP_IPV6) - inp->inp_laddr6 = in6addr_any; - else -#endif /* INET6 */ - inp->inp_laddr.s_addr = INADDR_ANY; - in_pcbdisconnect(inp); - - so->so_state &= ~SS_ISCONNECTED; /* XXX */ - break; - case PRU_SHUTDOWN: socantsendmore(so); break; @@ -1284,6 +1258,37 @@ udp_connect(struct socket *so, struct mbuf *addr) return (0); } +int +udp_disconnect(struct socket *so) +{ + struct inpcb *inp = sotoinpcb(so); + + soassertlocked(so); + +#ifdef INET6 + if (inp->inp_flags & INP_IPV6) { + if (IN6_IS_ADDR_UNSPECIFIED(&inp->inp_faddr6)) + return (ENOTCONN); + } else +#endif /* INET6 */ + { + if (inp->inp_faddr.s_addr == INADDR_ANY) + return (ENOTCONN); + } + +#ifdef INET6 + if (inp->inp_flags & INP_IPV6) + inp->inp_laddr6 = in6addr_any; + else +#endif /* INET6 */ + inp->inp_laddr.s_addr = INADDR_ANY; + + in_pcbdisconnect(inp); + so->so_state &= ~SS_ISCONNECTED; /* XXX */ + + return (0); +} + /* * Sysctl for udp variables. */ diff --git a/sys/netinet/udp_var.h b/sys/netinet/udp_var.h index 9098492c958..df3149a8698 100644 --- a/sys/netinet/udp_var.h +++ b/sys/netinet/udp_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: udp_var.h,v 1.40 2022/08/21 22:45:55 mvs Exp $ */ +/* $OpenBSD: udp_var.h,v 1.41 2022/08/22 13:23:07 mvs Exp $ */ /* $NetBSD: udp_var.h,v 1.12 1996/02/13 23:44:41 christos Exp $ */ /* @@ -145,5 +145,6 @@ int udp_attach(struct socket *, int); int udp_detach(struct socket *); int udp_bind(struct socket *, struct mbuf *, struct proc *); int udp_connect(struct socket *, struct mbuf *); +int udp_disconnect(struct socket *); #endif /* _KERNEL */ #endif /* _NETINET_UDP_VAR_H_ */ diff --git a/sys/netinet6/ip6_divert.c b/sys/netinet6/ip6_divert.c index 050894e1610..3526fd56912 100644 --- a/sys/netinet6/ip6_divert.c +++ b/sys/netinet6/ip6_divert.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_divert.c,v 1.73 2022/08/22 08:08:46 mvs Exp $ */ +/* $OpenBSD: ip6_divert.c,v 1.74 2022/08/22 13:23:07 mvs Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -298,7 +298,6 @@ divert6_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr, break; case PRU_CONNECT2: - case PRU_DISCONNECT: case PRU_SENDOOB: case PRU_FASTTIMO: case PRU_SLOWTIMO: diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h index d7bb0d4a2b5..f60742da02c 100644 --- a/sys/netinet6/ip6_var.h +++ b/sys/netinet6/ip6_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_var.h,v 1.97 2022/08/21 22:45:55 mvs Exp $ */ +/* $OpenBSD: ip6_var.h,v 1.98 2022/08/22 13:23:07 mvs Exp $ */ /* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */ /* @@ -357,6 +357,7 @@ int rip6_attach(struct socket *, int); int rip6_detach(struct socket *); int rip6_bind(struct socket *, struct mbuf *, struct proc *); int rip6_connect(struct socket *, struct mbuf *); +int rip6_disconnect(struct socket *); int rip6_sysctl(int *, u_int, void *, size_t *, void *, size_t); int dest6_input(struct mbuf **, int *, int, int); diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index 29af83ad5e4..23b6991baa4 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_ip6.c,v 1.155 2022/08/22 10:37:27 bluhm Exp $ */ +/* $OpenBSD: raw_ip6.c,v 1.156 2022/08/22 13:23:07 mvs Exp $ */ /* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */ /* @@ -111,6 +111,7 @@ const struct pr_usrreqs rip6_usrreqs = { .pru_detach = rip6_detach, .pru_bind = rip6_bind, .pru_connect = rip6_connect, + .pru_disconnect = rip6_disconnect, }; /* @@ -589,15 +590,6 @@ rip6_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, } switch (req) { - case PRU_DISCONNECT: - if ((so->so_state & SS_ISCONNECTED) == 0) { - error = ENOTCONN; - break; - } - in6p->inp_faddr6 = in6addr_any; - so->so_state &= ~SS_ISCONNECTED; /* XXX */ - break; - case PRU_ABORT: soisdisconnected(so); if (in6p == NULL) @@ -795,6 +787,21 @@ rip6_connect(struct socket *so, struct mbuf *nam) } int +rip6_disconnect(struct socket *so) +{ + struct inpcb *in6p = sotoinpcb(so); + + soassertlocked(so); + + if ((so->so_state & SS_ISCONNECTED) == 0) + return (ENOTCONN); + + in6p->inp_faddr6 = in6addr_any; + so->so_state &= ~SS_ISCONNECTED; /* XXX */ + return (0); +} + +int rip6_sysctl_rip6stat(void *oldp, size_t *oldplen, void *newp) { struct rip6stat rip6stat; diff --git a/sys/sys/protosw.h b/sys/sys/protosw.h index 549d489174a..5c9d50ad9e0 100644 --- a/sys/sys/protosw.h +++ b/sys/sys/protosw.h @@ -1,4 +1,4 @@ -/* $OpenBSD: protosw.h,v 1.41 2022/08/22 08:08:47 mvs Exp $ */ +/* $OpenBSD: protosw.h,v 1.42 2022/08/22 13:23:07 mvs Exp $ */ /* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */ /*- @@ -70,6 +70,7 @@ struct pr_usrreqs { int (*pru_listen)(struct socket *); int (*pru_connect)(struct socket *, struct mbuf *); int (*pru_accept)(struct socket *, struct mbuf *); + int (*pru_disconnect)(struct socket *); }; struct protosw { @@ -300,8 +301,9 @@ pru_accept(struct socket *so, struct mbuf *nam) static inline int pru_disconnect(struct socket *so) { - return (*so->so_proto->pr_usrreqs->pru_usrreq)(so, - PRU_DISCONNECT, NULL, NULL, NULL, curproc); + if (so->so_proto->pr_usrreqs->pru_disconnect) + return (*so->so_proto->pr_usrreqs->pru_disconnect)(so); + return (EOPNOTSUPP); } static inline int diff --git a/sys/sys/unpcb.h b/sys/sys/unpcb.h index c3196329546..3020786a7dc 100644 --- a/sys/sys/unpcb.h +++ b/sys/sys/unpcb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: unpcb.h,v 1.31 2022/08/22 08:08:47 mvs Exp $ */ +/* $OpenBSD: unpcb.h,v 1.32 2022/08/22 13:23:07 mvs Exp $ */ /* $NetBSD: unpcb.h,v 1.6 1994/06/29 06:46:08 cgd Exp $ */ /* @@ -117,6 +117,7 @@ int uipc_bind(struct socket *, struct mbuf *, struct proc *); int uipc_listen(struct socket *); int uipc_connect(struct socket *, struct mbuf *); int uipc_accept(struct socket *, struct mbuf *); +int uipc_disconnect(struct socket *); void unp_init(void); int unp_bind(struct unpcb *, struct mbuf *, struct proc *); |