diff options
author | 2017-11-23 13:45:46 +0000 | |
---|---|---|
committer | 2017-11-23 13:45:46 +0000 | |
commit | 036aff27650c09ac14152b52ceca955db60c14d8 (patch) | |
tree | ea67779daab2251edae60883ec309c17989e0cf9 | |
parent | We want `sb_flags' to be protected by the socket lock rather than the (diff) | |
download | wireguard-openbsd-036aff27650c09ac14152b52ceca955db60c14d8.tar.xz wireguard-openbsd-036aff27650c09ac14152b52ceca955db60c14d8.zip |
Constify protocol tables and remove an assert now that ip_deliver() is
mp-safe.
ok bluhm@, visa@
-rw-r--r-- | sys/kern/uipc_domain.c | 22 | ||||
-rw-r--r-- | sys/kern/uipc_socket.c | 10 | ||||
-rw-r--r-- | sys/netinet/in_proto.c | 4 | ||||
-rw-r--r-- | sys/netinet/ip_input.c | 8 | ||||
-rw-r--r-- | sys/netinet6/in6_proto.c | 4 | ||||
-rw-r--r-- | sys/netinet6/ip6_input.c | 4 | ||||
-rw-r--r-- | sys/netinet6/ip6protosw.h | 4 | ||||
-rw-r--r-- | sys/sys/domain.h | 4 | ||||
-rw-r--r-- | sys/sys/protosw.h | 8 | ||||
-rw-r--r-- | sys/sys/socketvar.h | 4 |
10 files changed, 35 insertions, 37 deletions
diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c index 522fe1a9f01..102120fc1b6 100644 --- a/sys/kern/uipc_domain.c +++ b/sys/kern/uipc_domain.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_domain.c,v 1.54 2017/10/29 14:56:36 florian Exp $ */ +/* $OpenBSD: uipc_domain.c,v 1.55 2017/11/23 13:45:46 mpi Exp $ */ /* $NetBSD: uipc_domain.c,v 1.14 1996/02/09 19:00:44 christos Exp $ */ /* @@ -76,7 +76,7 @@ void domaininit(void) { struct domain *dp; - struct protosw *pr; + const struct protosw *pr; static struct timeout pffast_timeout; static struct timeout pfslow_timeout; int i; @@ -118,11 +118,11 @@ pffinddomain(int family) return (NULL); } -struct protosw * +const struct protosw * pffindtype(int family, int type) { struct domain *dp; - struct protosw *pr; + const struct protosw *pr; dp = pffinddomain(family); if (dp == NULL) @@ -134,12 +134,12 @@ pffindtype(int family, int type) return (NULL); } -struct protosw * +const struct protosw * pffindproto(int family, int protocol, int type) { struct domain *dp; - struct protosw *pr; - struct protosw *maybe = NULL; + const struct protosw *pr; + const struct protosw *maybe = NULL; if (family == 0) return (NULL); @@ -164,7 +164,7 @@ net_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, size_t newlen, struct proc *p) { struct domain *dp; - struct protosw *pr; + const struct protosw *pr; int error, family, protocol; /* @@ -218,7 +218,7 @@ void pfctlinput(int cmd, struct sockaddr *sa) { struct domain *dp; - struct protosw *pr; + const struct protosw *pr; int i; NET_ASSERT_LOCKED(); @@ -235,7 +235,7 @@ pfslowtimo(void *arg) { struct timeout *to = (struct timeout *)arg; struct domain *dp; - struct protosw *pr; + const struct protosw *pr; int i; for (i = 0; (dp = domains[i]) != NULL; i++) { @@ -251,7 +251,7 @@ pffasttimo(void *arg) { struct timeout *to = (struct timeout *)arg; struct domain *dp; - struct protosw *pr; + const struct protosw *pr; int i; for (i = 0; (dp = domains[i]) != NULL; i++) { diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 7111b358287..99b2dc4331e 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.208 2017/11/23 13:42:53 mpi Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.209 2017/11/23 13:45:46 mpi Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -111,7 +111,7 @@ int socreate(int dom, struct socket **aso, int type, int proto) { struct proc *p = curproc; /* XXX */ - struct protosw *prp; + const struct protosw *prp; struct socket *so; int error, s; @@ -633,7 +633,7 @@ soreceive(struct socket *so, struct mbuf **paddr, struct uio *uio, struct mbuf *cm; u_long len, offset, moff; int flags, error, s, type, uio_error = 0; - struct protosw *pr = so->so_proto; + const struct protosw *pr = so->so_proto; struct mbuf *nextrecord; size_t resid, orig_resid = uio->uio_resid; @@ -1012,7 +1012,7 @@ release: int soshutdown(struct socket *so, int how) { - struct protosw *pr = so->so_proto; + const struct protosw *pr = so->so_proto; int s, error = 0; s = solock(so); @@ -1040,7 +1040,7 @@ void sorflush(struct socket *so) { struct sockbuf *sb = &so->so_rcv; - struct protosw *pr = so->so_proto; + const struct protosw *pr = so->so_proto; struct socket aso; int error; diff --git a/sys/netinet/in_proto.c b/sys/netinet/in_proto.c index 01e46bfd701..697b95c66e4 100644 --- a/sys/netinet/in_proto.c +++ b/sys/netinet/in_proto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_proto.c,v 1.87 2017/11/17 18:22:52 jca Exp $ */ +/* $OpenBSD: in_proto.c,v 1.88 2017/11/23 13:45:46 mpi Exp $ */ /* $NetBSD: in_proto.c,v 1.14 1996/02/18 18:58:32 christos Exp $ */ /* @@ -174,7 +174,7 @@ u_char ip_protox[IPPROTO_MAX]; -struct protosw inetsw[] = { +const struct protosw inetsw[] = { { .pr_domain = &inetdomain, .pr_init = ip_init, diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 5eee0d5eac5..695cf415b1c 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.333 2017/11/20 10:35:24 mpi Exp $ */ +/* $OpenBSD: ip_input.c,v 1.334 2017/11/23 13:45:46 mpi Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -151,7 +151,7 @@ void save_rte(struct mbuf *, u_char *, struct in_addr); void ip_init(void) { - struct protosw *pr; + const struct protosw *pr; int i; const u_int16_t defbaddynamicports_tcp[] = DEFBADDYNAMICPORTS_TCP; const u_int16_t defbaddynamicports_udp[] = DEFBADDYNAMICPORTS_UDP; @@ -613,14 +613,12 @@ ip_local(struct mbuf **mp, int *offp, int nxt, int af) int ip_deliver(struct mbuf **mp, int *offp, int nxt, int af) { - struct protosw *psw; + const struct protosw *psw; int naf = af; #ifdef INET6 int nest = 0; #endif /* INET6 */ - KERNEL_ASSERT_LOCKED(); - /* pf might have modified stuff, might have to chksum */ switch (af) { case AF_INET: diff --git a/sys/netinet6/in6_proto.c b/sys/netinet6/in6_proto.c index 85636b907d2..afe41596691 100644 --- a/sys/netinet6/in6_proto.c +++ b/sys/netinet6/in6_proto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_proto.c,v 1.99 2017/11/17 14:51:13 jca Exp $ */ +/* $OpenBSD: in6_proto.c,v 1.100 2017/11/23 13:45:46 mpi Exp $ */ /* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */ /* @@ -121,7 +121,7 @@ */ u_char ip6_protox[IPPROTO_MAX]; -struct protosw inet6sw[] = { +const struct protosw inet6sw[] = { { .pr_domain = &inet6domain, .pr_protocol = IPPROTO_IPV6, diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 28eff435ed3..6f07b36d9d3 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_input.c,v 1.209 2017/11/20 10:35:24 mpi Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.210 2017/11/23 13:45:46 mpi Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -138,7 +138,7 @@ static struct task ip6send_task = void ip6_init(void) { - struct protosw *pr; + const struct protosw *pr; int i; pr = pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW); diff --git a/sys/netinet6/ip6protosw.h b/sys/netinet6/ip6protosw.h index 9b118916ec2..ddbdbcb970d 100644 --- a/sys/netinet6/ip6protosw.h +++ b/sys/netinet6/ip6protosw.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6protosw.h,v 1.12 2017/01/29 19:58:47 bluhm Exp $ */ +/* $OpenBSD: ip6protosw.h,v 1.13 2017/11/23 13:45:46 mpi Exp $ */ /* $KAME: ip6protosw.h,v 1.22 2001/02/08 18:02:08 itojun Exp $ */ /* @@ -111,7 +111,7 @@ struct ip6ctlparam { #ifdef _KERNEL extern u_char ip6_protox[]; -extern struct protosw inet6sw[]; +extern const struct protosw inet6sw[]; #endif #endif /* !_NETINET6_IP6PROTOSW_H_ */ diff --git a/sys/sys/domain.h b/sys/sys/domain.h index c27bbcdb6f3..8cf580aff7c 100644 --- a/sys/sys/domain.h +++ b/sys/sys/domain.h @@ -1,4 +1,4 @@ -/* $OpenBSD: domain.h,v 1.17 2015/12/03 23:12:13 claudio Exp $ */ +/* $OpenBSD: domain.h,v 1.18 2017/11/23 13:45:46 mpi Exp $ */ /* $NetBSD: domain.h,v 1.10 1996/02/09 18:25:07 christos Exp $ */ /* @@ -55,7 +55,7 @@ struct domain { int (*dom_externalize)(struct mbuf *, socklen_t, int); /* dispose of internalized rights */ void (*dom_dispose)(struct mbuf *); - struct protosw *dom_protosw, *dom_protoswNPROTOSW; + const struct protosw *dom_protosw, *dom_protoswNPROTOSW; /* initialize routing table */ unsigned int dom_rtkeylen; /* maximum size of the key */ unsigned int dom_rtoffset; /* offset of the key, in bytes */ diff --git a/sys/sys/protosw.h b/sys/sys/protosw.h index f7691fd11fd..5683bfa9f81 100644 --- a/sys/sys/protosw.h +++ b/sys/sys/protosw.h @@ -1,4 +1,4 @@ -/* $OpenBSD: protosw.h,v 1.27 2017/11/05 13:19:59 florian Exp $ */ +/* $OpenBSD: protosw.h,v 1.28 2017/11/23 13:45:46 mpi Exp $ */ /* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */ /*- @@ -226,10 +226,10 @@ char *prcorequests[] = { #ifdef _KERNEL struct sockaddr; -struct protosw *pffindproto(int, int, int); -struct protosw *pffindtype(int, int); +const struct protosw *pffindproto(int, int, int); +const struct protosw *pffindtype(int, int); void pfctlinput(int, struct sockaddr *); extern u_char ip_protox[]; -extern struct protosw inetsw[]; +extern const struct protosw inetsw[]; #endif diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index 5b33317fb6c..e6dd63562b7 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: socketvar.h,v 1.78 2017/11/23 13:42:53 mpi Exp $ */ +/* $OpenBSD: socketvar.h,v 1.79 2017/11/23 13:45:46 mpi Exp $ */ /* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */ /*- @@ -56,7 +56,7 @@ struct socket { short so_linger; /* time to linger while closing */ short so_state; /* internal state flags SS_*, below */ void *so_pcb; /* protocol control block */ - struct protosw *so_proto; /* protocol handle */ + const struct protosw *so_proto; /* protocol handle */ /* * Variables for connection queueing. * Socket where accepts occur is so_head in all subsidiary sockets. |