diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2013-10-24 11:14:36 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2013-10-24 11:14:36 +0000 |
commit | e2b54bc3a14101ffffc2eb2186382c375ca1e9bc (patch) | |
tree | ae90fb11d1b8c500286035275365c21177f2ea30 /sys | |
parent | 4b08da2408ac66e41fd78b9000ef0627531080d7 (diff) |
Move obvious kernel prototypes (and structure's with kernel pointers,
obviously only used in the kernel) behind #ifdef _KERNEL
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/bpfdesc.h | 5 | ||||
-rw-r--r-- | sys/net/if_pfsync.h | 4 | ||||
-rw-r--r-- | sys/net/if_vlan_var.h | 59 | ||||
-rw-r--r-- | sys/net/pf.c | 6 | ||||
-rw-r--r-- | sys/net/route.h | 60 | ||||
-rw-r--r-- | sys/net/slcompress.h | 4 | ||||
-rw-r--r-- | sys/net/trunklacp.h | 4 |
7 files changed, 75 insertions, 67 deletions
diff --git a/sys/net/bpfdesc.h b/sys/net/bpfdesc.h index a98f2f0f012..ff5cc0ea77a 100644 --- a/sys/net/bpfdesc.h +++ b/sys/net/bpfdesc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bpfdesc.h,v 1.17 2006/03/25 22:41:47 djm Exp $ */ +/* $OpenBSD: bpfdesc.h,v 1.18 2013/10/24 11:14:33 deraadt Exp $ */ /* $NetBSD: bpfdesc.h,v 1.11 1995/09/27 18:30:42 thorpej Exp $ */ /* @@ -40,6 +40,8 @@ #ifndef _NET_BPFDESC_H_ #define _NET_BPFDESC_H_ +#ifdef _KERNEL + #include <sys/selinfo.h> /* @@ -102,7 +104,6 @@ struct bpf_if { struct ifnet *bif_ifp; /* correspoding interface */ }; -#ifdef _KERNEL int bpf_setf(struct bpf_d *, struct bpf_program *, int); #endif /* _KERNEL */ #endif /* _NET_BPFDESC_H_ */ diff --git a/sys/net/if_pfsync.h b/sys/net/if_pfsync.h index 4fcc8006b6b..b2c97ea68e8 100644 --- a/sys/net/if_pfsync.h +++ b/sys/net/if_pfsync.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pfsync.h,v 1.46 2012/06/29 15:12:21 mikeb Exp $ */ +/* $OpenBSD: if_pfsync.h,v 1.47 2013/10/24 11:14:33 deraadt Exp $ */ /* * Copyright (c) 2001 Michael Shalayeff @@ -310,6 +310,6 @@ int pfsync_defer(struct pf_state *, struct mbuf *); int pfsync_up(void); int pfsync_state_in_use(struct pf_state *); -#endif +#endif /* _KERNEL */ #endif /* _NET_IF_PFSYNC_H_ */ diff --git a/sys/net/if_vlan_var.h b/sys/net/if_vlan_var.h index e58cff42628..65a079d2a45 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.23 2013/10/19 14:05:14 reyk Exp $ */ +/* $OpenBSD: if_vlan_var.h,v 1.24 2013/10/24 11:14:33 deraadt Exp $ */ /* * Copyright 1998 Massachusetts Institute of Technology @@ -34,6 +34,33 @@ #ifndef _NET_IF_VLAN_VAR_H_ #define _NET_IF_VLAN_VAR_H_ +struct ether_vlan_header { + u_char evl_dhost[ETHER_ADDR_LEN]; + u_char evl_shost[ETHER_ADDR_LEN]; + u_int16_t evl_encap_proto; + u_int16_t evl_tag; + u_int16_t evl_proto; +}; + +#define EVL_VLID_MASK 0x0FFF +#define EVL_VLANOFTAG(tag) ((tag) & EVL_VLID_MASK) +#define EVL_PRIOFTAG(tag) (((tag) >> EVL_PRIO_BITS) & 7) +#define EVL_ENCAPLEN 4 /* length in octets of encapsulation */ +#define EVL_PRIO_MAX 7 +#define EVL_PRIO_BITS 13 + +/* sysctl(3) tags, for compatibility purposes */ +#define VLANCTL_PROTO 1 +#define VLANCTL_MAX 2 + +/* + * Configuration structure for SIOCSETVLAN and SIOCGETVLAN ioctls. + */ +struct vlanreq { + char vlr_parent[IFNAMSIZ]; + u_short vlr_tag; +}; + #ifdef _KERNEL #define mc_enm mc_u.mcu_enm @@ -67,36 +94,8 @@ struct ifvlan { #define ifv_prio ifv_mib.ifvm_prio #define ifv_type ifv_mib.ifvm_type #define IFVF_PROMISC 0x01 -#endif /* _KERNEL */ -struct ether_vlan_header { - u_char evl_dhost[ETHER_ADDR_LEN]; - u_char evl_shost[ETHER_ADDR_LEN]; - u_int16_t evl_encap_proto; - u_int16_t evl_tag; - u_int16_t evl_proto; -}; - -#define EVL_VLID_MASK 0x0FFF -#define EVL_VLANOFTAG(tag) ((tag) & EVL_VLID_MASK) -#define EVL_PRIOFTAG(tag) (((tag) >> EVL_PRIO_BITS) & 7) -#define EVL_ENCAPLEN 4 /* length in octets of encapsulation */ -#define EVL_PRIO_MAX 7 -#define EVL_PRIO_BITS 13 - -/* sysctl(3) tags, for compatibility purposes */ -#define VLANCTL_PROTO 1 -#define VLANCTL_MAX 2 - -/* - * Configuration structure for SIOCSETVLAN and SIOCGETVLAN ioctls. - */ -struct vlanreq { - char vlr_parent[IFNAMSIZ]; - u_short vlr_tag; -}; - -#ifdef _KERNEL extern int vlan_input(struct ether_header *eh, struct mbuf *m); #endif /* _KERNEL */ + #endif /* _NET_IF_VLAN_VAR_H_ */ diff --git a/sys/net/pf.c b/sys/net/pf.c index 062350c28d6..62b864ce8fe 100644 --- a/sys/net/pf.c +++ b/sys/net/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.853 2013/10/23 16:13:54 mikeb Exp $ */ +/* $OpenBSD: pf.c,v 1.854 2013/10/24 11:14:33 deraadt Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -831,10 +831,10 @@ pf_state_key_addr_setup(struct pf_pdesc *pd, void *arg, int sidx, break; default: if (multi == PF_ICMP_MULTI_LINK) { - key->addr[sidx].addr32[0] = IPV6_ADDR_INT32_MLL; + key->addr[sidx].addr32[0] = __IPV6_ADDR_INT32_MLL; key->addr[sidx].addr32[1] = 0; key->addr[sidx].addr32[2] = 0; - key->addr[sidx].addr32[3] = IPV6_ADDR_INT32_ONE; + key->addr[sidx].addr32[3] = __IPV6_ADDR_INT32_ONE; saddr = NULL; /* overwritten */ } } diff --git a/sys/net/route.h b/sys/net/route.h index 4cece04c60e..4dc68b78f91 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -1,4 +1,4 @@ -/* $OpenBSD: route.h,v 1.80 2013/10/20 13:21:57 claudio Exp $ */ +/* $OpenBSD: route.h,v 1.81 2013/10/24 11:14:35 deraadt Exp $ */ /* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */ /* @@ -45,17 +45,6 @@ */ /* - * A route consists of a destination address and a reference - * to a routing entry. These are often held by protocols - * in their control blocks, e.g. inpcb. - */ -struct route { - struct rtentry *ro_rt; - u_long ro_tableid; /* u_long because of alignment */ - struct sockaddr ro_dst; -}; - -/* * These numbers are used by reliable protocols for determining * retransmission behavior and are included in the routing structure. */ @@ -93,6 +82,7 @@ struct rt_metrics { #define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */ #define RTTTOPRHZ(r) ((r) / (RTM_RTTUNIT / PR_SLOWHZ)) +#ifdef _KERNEL /* * We distinguish between routes to hosts and routes to networks, * preferring the former if available. For each route we infer @@ -126,6 +116,8 @@ struct rtentry { }; #define rt_use rt_rmx.rmx_pksent +#endif /* _KERNEL */ + #define RTF_UP 0x1 /* route usable */ #define RTF_GATEWAY 0x2 /* destination is a gateway */ #define RTF_HOST 0x4 /* host entry (net otherwise) */ @@ -284,6 +276,25 @@ struct rt_msghdr { #define ROUTE_FILTER(m) (1 << (m)) #define RTABLE_ANY 0xffffffff +#define RTLABEL_LEN 32 + +struct sockaddr_rtlabel { + u_int8_t sr_len; /* total length */ + sa_family_t sr_family; /* address family */ + char sr_label[RTLABEL_LEN]; +}; + +/* + * A route consists of a destination address and a reference + * to a routing entry. These are often held by protocols + * in their control blocks, e.g. inpcb. + */ +struct route { + struct rtentry *ro_rt; + u_long ro_tableid; /* u_long because of alignment */ + struct sockaddr ro_dst; +}; + struct rt_addrinfo { int rti_addrs; struct sockaddr *rti_info[RTAX_MAX]; @@ -294,19 +305,13 @@ struct rt_addrinfo { u_char rti_mpls; }; -struct route_cb { - int ip_count; - int ip6_count; - int mpls_count; - int any_count; -}; +#ifdef _KERNEL /* * This structure, and the prototypes for the rt_timer_{init,remove_all, * add,timer} functions all used with the kind permission of BSDI. * These allow functions to be called for routes at specific times. */ - struct rttimer { TAILQ_ENTRY(rttimer) rtt_next; /* entry on timer queue */ LIST_ENTRY(rttimer) rtt_link; /* multiple timers per rtentry */ @@ -325,15 +330,6 @@ struct rttimer_queue { LIST_ENTRY(rttimer_queue) rtq_link; }; -#define RTLABEL_LEN 32 - -struct sockaddr_rtlabel { - u_int8_t sr_len; /* total length */ - sa_family_t sr_family; /* address family */ - char sr_label[RTLABEL_LEN]; -}; - -#ifdef _KERNEL const char *rtlabel_id2name(u_int16_t); u_int16_t rtlabel_name2id(char *); struct sockaddr *rtlabel_id2sa(u_int16_t, struct sockaddr_rtlabel *); @@ -352,6 +348,13 @@ void rtlabel_unref(u_int16_t); #define RT_REPORT 0x1 #define RT_NOCLONING 0x2 +struct route_cb { + int ip_count; + int ip6_count; + int mpls_count; + int any_count; +}; + extern struct route_cb route_cb; extern struct rtstat rtstat; extern const struct sockaddr_rtin rt_defmask4; @@ -415,4 +418,5 @@ struct rtentry *rt_lookup(struct sockaddr *, struct sockaddr *, u_int); struct rtentry *rt_mpath_next(struct rtentry *); #endif /* _KERNEL */ + #endif /* _NET_ROUTE_H_ */ diff --git a/sys/net/slcompress.h b/sys/net/slcompress.h index 1961f0d8a49..ea65d59dfa7 100644 --- a/sys/net/slcompress.h +++ b/sys/net/slcompress.h @@ -1,4 +1,4 @@ -/* $OpenBSD: slcompress.h,v 1.7 2003/06/02 23:28:12 millert Exp $ */ +/* $OpenBSD: slcompress.h,v 1.8 2013/10/24 11:14:35 deraadt Exp $ */ /* $NetBSD: slcompress.h,v 1.11 1997/05/17 21:12:11 christos Exp $ */ /* @@ -154,6 +154,7 @@ struct slcompress { /* flag values */ #define SLF_TOSS 1 /* tossing rcvd frames because of input err */ +#ifdef _KERNEL void sl_compress_init(struct slcompress *); void sl_compress_setup(struct slcompress *, int); u_int sl_compress_tcp(struct mbuf *, @@ -161,5 +162,6 @@ u_int sl_compress_tcp(struct mbuf *, int sl_uncompress_tcp(u_char **, int, u_int, struct slcompress *); int sl_uncompress_tcp_core(u_char *, int, int, u_int, struct slcompress *, u_char **, u_int *); +#endif /* _KERNEL */ #endif /* _NET_SLCOMPRESS_H_ */ diff --git a/sys/net/trunklacp.h b/sys/net/trunklacp.h index 927f6c59b93..97489ce66df 100644 --- a/sys/net/trunklacp.h +++ b/sys/net/trunklacp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: trunklacp.h,v 1.5 2009/09/09 15:01:18 reyk Exp $ */ +/* $OpenBSD: trunklacp.h,v 1.6 2013/10/24 11:14:35 deraadt Exp $ */ /* $NetBSD: ieee8023ad_impl.h,v 1.2 2005/12/10 23:21:39 elad Exp $ */ /* @@ -255,6 +255,7 @@ struct lacp_softc { #define LACP_UNLOCK(_lsc) mtx_unlock(&(_lsc)->lsc_mtx) #define LACP_LOCK_ASSERT(_lsc) mtx_assert(&(_lsc)->lsc_mtx, MA_OWNED) +#ifdef _KERNEL struct mbuf *lacp_input(struct trunk_port *, struct ether_header *, struct mbuf *); struct trunk_port *lacp_select_tx_port(struct trunk_softc *, struct mbuf *); @@ -268,6 +269,7 @@ void lacp_linkstate(struct trunk_port *); void lacp_req(struct trunk_softc *, caddr_t); void lacp_portreq(struct trunk_port *, caddr_t); u_int lacp_port_status(struct trunk_port *); +#endif /* _KERNEL */ /* following constants don't include terminating NUL */ #define LACP_MACSTR_MAX (2*6 + 5) |