-/* $OpenBSD: uipc_domain.c,v 1.58 2021/05/17 17:06:51 claudio Exp $ */
+/* $OpenBSD: uipc_domain.c,v 1.59 2021/05/25 22:45:09 bluhm Exp $ */
/* $NetBSD: uipc_domain.c,v 1.14 1996/02/09 19:00:44 christos Exp $ */
/*
#include "bpfilter.h"
#include "pflow.h"
-extern struct domain mplsdomain;
-extern struct domain pfkeydomain;
-extern struct domain inet6domain;
-extern struct domain inetdomain;
-extern struct domain unixdomain;
-extern struct domain routedomain;
-
-struct domain *domains[] = {
+const struct domain *const domains[] = {
#ifdef MPLS
&mplsdomain,
#endif
void pffasttimo(void *);
void pfslowtimo(void *);
-struct domain * pffinddomain(int);
+const struct domain * pffinddomain(int);
void
domaininit(void)
{
- struct domain *dp;
+ const struct domain *dp;
const struct protosw *pr;
static struct timeout pffast_timeout;
static struct timeout pfslow_timeout;
timeout_add(&pfslow_timeout, 1);
}
-struct domain *
+const struct domain *
pffinddomain(int family)
{
- struct domain *dp;
+ const struct domain *dp;
int i;
for (i = 0; (dp = domains[i]) != NULL; i++) {
const struct protosw *
pffindtype(int family, int type)
{
- struct domain *dp;
+ const struct domain *dp;
const struct protosw *pr;
dp = pffinddomain(family);
const struct protosw *
pffindproto(int family, int protocol, int type)
{
- struct domain *dp;
+ const struct domain *dp;
const struct protosw *pr;
const struct protosw *maybe = NULL;
net_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
size_t newlen, struct proc *p)
{
- struct domain *dp;
+ const struct domain *dp;
const struct protosw *pr;
int error, family, protocol;
void
pfctlinput(int cmd, struct sockaddr *sa)
{
- struct domain *dp;
+ const struct domain *dp;
const struct protosw *pr;
int i;
pfslowtimo(void *arg)
{
struct timeout *to = (struct timeout *)arg;
- struct domain *dp;
+ const struct domain *dp;
const struct protosw *pr;
int i;
pffasttimo(void *arg)
{
struct timeout *to = (struct timeout *)arg;
- struct domain *dp;
+ const struct domain *dp;
const struct protosw *pr;
int i;
-/* $OpenBSD: uipc_proto.c,v 1.18 2019/07/15 12:28:06 bluhm Exp $ */
+/* $OpenBSD: uipc_proto.c,v 1.19 2021/05/25 22:45:09 bluhm Exp $ */
/* $NetBSD: uipc_proto.c,v 1.8 1996/02/13 21:10:47 christos Exp $ */
/*-
* Definitions of protocols supported in the UNIX domain.
*/
-extern struct domain unixdomain; /* or at least forward */
-
struct protosw unixsw[] = {
{
.pr_type = SOCK_STREAM,
}
};
-struct domain unixdomain = {
+const struct domain unixdomain = {
.dom_family = AF_UNIX,
.dom_name = "unix",
.dom_init = unp_init,
-/* $OpenBSD: uipc_socket.c,v 1.261 2021/05/13 19:43:11 mvs Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.262 2021/05/25 22:45:09 bluhm Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
if (so->so_proto->pr_domain &&
so->so_proto->pr_domain->dom_protosw &&
so->so_proto->pr_ctloutput) {
- struct domain *dom = so->so_proto->pr_domain;
+ const struct domain *dom =
+ so->so_proto->pr_domain;
level = dom->dom_protosw->pr_protocol;
error = (*so->so_proto->pr_ctloutput)
if (so->so_proto->pr_domain &&
so->so_proto->pr_domain->dom_protosw &&
so->so_proto->pr_ctloutput) {
- struct domain *dom = so->so_proto->pr_domain;
+ const struct domain *dom =
+ so->so_proto->pr_domain;
level = dom->dom_protosw->pr_protocol;
error = (*so->so_proto->pr_ctloutput)
-/* $OpenBSD: uipc_usrreq.c,v 1.147 2021/05/18 11:15:14 mvs Exp $ */
+/* $OpenBSD: uipc_usrreq.c,v 1.148 2021/05/25 22:45:09 bluhm Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */
/*
}
#endif
-extern struct domain unixdomain;
-
static struct unpcb *
fptounp(struct file *fp)
{
-/* $OpenBSD: if.c,v 1.640 2021/03/26 22:41:06 mvs Exp $ */
+/* $OpenBSD: if.c,v 1.641 2021/05/25 22:45:09 bluhm Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
void
if_attachdomain(struct ifnet *ifp)
{
- struct domain *dp;
+ const struct domain *dp;
int i, s;
s = splnet();
{
struct ifaddr *ifa;
struct ifg_list *ifg;
- struct domain *dp;
+ const struct domain *dp;
int i, s;
/* Undo pseudo-driver changes. */
-/* $OpenBSD: pfkeyv2.c,v 1.212 2021/05/25 09:55:22 bluhm Exp $ */
+/* $OpenBSD: pfkeyv2.c,v 1.213 2021/05/25 22:45:09 bluhm Exp $ */
/*
* @(#)COPYRIGHT 1.1 (NRL) 17 January 1995
struct pool pkpcb_pool;
#define PFKEY_MSG_MAXSZ 4096
const struct sockaddr pfkey_addr = { 2, PF_KEY, };
-struct domain pfkeydomain;
+const struct domain pfkeydomain;
/*
* pfkey PCB
}
};
-struct domain pfkeydomain = {
+const struct domain pfkeydomain = {
.dom_family = PF_KEY,
.dom_name = "PF_KEY",
.dom_init = pfkey_init,
-/* $OpenBSD: route.c,v 1.398 2021/03/10 10:21:48 jsg Exp $ */
+/* $OpenBSD: route.c,v 1.399 2021/05/25 22:45:09 bluhm Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
static const u_char maskarray[] = {
0x0, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe };
struct sockaddr *ndst;
- struct domain *dp;
+ const struct domain *dp;
u_char *csrc, *cdst;
int i, plen;
-/* $OpenBSD: rtable.c,v 1.74 2021/03/26 22:41:06 mvs Exp $ */
+/* $OpenBSD: rtable.c,v 1.75 2021/05/25 22:45:09 bluhm Exp $ */
/*
* Copyright (c) 2014-2016 Martin Pieuchot
void
rtmap_init(void)
{
- struct domain *dp;
- int i;
+ const struct domain *dp;
+ int i;
/* Start with a single table for every domain that requires it. */
for (i = 0; (dp = domains[i]) != NULL; i++) {
void
rtable_init(void)
{
- struct domain *dp;
- int i;
+ const struct domain *dp;
+ int i;
KASSERT(sizeof(struct rtmap) == sizeof(struct dommp));
int
rtable_add(unsigned int id)
{
- struct domain *dp;
- void *tbl;
- struct rtmap *map;
- struct dommp *dmm;
- sa_family_t af;
- unsigned int off, alen;
- int i, error = 0;
+ const struct domain *dp;
+ void *tbl;
+ struct rtmap *map;
+ struct dommp *dmm;
+ sa_family_t af;
+ unsigned int off, alen;
+ int i, error = 0;
if (id > RT_TABLEID_MAX)
return (EINVAL);
int
rtable_exists(unsigned int rtableid)
{
- struct domain *dp;
- void *tbl;
- int i;
+ const struct domain *dp;
+ void *tbl;
+ int i;
for (i = 0; (dp = domains[i]) != NULL; i++) {
if (dp->dom_rtoffset == 0)
int
rtable_empty(unsigned int rtableid)
{
- struct domain *dp;
- int i;
- struct art_root *tbl;
+ const struct domain *dp;
+ int i;
+ struct art_root *tbl;
for (i = 0; (dp = domains[i]) != NULL; i++) {
if (dp->dom_rtoffset == 0)
int
rtable_satoplen(sa_family_t af, struct sockaddr *mask)
{
- struct domain *dp;
- uint8_t *ap, *ep;
- int mlen, plen = 0;
- int i;
+ const struct domain *dp;
+ uint8_t *ap, *ep;
+ int mlen, plen = 0;
+ int i;
for (i = 0; (dp = domains[i]) != NULL; i++) {
if (dp->dom_rtoffset == 0)
-/* $OpenBSD: rtsock.c,v 1.315 2021/05/17 17:58:35 claudio Exp $ */
+/* $OpenBSD: rtsock.c,v 1.316 2021/05/25 22:45:09 bluhm Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
* Definitions of protocols supported in the ROUTE domain.
*/
-struct domain routedomain;
-
struct protosw routesw[] = {
{
.pr_type = SOCK_RAW,
}
};
-struct domain routedomain = {
+const struct domain routedomain = {
.dom_family = PF_ROUTE,
.dom_name = "route",
.dom_init = route_init,
-/* $OpenBSD: in_proto.c,v 1.94 2019/11/04 23:52:28 dlg Exp $ */
+/* $OpenBSD: in_proto.c,v 1.95 2021/05/25 22:45:09 bluhm Exp $ */
/* $NetBSD: in_proto.c,v 1.14 1996/02/18 18:58:32 christos Exp $ */
/*
}
};
-struct domain inetdomain = {
+const struct domain inetdomain = {
.dom_family = AF_INET,
.dom_name = "internet",
.dom_init = in_init,
-/* $OpenBSD: in6_proto.c,v 1.104 2019/06/13 08:12:11 claudio Exp $ */
+/* $OpenBSD: in6_proto.c,v 1.105 2021/05/25 22:45:10 bluhm Exp $ */
/* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */
/*
}
};
-struct domain inet6domain = {
+const struct domain inet6domain = {
.dom_family = AF_INET6,
.dom_name = "internet6",
.dom_protosw = inet6sw,
-/* $OpenBSD: mpls.h,v 1.45 2021/03/10 10:21:49 jsg Exp $ */
+/* $OpenBSD: mpls.h,v 1.46 2021/05/25 22:45:10 bluhm Exp $ */
/*
* Copyright (C) 1999, 2000 and 2001 AYAME Project, WIDE Project.
#define MPLS_LABEL2SHIM(_l) (htonl((_l) << MPLS_LABEL_OFFSET))
#define MPLS_SHIM2LABEL(_s) (ntohl((_s)) >> MPLS_LABEL_OFFSET)
-extern struct domain mplsdomain;
-
extern int mpls_defttl;
extern int mpls_mapttl_ip;
extern int mpls_mapttl_ip6;
-/* $OpenBSD: mpls_proto.c,v 1.18 2019/06/13 08:12:11 claudio Exp $ */
+/* $OpenBSD: mpls_proto.c,v 1.19 2021/05/25 22:45:10 bluhm Exp $ */
/*
* Copyright (C) 1999, 2000 and 2001 AYAME Project, WIDE Project.
/*
* MPLS address family: needed for the routing table
*/
-struct domain mplsdomain = {
+const struct domain mplsdomain = {
.dom_family = AF_MPLS,
.dom_name = "mpls",
.dom_sasize = sizeof(struct sockaddr_mpls),
-/* $OpenBSD: domain.h,v 1.21 2021/03/10 10:21:47 jsg Exp $ */
+/* $OpenBSD: domain.h,v 1.22 2021/05/25 22:45:10 bluhm Exp $ */
/* $NetBSD: domain.h,v 1.10 1996/02/09 18:25:07 christos Exp $ */
/*
struct mbuf;
struct ifnet;
-struct domain {
+struct domain {
int dom_family; /* AF_xxx */
char *dom_name;
void (*dom_init)(void); /* initialize domain data structures */
};
#ifdef _KERNEL
-extern struct domain *domains[];
void domaininit(void);
-extern struct domain inetdomain;
-
-#ifdef INET6
-extern struct domain inet6domain;
-#endif
-
+extern const struct domain *const domains[];
+extern const struct domain inet6domain;
+extern const struct domain inetdomain;
+extern const struct domain mplsdomain;
+extern const struct domain pfkeydomain;
+extern const struct domain routedomain;
+extern const struct domain unixdomain;
#endif /* _KERNEL */
-/* $OpenBSD: protosw.h,v 1.31 2018/01/23 20:49:58 bluhm Exp $ */
+/* $OpenBSD: protosw.h,v 1.32 2021/05/25 22:45:10 bluhm Exp $ */
/* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */
/*-
struct protosw {
short pr_type; /* socket type used for */
- struct domain *pr_domain; /* domain protocol a member of */
+ const struct domain *pr_domain; /* domain protocol a member of */
short pr_protocol; /* protocol number */
short pr_flags; /* see below */