summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2015-12-03 16:27:32 +0000
committermpi <mpi@openbsd.org>2015-12-03 16:27:32 +0000
commitce2f93b3c0b7a3826214a6142a185dc98797ff37 (patch)
treef2b2c2c4c140f48ecab51682f3f2fe7879bb4b7c /sys
parentadd ifdef IPSEC for protoypes; requested by mpi@ (diff)
downloadwireguard-openbsd-ce2f93b3c0b7a3826214a6142a185dc98797ff37.tar.xz
wireguard-openbsd-ce2f93b3c0b7a3826214a6142a185dc98797ff37.zip
Use SRPL_HEAD() and SRPL_ENTRY() to be consistent with and allow to
fallback to a SLIST. ok dlg@, jasper@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/art.h5
-rw-r--r--sys/net/bpfdesc.h6
-rw-r--r--sys/net/if.c4
-rw-r--r--sys/net/if_var.h4
-rw-r--r--sys/net/if_vlan.c10
-rw-r--r--sys/net/if_vlan_var.h4
-rw-r--r--sys/net/route.h4
-rw-r--r--sys/netinet/ip_carp.c8
-rw-r--r--sys/sys/srp.h13
9 files changed, 30 insertions, 28 deletions
diff --git a/sys/net/art.h b/sys/net/art.h
index 20a0d40595b..158987fb075 100644
--- a/sys/net/art.h
+++ b/sys/net/art.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: art.h,v 1.7 2015/11/29 16:02:18 mpi Exp $ */
+/* $OpenBSD: art.h,v 1.8 2015/12/03 16:27:32 mpi Exp $ */
/*
* Copyright (c) 2015 Martin Pieuchot
@@ -45,8 +45,7 @@ struct rtentry;
struct art_node {
struct sockaddr *an_dst; /* Destination address (key) */
int an_plen; /* Prefix length */
-
- struct srpl an_rtlist; /* Route related to this node */
+ SRPL_HEAD(, rtentry) an_rtlist; /* Route related to this node */
};
void art_init(void);
diff --git a/sys/net/bpfdesc.h b/sys/net/bpfdesc.h
index b173f75deb1..ab7c57f5c28 100644
--- a/sys/net/bpfdesc.h
+++ b/sys/net/bpfdesc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpfdesc.h,v 1.28 2015/09/09 11:55:37 dlg Exp $ */
+/* $OpenBSD: bpfdesc.h,v 1.29 2015/12/03 16:27:32 mpi Exp $ */
/* $NetBSD: bpfdesc.h,v 1.11 1995/09/27 18:30:42 thorpej Exp $ */
/*
@@ -48,7 +48,7 @@
* Descriptor associated with each open bpf file.
*/
struct bpf_d {
- struct srpl_entry bd_next; /* Linked list of descriptors */
+ SRPL_ENTRY(bpf_d) bd_next; /* Linked list of descriptors */
/*
* Buffer slots: two mbuf clusters buffer the incoming packets.
* The model has three slots. Sbuf is always occupied.
@@ -98,7 +98,7 @@ struct bpf_d {
*/
struct bpf_if {
struct bpf_if *bif_next; /* list of all interfaces */
- struct srpl bif_dlist; /* descriptor list */
+ SRPL_HEAD(, bpf_d) bif_dlist; /* descriptor list */
struct bpf_if **bif_driverp; /* pointer into softc */
u_int bif_dlt; /* link layer type */
u_int bif_hdrlen; /* length of header (with padding) */
diff --git a/sys/net/if.c b/sys/net/if.c
index 728e9a0cdd6..249c22e25b9 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.419 2015/12/03 14:55:17 vgross Exp $ */
+/* $OpenBSD: if.c,v 1.420 2015/12/03 16:27:32 mpi Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -740,7 +740,7 @@ if_input_local(struct ifnet *ifp, struct mbuf *m, sa_family_t af)
}
struct ifih {
- struct srpl_entry ifih_next;
+ SRPL_ENTRY(ifih) ifih_next;
int (*ifih_input)(struct ifnet *, struct mbuf *,
void *);
void *ifih_cookie;
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index d411fec1ef1..f4f7419fa20 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_var.h,v 1.61 2015/12/03 12:22:51 dlg Exp $ */
+/* $OpenBSD: if_var.h,v 1.62 2015/12/03 16:27:32 mpi Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
@@ -162,7 +162,7 @@ struct ifnet { /* and the entries */
struct task *if_linkstatetask; /* task to do route updates */
/* procedure handles */
- struct srpl if_inputs; /* input routines (dequeue) */
+ SRPL_HEAD(, ifih) if_inputs; /* input routines (dequeue) */
/* output routine (enqueue) */
int (*if_output)(struct ifnet *, struct mbuf *, struct sockaddr *,
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 3029b223813..06ab2da3bfc 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vlan.c,v 1.147 2015/11/10 06:34:35 dlg Exp $ */
+/* $OpenBSD: if_vlan.c,v 1.148 2015/12/03 16:27:32 mpi Exp $ */
/*
* Copyright 1998 Massachusetts Institute of Technology
@@ -77,7 +77,7 @@
#define TAG_HASH_SIZE (1 << TAG_HASH_BITS)
#define TAG_HASH_MASK (TAG_HASH_SIZE - 1)
#define TAG_HASH(tag) (tag & TAG_HASH_MASK)
-struct srpl *vlan_tagh, *svlan_tagh;
+SRPL_HEAD(, ifvlan) *vlan_tagh, *svlan_tagh;
struct rwlock vlan_tagh_lk = RWLOCK_INITIALIZER("vlantag");
int vlan_input(struct ifnet *, struct mbuf *, void *);
@@ -309,7 +309,7 @@ vlan_input(struct ifnet *ifp, struct mbuf *m, void *cookie)
struct ifvlan *ifv;
struct ether_vlan_header *evl;
struct ether_header *eh;
- struct srpl *tagh, *list;
+ SRPL_HEAD(, ifvlan) *tagh, *list;
struct srpl_iter i;
u_int tag;
struct mbuf_list ml = MBUF_LIST_INITIALIZER();
@@ -400,7 +400,7 @@ int
vlan_config(struct ifvlan *ifv, struct ifnet *p, u_int16_t tag)
{
struct sockaddr_dl *sdl1, *sdl2;
- struct srpl *tagh, *list;
+ SRPL_HEAD(, ifvlan) *tagh, *list;
u_int flags;
if (p->if_type != IFT_ETHER)
@@ -491,7 +491,7 @@ vlan_unconfig(struct ifnet *ifp, struct ifnet *newp)
{
struct sockaddr_dl *sdl;
struct ifvlan *ifv;
- struct srpl *tagh, *list;
+ SRPL_HEAD(, ifvlan) *tagh, *list;
struct ifnet *p;
ifv = ifp->if_softc;
diff --git a/sys/net/if_vlan_var.h b/sys/net/if_vlan_var.h
index 8b271e8a7d6..7d1e1185665 100644
--- a/sys/net/if_vlan_var.h
+++ b/sys/net/if_vlan_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vlan_var.h,v 1.30 2015/09/13 10:02:36 dlg Exp $ */
+/* $OpenBSD: if_vlan_var.h,v 1.31 2015/12/03 16:27:32 mpi Exp $ */
/*
* Copyright 1998 Massachusetts Institute of Technology
@@ -85,7 +85,7 @@ struct ifvlan {
u_int16_t ifvm_type; /* non-standard ethertype or 0x8100 */
} ifv_mib;
LIST_HEAD(__vlan_mchead, vlan_mc_entry) vlan_mc_listhead;
- struct srpl_entry ifv_list;
+ SRPL_ENTRY(ifvlan) ifv_list;
int ifv_flags;
struct refcnt ifv_refcnt;
void *lh_cookie;
diff --git a/sys/net/route.h b/sys/net/route.h
index f81fcd29055..3186e5de82b 100644
--- a/sys/net/route.h
+++ b/sys/net/route.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.h,v 1.128 2015/12/03 14:26:27 mpi Exp $ */
+/* $OpenBSD: route.h,v 1.129 2015/12/03 16:27:32 mpi Exp $ */
/* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */
/*
@@ -99,7 +99,7 @@ struct rtentry {
struct art_node *rt_node; /* ART entry */
struct sockaddr *rt_dest; /* destination */
struct sockaddr *rt_mask; /* mask (radix tree compat) */
- struct srpl_entry rt_next; /* Next multipath entry to our dst. */
+ SRPL_ENTRY(rtentry) rt_next; /* Next multipath entry to our dst. */
#endif
struct sockaddr *rt_gateway; /* value */
struct ifaddr *rt_ifa; /* the answer: interface addr to use */
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index f8e7e66d7f6..4dbb6e5616b 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.282 2015/11/18 13:53:59 mpi Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.283 2015/12/03 16:27:32 mpi Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -94,7 +94,7 @@ struct carp_mc_entry {
enum { HMAC_ORIG=0, HMAC_NOV6LL=1, HMAC_MAX=2 };
struct carp_vhost_entry {
- struct srpl_entry vhost_entries;
+ SRPL_ENTRY(carp_vhost_entry) vhost_entries;
struct refcnt vhost_refcnt;
struct carp_softc *parent_sc;
@@ -133,7 +133,7 @@ struct carp_softc {
struct ip6_moptions sc_im6o;
#endif /* INET6 */
- struct srpl_entry sc_list;
+ SRPL_ENTRY(carp_softc) sc_list;
struct refcnt sc_refcnt;
int sc_suppress;
@@ -147,7 +147,7 @@ struct carp_softc {
char sc_curlladdr[ETHER_ADDR_LEN];
- struct srpl carp_vhosts;
+ SRPL_HEAD(, carp_vhost_entry) carp_vhosts;
int sc_vhe_count;
u_int8_t sc_vhids[CARP_MAXNODES];
u_int8_t sc_advskews[CARP_MAXNODES];
diff --git a/sys/sys/srp.h b/sys/sys/srp.h
index 44b9d7cc4a1..716d80f44ca 100644
--- a/sys/sys/srp.h
+++ b/sys/sys/srp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: srp.h,v 1.6 2015/11/26 12:17:19 mpi Exp $ */
+/* $OpenBSD: srp.h,v 1.7 2015/12/03 16:27:32 mpi Exp $ */
/*
* Copyright (c) 2014 Jonathan Matthew <jmatthew@openbsd.org>
@@ -79,10 +79,6 @@ struct srpl {
struct srp sl_head;
};
-struct srpl_entry {
- struct srp se_next;
-};
-
struct srpl_iter {
struct srp * si_ref;
};
@@ -96,6 +92,13 @@ void srpl_rc_init(struct srpl_rc *, void (*)(void *, void *),
#define SRPL_INIT(_sl) srp_init(&(_sl)->sl_head)
+#define SRPL_HEAD(name, type) struct srpl
+
+#define SRPL_ENTRY(type) \
+struct { \
+ struct srp se_next; \
+}
+
static inline void *
_srpl_enter(struct srpl *sl, struct srpl_iter *si)
{