summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/ip6_var.h
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2009-07-14 22:48:30 +0000
committerrwatson <rwatson@FreeBSD.org>2009-07-14 22:48:30 +0000
commit57ca4583e728cab422fba8f15de10bd0b637b3dd (patch)
tree13848f891fb2f7a396281b31633563d0f764ff65 /sys/netinet6/ip6_var.h
parentef443476d9706035ac219f0280ef0b817dda7a6d (diff)
downloadFreeBSD-src-57ca4583e728cab422fba8f15de10bd0b637b3dd.zip
FreeBSD-src-57ca4583e728cab422fba8f15de10bd0b637b3dd.tar.gz
Build on Jeff Roberson's linker-set based dynamic per-CPU allocator
(DPCPU), as suggested by Peter Wemm, and implement a new per-virtual network stack memory allocator. Modify vnet to use the allocator instead of monolithic global container structures (vinet, ...). This change solves many binary compatibility problems associated with VIMAGE, and restores ELF symbols for virtualized global variables. Each virtualized global variable exists as a "reference copy", and also once per virtual network stack. Virtualized global variables are tagged at compile-time, placing the in a special linker set, which is loaded into a contiguous region of kernel memory. Virtualized global variables in the base kernel are linked as normal, but those in modules are copied and relocated to a reserved portion of the kernel's vnet region with the help of a the kernel linker. Virtualized global variables exist in per-vnet memory set up when the network stack instance is created, and are initialized statically from the reference copy. Run-time access occurs via an accessor macro, which converts from the current vnet and requested symbol to a per-vnet address. When "options VIMAGE" is not compiled into the kernel, normal global ELF symbols will be used instead and indirection is avoided. This change restores static initialization for network stack global variables, restores support for non-global symbols and types, eliminates the need for many subsystem constructors, eliminates large per-subsystem structures that caused many binary compatibility issues both for monitoring applications (netstat) and kernel modules, removes the per-function INIT_VNET_*() macros throughout the stack, eliminates the need for vnet_symmap ksym(2) munging, and eliminates duplicate definitions of virtualized globals under VIMAGE_GLOBALS. Bump __FreeBSD_version and update UPDATING. Portions submitted by: bz Reviewed by: bz, zec Discussed with: gnn, jamie, jeff, jhb, julian, sam Suggested by: peter Approved by: re (kensmith)
Diffstat (limited to 'sys/netinet6/ip6_var.h')
-rw-r--r--sys/netinet6/ip6_var.h92
1 files changed, 61 insertions, 31 deletions
diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h
index 414880b..b61da42 100644
--- a/sys/netinet6/ip6_var.h
+++ b/sys/netinet6/ip6_var.h
@@ -291,42 +291,72 @@ struct ip6aux {
#define IP6_HDR_ALIGNED_P(ip) ((((intptr_t) (ip)) & 3) == 0)
#endif
-#ifdef VIMAGE_GLOBALS
-extern struct ip6stat ip6stat; /* statistics */
-extern int ip6_defhlim; /* default hop limit */
-extern int ip6_defmcasthlim; /* default multicast hop limit */
-extern int ip6_forwarding; /* act as router? */
-extern int ip6_gif_hlim; /* Hop limit for gif encap packet */
-extern int ip6_use_deprecated; /* allow deprecated addr as source */
-extern int ip6_rr_prune; /* router renumbering prefix
+VNET_DECLARE(struct ip6stat, ip6stat); /* statistics */
+VNET_DECLARE(int, ip6_defhlim); /* default hop limit */
+VNET_DECLARE(int, ip6_defmcasthlim); /* default multicast hop limit */
+VNET_DECLARE(int, ip6_forwarding); /* act as router? */
+VNET_DECLARE(int, ip6_gif_hlim); /* Hop limit for gif encap packet */
+VNET_DECLARE(int, ip6_use_deprecated); /* allow deprecated addr as source */
+VNET_DECLARE(int, ip6_rr_prune); /* router renumbering prefix
* walk list every 5 sec. */
-extern int ip6_mcast_pmtu; /* enable pMTU discovery for multicast? */
-extern int ip6_v6only;
-extern struct socket *ip6_mrouter; /* multicast routing daemon */
-extern int ip6_sendredirects; /* send IP redirects when forwarding? */
-extern int ip6_maxfragpackets; /* Maximum packets in reassembly queue */
-extern int ip6_maxfrags; /* Maximum fragments in reassembly queue */
-extern int ip6_accept_rtadv; /* Acts as a host not a router */
-extern int ip6_keepfaith; /* Firewall Aided Internet Translator */
-extern int ip6_log_interval;
-extern time_t ip6_log_time;
-extern int ip6_hdrnestlimit; /* upper limit of # of extension headers */
-extern int ip6_dad_count; /* DupAddrDetectionTransmits */
-
-extern int ip6_auto_flowlabel;
-extern int ip6_auto_linklocal;
-
-extern int ip6_use_tempaddr; /* whether to use temporary addresses. */
-extern int ip6_prefer_tempaddr; /* whether to prefer temporary addresses
- in the source address selection */
+VNET_DECLARE(int, ip6_mcast_pmtu); /* enable pMTU discovery for multicast? */
+VNET_DECLARE(int, ip6_v6only);
+VNET_DECLARE(struct socket *, ip6_mrouter); /* multicast routing daemon */
+VNET_DECLARE(int, ip6_sendredirects); /* send IP redirects when forwarding? */
+VNET_DECLARE(int, ip6_maxfragpackets); /* Maximum packets in reassembly
+ * queue */
+VNET_DECLARE(int, ip6_maxfrags); /* Maximum fragments in reassembly
+ * queue */
+VNET_DECLARE(int, ip6_accept_rtadv); /* Acts as a host not a router */
+VNET_DECLARE(int, ip6_keepfaith); /* Firewall Aided Internet Translator */
+VNET_DECLARE(int, ip6_log_interval);
+VNET_DECLARE(time_t, ip6_log_time);
+VNET_DECLARE(int, ip6_hdrnestlimit); /* upper limit of # of extension
+ * headers */
+VNET_DECLARE(int, ip6_dad_count); /* DupAddrDetectionTransmits */
+
+VNET_DECLARE(int, ip6_auto_flowlabel);
+VNET_DECLARE(int, ip6_auto_linklocal);
+
+VNET_DECLARE(int, ip6_use_tempaddr); /* Whether to use temporary addresses */
+VNET_DECLARE(int, ip6_prefer_tempaddr); /* Whether to prefer temporary
+ * addresses in the source address
+ * selection */
#ifdef IPSTEALTH
-extern int ip6stealth;
+VNET_DECLARE(int, ip6stealth);
#endif
-extern int ip6_use_defzone; /* whether to use the default scope zone
- when unspecified */
-#endif /* VIMAGE_GLOBALS */
+VNET_DECLARE(int, ip6_use_defzone); /* Whether to use the default scope
+ * zone when unspecified */
+
+#define V_ip6stat VNET_GET(ip6stat)
+#define V_ip6_defhlim VNET_GET(ip6_defhlim)
+#define V_ip6_defmcasthlim VNET_GET(ip6_defmcasthlim)
+#define V_ip6_forwarding VNET_GET(ip6_forwarding)
+#define V_ip6_gif_hlim VNET_GET(ip6_gif_hlim)
+#define V_ip6_use_deprecated VNET_GET(ip6_use_deprecated)
+#define V_ip6_rr_prune VNET_GET(ip6_rr_prune)
+#define V_ip6_mcast_pmtu VNET_GET(ip6_mcast_pmtu)
+#define V_ip6_v6only VNET_GET(ip6_v6only)
+#define V_ip6_mrouter VNET_GET(ip6_mrouter)
+#define V_ip6_sendredirects VNET_GET(ip6_sendredirects)
+#define V_ip6_maxfragpackets VNET_GET(ip6_maxfragpackets)
+#define V_ip6_maxfrags VNET_GET(ip6_maxfrags)
+#define V_ip6_accept_rtadv VNET_GET(ip6_accept_rtadv)
+#define V_ip6_keepfaith VNET_GET(ip6_keepfaith)
+#define V_ip6_log_interval VNET_GET(ip6_log_interval)
+#define V_ip6_log_time VNET_GET(ip6_log_time)
+#define V_ip6_hdrnestlimit VNET_GET(ip6_hdrnestlimit)
+#define V_ip6_dad_count VNET_GET(ip6_dad_count)
+#define V_ip6_auto_flowlabel VNET_GET(ip6_auto_flowlabel)
+#define V_ip6_auto_linklocal VNET_GET(ip6_auto_linklocal)
+#define V_ip6_use_tempaddr VNET_GET(ip6_use_tempaddr)
+#define V_ip6_prefer_tempaddr VNET_GET(ip6_prefer_tempaddr)
+#ifdef IPSTEALTH
+#define V_ip6stealth VNET_GET(ip6stealth)
+#endif
+#define V_ip6_use_defzone VNET_GET(ip6_use_defzone)
extern struct pfil_head inet6_pfil_hook; /* packet filter hooks */
OpenPOWER on IntegriCloud