-/* $OpenBSD: sys_socket.c,v 1.53 2022/08/14 01:58:28 jsg Exp $ */
+/* $OpenBSD: sys_socket.c,v 1.54 2022/09/02 13:12:31 mvs Exp $ */
/* $NetBSD: sys_socket.c,v 1.13 1995/08/12 23:59:09 mycroft Exp $ */
/*
if (IOCGROUP(cmd) == 'r')
return (EOPNOTSUPP);
KERNEL_LOCK();
- error = pru_control(so, cmd, data, NULL, p);
+ error = pru_control(so, cmd, data, NULL);
KERNEL_UNLOCK();
break;
}
-/* $OpenBSD: uipc_usrreq.c,v 1.182 2022/09/01 18:21:22 mvs Exp $ */
+/* $OpenBSD: uipc_usrreq.c,v 1.183 2022/09/02 13:12:31 mvs Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */
/*
struct socket *so2;
int error = 0;
- if (req == PRU_CONTROL)
- return (EOPNOTSUPP);
if (req != PRU_SEND && control && control->m_len) {
error = EOPNOTSUPP;
goto release;
-/* $OpenBSD: if.c,v 1.663 2022/08/13 21:01:46 mvs Exp $ */
+/* $OpenBSD: if.c,v 1.664 2022/09/02 13:12:31 mvs Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
break;
/* FALLTHROUGH */
default:
- error = pru_control(so, cmd, data, ifp, p);
+ error = pru_control(so, cmd, data, ifp);
if (error != EOPNOTSUPP)
break;
switch (cmd) {
-/* $OpenBSD: pfkeyv2.c,v 1.249 2022/09/01 18:21:23 mvs Exp $ */
+/* $OpenBSD: pfkeyv2.c,v 1.250 2022/09/02 13:12:32 mvs Exp $ */
/*
* @(#)COPYRIGHT 1.1 (NRL) 17 January 1995
struct pkpcb *kp;
int error = 0;
- if (req == PRU_CONTROL)
- return (EOPNOTSUPP);
-
soassertlocked(so);
if (control && control->m_len) {
-/* $OpenBSD: rtsock.c,v 1.350 2022/09/01 18:21:23 mvs Exp $ */
+/* $OpenBSD: rtsock.c,v 1.351 2022/09/02 13:12:32 mvs Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
struct rtpcb *rop;
int error = 0;
- if (req == PRU_CONTROL)
- return (EOPNOTSUPP);
-
soassertlocked(so);
if (control && control->m_len) {
-/* $OpenBSD: ip_divert.c,v 1.83 2022/09/01 18:21:23 mvs Exp $ */
+/* $OpenBSD: ip_divert.c,v 1.84 2022/09/02 13:12:32 mvs Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
.pru_shutdown = divert_shutdown,
.pru_send = divert_send,
.pru_abort = divert_abort,
+ .pru_control = in_control,
};
int divbhashsize = DIVERTHASHSIZE;
struct inpcb *inp = sotoinpcb(so);
int error = 0;
- if (req == PRU_CONTROL) {
- return (in_control(so, (u_long)m, (caddr_t)addr,
- (struct ifnet *)control));
- }
-
soassertlocked(so);
if (inp == NULL) {
-/* $OpenBSD: ip_gre.c,v 1.81 2022/08/28 18:44:16 mvs Exp $ */
+/* $OpenBSD: ip_gre.c,v 1.82 2022/09/02 13:12:32 mvs Exp $ */
/* $NetBSD: ip_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
/*
#include <sys/sysctl.h>
#include <net/if.h>
+#include <net/if_var.h>
#include <net/route.h>
#include <netinet/in.h>
#include <netinet/ip_gre.h>
#include <netinet/ip_var.h>
#include <netinet/in_pcb.h>
+#include <netinet/in_var.h>
#ifdef PIPEX
#include <net/pipex.h>
.pru_shutdown = rip_shutdown,
.pru_send = gre_send,
.pru_abort = rip_abort,
+ .pru_control = in_control,
};
int
-/* $OpenBSD: raw_ip.c,v 1.144 2022/09/01 18:21:23 mvs Exp $ */
+/* $OpenBSD: raw_ip.c,v 1.145 2022/09/02 13:12:32 mvs Exp $ */
/* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */
/*
.pru_shutdown = rip_shutdown,
.pru_send = rip_send,
.pru_abort = rip_abort,
+ .pru_control = in_control,
};
/*
struct inpcb *inp;
int error = 0;
- if (req == PRU_CONTROL)
- return (in_control(so, (u_long)m, (caddr_t)nam,
- (struct ifnet *)control));
-
soassertlocked(so);
inp = sotoinpcb(so);
-/* $OpenBSD: tcp_usrreq.c,v 1.203 2022/09/01 18:21:23 mvs Exp $ */
+/* $OpenBSD: tcp_usrreq.c,v 1.204 2022/09/02 13:12:32 mvs Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
.pru_sense = tcp_sense,
.pru_rcvoob = tcp_rcvoob,
.pru_sendoob = tcp_sendoob,
+ .pru_control = in_control,
};
+#ifdef INET6
+const struct pr_usrreqs tcp6_usrreqs = {
+ .pru_usrreq = tcp_usrreq,
+ .pru_attach = tcp_attach,
+ .pru_detach = tcp_detach,
+ .pru_bind = tcp_bind,
+ .pru_listen = tcp_listen,
+ .pru_connect = tcp_connect,
+ .pru_accept = tcp_accept,
+ .pru_disconnect = tcp_disconnect,
+ .pru_shutdown = tcp_shutdown,
+ .pru_rcvd = tcp_rcvd,
+ .pru_send = tcp_send,
+ .pru_abort = tcp_abort,
+ .pru_sense = tcp_sense,
+ .pru_rcvoob = tcp_rcvoob,
+ .pru_sendoob = tcp_sendoob,
+ .pru_control = in6_control,
+};
+#endif
+
static int pr_slowhz = PR_SLOWHZ;
const struct sysctl_bounded_args tcpctl_vars[] = {
{ TCPCTL_SLOWHZ, &pr_slowhz, SYSCTL_INT_READONLY },
int error = 0;
short ostate;
- if (req == PRU_CONTROL) {
-#ifdef INET6
- if (sotopf(so) == PF_INET6)
- return in6_control(so, (u_long)m, (caddr_t)nam,
- (struct ifnet *)control);
- else
-#endif /* INET6 */
- return (in_control(so, (u_long)m, (caddr_t)nam,
- (struct ifnet *)control));
- }
-
soassertlocked(so);
if (control && control->m_len) {
-/* $OpenBSD: tcp_var.h,v 1.153 2022/08/31 21:23:02 mvs Exp $ */
+/* $OpenBSD: tcp_var.h,v 1.154 2022/09/02 13:12:32 mvs Exp $ */
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
/*
}
extern const struct pr_usrreqs tcp_usrreqs;
+
+#ifdef INET6
+extern const struct pr_usrreqs tcp6_usrreqs;
+#endif
+
extern struct pool tcpcb_pool;
extern struct inpcbtable tcbtable; /* head of queue of active tcpcb's */
extern u_int32_t tcp_now; /* for RFC 1323 timestamps */
-/* $OpenBSD: udp_usrreq.c,v 1.298 2022/09/01 18:21:23 mvs Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.299 2022/09/02 13:12:32 mvs Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
.pru_shutdown = udp_shutdown,
.pru_send = udp_send,
.pru_abort = udp_abort,
+ .pru_control = in_control,
};
+#ifdef INET6
+const struct pr_usrreqs udp6_usrreqs = {
+ .pru_usrreq = udp_usrreq,
+ .pru_attach = udp_attach,
+ .pru_detach = udp_detach,
+ .pru_bind = udp_bind,
+ .pru_connect = udp_connect,
+ .pru_disconnect = udp_disconnect,
+ .pru_shutdown = udp_shutdown,
+ .pru_send = udp_send,
+ .pru_abort = udp_abort,
+ .pru_control = in6_control,
+};
+#endif
+
const struct sysctl_bounded_args udpctl_vars[] = {
{ UDPCTL_CHECKSUM, &udpcksum, 0, 1 },
{ UDPCTL_RECVSPACE, &udp_recvspace, 0, INT_MAX },
struct inpcb *inp;
int error = 0;
- if (req == PRU_CONTROL) {
-#ifdef INET6
- if (sotopf(so) == PF_INET6)
- return (in6_control(so, (u_long)m, (caddr_t)addr,
- (struct ifnet *)control));
- else
-#endif /* INET6 */
- return (in_control(so, (u_long)m, (caddr_t)addr,
- (struct ifnet *)control));
- }
-
soassertlocked(so);
inp = sotoinpcb(so);
-/* $OpenBSD: udp_var.h,v 1.44 2022/08/28 18:44:16 mvs Exp $ */
+/* $OpenBSD: udp_var.h,v 1.45 2022/09/02 13:12:32 mvs Exp $ */
/* $NetBSD: udp_var.h,v 1.12 1996/02/13 23:44:41 christos Exp $ */
/*
extern const struct pr_usrreqs udp_usrreqs;
+#ifdef INET6
+extern const struct pr_usrreqs udp6_usrreqs;
+#endif
+
#ifdef INET6
void udp6_ctlinput(int, struct sockaddr *, u_int, void *);
#endif /* INET6 */
-/* $OpenBSD: in6_proto.c,v 1.110 2022/08/15 09:11:39 mvs Exp $ */
+/* $OpenBSD: in6_proto.c,v 1.111 2022/09/02 13:12:32 mvs Exp $ */
/* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */
/*
.pr_input = udp_input,
.pr_ctlinput = udp6_ctlinput,
.pr_ctloutput = ip6_ctloutput,
- .pr_usrreqs = &udp_usrreqs,
+ .pr_usrreqs = &udp6_usrreqs,
.pr_sysctl = udp_sysctl
},
{
.pr_input = tcp_input,
.pr_ctlinput = tcp6_ctlinput,
.pr_ctloutput = tcp_ctloutput,
- .pr_usrreqs = &tcp_usrreqs,
+ .pr_usrreqs = &tcp6_usrreqs,
.pr_sysctl = tcp_sysctl
},
{
-/* $OpenBSD: ip6_divert.c,v 1.82 2022/09/01 18:21:23 mvs Exp $ */
+/* $OpenBSD: ip6_divert.c,v 1.83 2022/09/02 13:12:32 mvs Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
.pru_shutdown = divert6_shutdown,
.pru_send = divert6_send,
.pru_abort = divert6_abort,
+ .pru_control = in6_control,
};
int divb6hashsize = DIVERTHASHSIZE;
struct inpcb *inp = sotoinpcb(so);
int error = 0;
- if (req == PRU_CONTROL) {
- return (in6_control(so, (u_long)m, (caddr_t)addr,
- (struct ifnet *)control));
- }
-
soassertlocked(so);
if (inp == NULL) {
-/* $OpenBSD: raw_ip6.c,v 1.165 2022/09/01 18:21:23 mvs Exp $ */
+/* $OpenBSD: raw_ip6.c,v 1.166 2022/09/02 13:12:32 mvs Exp $ */
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
.pru_shutdown = rip6_shutdown,
.pru_send = rip6_send,
.pru_abort = rip6_abort,
+ .pru_control = in6_control,
};
/*
struct inpcb *in6p;
int error = 0;
- if (req == PRU_CONTROL)
- return (in6_control(so, (u_long)m, (caddr_t)nam,
- (struct ifnet *)control));
-
soassertlocked(so);
in6p = sotoinpcb(so);
-/* $OpenBSD: protosw.h,v 1.51 2022/09/01 18:21:23 mvs Exp $ */
+/* $OpenBSD: protosw.h,v 1.52 2022/09/02 13:12:32 mvs Exp $ */
/* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */
/*-
struct domain;
struct proc;
struct stat;
+struct ifnet;
struct pr_usrreqs {
/* user request: see list below */
int (*pru_send)(struct socket *, struct mbuf *, struct mbuf *,
struct mbuf *);
int (*pru_abort)(struct socket *);
+ int (*pru_control)(struct socket *, u_long, caddr_t,
+ struct ifnet *);
int (*pru_sense)(struct socket *, struct stat *);
int (*pru_rcvoob)(struct socket *, struct mbuf *, int);
int (*pru_sendoob)(struct socket *, struct mbuf *, struct mbuf *,
}
static inline int
-pru_control(struct socket *so, u_long cmd, caddr_t data,
- struct ifnet *ifp, struct proc *p)
+pru_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp)
{
- return (*so->so_proto->pr_usrreqs->pru_usrreq)(so,
- PRU_CONTROL, (struct mbuf *)cmd, (struct mbuf *)data,
- (struct mbuf *)ifp, p);
+ if (so->so_proto->pr_usrreqs->pru_control)
+ return (*so->so_proto->pr_usrreqs->pru_control)(so,
+ cmd, data, ifp);
+ return (EOPNOTSUPP);
}
static inline int