-/* $OpenBSD: uipc_usrreq.c,v 1.176 2022/08/27 20:28:01 mvs Exp $ */
+/* $OpenBSD: uipc_usrreq.c,v 1.177 2022/08/28 18:44:16 mvs Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */
/*
.pru_shutdown = uipc_shutdown,
.pru_rcvd = uipc_rcvd,
.pru_send = uipc_send,
+ .pru_abort = uipc_abort,
};
void
}
break;
- case PRU_ABORT:
- unp_detach(unp);
- sofree(so, 0);
- break;
-
case PRU_SENSE: {
struct stat *sb = (struct stat *)m;
return (error);
}
+int
+uipc_abort(struct socket *so)
+{
+ struct unpcb *unp = sotounpcb(so);
+
+ unp_detach(unp);
+ sofree(so, 0);
+
+ 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.243 2022/08/27 20:28:01 mvs Exp $ */
+/* $OpenBSD: pfkeyv2.c,v 1.244 2022/08/28 18:44:16 mvs Exp $ */
/*
* @(#)COPYRIGHT 1.1 (NRL) 17 January 1995
int pfkeyv2_shutdown(struct socket *);
int pfkeyv2_send(struct socket *, struct mbuf *, struct mbuf *,
struct mbuf *);
+int pfkeyv2_abort(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_disconnect = pfkeyv2_disconnect,
.pru_shutdown = pfkeyv2_shutdown,
.pru_send = pfkeyv2_send,
+ .pru_abort = pfkeyv2_abort,
};
const struct protosw pfkeysw[] = {
return (error);
}
+int
+pfkeyv2_abort(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)
error = EOPNOTSUPP;
break;
- case PRU_ABORT:
- soisdisconnected(so);
- break;
case PRU_SENSE:
/* stat: don't bother with a blocksize. */
break;
-/* $OpenBSD: rtsock.c,v 1.343 2022/08/27 20:28:01 mvs Exp $ */
+/* $OpenBSD: rtsock.c,v 1.344 2022/08/28 18:44:16 mvs Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
int route_rcvd(struct socket *);
int route_send(struct socket *, struct mbuf *, struct mbuf *,
struct mbuf *);
+int route_abort(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);
error = EOPNOTSUPP;
break;
- case PRU_ABORT:
- soisdisconnected(so);
- break;
case PRU_SENSE:
/* stat: don't bother with a blocksize. */
break;
return (error);
}
+int
+route_abort(struct socket *so)
+{
+ soisdisconnected(so);
+ return (0);
+}
+
int
route_ctloutput(int op, struct socket *so, int level, int optname,
struct mbuf *m)
.pru_shutdown = route_shutdown,
.pru_rcvd = route_rcvd,
.pru_send = route_send,
+ .pru_abort = route_abort,
};
const struct protosw routesw[] = {
-/* $OpenBSD: ip_divert.c,v 1.78 2022/08/27 20:28:01 mvs Exp $ */
+/* $OpenBSD: ip_divert.c,v 1.79 2022/08/28 18:44:16 mvs Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
.pru_bind = divert_bind,
.pru_shutdown = divert_shutdown,
.pru_send = divert_send,
+ .pru_abort = divert_abort,
};
int divbhashsize = DIVERTHASHSIZE;
}
switch (req) {
- case PRU_ABORT:
- soisdisconnected(so);
- in_pcbdetach(inp);
- break;
-
case PRU_SOCKADDR:
in_setsockaddr(inp, addr);
break;
return (divert_output(inp, m, addr, control));
}
+int
+divert_abort(struct socket *so)
+{
+ struct inpcb *inp = sotoinpcb(so);
+
+ soassertlocked(so);
+
+ soisdisconnected(so);
+ in_pcbdetach(inp);
+
+ return (0);
+}
+
int
divert_sysctl_divstat(void *oldp, size_t *oldlenp, void *newp)
{
-/* $OpenBSD: ip_divert.h,v 1.19 2022/08/27 20:28:01 mvs Exp $ */
+/* $OpenBSD: ip_divert.h,v 1.20 2022/08/28 18:44:16 mvs Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
int divert_shutdown(struct socket *);
int divert_send(struct socket *, struct mbuf *, struct mbuf *,
struct mbuf *);
+int divert_abort(struct socket *);
#endif /* _KERNEL */
#endif /* _IP_DIVERT_H_ */
-/* $OpenBSD: ip_gre.c,v 1.80 2022/08/27 20:28:01 mvs Exp $ */
+/* $OpenBSD: ip_gre.c,v 1.81 2022/08/28 18:44:16 mvs Exp $ */
/* $NetBSD: ip_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
/*
.pru_disconnect = rip_disconnect,
.pru_shutdown = rip_shutdown,
.pru_send = gre_send,
+ .pru_abort = rip_abort,
};
int
-/* $OpenBSD: ip_var.h,v 1.102 2022/08/27 20:28:01 mvs Exp $ */
+/* $OpenBSD: ip_var.h,v 1.103 2022/08/28 18:44:16 mvs Exp $ */
/* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */
/*
int rip_shutdown(struct socket *);
int rip_send(struct socket *, struct mbuf *, struct mbuf *,
struct mbuf *);
+int rip_abort(struct socket *);
#ifdef MROUTING
extern struct socket *ip_mrouter[]; /* multicast routing daemon */
#endif
-/* $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 $ */
/*
.pru_disconnect = rip_disconnect,
.pru_shutdown = rip_shutdown,
.pru_send = rip_send,
+ .pru_abort = rip_abort,
};
/*
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;
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);
+}
-/* $OpenBSD: tcp_usrreq.c,v 1.196 2022/08/27 20:28:01 mvs Exp $ */
+/* $OpenBSD: tcp_usrreq.c,v 1.197 2022/08/28 18:44:16 mvs Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
.pru_shutdown = tcp_shutdown,
.pru_rcvd = tcp_rcvd,
.pru_send = tcp_send,
+ .pru_abort = tcp_abort,
};
static int pr_slowhz = PR_SLOWHZ;
error = EOPNOTSUPP;
break;
- /*
- * Abort the TCP.
- */
- case PRU_ABORT:
- tp = tcp_drop(tp, ECONNABORTED);
- break;
-
case PRU_SENSE:
((struct stat *) m)->st_blksize = so->so_snd.sb_hiwat;
break;
return (error);
}
+/*
+ * Abort the TCP.
+ */
+int
+tcp_abort(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_drop(tp, ECONNABORTED);
+
+ if (otp)
+ tcp_trace(TA_USER, ostate, tp, otp, NULL, PRU_ABORT, 0);
+ return (0);
+}
+
/*
* Initiate (or continue) disconnect.
* If embryonic state, just send reset (once).
-/* $OpenBSD: tcp_var.h,v 1.149 2022/08/27 20:28:01 mvs Exp $ */
+/* $OpenBSD: tcp_var.h,v 1.150 2022/08/28 18:44:16 mvs Exp $ */
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
/*
int tcp_rcvd(struct socket *);
int tcp_send(struct socket *, struct mbuf *, struct mbuf *,
struct mbuf *);
+int tcp_abort(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.291 2022/08/27 20:28:01 mvs Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.292 2022/08/28 18:44:16 mvs Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
.pru_disconnect = udp_disconnect,
.pru_shutdown = udp_shutdown,
.pru_send = udp_send,
+ .pru_abort = udp_abort,
};
const struct sysctl_bounded_args udpctl_vars[] = {
error = EOPNOTSUPP;
break;
- case PRU_ABORT:
- soisdisconnected(so);
- in_pcbdetach(inp);
- break;
-
case PRU_SOCKADDR:
#ifdef INET6
if (inp->inp_flags & INP_IPV6)
return (error);
}
+int
+udp_abort(struct socket *so)
+{
+ struct inpcb *inp = sotoinpcb(so);
+
+ soassertlocked(so);
+
+ soisdisconnected(so);
+ in_pcbdetach(inp);
+
+ return (0);
+}
+
/*
* Sysctl for udp variables.
*/
-/* $OpenBSD: udp_var.h,v 1.43 2022/08/27 20:28:01 mvs Exp $ */
+/* $OpenBSD: udp_var.h,v 1.44 2022/08/28 18:44:16 mvs Exp $ */
/* $NetBSD: udp_var.h,v 1.12 1996/02/13 23:44:41 christos Exp $ */
/*
int udp_shutdown(struct socket *);
int udp_send(struct socket *, struct mbuf *, struct mbuf *,
struct mbuf *);
+int udp_abort(struct socket *);
#endif /* _KERNEL */
#endif /* _NETINET_UDP_VAR_H_ */
-/* $OpenBSD: ip6_divert.c,v 1.77 2022/08/27 20:28:01 mvs Exp $ */
+/* $OpenBSD: ip6_divert.c,v 1.78 2022/08/28 18:44:17 mvs Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
.pru_bind = divert6_bind,
.pru_shutdown = divert6_shutdown,
.pru_send = divert6_send,
+ .pru_abort = divert6_abort,
};
int divb6hashsize = DIVERTHASHSIZE;
}
switch (req) {
- case PRU_ABORT:
- soisdisconnected(so);
- in_pcbdetach(inp);
- break;
-
case PRU_SOCKADDR:
in6_setsockaddr(inp, addr);
break;
return (divert6_output(inp, m, addr, control));
}
+int
+divert6_abort(struct socket *so)
+{
+ struct inpcb *inp = sotoinpcb(so);
+
+ soassertlocked(so);
+ soisdisconnected(so);
+ in_pcbdetach(inp);
+
+ return (0);
+}
+
int
divert6_sysctl_div6stat(void *oldp, size_t *oldlenp, void *newp)
{
-/* $OpenBSD: ip6_divert.h,v 1.17 2022/08/27 20:28:01 mvs Exp $ */
+/* $OpenBSD: ip6_divert.h,v 1.18 2022/08/28 18:44:17 mvs Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
int divert6_shutdown(struct socket *);
int divert6_send(struct socket *, struct mbuf *, struct mbuf *,
struct mbuf *);
+int divert6_abort(struct socket *);
#endif /* _KERNEL */
#endif /* _IP6_DIVERT_H_ */
-/* $OpenBSD: ip6_var.h,v 1.100 2022/08/27 20:28:01 mvs Exp $ */
+/* $OpenBSD: ip6_var.h,v 1.101 2022/08/28 18:44:17 mvs Exp $ */
/* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */
/*
int rip6_shutdown(struct socket *);
int rip6_send(struct socket *, struct mbuf *, struct mbuf *,
struct mbuf *);
+int rip6_abort(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.159 2022/08/27 20:28:01 mvs Exp $ */
+/* $OpenBSD: raw_ip6.c,v 1.160 2022/08/28 18:44:17 mvs Exp $ */
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
.pru_disconnect = rip6_disconnect,
.pru_shutdown = rip6_shutdown,
.pru_send = rip6_send,
+ .pru_abort = rip6_abort,
};
/*
}
switch (req) {
- case PRU_ABORT:
- soisdisconnected(so);
- if (in6p == NULL)
- panic("%s", __func__);
-#ifdef MROUTING
- if (so == ip6_mrouter[in6p->inp_rtableid])
- ip6_mrouter_done(so);
-#endif
- free(in6p->inp_icmp6filt, M_PCB, sizeof(struct icmp6_filter));
- in6p->inp_icmp6filt = NULL;
-
- in_pcbdetach(in6p);
- break;
-
case PRU_CONNECT2:
error = EOPNOTSUPP;
break;
return (error);
}
+int
+rip6_abort(struct socket *so)
+{
+ struct inpcb *in6p = sotoinpcb(so);
+
+ soassertlocked(so);
+
+ soisdisconnected(so);
+#ifdef MROUTING
+ if (so == ip6_mrouter[in6p->inp_rtableid])
+ ip6_mrouter_done(so);
+#endif
+ free(in6p->inp_icmp6filt, M_PCB, sizeof(struct icmp6_filter));
+ in6p->inp_icmp6filt = NULL;
+
+ in_pcbdetach(in6p);
+
+ return (0);
+}
+
int
rip6_sysctl_rip6stat(void *oldp, size_t *oldplen, void *newp)
{
-/* $OpenBSD: protosw.h,v 1.45 2022/08/27 20:28:01 mvs Exp $ */
+/* $OpenBSD: protosw.h,v 1.46 2022/08/28 18:44:17 mvs Exp $ */
/* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */
/*-
int (*pru_rcvd)(struct socket *);
int (*pru_send)(struct socket *, struct mbuf *, struct mbuf *,
struct mbuf *);
+ int (*pru_abort)(struct socket *);
};
struct protosw {
static inline int
pru_abort(struct socket *so)
{
- return (*so->so_proto->pr_usrreqs->pru_usrreq)(so,
- PRU_ABORT, NULL, NULL, NULL, curproc);
+ return (*so->so_proto->pr_usrreqs->pru_abort)(so);
}
static inline int
-/* $OpenBSD: unpcb.h,v 1.35 2022/08/27 20:28:01 mvs Exp $ */
+/* $OpenBSD: unpcb.h,v 1.36 2022/08/28 18:44:17 mvs Exp $ */
/* $NetBSD: unpcb.h,v 1.6 1994/06/29 06:46:08 cgd Exp $ */
/*
int uipc_rcvd(struct socket *);
int uipc_send(struct socket *, struct mbuf *, struct mbuf *,
struct mbuf *);
+int uipc_abort(struct socket *);
void unp_init(void);
int unp_bind(struct unpcb *, struct mbuf *, struct proc *);