svn commit: r287062 - in projects/routing/sys: fs/nfs net netgraph/netflow netinet netinet6 netpfil/ipfw
Alexander V. Chernikov
melifaro at FreeBSD.org
Sun Aug 23 18:26:02 UTC 2015
Author: melifaro
Date: Sun Aug 23 18:25:53 2015
New Revision: 287062
URL: https://svnweb.freebsd.org/changeset/base/287062
Log:
Hide 'struct rtentry' and all its macro inside new header:
net/route_internal.h The goal is to make its opaque for all code
except route/rtsock and proto domain _rmx.
Modified:
projects/routing/sys/fs/nfs/nfsport.h
projects/routing/sys/net/if.c
projects/routing/sys/net/if_disc.c
projects/routing/sys/net/if_loop.c
projects/routing/sys/net/if_stf.c
projects/routing/sys/net/radix_mpath.c
projects/routing/sys/net/route.c
projects/routing/sys/net/route.h
projects/routing/sys/net/rt_nhops.c
projects/routing/sys/net/rtsock.c
projects/routing/sys/netgraph/netflow/netflow.c
projects/routing/sys/netinet/if_ether.c
projects/routing/sys/netinet/in.c
projects/routing/sys/netinet/in_gif.c
projects/routing/sys/netinet/in_rmx.c
projects/routing/sys/netinet/sctp_os_bsd.h
projects/routing/sys/netinet6/icmp6.c
projects/routing/sys/netinet6/in6.c
projects/routing/sys/netinet6/in6_gif.c
projects/routing/sys/netinet6/in6_ifattach.c
projects/routing/sys/netinet6/in6_rmx.c
projects/routing/sys/netinet6/ip6_forward.c
projects/routing/sys/netinet6/ip6_input.c
projects/routing/sys/netinet6/nd6.c
projects/routing/sys/netinet6/nd6_nbr.c
projects/routing/sys/netinet6/nd6_rtr.c
projects/routing/sys/netpfil/ipfw/ip_fw_table_algo.c
Modified: projects/routing/sys/fs/nfs/nfsport.h
==============================================================================
--- projects/routing/sys/fs/nfs/nfsport.h Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/fs/nfs/nfsport.h Sun Aug 23 18:25:53 2015 (r287062)
@@ -82,6 +82,7 @@
#include <net/if_var.h>
#include <net/radix.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <net/if_dl.h>
#include <netinet/in.h>
#include <netinet/in_pcb.h>
Modified: projects/routing/sys/net/if.c
==============================================================================
--- projects/routing/sys/net/if.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/net/if.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -75,6 +75,7 @@
#include <net/if_vlan_var.h>
#include <net/radix.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <net/vnet.h>
#if defined(INET) || defined(INET6)
Modified: projects/routing/sys/net/if_disc.c
==============================================================================
--- projects/routing/sys/net/if_disc.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/net/if_disc.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -49,6 +49,7 @@
#include <net/if_clone.h>
#include <net/if_types.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <net/bpf.h>
#include <net/vnet.h>
Modified: projects/routing/sys/net/if_loop.c
==============================================================================
--- projects/routing/sys/net/if_loop.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/net/if_loop.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -54,6 +54,7 @@
#include <net/if_types.h>
#include <net/netisr.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <net/bpf.h>
#include <net/vnet.h>
Modified: projects/routing/sys/net/if_stf.c
==============================================================================
--- projects/routing/sys/net/if_stf.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/net/if_stf.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -96,6 +96,7 @@
#include <net/if_var.h>
#include <net/if_clone.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <net/netisr.h>
#include <net/if_types.h>
#include <net/vnet.h>
Modified: projects/routing/sys/net/radix_mpath.c
==============================================================================
--- projects/routing/sys/net/radix_mpath.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/net/radix_mpath.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
#include <net/radix.h>
#include <net/radix_mpath.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <net/if.h>
#include <net/if_var.h>
Modified: projects/routing/sys/net/route.c
==============================================================================
--- projects/routing/sys/net/route.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/net/route.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -57,6 +57,7 @@
#include <net/if_var.h>
#include <net/if_dl.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <net/vnet.h>
#include <net/flowtable.h>
Modified: projects/routing/sys/net/route.h
==============================================================================
--- projects/routing/sys/net/route.h Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/net/route.h Sun Aug 23 18:25:53 2015 (r287062)
@@ -107,7 +107,9 @@ VNET_DECLARE(u_int, rt_add_addr_allfibs)
#endif
#endif
-#if defined(_KERNEL) || defined(_WANT_RTENTRY)
+struct rtentry;
+#if !defined(_KERNEL) || defined(_WANT_RTENTRY)
+/* This structure is kept for compatibility reasons only */
struct rtentry {
struct radix_node rt_nodes[2]; /* tree glue, and other values */
/*
@@ -126,11 +128,10 @@ struct rtentry {
u_long rt_mtu; /* MTU for this path */
u_long rt_weight; /* absolute weight */
u_long rt_expire; /* lifetime for route, e.g. redirect */
-#define rt_endzero rt_pksent
- counter_u64_t rt_pksent; /* packets sent using this route */
+#define rt_endzero rt_mtx
struct mtx rt_mtx; /* mutex for routing entry */
};
-#endif /* _KERNEL || _WANT_RTENTRY */
+#endif /* !_KERNEL || _WANT_RTENTRY */
#define RTF_UP 0x1 /* route usable */
#define RTF_GATEWAY 0x2 /* destination is a gateway */
@@ -291,59 +292,6 @@ struct rt_addrinfo {
#define RT_LINK_IS_UP(ifp) (!((ifp)->if_capabilities & IFCAP_LINKSTATE) \
|| (ifp)->if_link_state == LINK_STATE_UP)
-#define RT_LOCK_INIT(_rt) \
- mtx_init(&(_rt)->rt_mtx, "rtentry", NULL, MTX_DEF | MTX_DUPOK)
-#define RT_LOCK(_rt) mtx_lock(&(_rt)->rt_mtx)
-#define RT_UNLOCK(_rt) mtx_unlock(&(_rt)->rt_mtx)
-#define RT_LOCK_DESTROY(_rt) mtx_destroy(&(_rt)->rt_mtx)
-#define RT_LOCK_ASSERT(_rt) mtx_assert(&(_rt)->rt_mtx, MA_OWNED)
-#define RT_UNLOCK_COND(_rt) do { \
- if (mtx_owned(&(_rt)->rt_mtx)) \
- mtx_unlock(&(_rt)->rt_mtx); \
-} while (0)
-
-#define RT_ADDREF(_rt) do { \
- RT_LOCK_ASSERT(_rt); \
- KASSERT((_rt)->rt_refcnt >= 0, \
- ("negative refcnt %d", (_rt)->rt_refcnt)); \
- (_rt)->rt_refcnt++; \
-} while (0)
-
-#define RT_REMREF(_rt) do { \
- RT_LOCK_ASSERT(_rt); \
- KASSERT((_rt)->rt_refcnt > 0, \
- ("bogus refcnt %d", (_rt)->rt_refcnt)); \
- (_rt)->rt_refcnt--; \
-} while (0)
-
-#define RTFREE_LOCKED(_rt) do { \
- if ((_rt)->rt_refcnt <= 1) \
- rtfree(_rt); \
- else { \
- RT_REMREF(_rt); \
- RT_UNLOCK(_rt); \
- } \
- /* guard against invalid refs */ \
- _rt = 0; \
-} while (0)
-
-#define RTFREE(_rt) do { \
- RT_LOCK(_rt); \
- RTFREE_LOCKED(_rt); \
-} while (0)
-
-#define RO_RTFREE(_ro) do { \
- if ((_ro)->ro_rt) { \
- if ((_ro)->ro_flags & RT_NORTREF) { \
- (_ro)->ro_flags &= ~RT_NORTREF; \
- (_ro)->ro_rt = NULL; \
- } else { \
- RT_LOCK((_ro)->ro_rt); \
- RTFREE_LOCKED((_ro)->ro_rt); \
- } \
- } \
-} while (0)
-
struct radix_node_head *rt_tables_get_rnh(int, int);
struct ifmultiaddr;
Modified: projects/routing/sys/net/rt_nhops.c
==============================================================================
--- projects/routing/sys/net/rt_nhops.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/net/rt_nhops.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -55,6 +55,7 @@
#include <net/if_var.h>
#include <net/if_dl.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <net/vnet.h>
#ifdef RADIX_MPATH
Modified: projects/routing/sys/net/rtsock.c
==============================================================================
--- projects/routing/sys/net/rtsock.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/net/rtsock.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -59,6 +59,7 @@
#include <net/netisr.h>
#include <net/raw_cb.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <net/vnet.h>
#include <netinet/in.h>
Modified: projects/routing/sys/netgraph/netflow/netflow.c
==============================================================================
--- projects/routing/sys/netgraph/netflow/netflow.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/netgraph/netflow/netflow.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
#include <net/if.h>
#include <net/if_var.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <net/ethernet.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
Modified: projects/routing/sys/netinet/if_ether.c
==============================================================================
--- projects/routing/sys/netinet/if_ether.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/netinet/if_ether.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
#include <net/if_llc.h>
#include <net/ethernet.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <net/vnet.h>
#include <netinet/in.h>
Modified: projects/routing/sys/netinet/in.c
==============================================================================
--- projects/routing/sys/netinet/in.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/netinet/in.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$");
#include <net/if_llatbl.h>
#include <net/if_types.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <net/vnet.h>
#include <netinet/if_ether.h>
Modified: projects/routing/sys/netinet/in_gif.c
==============================================================================
--- projects/routing/sys/netinet/in_gif.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/netinet/in_gif.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
#include <net/if.h>
#include <net/if_var.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <net/vnet.h>
#include <netinet/in.h>
Modified: projects/routing/sys/netinet/in_rmx.c
==============================================================================
--- projects/routing/sys/netinet/in_rmx.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/netinet/in_rmx.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include <net/if.h>
#include <net/if_var.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <net/vnet.h>
#include <netinet/in.h>
Modified: projects/routing/sys/netinet/sctp_os_bsd.h
==============================================================================
--- projects/routing/sys/netinet/sctp_os_bsd.h Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/netinet/sctp_os_bsd.h Sun Aug 23 18:25:53 2015 (r287062)
@@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$");
#include <net/if_types.h>
#include <net/if_var.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <net/vnet.h>
#include <netinet/in.h>
Modified: projects/routing/sys/netinet6/icmp6.c
==============================================================================
--- projects/routing/sys/netinet6/icmp6.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/netinet6/icmp6.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -91,6 +91,7 @@ __FBSDID("$FreeBSD$");
#include <net/if_llatbl.h>
#include <net/if_types.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <net/vnet.h>
#include <netinet/in.h>
Modified: projects/routing/sys/netinet6/in6.c
==============================================================================
--- projects/routing/sys/netinet6/in6.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/netinet6/in6.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -88,6 +88,7 @@ __FBSDID("$FreeBSD$");
#include <net/if_var.h>
#include <net/if_types.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <net/if_dl.h>
#include <net/vnet.h>
Modified: projects/routing/sys/netinet6/in6_gif.c
==============================================================================
--- projects/routing/sys/netinet6/in6_gif.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/netinet6/in6_gif.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
#include <net/if.h>
#include <net/if_var.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <net/vnet.h>
#include <netinet/in.h>
Modified: projects/routing/sys/netinet6/in6_ifattach.c
==============================================================================
--- projects/routing/sys/netinet6/in6_ifattach.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/netinet6/in6_ifattach.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
#include <net/if_dl.h>
#include <net/if_types.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <net/vnet.h>
#include <netinet/in.h>
Modified: projects/routing/sys/netinet6/in6_rmx.c
==============================================================================
--- projects/routing/sys/netinet6/in6_rmx.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/netinet6/in6_rmx.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$");
#include <net/if.h>
#include <net/if_var.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <netinet/in.h>
#include <netinet/ip_var.h>
Modified: projects/routing/sys/netinet6/ip6_forward.c
==============================================================================
--- projects/routing/sys/netinet6/ip6_forward.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/netinet6/ip6_forward.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
#include <net/if_var.h>
#include <net/netisr.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <net/pfil.h>
#include <netinet/in.h>
Modified: projects/routing/sys/netinet6/ip6_input.c
==============================================================================
--- projects/routing/sys/netinet6/ip6_input.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/netinet6/ip6_input.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -91,6 +91,7 @@ __FBSDID("$FreeBSD$");
#include <net/if_types.h>
#include <net/if_dl.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <net/netisr.h>
#include <net/pfil.h>
#include <net/vnet.h>
Modified: projects/routing/sys/netinet6/nd6.c
==============================================================================
--- projects/routing/sys/netinet6/nd6.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/netinet6/nd6.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
#include <net/iso88025.h>
#include <net/fddi.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <net/vnet.h>
#include <netinet/in.h>
Modified: projects/routing/sys/netinet6/nd6_nbr.c
==============================================================================
--- projects/routing/sys/netinet6/nd6_nbr.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/netinet6/nd6_nbr.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
#include <net/if_dl.h>
#include <net/if_var.h>
#include <net/route.h>
+#include <net/route_internal.h>
#ifdef RADIX_MPATH
#include <net/radix_mpath.h>
#endif
Modified: projects/routing/sys/netinet6/nd6_rtr.c
==============================================================================
--- projects/routing/sys/netinet6/nd6_rtr.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/netinet6/nd6_rtr.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
#include <net/if_types.h>
#include <net/if_dl.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <net/radix.h>
#include <net/vnet.h>
Modified: projects/routing/sys/netpfil/ipfw/ip_fw_table_algo.c
==============================================================================
--- projects/routing/sys/netpfil/ipfw/ip_fw_table_algo.c Sun Aug 23 18:24:55 2015 (r287061)
+++ projects/routing/sys/netpfil/ipfw/ip_fw_table_algo.c Sun Aug 23 18:25:53 2015 (r287062)
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
#include <net/if.h> /* ip_fw.h requires IFNAMSIZ */
#include <net/radix.h>
#include <net/route.h>
+#include <net/route_internal.h>
#include <netinet/in.h>
#include <netinet/ip_var.h> /* struct ipfw_rule_ref */
More information about the svn-src-projects
mailing list