-/* $OpenBSD: uipc_usrreq.c,v 1.173 2022/08/22 13:23:06 mvs Exp $ */
+/* $OpenBSD: uipc_usrreq.c,v 1.174 2022/08/22 21:18:48 mvs Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */
/*
.pru_connect = uipc_connect,
.pru_accept = uipc_accept,
.pru_disconnect = uipc_disconnect,
+ .pru_shutdown = uipc_shutdown,
};
void
}
break;
- case PRU_SHUTDOWN:
- socantsendmore(so);
- unp_shutdown(unp);
- break;
-
case PRU_RCVD:
switch (so->so_type) {
return (0);
}
+int
+uipc_shutdown(struct socket *so)
+{
+ struct unpcb *unp = sotounpcb(so);
+
+ socantsendmore(so);
+ unp_shutdown(unp);
+ return (0);
+}
+
int
uipc_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
size_t newlen)
-/* $OpenBSD: pfkeyv2.c,v 1.240 2022/08/22 13:23:06 mvs Exp $ */
+/* $OpenBSD: pfkeyv2.c,v 1.241 2022/08/22 21:18:48 mvs Exp $ */
/*
* @(#)COPYRIGHT 1.1 (NRL) 17 January 1995
int pfkeyv2_attach(struct socket *, int);
int pfkeyv2_detach(struct socket *);
int pfkeyv2_disconnect(struct socket *);
+int pfkeyv2_shutdown(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 *,
.pru_attach = pfkeyv2_attach,
.pru_detach = pfkeyv2_detach,
.pru_disconnect = pfkeyv2_disconnect,
+ .pru_shutdown = pfkeyv2_shutdown,
};
const struct protosw pfkeysw[] = {
return (0);
}
+int
+pfkeyv2_shutdown(struct socket *so)
+{
+ socantsendmore(so);
+ return (0);
+}
+
int
pfkeyv2_usrreq(struct socket *so, int req, struct mbuf *m,
struct mbuf *nam, struct mbuf *control, struct proc *p)
case PRU_ABORT:
soisdisconnected(so);
break;
- case PRU_SHUTDOWN:
- socantsendmore(so);
- break;
case PRU_SENSE:
/* stat: don't bother with a blocksize. */
break;
-/* $OpenBSD: rtsock.c,v 1.340 2022/08/22 13:23:07 mvs Exp $ */
+/* $OpenBSD: rtsock.c,v 1.341 2022/08/22 21:18:48 mvs Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
int route_usrreq(struct socket *, int, struct mbuf *, struct mbuf *,
struct mbuf *, struct proc *);
int route_disconnect(struct socket *);
+int route_shutdown(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);
case PRU_ABORT:
soisdisconnected(so);
break;
- case PRU_SHUTDOWN:
- socantsendmore(so);
- break;
case PRU_SENSE:
/* stat: don't bother with a blocksize. */
break;
return (0);
}
+int
+route_shutdown(struct socket *so)
+{
+ socantsendmore(so);
+ return (0);
+}
+
int
route_ctloutput(int op, struct socket *so, int level, int optname,
struct mbuf *m)
.pru_attach = route_attach,
.pru_detach = route_detach,
.pru_disconnect = route_disconnect,
+ .pru_shutdown = route_shutdown,
};
const struct protosw routesw[] = {
-/* $OpenBSD: ip_divert.c,v 1.75 2022/08/22 13:23:07 mvs Exp $ */
+/* $OpenBSD: ip_divert.c,v 1.76 2022/08/22 21:18:48 mvs Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
.pru_attach = divert_attach,
.pru_detach = divert_detach,
.pru_bind = divert_bind,
+ .pru_shutdown = divert_shutdown,
};
int divbhashsize = DIVERTHASHSIZE;
}
switch (req) {
- case PRU_SHUTDOWN:
- socantsendmore(so);
- break;
-
case PRU_SEND:
return (divert_output(inp, m, addr, control));
return in_pcbbind(inp, addr, p);
}
+int
+divert_shutdown(struct socket *so)
+{
+ soassertlocked(so);
+ socantsendmore(so);
+ return (0);
+}
+
int
divert_sysctl_divstat(void *oldp, size_t *oldlenp, void *newp)
{
-/* $OpenBSD: ip_divert.h,v 1.17 2022/08/20 23:48:58 mvs Exp $ */
+/* $OpenBSD: ip_divert.h,v 1.18 2022/08/22 21:18:48 mvs Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
int divert_attach(struct socket *, int);
int divert_detach(struct socket *);
int divert_bind(struct socket *, struct mbuf *, struct proc *);
+int divert_shutdown(struct socket *);
#endif /* _KERNEL */
#endif /* _IP_DIVERT_H_ */
-/* $OpenBSD: ip_gre.c,v 1.78 2022/08/22 13:23:07 mvs Exp $ */
+/* $OpenBSD: ip_gre.c,v 1.79 2022/08/22 21:18:48 mvs Exp $ */
/* $NetBSD: ip_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
/*
.pru_bind = rip_bind,
.pru_connect = rip_connect,
.pru_disconnect = rip_disconnect,
+ .pru_shutdown = rip_shutdown,
};
int
-/* $OpenBSD: ip_var.h,v 1.100 2022/08/22 13:23:07 mvs Exp $ */
+/* $OpenBSD: ip_var.h,v 1.101 2022/08/22 21:18:48 mvs Exp $ */
/* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */
/*
int rip_bind(struct socket *so, struct mbuf *, struct proc *);
int rip_connect(struct socket *, struct mbuf *);
int rip_disconnect(struct socket *);
+int rip_shutdown(struct socket *);
#ifdef MROUTING
extern struct socket *ip_mrouter[]; /* multicast routing daemon */
#endif
-/* $OpenBSD: raw_ip.c,v 1.136 2022/08/22 13:23:07 mvs Exp $ */
+/* $OpenBSD: raw_ip.c,v 1.137 2022/08/22 21:18:48 mvs Exp $ */
/* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */
/*
.pru_bind = rip_bind,
.pru_connect = rip_connect,
.pru_disconnect = rip_disconnect,
+ .pru_shutdown = rip_shutdown,
};
/*
error = EOPNOTSUPP;
break;
- /*
- * Mark the connection as being incapable of further input.
- */
- case PRU_SHUTDOWN:
- socantsendmore(so);
- break;
-
/*
* Ship a packet out. The appropriate raw output
* routine handles any massaging necessary.
return (0);
}
+
+int
+rip_shutdown(struct socket *so)
+{
+ /*
+ * Mark the connection as being incapable of further input.
+ */
+
+ soassertlocked(so);
+ socantsendmore(so);
+
+ return (0);
+}
-/* $OpenBSD: tcp_usrreq.c,v 1.193 2022/08/22 13:23:07 mvs Exp $ */
+/* $OpenBSD: tcp_usrreq.c,v 1.194 2022/08/22 21:18:48 mvs Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
.pru_connect = tcp_connect,
.pru_accept = tcp_accept,
.pru_disconnect = tcp_disconnect,
+ .pru_shutdown = tcp_shutdown,
};
static int pr_slowhz = PR_SLOWHZ;
error = EOPNOTSUPP;
break;
- /*
- * Mark the connection as being incapable of further output.
- */
- case PRU_SHUTDOWN:
- if (so->so_state & SS_CANTSENDMORE)
- break;
- socantsendmore(so);
- tp = tcp_usrclosed(tp);
- if (tp)
- error = tcp_output(tp);
- break;
-
/*
* After a receive, possibly send window update to peer.
*/
return (0);
}
+/*
+ * Mark the connection as being incapable of further output.
+ */
+int
+tcp_shutdown(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;
+ }
+
+ if (so->so_state & SS_CANTSENDMORE)
+ goto out;
+
+ socantsendmore(so);
+ tp = tcp_usrclosed(tp);
+ if (tp)
+ error = tcp_output(tp);
+
+out:
+ if (otp)
+ tcp_trace(TA_USER, ostate, tp, otp, NULL, PRU_SHUTDOWN, 0);
+ return (error);
+}
+
/*
* Initiate (or continue) disconnect.
* If embryonic state, just send reset (once).
-/* $OpenBSD: tcp_var.h,v 1.146 2022/08/22 13:23:07 mvs Exp $ */
+/* $OpenBSD: tcp_var.h,v 1.147 2022/08/22 21:18:48 mvs Exp $ */
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
/*
int tcp_connect(struct socket *, struct mbuf *);
int tcp_accept(struct socket *, struct mbuf *);
int tcp_disconnect(struct socket *);
+int tcp_shutdown(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);
-/* $OpenBSD: udp_usrreq.c,v 1.288 2022/08/22 13:23:07 mvs Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.289 2022/08/22 21:18:48 mvs Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
.pru_bind = udp_bind,
.pru_connect = udp_connect,
.pru_disconnect = udp_disconnect,
+ .pru_shutdown = udp_shutdown,
};
const struct sysctl_bounded_args udpctl_vars[] = {
error = EOPNOTSUPP;
break;
- case PRU_SHUTDOWN:
- socantsendmore(so);
- break;
-
case PRU_SEND:
#ifdef PIPEX
if (inp->inp_pipex) {
return (0);
}
-
+
+int
+udp_shutdown(struct socket *so)
+{
+ soassertlocked(so);
+ socantsendmore(so);
+ return (0);
+}
+
/*
* Sysctl for udp variables.
*/
-/* $OpenBSD: udp_var.h,v 1.41 2022/08/22 13:23:07 mvs Exp $ */
+/* $OpenBSD: udp_var.h,v 1.42 2022/08/22 21:18:48 mvs Exp $ */
/* $NetBSD: udp_var.h,v 1.12 1996/02/13 23:44:41 christos Exp $ */
/*
int udp_bind(struct socket *, struct mbuf *, struct proc *);
int udp_connect(struct socket *, struct mbuf *);
int udp_disconnect(struct socket *);
+int udp_shutdown(struct socket *);
#endif /* _KERNEL */
#endif /* _NETINET_UDP_VAR_H_ */
-/* $OpenBSD: ip6_divert.c,v 1.74 2022/08/22 13:23:07 mvs Exp $ */
+/* $OpenBSD: ip6_divert.c,v 1.75 2022/08/22 21:18:48 mvs Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
.pru_attach = divert6_attach,
.pru_detach = divert6_detach,
.pru_bind = divert6_bind,
+ .pru_shutdown = divert6_shutdown,
};
int divb6hashsize = DIVERTHASHSIZE;
}
switch (req) {
- case PRU_SHUTDOWN:
- socantsendmore(so);
- break;
-
case PRU_SEND:
return (divert6_output(inp, m, addr, control));
return in_pcbbind(inp, addr, p);
}
+int
+divert6_shutdown(struct socket *so)
+{
+ soassertlocked(so);
+ socantsendmore(so);
+
+ return (0);
+}
+
int
divert6_sysctl_div6stat(void *oldp, size_t *oldlenp, void *newp)
{
-/* $OpenBSD: ip6_divert.h,v 1.15 2022/08/20 23:48:58 mvs Exp $ */
+/* $OpenBSD: ip6_divert.h,v 1.16 2022/08/22 21:18:48 mvs Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
int divert6_attach(struct socket *, int);
int divert6_detach(struct socket *);
int divert6_bind(struct socket *, struct mbuf *, struct proc *);
+int divert6_shutdown(struct socket *);
#endif /* _KERNEL */
#endif /* _IP6_DIVERT_H_ */
-/* $OpenBSD: ip6_var.h,v 1.98 2022/08/22 13:23:07 mvs Exp $ */
+/* $OpenBSD: ip6_var.h,v 1.99 2022/08/22 21:18:48 mvs Exp $ */
/* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */
/*
int rip6_bind(struct socket *, struct mbuf *, struct proc *);
int rip6_connect(struct socket *, struct mbuf *);
int rip6_disconnect(struct socket *);
+int rip6_shutdown(struct socket *);
int rip6_sysctl(int *, u_int, void *, size_t *, void *, size_t);
int dest6_input(struct mbuf **, int *, int, int);
-/* $OpenBSD: raw_ip6.c,v 1.156 2022/08/22 13:23:07 mvs Exp $ */
+/* $OpenBSD: raw_ip6.c,v 1.157 2022/08/22 21:18:48 mvs Exp $ */
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
.pru_bind = rip6_bind,
.pru_connect = rip6_connect,
.pru_disconnect = rip6_disconnect,
+ .pru_shutdown = rip6_shutdown,
};
/*
error = EOPNOTSUPP;
break;
- /*
- * Mark the connection as being incapable of further input.
- */
- case PRU_SHUTDOWN:
- socantsendmore(so);
- break;
/*
* Ship a packet out. The appropriate raw output
* routine handles any messaging necessary.
return (0);
}
+int
+rip6_shutdown(struct socket *so)
+{
+ /*
+ * Mark the connection as being incapable of further input.
+ */
+ soassertlocked(so);
+ socantsendmore(so);
+ return (0);
+}
+
int
rip6_sysctl_rip6stat(void *oldp, size_t *oldplen, void *newp)
{
-/* $OpenBSD: protosw.h,v 1.42 2022/08/22 13:23:07 mvs Exp $ */
+/* $OpenBSD: protosw.h,v 1.43 2022/08/22 21:18:48 mvs Exp $ */
/* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */
/*-
int (*pru_connect)(struct socket *, struct mbuf *);
int (*pru_accept)(struct socket *, struct mbuf *);
int (*pru_disconnect)(struct socket *);
+ int (*pru_shutdown)(struct socket *);
};
struct protosw {
static inline int
pru_shutdown(struct socket *so)
{
- return (*so->so_proto->pr_usrreqs->pru_usrreq)(so,
- PRU_SHUTDOWN, NULL, NULL, NULL, curproc);
+ return (*so->so_proto->pr_usrreqs->pru_shutdown)(so);
}
static inline int
-/* $OpenBSD: unpcb.h,v 1.32 2022/08/22 13:23:07 mvs Exp $ */
+/* $OpenBSD: unpcb.h,v 1.33 2022/08/22 21:18:48 mvs Exp $ */
/* $NetBSD: unpcb.h,v 1.6 1994/06/29 06:46:08 cgd Exp $ */
/*
int uipc_connect(struct socket *, struct mbuf *);
int uipc_accept(struct socket *, struct mbuf *);
int uipc_disconnect(struct socket *);
+int uipc_shutdown(struct socket *);
void unp_init(void);
int unp_bind(struct unpcb *, struct mbuf *, struct proc *);