-/* $OpenBSD: uipc_proto.c,v 1.23 2022/08/14 01:58:28 jsg Exp $ */
+/* $OpenBSD: uipc_proto.c,v 1.24 2022/08/15 09:11:38 mvs Exp $ */
/* $NetBSD: uipc_proto.c,v 1.8 1996/02/13 21:10:47 christos Exp $ */
/*-
.pr_domain = &unixdomain,
.pr_protocol = PF_UNIX,
.pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_RIGHTS,
- .pr_usrreq = uipc_usrreq,
- .pr_attach = uipc_attach,
- .pr_detach = uipc_detach,
+ .pr_usrreqs = &uipc_usrreqs,
},
{
.pr_type = SOCK_SEQPACKET,
.pr_domain = &unixdomain,
.pr_protocol = PF_UNIX,
.pr_flags = PR_ATOMIC|PR_CONNREQUIRED|PR_WANTRCVD|PR_RIGHTS,
- .pr_usrreq = uipc_usrreq,
- .pr_attach = uipc_attach,
- .pr_detach = uipc_detach,
+ .pr_usrreqs = &uipc_usrreqs,
},
{
.pr_type = SOCK_DGRAM,
.pr_domain = &unixdomain,
.pr_protocol = PF_UNIX,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_RIGHTS,
- .pr_usrreq = uipc_usrreq,
- .pr_attach = uipc_attach,
- .pr_detach = uipc_detach,
+ .pr_usrreqs = &uipc_usrreqs,
}
};
-/* $OpenBSD: uipc_socket.c,v 1.282 2022/08/14 01:58:28 jsg Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.283 2022/08/15 09:11:38 mvs Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
prp = pffindproto(dom, proto, type);
else
prp = pffindtype(dom, type);
- if (prp == NULL || prp->pr_attach == NULL)
+ if (prp == NULL || prp->pr_usrreqs == NULL)
return (EPROTONOSUPPORT);
if (prp->pr_type != type)
return (EPROTOTYPE);
if ((error = getsock(curproc, fd, &fp)) != 0)
return (error);
sosp = fp->f_data;
- if (sosp->so_proto->pr_usrreq != so->so_proto->pr_usrreq) {
+ if (sosp->so_proto->pr_usrreqs != so->so_proto->pr_usrreqs) {
error = EPROTONOSUPPORT;
goto frele;
}
-/* $OpenBSD: uipc_usrreq.c,v 1.167 2022/07/02 11:49:23 mvs Exp $ */
+/* $OpenBSD: uipc_usrreq.c,v 1.168 2022/08/15 09:11:38 mvs Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */
/*
int unp_defer; /* [G] number of deferred fp to close by the GC task */
int unp_gcing; /* [G] GC task currently running */
+const struct pr_usrreqs uipc_usrreqs = {
+ .pru_usrreq = uipc_usrreq,
+ .pru_attach = uipc_attach,
+ .pru_detach = uipc_detach,
+};
+
void
unp_init(void)
{
-/* $OpenBSD: pfkeyv2.c,v 1.234 2022/06/06 14:45:41 claudio Exp $ */
+/* $OpenBSD: pfkeyv2.c,v 1.235 2022/08/15 09:11:38 mvs Exp $ */
/*
* @(#)COPYRIGHT 1.1 (NRL) 17 January 1995
return (0);
}
+const struct pr_usrreqs pfkeyv2_usrreqs = {
+ .pru_usrreq = pfkeyv2_usrreq,
+ .pru_attach = pfkeyv2_attach,
+ .pru_detach = pfkeyv2_detach,
+};
+
const struct protosw pfkeysw[] = {
{
.pr_type = SOCK_RAW,
.pr_protocol = PF_KEY_V2,
.pr_flags = PR_ATOMIC | PR_ADDR,
.pr_output = pfkeyv2_output,
- .pr_usrreq = pfkeyv2_usrreq,
- .pr_attach = pfkeyv2_attach,
- .pr_detach = pfkeyv2_detach,
+ .pr_usrreqs = &pfkeyv2_usrreqs,
.pr_sysctl = pfkeyv2_sysctl,
}
};
-/* $OpenBSD: rtsock.c,v 1.334 2022/06/28 10:01:13 bluhm Exp $ */
+/* $OpenBSD: rtsock.c,v 1.335 2022/08/15 09:11:38 mvs Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
* Definitions of protocols supported in the ROUTE domain.
*/
+const struct pr_usrreqs route_usrreqs = {
+ .pru_usrreq = route_usrreq,
+ .pru_attach = route_attach,
+ .pru_detach = route_detach,
+};
+
const struct protosw routesw[] = {
{
.pr_type = SOCK_RAW,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_WANTRCVD,
.pr_output = route_output,
.pr_ctloutput = route_ctloutput,
- .pr_usrreq = route_usrreq,
- .pr_attach = route_attach,
- .pr_detach = route_detach,
+ .pr_usrreqs = &route_usrreqs,
.pr_init = route_prinit,
.pr_sysctl = sysctl_rtable
}
-/* $OpenBSD: in_proto.c,v 1.98 2022/02/25 23:51:03 guenther Exp $ */
+/* $OpenBSD: in_proto.c,v 1.99 2022/08/15 09:11:38 mvs Exp $ */
/* $NetBSD: in_proto.c,v 1.14 1996/02/18 18:58:32 christos Exp $ */
/*
.pr_input = udp_input,
.pr_ctlinput = udp_ctlinput,
.pr_ctloutput = ip_ctloutput,
- .pr_usrreq = udp_usrreq,
- .pr_attach = udp_attach,
- .pr_detach = udp_detach,
+ .pr_usrreqs = &udp_usrreqs,
.pr_init = udp_init,
.pr_sysctl = udp_sysctl
},
.pr_input = tcp_input,
.pr_ctlinput = tcp_ctlinput,
.pr_ctloutput = tcp_ctloutput,
- .pr_usrreq = tcp_usrreq,
- .pr_attach = tcp_attach,
- .pr_detach = tcp_detach,
+ .pr_usrreqs = &tcp_usrreqs,
.pr_init = tcp_init,
.pr_slowtimo = tcp_slowtimo,
.pr_sysctl = tcp_sysctl
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = rip_input,
.pr_ctloutput = rip_ctloutput,
- .pr_usrreq = rip_usrreq,
- .pr_attach = rip_attach,
- .pr_detach = rip_detach,
+ .pr_usrreqs = &rip_usrreqs,
},
{
.pr_type = SOCK_RAW,
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = icmp_input,
.pr_ctloutput = rip_ctloutput,
- .pr_usrreq = rip_usrreq,
- .pr_attach = rip_attach,
- .pr_detach = rip_detach,
+ .pr_usrreqs = &rip_usrreqs,
.pr_init = icmp_init,
.pr_sysctl = icmp_sysctl
},
.pr_input = ipip_input,
#endif
.pr_ctloutput = rip_ctloutput,
- .pr_usrreq = rip_usrreq,
- .pr_attach = rip_attach,
- .pr_detach = rip_detach,
+ .pr_usrreqs = &rip_usrreqs,
.pr_sysctl = ipip_sysctl,
.pr_init = ipip_init
},
.pr_input = ipip_input,
#endif
.pr_ctloutput = rip_ctloutput,
- .pr_usrreq = rip_usrreq, /* XXX */
- .pr_attach = rip_attach,
- .pr_detach = rip_detach,
+ .pr_usrreqs = &rip_usrreqs, /* XXX */
},
#endif
#if defined(MPLS) && NGIF > 0
.pr_protocol = IPPROTO_MPLS,
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = in_gif_input,
- .pr_usrreq = rip_usrreq,
- .pr_attach = rip_attach,
- .pr_detach = rip_detach,
+ .pr_usrreqs = &rip_usrreqs,
},
#endif /* MPLS && GIF */
{
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = igmp_input,
.pr_ctloutput = rip_ctloutput,
- .pr_usrreq = rip_usrreq,
- .pr_attach = rip_attach,
- .pr_detach = rip_detach,
+ .pr_usrreqs = &rip_usrreqs,
.pr_init = igmp_init,
.pr_fasttimo = igmp_fasttimo,
.pr_slowtimo = igmp_slowtimo,
.pr_input = ah46_input,
.pr_ctlinput = ah4_ctlinput,
.pr_ctloutput = rip_ctloutput,
- .pr_usrreq = rip_usrreq,
- .pr_attach = rip_attach,
- .pr_detach = rip_detach,
+ .pr_usrreqs = &rip_usrreqs,
.pr_sysctl = ah_sysctl
},
{
.pr_input = esp46_input,
.pr_ctlinput = esp4_ctlinput,
.pr_ctloutput = rip_ctloutput,
- .pr_usrreq = rip_usrreq,
- .pr_attach = rip_attach,
- .pr_detach = rip_detach,
+ .pr_usrreqs = &rip_usrreqs,
.pr_sysctl = esp_sysctl
},
{
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = ipcomp46_input,
.pr_ctloutput = rip_ctloutput,
- .pr_usrreq = rip_usrreq,
- .pr_attach = rip_attach,
- .pr_detach = rip_detach,
+ .pr_usrreqs = &rip_usrreqs,
.pr_sysctl = ipcomp_sysctl
},
#endif /* IPSEC */
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = gre_input,
.pr_ctloutput = rip_ctloutput,
- .pr_usrreq = gre_usrreq,
- .pr_attach = rip_attach,
- .pr_detach = rip_detach,
+ .pr_usrreqs = &gre_usrreqs,
.pr_sysctl = gre_sysctl
},
#endif /* NGRE > 0 */
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = carp_proto_input,
.pr_ctloutput = rip_ctloutput,
- .pr_usrreq = rip_usrreq,
- .pr_attach = rip_attach,
- .pr_detach = rip_detach,
+ .pr_usrreqs = &rip_usrreqs,
.pr_sysctl = carp_sysctl
},
#endif /* NCARP > 0 */
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = pfsync_input,
.pr_ctloutput = rip_ctloutput,
- .pr_usrreq = rip_usrreq,
- .pr_attach = rip_attach,
- .pr_detach = rip_detach,
+ .pr_usrreqs = &rip_usrreqs,
.pr_sysctl = pfsync_sysctl
},
#endif /* NPFSYNC > 0 */
.pr_protocol = IPPROTO_DIVERT,
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_ctloutput = rip_ctloutput,
- .pr_usrreq = divert_usrreq,
- .pr_attach = divert_attach,
- .pr_detach = divert_detach,
+ .pr_usrreqs = &divert_usrreqs,
.pr_init = divert_init,
.pr_sysctl = divert_sysctl
},
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = ip_etherip_input,
.pr_ctloutput = rip_ctloutput,
- .pr_usrreq = rip_usrreq,
- .pr_attach = rip_attach,
- .pr_detach = rip_detach,
+ .pr_usrreqs = &rip_usrreqs,
.pr_sysctl = etherip_sysctl
},
#endif /* NETHERIP */
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = rip_input,
.pr_ctloutput = rip_ctloutput,
- .pr_usrreq = rip_usrreq,
- .pr_attach = rip_attach,
- .pr_detach = rip_detach,
+ .pr_usrreqs = &rip_usrreqs,
.pr_init = rip_init
}
};
-/* $OpenBSD: ip_divert.c,v 1.68 2022/05/09 19:33:46 bluhm Exp $ */
+/* $OpenBSD: ip_divert.c,v 1.69 2022/08/15 09:11:39 mvs Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
{ DIVERTCTL_SENDSPACE, &divert_sendspace, 0, INT_MAX },
};
+const struct pr_usrreqs divert_usrreqs = {
+ .pru_usrreq = divert_usrreq,
+ .pru_attach = divert_attach,
+ .pru_detach = divert_detach,
+};
+
int divbhashsize = DIVERTHASHSIZE;
int divert_output(struct inpcb *, struct mbuf *, struct mbuf *,
-/* $OpenBSD: ip_divert.h,v 1.15 2022/05/05 16:44:22 bluhm Exp $ */
+/* $OpenBSD: ip_divert.h,v 1.16 2022/08/15 09:11:39 mvs Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
extern struct inpcbtable divbtable;
+extern const struct pr_usrreqs divert_usrreqs;
+
void divert_init(void);
void divert_packet(struct mbuf *, int, u_int16_t);
int divert_sysctl(int *, u_int, void *, size_t *, void *, size_t);
-/* $OpenBSD: ip_gre.c,v 1.74 2022/06/26 15:50:21 mvs Exp $ */
+/* $OpenBSD: ip_gre.c,v 1.75 2022/08/15 09:11:39 mvs Exp $ */
/* $NetBSD: ip_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
/*
#include <netinet/in.h>
#include <netinet/ip.h>
+#include <netinet/ip_gre.h>
#include <netinet/ip_var.h>
#include <netinet/in_pcb.h>
#include <net/pipex.h>
#endif
+const struct pr_usrreqs gre_usrreqs = {
+ .pru_usrreq = gre_usrreq,
+ .pru_attach = rip_attach,
+ .pru_detach = rip_detach,
+};
+
int
gre_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
struct mbuf *control, struct proc *p)
-/* $OpenBSD: ip_gre.h,v 1.16 2022/02/25 23:51:03 guenther Exp $ */
+/* $OpenBSD: ip_gre.h,v 1.17 2022/08/15 09:11:39 mvs Exp $ */
/* $NetBSD: ip_gre.h,v 1.3 1998/10/07 23:33:02 thorpej Exp $ */
/*
}
#ifdef _KERNEL
+
+extern const struct pr_usrreqs gre_usrreqs;
+
int gre_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
#endif /* _KERNEL */
#endif /* _NETINET_IP_GRE_H_ */
-/* $OpenBSD: ip_var.h,v 1.96 2022/08/12 14:49:15 bluhm Exp $ */
+/* $OpenBSD: ip_var.h,v 1.97 2022/08/15 09:11:39 mvs Exp $ */
/* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */
/*
extern int ipmultipath; /* enable multipath routing */
extern int la_hold_total;
+extern const struct pr_usrreqs rip_usrreqs;
+
extern struct rttimer_queue ip_mtudisc_timeout_q;
extern struct pool ipqent_pool;
struct route;
-/* $OpenBSD: raw_ip.c,v 1.129 2022/08/06 15:57:59 bluhm Exp $ */
+/* $OpenBSD: raw_ip.c,v 1.130 2022/08/15 09:11:39 mvs Exp $ */
/* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */
/*
* Raw interface to IP protocol.
*/
+const struct pr_usrreqs rip_usrreqs = {
+ .pru_usrreq = rip_usrreq,
+ .pru_attach = rip_attach,
+ .pru_detach = rip_detach,
+};
+
/*
* Initialize raw connection block q.
*/
-/* $OpenBSD: tcp_usrreq.c,v 1.186 2022/08/13 19:13:45 bluhm Exp $ */
+/* $OpenBSD: tcp_usrreq.c,v 1.187 2022/08/15 09:11:39 mvs Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
u_int tcp_recvspace = TCP_RECVSPACE;
u_int tcp_autorcvbuf_inc = 16 * 1024;
+const struct pr_usrreqs tcp_usrreqs = {
+ .pru_usrreq = tcp_usrreq,
+ .pru_attach = tcp_attach,
+ .pru_detach = tcp_detach,
+};
+
static int pr_slowhz = PR_SLOWHZ;
const struct sysctl_bounded_args tcpctl_vars[] = {
{ TCPCTL_SLOWHZ, &pr_slowhz, SYSCTL_INT_READONLY },
-/* $OpenBSD: tcp_var.h,v 1.140 2022/08/11 09:13:21 claudio Exp $ */
+/* $OpenBSD: tcp_var.h,v 1.141 2022/08/15 09:11:39 mvs Exp $ */
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
/*
counters_pkt(tcpcounters, pcounter, bcounter, v);
}
+extern const struct pr_usrreqs tcp_usrreqs;
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.281 2022/08/08 12:06:30 bluhm Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.282 2022/08/15 09:11:39 mvs Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
u_int udp_recvspace = 40 * (1024 + sizeof(struct sockaddr_in));
/* 40 1K datagrams */
+const struct pr_usrreqs udp_usrreqs = {
+ .pru_usrreq = udp_usrreq,
+ .pru_attach = udp_attach,
+ .pru_detach = udp_detach,
+};
+
const struct sysctl_bounded_args udpctl_vars[] = {
{ UDPCTL_CHECKSUM, &udpcksum, 0, 1 },
{ UDPCTL_RECVSPACE, &udp_recvspace, 0, INT_MAX },
-/* $OpenBSD: udp_var.h,v 1.37 2022/02/25 23:51:03 guenther Exp $ */
+/* $OpenBSD: udp_var.h,v 1.38 2022/08/15 09:11:39 mvs Exp $ */
/* $NetBSD: udp_var.h,v 1.12 1996/02/13 23:44:41 christos Exp $ */
/*
extern struct inpcbtable udbtable;
extern struct udpstat udpstat;
+extern const struct pr_usrreqs udp_usrreqs;
+
#ifdef INET6
void udp6_ctlinput(int, struct sockaddr *, u_int, void *);
#endif /* INET6 */
-/* $OpenBSD: in6_proto.c,v 1.109 2022/02/25 23:51:04 guenther Exp $ */
+/* $OpenBSD: in6_proto.c,v 1.110 2022/08/15 09:11:39 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_usrreq = udp_usrreq,
- .pr_attach = udp_attach,
- .pr_detach = udp_detach,
+ .pr_usrreqs = &udp_usrreqs,
.pr_sysctl = udp_sysctl
},
{
.pr_input = tcp_input,
.pr_ctlinput = tcp6_ctlinput,
.pr_ctloutput = tcp_ctloutput,
- .pr_usrreq = tcp_usrreq,
- .pr_attach = tcp_attach,
- .pr_detach = tcp_detach,
+ .pr_usrreqs = &tcp_usrreqs,
.pr_sysctl = tcp_sysctl
},
{
.pr_input = rip6_input,
.pr_ctlinput = rip6_ctlinput,
.pr_ctloutput = rip6_ctloutput,
- .pr_usrreq = rip6_usrreq,
- .pr_attach = rip6_attach,
- .pr_detach = rip6_detach,
+ .pr_usrreqs = &rip6_usrreqs,
.pr_sysctl = rip6_sysctl
},
{
.pr_input = icmp6_input,
.pr_ctlinput = rip6_ctlinput,
.pr_ctloutput = rip6_ctloutput,
- .pr_usrreq = rip6_usrreq,
- .pr_attach = rip6_attach,
- .pr_detach = rip6_detach,
+ .pr_usrreqs = &rip6_usrreqs,
.pr_init = icmp6_init,
.pr_fasttimo = icmp6_fasttimo,
.pr_sysctl = icmp6_sysctl
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = ah46_input,
.pr_ctloutput = rip6_ctloutput,
- .pr_usrreq = rip6_usrreq,
- .pr_attach = rip6_attach,
- .pr_detach = rip6_detach,
+ .pr_usrreqs = &rip6_usrreqs,
.pr_sysctl = ah_sysctl
},
{
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = esp46_input,
.pr_ctloutput = rip6_ctloutput,
- .pr_usrreq = rip6_usrreq,
- .pr_attach = rip6_attach,
- .pr_detach = rip6_detach,
+ .pr_usrreqs = &rip6_usrreqs,
.pr_sysctl = esp_sysctl
},
{
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = ipcomp46_input,
.pr_ctloutput = rip6_ctloutput,
- .pr_usrreq = rip6_usrreq,
- .pr_attach = rip6_attach,
- .pr_detach = rip6_detach,
+ .pr_usrreqs = &rip6_usrreqs,
.pr_sysctl = ipcomp_sysctl
},
#endif /* IPSEC */
.pr_input = ipip_input,
#endif
.pr_ctloutput = rip6_ctloutput,
- .pr_usrreq = rip6_usrreq, /* XXX */
- .pr_attach = rip6_attach,
- .pr_detach = rip6_detach,
+ .pr_usrreqs = &rip6_usrreqs, /* XXX */
},
{
.pr_type = SOCK_RAW,
.pr_input = ipip_input,
#endif
.pr_ctloutput = rip6_ctloutput,
- .pr_usrreq = rip6_usrreq, /* XXX */
- .pr_attach = rip6_attach,
- .pr_detach = rip6_detach,
+ .pr_usrreqs = &rip6_usrreqs, /* XXX */
},
#if defined(MPLS) && NGIF > 0
{
.pr_input = ipip_input,
#endif
.pr_ctloutput = rip6_ctloutput,
- .pr_usrreq = rip6_usrreq, /* XXX */
- .pr_attach = rip6_attach,
- .pr_detach = rip6_detach,
+ .pr_usrreqs = &rip6_usrreqs, /* XXX */
},
#endif /* MPLS */
#if NCARP > 0
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = carp6_proto_input,
.pr_ctloutput = rip6_ctloutput,
- .pr_usrreq = rip6_usrreq,
- .pr_attach = rip6_attach,
- .pr_detach = rip6_detach,
+ .pr_usrreqs = &rip6_usrreqs,
.pr_sysctl = carp_sysctl
},
#endif /* NCARP */
.pr_protocol = IPPROTO_DIVERT,
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_ctloutput = rip6_ctloutput,
- .pr_usrreq = divert6_usrreq,
- .pr_attach = divert6_attach,
- .pr_detach = divert6_detach,
+ .pr_usrreqs = &divert6_usrreqs,
.pr_init = divert6_init,
.pr_sysctl = divert6_sysctl
},
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = ip6_etherip_input,
.pr_ctloutput = rip6_ctloutput,
- .pr_usrreq = rip6_usrreq,
- .pr_attach = rip6_attach,
- .pr_detach = rip6_detach,
+ .pr_usrreqs = &rip6_usrreqs,
},
#endif /* NETHERIP */
#if NGRE > 0
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = gre_input6,
.pr_ctloutput = rip6_ctloutput,
- .pr_usrreq = rip6_usrreq,
- .pr_attach = rip6_attach,
- .pr_detach = rip6_detach,
+ .pr_usrreqs = &rip6_usrreqs,
},
#endif /* NGRE */
{
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = rip6_input,
.pr_ctloutput = rip6_ctloutput,
- .pr_usrreq = rip6_usrreq,
- .pr_attach = rip6_attach,
- .pr_detach = rip6_detach,
+ .pr_usrreqs = &rip6_usrreqs,
.pr_init = rip6_init
}
};
-/* $OpenBSD: ip6_divert.c,v 1.67 2022/05/09 19:33:46 bluhm Exp $ */
+/* $OpenBSD: ip6_divert.c,v 1.68 2022/08/15 09:11:39 mvs Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
{ DIVERT6CTL_SENDSPACE, &divert6_sendspace, 0, INT_MAX },
};
+const struct pr_usrreqs divert6_usrreqs = {
+ .pru_usrreq = divert6_usrreq,
+ .pru_attach = divert6_attach,
+ .pru_detach = divert6_detach,
+};
+
int divb6hashsize = DIVERTHASHSIZE;
int divert6_output(struct inpcb *, struct mbuf *, struct mbuf *,
-/* $OpenBSD: ip6_divert.h,v 1.13 2022/05/05 16:44:22 bluhm Exp $ */
+/* $OpenBSD: ip6_divert.h,v 1.14 2022/08/15 09:11:39 mvs Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
extern struct inpcbtable divb6table;
+extern const struct pr_usrreqs divert6_usrreqs;
+
void divert6_init(void);
void divert6_packet(struct mbuf *, int, u_int16_t);
int divert6_sysctl(int *, u_int, void *, size_t *, void *, size_t);
-/* $OpenBSD: ip6_var.h,v 1.94 2022/08/12 14:49:15 bluhm Exp $ */
+/* $OpenBSD: ip6_var.h,v 1.95 2022/08/15 09:11:39 mvs Exp $ */
/* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */
/*
#define IP6_SOIIKEY_LEN 16
extern uint8_t ip6_soiikey[IP6_SOIIKEY_LEN];
+extern const struct pr_usrreqs rip6_usrreqs;
+
struct in6pcb;
struct inpcb;
-/* $OpenBSD: raw_ip6.c,v 1.149 2022/08/08 12:06:31 bluhm Exp $ */
+/* $OpenBSD: raw_ip6.c,v 1.150 2022/08/15 09:11:39 mvs Exp $ */
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
struct cpumem *rip6counters;
+const struct pr_usrreqs rip6_usrreqs = {
+ .pru_usrreq = rip6_usrreq,
+ .pru_attach = rip6_attach,
+ .pru_detach = rip6_detach,
+};
+
/*
* Initialize raw connection block queue.
*/
-/* $OpenBSD: protosw.h,v 1.36 2022/08/13 21:01:46 mvs Exp $ */
+/* $OpenBSD: protosw.h,v 1.37 2022/08/15 09:11:39 mvs Exp $ */
/* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */
/*-
struct domain;
struct proc;
+struct pr_usrreqs {
+ /* user request: see list below */
+ int (*pru_usrreq)(struct socket *, int, struct mbuf *,
+ struct mbuf *, struct mbuf *, struct proc *);
+
+ int (*pru_attach)(struct socket *, int);
+ int (*pru_detach)(struct socket *);
+};
+
struct protosw {
short pr_type; /* socket type used for */
const struct domain *pr_domain; /* domain protocol a member of */
/* control output (from above) */
int (*pr_ctloutput)(int, struct socket *, int, int, struct mbuf *);
-/* user-protocol hook */
- /* user request: see list below */
- int (*pr_usrreq)(struct socket *, int, struct mbuf *,
- struct mbuf *, struct mbuf *, struct proc *);
-
- int (*pr_attach)(struct socket *, int);
- int (*pr_detach)(struct socket *);
-
+/* user-protocol hooks */
+ const struct pr_usrreqs *pr_usrreqs;
+
/* utility hooks */
void (*pr_init)(void); /* initialization hook */
void (*pr_fasttimo)(void); /* fast timeout (200ms) */
static inline int
pru_attach(struct socket *so, int proto)
{
- return (*so->so_proto->pr_attach)(so, proto);
+ return (*so->so_proto->pr_usrreqs->pru_attach)(so, proto);
}
static inline int
pru_detach(struct socket *so)
{
- return (*so->so_proto->pr_detach)(so);
+ return (*so->so_proto->pr_usrreqs->pru_detach)(so);
}
static inline int
pru_bind(struct socket *so, struct mbuf *nam, struct proc *p)
{
- return (*so->so_proto->pr_usrreq)(so,
+ return (*so->so_proto->pr_usrreqs->pru_usrreq)(so,
PRU_BIND, NULL, nam, NULL, p);
}
static inline int
pru_listen(struct socket *so)
{
- return (*so->so_proto->pr_usrreq)(so,
+ return (*so->so_proto->pr_usrreqs->pru_usrreq)(so,
PRU_LISTEN, NULL, NULL, NULL, curproc);
}
static inline int
pru_connect(struct socket *so, struct mbuf *nam)
{
- return (*so->so_proto->pr_usrreq)(so,
+ return (*so->so_proto->pr_usrreqs->pru_usrreq)(so,
PRU_CONNECT, NULL, nam, NULL, curproc);
}
static inline int
pru_accept(struct socket *so, struct mbuf *nam)
{
- return (*so->so_proto->pr_usrreq)(so,
+ return (*so->so_proto->pr_usrreqs->pru_usrreq)(so,
PRU_ACCEPT, NULL, nam, NULL, curproc);
}
static inline int
pru_disconnect(struct socket *so)
{
- return (*so->so_proto->pr_usrreq)(so,
+ return (*so->so_proto->pr_usrreqs->pru_usrreq)(so,
PRU_DISCONNECT, NULL, NULL, NULL, curproc);
}
static inline int
pru_shutdown(struct socket *so)
{
- return (*so->so_proto->pr_usrreq)(so,
+ return (*so->so_proto->pr_usrreqs->pru_usrreq)(so,
PRU_SHUTDOWN, NULL, NULL, NULL, curproc);
}
static inline int
pru_rcvd(struct socket *so, int flags)
{
- return (*so->so_proto->pr_usrreq)(so,
+ return (*so->so_proto->pr_usrreqs->pru_usrreq)(so,
PRU_RCVD, NULL, (struct mbuf *)(long)flags, NULL, curproc);
}
pru_send(struct socket *so, struct mbuf *top, struct mbuf *addr,
struct mbuf *control)
{
- return (*so->so_proto->pr_usrreq)(so,
+ return (*so->so_proto->pr_usrreqs->pru_usrreq)(so,
PRU_SEND, top, addr, control, curproc);
}
static inline int
pru_abort(struct socket *so)
{
- return (*so->so_proto->pr_usrreq)(so,
+ return (*so->so_proto->pr_usrreqs->pru_usrreq)(so,
PRU_ABORT, NULL, NULL, NULL, curproc);
}
pru_control(struct socket *so, u_long cmd, caddr_t data,
struct ifnet *ifp, struct proc *p)
{
- return (*so->so_proto->pr_usrreq)(so,
+ return (*so->so_proto->pr_usrreqs->pru_usrreq)(so,
PRU_CONTROL, (struct mbuf *)cmd, (struct mbuf *)data,
(struct mbuf *)ifp, p);
}
static inline int
pru_sense(struct socket *so, struct stat *ub)
{
- return (*so->so_proto->pr_usrreq)(so,
+ return (*so->so_proto->pr_usrreqs->pru_usrreq)(so,
PRU_SENSE, (struct mbuf *)ub, NULL, NULL, curproc);
}
static inline int
pru_rcvoob(struct socket *so, struct mbuf *m, int flags)
{
- return (*so->so_proto->pr_usrreq)(so,
+ return (*so->so_proto->pr_usrreqs->pru_usrreq)(so,
PRU_RCVOOB, m, (struct mbuf *)(long)flags, NULL, curproc);
}
pru_sendoob(struct socket *so, struct mbuf *top, struct mbuf *addr,
struct mbuf *control)
{
- return (*so->so_proto->pr_usrreq)(so,
+ return (*so->so_proto->pr_usrreqs->pru_usrreq)(so,
PRU_SENDOOB, top, addr, control, curproc);
}
static inline int
pru_sockaddr(struct socket *so, struct mbuf *addr)
{
- return (*so->so_proto->pr_usrreq)(so,
+ return (*so->so_proto->pr_usrreqs->pru_usrreq)(so,
PRU_SOCKADDR, NULL, addr, NULL, curproc);
}
static inline int
pru_peeraddr(struct socket *so, struct mbuf *addr)
{
- return (*so->so_proto->pr_usrreq)(so,
+ return (*so->so_proto->pr_usrreqs->pru_usrreq)(so,
PRU_PEERADDR, NULL, addr, NULL, curproc);
}
static inline int
pru_connect2(struct socket *so1, struct socket *so2)
{
- return (*so1->so_proto->pr_usrreq)(so1,
+ return (*so1->so_proto->pr_usrreqs->pru_usrreq)(so1,
PRU_CONNECT2, NULL, (struct mbuf *)so2, NULL, curproc);
}
-/* $OpenBSD: unpcb.h,v 1.26 2022/07/01 09:56:17 mvs Exp $ */
+/* $OpenBSD: unpcb.h,v 1.27 2022/08/15 09:11:39 mvs Exp $ */
/* $NetBSD: unpcb.h,v 1.6 1994/06/29 06:46:08 cgd Exp $ */
/*
int flags;
};
+extern const struct pr_usrreqs uipc_usrreqs;
+
int uipc_usrreq(struct socket *, int , struct mbuf *,
struct mbuf *, struct mbuf *, struct proc *);
int uipc_attach(struct socket *, int);