-/* $OpenBSD: sys_socket.c,v 1.48 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: sys_socket.c,v 1.49 2022/02/25 23:51:03 guenther Exp $ */
/* $NetBSD: sys_socket.c,v 1.13 1995/08/12 23:59:09 mycroft Exp $ */
/*
}
if (IOCGROUP(cmd) == 'r')
return (EOPNOTSUPP);
- if (so->so_proto->pr_usrreqs->pru_control == NULL)
- return (EOPNOTSUPP);
KERNEL_LOCK();
- error = ((*so->so_proto->pr_usrreqs->pru_control)(so, cmd,
- data, NULL));
+ error = ((*so->so_proto->pr_usrreq)(so, PRU_CONTROL,
+ (struct mbuf *)cmd, (struct mbuf *)data, NULL, p));
KERNEL_UNLOCK();
break;
}
-/* $OpenBSD: uipc_proto.c,v 1.21 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: uipc_proto.c,v 1.22 2022/02/25 23:51:03 guenther Exp $ */
/* $NetBSD: uipc_proto.c,v 1.8 1996/02/13 21:10:47 christos Exp $ */
/*-
.pr_protocol = PF_UNIX,
.pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_RIGHTS,
.pr_usrreq = uipc_usrreq,
- .pr_usrreqs = &uipc_usrreqs,
+ .pr_attach = uipc_attach,
+ .pr_detach = uipc_detach,
},
{
.pr_type = SOCK_SEQPACKET,
.pr_protocol = PF_UNIX,
.pr_flags = PR_ATOMIC|PR_CONNREQUIRED|PR_WANTRCVD|PR_RIGHTS,
.pr_usrreq = uipc_usrreq,
- .pr_usrreqs = &uipc_usrreqs,
+ .pr_attach = uipc_attach,
+ .pr_detach = uipc_detach,
},
{
.pr_type = SOCK_DGRAM,
.pr_protocol = PF_UNIX,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_RIGHTS,
.pr_usrreq = uipc_usrreq,
- .pr_usrreqs = &uipc_usrreqs,
+ .pr_attach = uipc_attach,
+ .pr_detach = uipc_detach,
}
};
-/* $OpenBSD: uipc_socket.c,v 1.274 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.275 2022/02/25 23:51:03 guenther 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_usrreqs->pru_attach == NULL)
+ if (prp == NULL || prp->pr_attach == NULL)
return (EPROTONOSUPPORT);
if (prp->pr_type != type)
return (EPROTOTYPE);
so->so_rcv.sb_timeo_nsecs = INFSLP;
s = solock(so);
- error = (*prp->pr_usrreqs->pru_attach)(so, proto);
+ error = (*prp->pr_attach)(so, proto);
if (error) {
so->so_state |= SS_NOFDREF;
/* sofree() calls sounlock(). */
drop:
if (so->so_pcb) {
int error2;
- KASSERT(so->so_proto->pr_usrreqs->pru_detach != NULL);
- error2 = (*so->so_proto->pr_usrreqs->pru_detach)(so);
+ KASSERT(so->so_proto->pr_detach);
+ error2 = (*so->so_proto->pr_detach)(so);
if (error == 0)
error = error2;
}
-/* $OpenBSD: uipc_socket2.c,v 1.119 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: uipc_socket2.c,v 1.120 2022/02/25 23:51:03 guenther Exp $ */
/* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */
/*
/*
* XXXSMP as long as `so' and `head' share the same lock, we
- * can call soreserve() and pru_attach() below w/o explicitly
+ * can call soreserve() and pr_attach() below w/o explicitly
* locking `so'.
*/
soassertlocked(head);
sigio_copy(&so->so_sigio, &head->so_sigio);
soqinsque(head, so, soqueue);
- if ((*so->so_proto->pr_usrreqs->pru_attach)(so, 0)) {
+ if ((*so->so_proto->pr_attach)(so, 0)) {
(void) soqremque(so, soqueue);
sigio_free(&so->so_sigio);
klist_free(&so->so_rcv.sb_sel.si_note);
-/* $OpenBSD: uipc_usrreq.c,v 1.162 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: uipc_usrreq.c,v 1.163 2022/02/25 23:51:03 guenther 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;
return (0);
}
-const struct pr_usrreqs uipc_usrreqs = {
- .pru_attach = uipc_attach,
- .pru_detach = uipc_detach,
-};
-
int
uipc_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
size_t newlen)
-/* $OpenBSD: if.c,v 1.648 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: if.c,v 1.649 2022/02/25 23:51:03 guenther Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
break;
/* FALLTHROUGH */
default:
- if (so->so_proto->pr_usrreqs->pru_control != NULL) {
- error = ((*so->so_proto->pr_usrreqs->pru_control)(so,
- cmd, data, ifp));
- if (error != EOPNOTSUPP)
- break;
- }
+ error = ((*so->so_proto->pr_usrreq)(so, PRU_CONTROL,
+ (struct mbuf *) cmd, (struct mbuf *) data,
+ (struct mbuf *) ifp, p));
+ if (error != EOPNOTSUPP)
+ break;
switch (cmd) {
case SIOCAIFADDR:
case SIOCDIFADDR:
-/* $OpenBSD: pfkeyv2.c,v 1.230 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: pfkeyv2.c,v 1.231 2022/02/25 23:51:03 guenther Exp $ */
/*
* @(#)COPYRIGHT 1.1 (NRL) 17 January 1995
return (0);
}
-const struct pr_usrreqs pfkeyv2_usrreqs = {
- .pru_attach = pfkeyv2_attach,
- .pru_detach = pfkeyv2_detach,
-};
-
const struct protosw pfkeysw[] = {
{
.pr_type = SOCK_RAW,
.pr_flags = PR_ATOMIC | PR_ADDR,
.pr_output = pfkeyv2_output,
.pr_usrreq = pfkeyv2_usrreq,
- .pr_usrreqs = &pfkeyv2_usrreqs,
+ .pr_attach = pfkeyv2_attach,
+ .pr_detach = pfkeyv2_detach,
.pr_sysctl = pfkeyv2_sysctl,
}
};
struct pkpcb *kp;
int error = 0;
+ if (req == PRU_CONTROL)
+ return (EOPNOTSUPP);
+
soassertlocked(so);
if (control && control->m_len) {
-/* $OpenBSD: rtsock.c,v 1.325 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: rtsock.c,v 1.326 2022/02/25 23:51:03 guenther 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) {
* Definitions of protocols supported in the ROUTE domain.
*/
-const struct pr_usrreqs route_usrreqs = {
- .pru_attach = route_attach,
- .pru_detach = route_detach,
-};
-
const struct protosw routesw[] = {
{
.pr_type = SOCK_RAW,
.pr_output = route_output,
.pr_ctloutput = route_ctloutput,
.pr_usrreq = route_usrreq,
- .pr_usrreqs = &route_usrreqs,
+ .pr_attach = route_attach,
+ .pr_detach = route_detach,
.pr_init = route_prinit,
.pr_sysctl = sysctl_rtable
}
-/* $OpenBSD: in_proto.c,v 1.97 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: in_proto.c,v 1.98 2022/02/25 23:51:03 guenther Exp $ */
/* $NetBSD: in_proto.c,v 1.14 1996/02/18 18:58:32 christos Exp $ */
/*
.pr_ctlinput = udp_ctlinput,
.pr_ctloutput = ip_ctloutput,
.pr_usrreq = udp_usrreq,
- .pr_usrreqs = &udp_usrreqs,
+ .pr_attach = udp_attach,
+ .pr_detach = udp_detach,
.pr_init = udp_init,
.pr_sysctl = udp_sysctl
},
.pr_ctlinput = tcp_ctlinput,
.pr_ctloutput = tcp_ctloutput,
.pr_usrreq = tcp_usrreq,
- .pr_usrreqs = &tcp_usrreqs,
+ .pr_attach = tcp_attach,
+ .pr_detach = tcp_detach,
.pr_init = tcp_init,
.pr_slowtimo = tcp_slowtimo,
.pr_sysctl = tcp_sysctl
.pr_input = rip_input,
.pr_ctloutput = rip_ctloutput,
.pr_usrreq = rip_usrreq,
- .pr_usrreqs = &rip_usrreqs,
+ .pr_attach = rip_attach,
+ .pr_detach = rip_detach,
},
{
.pr_type = SOCK_RAW,
.pr_input = icmp_input,
.pr_ctloutput = rip_ctloutput,
.pr_usrreq = rip_usrreq,
- .pr_usrreqs = &rip_usrreqs,
+ .pr_attach = rip_attach,
+ .pr_detach = rip_detach,
.pr_init = icmp_init,
.pr_sysctl = icmp_sysctl
},
#endif
.pr_ctloutput = rip_ctloutput,
.pr_usrreq = rip_usrreq,
- .pr_usrreqs = &rip_usrreqs,
+ .pr_attach = rip_attach,
+ .pr_detach = rip_detach,
.pr_sysctl = ipip_sysctl,
.pr_init = ipip_init
},
#endif
.pr_ctloutput = rip_ctloutput,
.pr_usrreq = rip_usrreq, /* XXX */
- .pr_usrreqs = &rip_usrreqs,
+ .pr_attach = rip_attach,
+ .pr_detach = rip_detach,
},
#endif
#if defined(MPLS) && NGIF > 0
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = in_gif_input,
.pr_usrreq = rip_usrreq,
- .pr_usrreqs = &rip_usrreqs,
+ .pr_attach = rip_attach,
+ .pr_detach = rip_detach,
},
#endif /* MPLS && GIF */
{
.pr_input = igmp_input,
.pr_ctloutput = rip_ctloutput,
.pr_usrreq = rip_usrreq,
- .pr_usrreqs = &rip_usrreqs,
+ .pr_attach = rip_attach,
+ .pr_detach = rip_detach,
.pr_init = igmp_init,
.pr_fasttimo = igmp_fasttimo,
.pr_slowtimo = igmp_slowtimo,
.pr_ctlinput = ah4_ctlinput,
.pr_ctloutput = rip_ctloutput,
.pr_usrreq = rip_usrreq,
- .pr_usrreqs = &rip_usrreqs,
+ .pr_attach = rip_attach,
+ .pr_detach = rip_detach,
.pr_sysctl = ah_sysctl
},
{
.pr_ctlinput = esp4_ctlinput,
.pr_ctloutput = rip_ctloutput,
.pr_usrreq = rip_usrreq,
- .pr_usrreqs = &rip_usrreqs,
+ .pr_attach = rip_attach,
+ .pr_detach = rip_detach,
.pr_sysctl = esp_sysctl
},
{
.pr_input = ipcomp46_input,
.pr_ctloutput = rip_ctloutput,
.pr_usrreq = rip_usrreq,
- .pr_usrreqs = &rip_usrreqs,
+ .pr_attach = rip_attach,
+ .pr_detach = rip_detach,
.pr_sysctl = ipcomp_sysctl
},
#endif /* IPSEC */
.pr_input = gre_input,
.pr_ctloutput = rip_ctloutput,
.pr_usrreq = gre_usrreq,
- .pr_usrreqs = &gre_usrreqs,
+ .pr_attach = rip_attach,
+ .pr_detach = rip_detach,
.pr_sysctl = gre_sysctl
},
#endif /* NGRE > 0 */
.pr_input = carp_proto_input,
.pr_ctloutput = rip_ctloutput,
.pr_usrreq = rip_usrreq,
- .pr_usrreqs = &rip_usrreqs,
+ .pr_attach = rip_attach,
+ .pr_detach = rip_detach,
.pr_sysctl = carp_sysctl
},
#endif /* NCARP > 0 */
.pr_input = pfsync_input,
.pr_ctloutput = rip_ctloutput,
.pr_usrreq = rip_usrreq,
- .pr_usrreqs = &rip_usrreqs,
+ .pr_attach = rip_attach,
+ .pr_detach = rip_detach,
.pr_sysctl = pfsync_sysctl
},
#endif /* NPFSYNC > 0 */
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_ctloutput = rip_ctloutput,
.pr_usrreq = divert_usrreq,
- .pr_usrreqs = &divert_usrreqs,
+ .pr_attach = divert_attach,
+ .pr_detach = divert_detach,
.pr_init = divert_init,
.pr_sysctl = divert_sysctl
},
.pr_input = ip_etherip_input,
.pr_ctloutput = rip_ctloutput,
.pr_usrreq = rip_usrreq,
- .pr_usrreqs = &rip_usrreqs,
+ .pr_attach = rip_attach,
+ .pr_detach = rip_detach,
.pr_sysctl = etherip_sysctl
},
#endif /* NETHERIP */
.pr_input = rip_input,
.pr_ctloutput = rip_ctloutput,
.pr_usrreq = rip_usrreq,
- .pr_usrreqs = &rip_usrreqs,
+ .pr_attach = rip_attach,
+ .pr_detach = rip_detach,
.pr_init = rip_init
}
};
-/* $OpenBSD: ip_divert.c,v 1.65 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: ip_divert.c,v 1.66 2022/02/25 23:51:03 guenther Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
#include <net/pfvar.h>
-int divert_attach(struct socket *, int);
-int divert_detach(struct socket *);
-
struct inpcbtable divbtable;
struct cpumem *divcounters;
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) {
return (0);
}
-const struct pr_usrreqs divert_usrreqs = {
- .pru_attach = divert_attach,
- .pru_detach = divert_detach,
- .pru_control = in_control,
-};
-
int
divert_sysctl_divstat(void *oldp, size_t *oldlenp, void *newp)
{
-/* $OpenBSD: ip_divert.h,v 1.13 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: ip_divert.h,v 1.14 2022/02/25 23:51:03 guenther Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
int divert_sysctl(int *, u_int, void *, size_t *, void *, size_t);
int divert_usrreq(struct socket *,
int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
-
-extern const struct pr_usrreqs divert_usrreqs;
+int divert_attach(struct socket *, int);
+int divert_detach(struct socket *);
#endif /* _KERNEL */
#endif /* _IP_DIVERT_H_ */
-/* $OpenBSD: ip_gre.c,v 1.72 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: ip_gre.c,v 1.73 2022/02/25 23:51:03 guenther Exp $ */
/* $NetBSD: ip_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
/*
#endif
return rip_usrreq(so, req, m, nam, control, p);
}
-
-const struct pr_usrreqs gre_usrreqs = {
- .pru_attach = rip_attach,
- .pru_detach = rip_detach,
-};
#endif /* if NGRE > 0 */
-/* $OpenBSD: ip_gre.h,v 1.15 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: ip_gre.h,v 1.16 2022/02/25 23:51:03 guenther Exp $ */
/* $NetBSD: ip_gre.h,v 1.3 1998/10/07 23:33:02 thorpej Exp $ */
/*
#ifdef _KERNEL
int gre_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
-
-extern const struct pr_usrreqs gre_usrreqs;
#endif /* _KERNEL */
#endif /* _NETINET_IP_GRE_H_ */
-/* $OpenBSD: ip_var.h,v 1.89 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: ip_var.h,v 1.90 2022/02/25 23:51:03 guenther Exp $ */
/* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */
/*
int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
int rip_attach(struct socket *, int);
int rip_detach(struct socket *);
-
-extern const struct pr_usrreqs rip_usrreqs;
-
#ifdef MROUTING
extern struct socket *ip_mrouter[]; /* multicast routing daemon */
#endif
-/* $OpenBSD: raw_ip.c,v 1.120 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: raw_ip.c,v 1.121 2022/02/25 23:51:03 guenther Exp $ */
/* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */
/*
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);
return (0);
}
-
-const struct pr_usrreqs rip_usrreqs = {
- .pru_attach = rip_attach,
- .pru_detach = rip_detach,
- .pru_control = in_control,
-};
-/* $OpenBSD: tcp_usrreq.c,v 1.182 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: tcp_usrreq.c,v 1.183 2022/02/25 23:51:03 guenther Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
#include <netinet6/in6_var.h>
#endif
-int tcp_attach(struct socket *, int);
-int tcp_detach(struct socket *);
-
#ifndef TCP_SENDSPACE
#define TCP_SENDSPACE 1024*16
#endif
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) {
return (error);
}
-const struct pr_usrreqs tcp_usrreqs = {
- .pru_attach = tcp_attach,
- .pru_detach = tcp_detach,
- .pru_control = in_control,
-};
-#ifdef INET6
-const struct pr_usrreqs tcp6_usrreqs = {
- .pru_attach = tcp_attach,
- .pru_detach = tcp_detach,
- .pru_control = in6_control,
-};
-#endif
-
/*
* Initiate (or continue) disconnect.
* If embryonic state, just send reset (once).
-/* $OpenBSD: tcp_var.h,v 1.138 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: tcp_var.h,v 1.139 2022/02/25 23:51:03 guenther Exp $ */
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
/*
int tcp_sysctl(int *, u_int, void *, size_t *, void *, size_t);
int tcp_usrreq(struct socket *,
int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
+int tcp_attach(struct socket *, int);
+int tcp_detach(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);
}
#endif
-extern const struct pr_usrreqs tcp_usrreqs;
-#ifdef INET6
-extern const struct pr_usrreqs tcp6_usrreqs;
-#endif
-
#endif /* _KERNEL */
#endif /* _NETINET_TCP_VAR_H_ */
-/* $OpenBSD: udp_usrreq.c,v 1.270 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.271 2022/02/25 23:51:03 guenther Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
#include <net/pipex.h>
#endif
-int udp_attach(struct socket *, int);
-int udp_detach(struct socket *);
-
/*
* UDP protocol implementation.
* Per RFC 768, August, 1980.
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);
return (0);
}
-const struct pr_usrreqs udp_usrreqs = {
- .pru_attach = udp_attach,
- .pru_detach = udp_detach,
- .pru_control = in_control,
-};
-#ifdef INET6
-const struct pr_usrreqs udp6_usrreqs = {
- .pru_attach = udp_attach,
- .pru_detach = udp_detach,
- .pru_control = in6_control,
-};
-#endif
-
/*
* Sysctl for udp variables.
*/
-/* $OpenBSD: udp_var.h,v 1.36 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: udp_var.h,v 1.37 2022/02/25 23:51:03 guenther Exp $ */
/* $NetBSD: udp_var.h,v 1.12 1996/02/13 23:44:41 christos Exp $ */
/*
int udp_sysctl(int *, u_int, void *, size_t *, void *, size_t);
int udp_usrreq(struct socket *,
int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
-
-extern const struct pr_usrreqs udp_usrreqs;
-#ifdef INET6
-extern const struct pr_usrreqs udp6_usrreqs;
-#endif
+int udp_attach(struct socket *, int);
+int udp_detach(struct socket *);
#endif /* _KERNEL */
#endif /* _NETINET_UDP_VAR_H_ */
-/* $OpenBSD: in6.c,v 1.245 2022/02/25 08:33:26 guenther Exp $ */
+/* $OpenBSD: in6.c,v 1.246 2022/02/25 23:51:04 guenther Exp $ */
/* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */
/*
const struct in6_addr in6mask96 = IN6MASK96;
const struct in6_addr in6mask128 = IN6MASK128;
+int in6_ioctl(u_long, caddr_t, struct ifnet *, int);
int in6_ioctl_change_ifaddr(u_long, caddr_t, struct ifnet *);
int in6_ioctl_get(u_long, caddr_t, struct ifnet *);
int in6_check_embed_scope(struct sockaddr_in6 *, unsigned int);
-/* $OpenBSD: in6_proto.c,v 1.108 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: in6_proto.c,v 1.109 2022/02/25 23:51:04 guenther Exp $ */
/* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */
/*
.pr_ctlinput = udp6_ctlinput,
.pr_ctloutput = ip6_ctloutput,
.pr_usrreq = udp_usrreq,
- .pr_usrreqs = &udp6_usrreqs,
+ .pr_attach = udp_attach,
+ .pr_detach = udp_detach,
.pr_sysctl = udp_sysctl
},
{
.pr_ctlinput = tcp6_ctlinput,
.pr_ctloutput = tcp_ctloutput,
.pr_usrreq = tcp_usrreq,
- .pr_usrreqs = &tcp6_usrreqs,
+ .pr_attach = tcp_attach,
+ .pr_detach = tcp_detach,
.pr_sysctl = tcp_sysctl
},
{
.pr_ctlinput = rip6_ctlinput,
.pr_ctloutput = rip6_ctloutput,
.pr_usrreq = rip6_usrreq,
- .pr_usrreqs = &rip6_usrreqs,
+ .pr_attach = rip6_attach,
+ .pr_detach = rip6_detach,
.pr_sysctl = rip6_sysctl
},
{
.pr_ctlinput = rip6_ctlinput,
.pr_ctloutput = rip6_ctloutput,
.pr_usrreq = rip6_usrreq,
- .pr_usrreqs = &rip6_usrreqs,
+ .pr_attach = rip6_attach,
+ .pr_detach = rip6_detach,
.pr_init = icmp6_init,
.pr_fasttimo = icmp6_fasttimo,
.pr_sysctl = icmp6_sysctl
.pr_input = ah46_input,
.pr_ctloutput = rip6_ctloutput,
.pr_usrreq = rip6_usrreq,
- .pr_usrreqs = &rip6_usrreqs,
+ .pr_attach = rip6_attach,
+ .pr_detach = rip6_detach,
.pr_sysctl = ah_sysctl
},
{
.pr_input = esp46_input,
.pr_ctloutput = rip6_ctloutput,
.pr_usrreq = rip6_usrreq,
- .pr_usrreqs = &rip6_usrreqs,
+ .pr_attach = rip6_attach,
+ .pr_detach = rip6_detach,
.pr_sysctl = esp_sysctl
},
{
.pr_input = ipcomp46_input,
.pr_ctloutput = rip6_ctloutput,
.pr_usrreq = rip6_usrreq,
- .pr_usrreqs = &rip6_usrreqs,
+ .pr_attach = rip6_attach,
+ .pr_detach = rip6_detach,
.pr_sysctl = ipcomp_sysctl
},
#endif /* IPSEC */
#endif
.pr_ctloutput = rip6_ctloutput,
.pr_usrreq = rip6_usrreq, /* XXX */
- .pr_usrreqs = &rip6_usrreqs,
+ .pr_attach = rip6_attach,
+ .pr_detach = rip6_detach,
},
{
.pr_type = SOCK_RAW,
#endif
.pr_ctloutput = rip6_ctloutput,
.pr_usrreq = rip6_usrreq, /* XXX */
- .pr_usrreqs = &rip6_usrreqs,
+ .pr_attach = rip6_attach,
+ .pr_detach = rip6_detach,
},
#if defined(MPLS) && NGIF > 0
{
#endif
.pr_ctloutput = rip6_ctloutput,
.pr_usrreq = rip6_usrreq, /* XXX */
- .pr_usrreqs = &rip6_usrreqs,
+ .pr_attach = rip6_attach,
+ .pr_detach = rip6_detach,
},
#endif /* MPLS */
#if NCARP > 0
.pr_input = carp6_proto_input,
.pr_ctloutput = rip6_ctloutput,
.pr_usrreq = rip6_usrreq,
- .pr_usrreqs = &rip6_usrreqs,
+ .pr_attach = rip6_attach,
+ .pr_detach = rip6_detach,
.pr_sysctl = carp_sysctl
},
#endif /* NCARP */
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_ctloutput = rip6_ctloutput,
.pr_usrreq = divert6_usrreq,
- .pr_usrreqs = &divert6_usrreqs,
+ .pr_attach = divert6_attach,
+ .pr_detach = divert6_detach,
.pr_init = divert6_init,
.pr_sysctl = divert6_sysctl
},
.pr_input = ip6_etherip_input,
.pr_ctloutput = rip6_ctloutput,
.pr_usrreq = rip6_usrreq,
- .pr_usrreqs = &rip6_usrreqs,
+ .pr_attach = rip6_attach,
+ .pr_detach = rip6_detach,
},
#endif /* NETHERIP */
#if NGRE > 0
.pr_input = gre_input6,
.pr_ctloutput = rip6_ctloutput,
.pr_usrreq = rip6_usrreq,
- .pr_usrreqs = &rip6_usrreqs,
+ .pr_attach = rip6_attach,
+ .pr_detach = rip6_detach,
},
#endif /* NGRE */
{
.pr_input = rip6_input,
.pr_ctloutput = rip6_ctloutput,
.pr_usrreq = rip6_usrreq,
- .pr_usrreqs = &rip6_usrreqs,
+ .pr_attach = rip6_attach,
+ .pr_detach = rip6_detach,
.pr_init = rip6_init
}
};
-/* $OpenBSD: ip6_divert.c,v 1.64 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: ip6_divert.c,v 1.65 2022/02/25 23:51:04 guenther Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
#include <net/pfvar.h>
-int divert6_attach(struct socket *, int);
-int divert6_detach(struct socket *);
-
struct inpcbtable divb6table;
struct cpumem *div6counters;
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) {
return (0);
}
-const struct pr_usrreqs divert6_usrreqs = {
- .pru_attach = divert6_attach,
- .pru_detach = divert6_detach,
- .pru_control = in6_control,
-};
-
int
divert6_sysctl_div6stat(void *oldp, size_t *oldlenp, void *newp)
{
-/* $OpenBSD: ip6_divert.h,v 1.11 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: ip6_divert.h,v 1.12 2022/02/25 23:51:04 guenther Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
int divert6_sysctl(int *, u_int, void *, size_t *, void *, size_t);
int divert6_usrreq(struct socket *,
int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
-
-extern const struct pr_usrreqs divert6_usrreqs;
+int divert6_attach(struct socket *, int);
+int divert6_detach(struct socket *);
#endif /* _KERNEL */
#endif /* _IP6_DIVERT_H_ */
-/* $OpenBSD: ip6_var.h,v 1.90 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: ip6_var.h,v 1.91 2022/02/25 23:51:04 guenther Exp $ */
/* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */
/*
struct mbuf *);
int rip6_usrreq(struct socket *,
int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
+int rip6_attach(struct socket *, int);
+int rip6_detach(struct socket *);
int rip6_sysctl(int *, u_int, void *, size_t *, void *, size_t);
int dest6_input(struct mbuf **, int *, int, int);
int, int);
#endif /* IPSEC */
-extern const struct pr_usrreqs rip6_usrreqs;
-
#endif /* _KERNEL */
#endif /* !_NETINET6_IP6_VAR_H_ */
-/* $OpenBSD: raw_ip6.c,v 1.140 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: raw_ip6.c,v 1.141 2022/02/25 23:51:04 guenther Exp $ */
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
#include <sys/stdarg.h>
-int rip6_attach(struct socket *, int);
-int rip6_detach(struct socket *);
-
/*
* Raw interface to IP6 protocol.
*/
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);
return (0);
}
-const struct pr_usrreqs rip6_usrreqs = {
- .pru_attach = rip6_attach,
- .pru_detach = rip6_detach,
- .pru_control = in6_control,
-};
-
int
rip6_sysctl_rip6stat(void *oldp, size_t *oldplen, void *newp)
{
-/* $OpenBSD: protosw.h,v 1.34 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: protosw.h,v 1.35 2022/02/25 23:51:04 guenther Exp $ */
/* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */
/*-
struct socket;
struct domain;
struct proc;
-struct pr_usrreqs;
struct protosw {
short pr_type; /* socket type used for */
/* user request: see list below */
int (*pr_usrreq)(struct socket *, int, struct mbuf *,
struct mbuf *, struct mbuf *, struct proc *);
- const struct pr_usrreqs *pr_usrreqs;
+
+ int (*pr_attach)(struct socket *, int);
+ int (*pr_detach)(struct socket *);
/* utility hooks */
void (*pr_init)(void); /* initialization hook */
#endif
#ifdef _KERNEL
-struct ifnet;
-
-struct pr_usrreqs {
- int (*pru_attach)(struct socket *, int _proto);
- int (*pru_detach)(struct socket *);
- int (*pru_control)(struct socket *, u_long _cmd, caddr_t _data,
- struct ifnet *_ifp);
-};
-
+struct sockaddr;
const struct protosw *pffindproto(int, int, int);
const struct protosw *pffindtype(int, int);
void pfctlinput(int, struct sockaddr *);
-/* $OpenBSD: unpcb.h,v 1.24 2022/02/25 08:36:01 guenther Exp $ */
+/* $OpenBSD: unpcb.h,v 1.25 2022/02/25 23:51:04 guenther Exp $ */
/* $NetBSD: unpcb.h,v 1.6 1994/06/29 06:46:08 cgd Exp $ */
/*
int unp_externalize(struct mbuf *, socklen_t, int);
int unp_internalize(struct mbuf *, struct proc *);
void unp_dispose(struct mbuf *);
-
-extern const struct pr_usrreqs uipc_usrreqs;
#endif /* _KERNEL */