diff options
Diffstat (limited to 'sys/netinet6')
30 files changed, 412 insertions, 858 deletions
diff --git a/sys/netinet6/dest6.c b/sys/netinet6/dest6.c index f0045aa..20b5e9d 100644 --- a/sys/netinet6/dest6.c +++ b/sys/netinet6/dest6.c @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$"); #include <netinet/ip6.h> #include <netinet6/ip6_var.h> #include <netinet/icmp6.h> -#include <netinet6/vinet6.h> /* * Destination options header processing. @@ -63,7 +62,6 @@ __FBSDID("$FreeBSD$"); int dest6_input(struct mbuf **mp, int *offp, int proto) { - INIT_VNET_INET6(curvnet); struct mbuf *m = *mp; int off = *offp, dstoptlen, optlen; struct ip6_dest *dstopts; diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c index 3f57802..1531c87 100644 --- a/sys/netinet6/frag6.c +++ b/sys/netinet6/frag6.c @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include <net/if.h> #include <net/route.h> +#include <net/vnet.h> #include <netinet/in.h> #include <netinet/in_var.h> @@ -55,7 +56,6 @@ __FBSDID("$FreeBSD$"); #include <netinet/icmp6.h> #include <netinet/in_systm.h> /* for ECN definitions */ #include <netinet/ip.h> /* for ECN definitions */ -#include <netinet6/vinet6.h> #include <security/mac/mac_framework.h> @@ -76,11 +76,13 @@ static struct mtx ip6qlock; /* * These fields all protected by ip6qlock. */ -#ifdef VIMAGE_GLOBALS -static u_int frag6_nfragpackets; -static u_int frag6_nfrags; -static struct ip6q ip6q; /* ip6 reassemble queue */ -#endif +static VNET_DEFINE(u_int, frag6_nfragpackets); +static VNET_DEFINE(u_int, frag6_nfrags); +static VNET_DEFINE(struct ip6q, ip6q); /* ip6 reassemble queue */ + +#define V_frag6_nfragpackets VNET_GET(frag6_nfragpackets) +#define V_frag6_nfrags VNET_GET(frag6_nfrags) +#define V_ip6q VNET_GET(ip6q) #define IP6Q_LOCK_INIT() mtx_init(&ip6qlock, "ip6qlock", NULL, MTX_DEF); #define IP6Q_LOCK() mtx_lock(&ip6qlock) @@ -96,7 +98,6 @@ static MALLOC_DEFINE(M_FTABLE, "fragment", "fragment reassembly header"); static void frag6_change(void *tag) { - INIT_VNET_INET6(curvnet); V_ip6_maxfragpackets = nmbclusters / 4; V_ip6_maxfrags = nmbclusters / 4; @@ -105,7 +106,6 @@ frag6_change(void *tag) void frag6_init(void) { - INIT_VNET_INET6(curvnet); V_ip6q.ip6q_next = V_ip6q.ip6q_prev = &V_ip6q; V_ip6_maxfragpackets = nmbclusters / 4; @@ -154,7 +154,6 @@ frag6_init(void) int frag6_input(struct mbuf **mp, int *offp, int proto) { - INIT_VNET_INET6(curvnet); struct mbuf *m = *mp, *t; struct ip6_hdr *ip6; struct ip6_frag *ip6f; @@ -619,7 +618,6 @@ insert: void frag6_freef(struct ip6q *q6) { - INIT_VNET_INET6(curvnet); struct ip6asfrag *af6, *down6; IP6Q_LOCK_ASSERT(); @@ -726,7 +724,6 @@ frag6_slowtimo(void) VNET_LIST_RLOCK(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); - INIT_VNET_INET6(vnet_iter); q6 = V_ip6q.ip6q_next; if (q6) while (q6 != &V_ip6q) { @@ -768,7 +765,6 @@ frag6_drain(void) VNET_LIST_RLOCK(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); - INIT_VNET_INET6(vnet_iter); while (V_ip6q.ip6q_next != &V_ip6q) { V_ip6stat.ip6s_fragdropped++; /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 3ecf386..f65aec8 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -97,7 +97,6 @@ __FBSDID("$FreeBSD$"); #include <netinet/ip6.h> #include <netinet/icmp6.h> #include <netinet/tcp_var.h> -#include <netinet/vinet.h> #include <netinet6/in6_ifattach.h> #include <netinet6/in6_pcb.h> @@ -106,7 +105,6 @@ __FBSDID("$FreeBSD$"); #include <netinet6/scope6_var.h> #include <netinet6/mld6_var.h> #include <netinet6/nd6.h> -#include <netinet6/vinet6.h> #ifdef IPSEC #include <netipsec/ipsec.h> @@ -115,16 +113,22 @@ __FBSDID("$FreeBSD$"); extern struct domain inet6domain; -#ifdef VIMAGE_GLOBALS -extern struct inpcbinfo ripcbinfo; -extern struct inpcbhead ripcb; -extern int icmp6errppslim; -extern int icmp6_nodeinfo; +VNET_DECLARE(struct inpcbinfo, ripcbinfo); +VNET_DECLARE(struct inpcbhead, ripcb); +VNET_DECLARE(int, icmp6errppslim); +VNET_DECLARE(int, icmp6_nodeinfo); -struct icmp6stat icmp6stat; -static int icmp6errpps_count; -static struct timeval icmp6errppslim_last; -#endif +#define V_ripcbinfo VNET_GET(ripcbinfo) +#define V_ripcb VNET_GET(ripcb) +#define V_icmp6errppslim VNET_GET(icmp6errppslim) +#define V_icmp6_nodeinfo VNET_GET(icmp6_nodeinfo) + +VNET_DEFINE(struct icmp6stat, icmp6stat); +static VNET_DEFINE(int, icmp6errpps_count); +static VNET_DEFINE(struct timeval, icmp6errppslim_last); + +#define V_icmp6errpps_count VNET_GET(icmp6errpps_count) +#define V_icmp6errppslim_last VNET_GET(icmp6errppslim_last) static void icmp6_errcount(struct icmp6errstat *, int, int); static int icmp6_rip6_input(struct mbuf **, int); @@ -144,7 +148,6 @@ static int icmp6_notify_error(struct mbuf **, int, int, int); void icmp6_init(void) { - INIT_VNET_INET6(curvnet); V_icmp6errpps_count = 0; } @@ -213,7 +216,6 @@ void icmp6_error2(struct mbuf *m, int type, int code, int param, struct ifnet *ifp) { - INIT_VNET_INET6(curvnet); struct ip6_hdr *ip6; if (ifp == NULL) @@ -245,7 +247,6 @@ icmp6_error2(struct mbuf *m, int type, int code, int param, void icmp6_error(struct mbuf *m, int type, int code, int param) { - INIT_VNET_INET6(curvnet); struct ip6_hdr *oip6, *nip6; struct icmp6_hdr *icmp6; u_int preplen; @@ -400,7 +401,6 @@ icmp6_error(struct mbuf *m, int type, int code, int param) int icmp6_input(struct mbuf **mp, int *offp, int proto) { - INIT_VNET_INET6(curvnet); struct mbuf *m = *mp, *n; struct ifnet *ifp; struct ip6_hdr *ip6, *nip6; @@ -884,7 +884,6 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) static int icmp6_notify_error(struct mbuf **mp, int off, int icmp6len, int code) { - INIT_VNET_INET6(curvnet); struct mbuf *m = *mp; struct icmp6_hdr *icmp6; struct ip6_hdr *eip6; @@ -1116,7 +1115,6 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp6len, int code) void icmp6_mtudisc_update(struct ip6ctlparam *ip6cp, int validated) { - INIT_VNET_INET6(curvnet); struct in6_addr *dst = ip6cp->ip6c_finaldst; struct icmp6_hdr *icmp6 = ip6cp->ip6c_icmp6; struct mbuf *m = ip6cp->ip6c_m; /* will be necessary for scope issue */ @@ -1181,7 +1179,6 @@ icmp6_mtudisc_update(struct ip6ctlparam *ip6cp, int validated) static struct mbuf * ni6_input(struct mbuf *m, int off) { - INIT_VNET_INET6(curvnet); struct icmp6_nodeinfo *ni6, *nni6; struct mbuf *n = NULL; struct prison *pr; @@ -1673,8 +1670,6 @@ static int ni6_addrs(struct icmp6_nodeinfo *ni6, struct mbuf *m, struct ifnet **ifpp, struct in6_addr *subj) { - INIT_VNET_NET(curvnet); - INIT_VNET_INET6(curvnet); struct ifnet *ifp; struct in6_ifaddr *ifa6; struct ifaddr *ifa; @@ -1768,8 +1763,6 @@ static int ni6_store_addrs(struct icmp6_nodeinfo *ni6, struct icmp6_nodeinfo *nni6, struct ifnet *ifp0, int resid) { - INIT_VNET_NET(curvnet); - INIT_VNET_INET6(curvnet); struct ifnet *ifp = ifp0 ? ifp0 : TAILQ_FIRST(&V_ifnet); struct in6_ifaddr *ifa6; struct ifaddr *ifa; @@ -1911,8 +1904,6 @@ ni6_store_addrs(struct icmp6_nodeinfo *ni6, struct icmp6_nodeinfo *nni6, static int icmp6_rip6_input(struct mbuf **mp, int off) { - INIT_VNET_INET(curvnet); - INIT_VNET_INET6(curvnet); struct mbuf *m = *mp; struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); struct inpcb *in6p; @@ -2073,7 +2064,6 @@ icmp6_rip6_input(struct mbuf **mp, int off) void icmp6_reflect(struct mbuf *m, size_t off) { - INIT_VNET_INET6(curvnet); struct ip6_hdr *ip6; struct icmp6_hdr *icmp6; struct in6_ifaddr *ia = NULL; @@ -2265,7 +2255,6 @@ icmp6_redirect_diag(struct in6_addr *src6, struct in6_addr *dst6, void icmp6_redirect_input(struct mbuf *m, int off) { - INIT_VNET_INET6(curvnet); struct ifnet *ifp; struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); struct nd_redirect *nd_rd; @@ -2473,7 +2462,6 @@ icmp6_redirect_input(struct mbuf *m, int off) void icmp6_redirect_output(struct mbuf *m0, struct rtentry *rt) { - INIT_VNET_INET6(curvnet); struct ifnet *ifp; /* my outgoing interface */ struct in6_addr *ifp_ll6; struct in6_addr *router_ll6; @@ -2843,7 +2831,6 @@ static int icmp6_ratelimit(const struct in6_addr *dst, const int type, const int code) { - INIT_VNET_INET6(curvnet); int ret; ret = 0; /* okay to send */ diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 40d198a..7100ff1 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -103,7 +103,6 @@ __FBSDID("$FreeBSD$"); #include <netinet6/in6_ifattach.h> #include <netinet6/scope6_var.h> #include <netinet6/in6_pcb.h> -#include <netinet6/vinet6.h> /* * Definitions of some costant IP6 addresses. @@ -181,7 +180,6 @@ int in6_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) { - INIT_VNET_INET6(curvnet); struct in6_ifreq *ifr = (struct in6_ifreq *)data; struct in6_ifaddr *ia = NULL; struct in6_aliasreq *ifra = (struct in6_aliasreq *)data; @@ -682,7 +680,6 @@ int in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, struct in6_ifaddr *ia, int flags) { - INIT_VNET_INET6(ifp->if_vnet); int error = 0, hostIsNew = 0, plen = -1; struct sockaddr_in6 dst6; struct in6_addrlifetime *lt; @@ -1388,7 +1385,6 @@ cleanup: static void in6_unlink_ifa(struct in6_ifaddr *ia, struct ifnet *ifp) { - INIT_VNET_INET6(ifp->if_vnet); int s = splnet(); IF_ADDR_LOCK(ifp); @@ -1964,7 +1960,6 @@ ip6_sprintf(char *ip6buf, const struct in6_addr *addr) int in6_localaddr(struct in6_addr *in6) { - INIT_VNET_INET6(curvnet); struct in6_ifaddr *ia; if (IN6_IS_ADDR_LOOPBACK(in6) || IN6_IS_ADDR_LINKLOCAL(in6)) @@ -1986,7 +1981,6 @@ in6_localaddr(struct in6_addr *in6) int in6_is_addr_deprecated(struct sockaddr_in6 *sa6) { - INIT_VNET_INET6(curvnet); struct in6_ifaddr *ia; IN6_IFADDR_RLOCK(); @@ -2083,7 +2077,6 @@ in6_prefixlen2mask(struct in6_addr *maskp, int len) struct in6_ifaddr * in6_ifawithifp(struct ifnet *ifp, struct in6_addr *dst) { - INIT_VNET_INET6(curvnet); int dst_scope = in6_addrscope(dst), blen = -1, tlen; struct ifaddr *ifa; struct in6_ifaddr *besta = 0; @@ -2244,8 +2237,6 @@ in6if_do_dad(struct ifnet *ifp) void in6_setmaxmtu(void) { - INIT_VNET_NET(curvnet); - INIT_VNET_INET6(curvnet); unsigned long maxmtu = 0; struct ifnet *ifp; diff --git a/sys/netinet6/in6_gif.c b/sys/netinet6/in6_gif.c index 68ebc9c..e51506b 100644 --- a/sys/netinet6/in6_gif.c +++ b/sys/netinet6/in6_gif.c @@ -66,7 +66,6 @@ __FBSDID("$FreeBSD$"); #include <netinet/ip_ecn.h> #ifdef INET6 #include <netinet6/ip6_ecn.h> -#include <netinet6/vinet6.h> #endif #include <net/if_gif.h> @@ -91,7 +90,6 @@ in6_gif_output(struct ifnet *ifp, int family, /* family of the packet to be encapsulate */ struct mbuf *m) { - INIT_VNET_GIF(ifp->if_vnet); struct gif_softc *sc = ifp->if_softc; struct sockaddr_in6 *dst = (struct sockaddr_in6 *)&sc->gif_ro6.ro_dst; struct sockaddr_in6 *sin6_src = (struct sockaddr_in6 *)sc->gif_psrc; @@ -279,7 +277,6 @@ in6_gif_output(struct ifnet *ifp, int in6_gif_input(struct mbuf **mp, int *offp, int proto) { - INIT_VNET_INET6(curvnet); struct mbuf *m = *mp; struct ifnet *gifp = NULL; struct gif_softc *sc; diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index 7fc1251..56d9f27 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -53,7 +53,9 @@ __FBSDID("$FreeBSD$"); #include <netinet/in_var.h> #include <netinet/if_ether.h> #include <netinet/in_pcb.h> -#include <netinet/vinet.h> +#include <netinet/ip_var.h> +#include <netinet/udp.h> +#include <netinet/udp_var.h> #include <netinet/ip6.h> #include <netinet6/ip6_var.h> @@ -64,14 +66,15 @@ __FBSDID("$FreeBSD$"); #include <netinet6/nd6.h> #include <netinet6/mld6_var.h> #include <netinet6/scope6_var.h> -#include <netinet6/vinet6.h> -#ifdef VIMAGE_GLOBALS -unsigned long in6_maxmtu; -int ip6_auto_linklocal; -struct callout in6_tmpaddrtimer_ch; -extern struct inpcbinfo ripcbinfo; -#endif +VNET_DEFINE(unsigned long, in6_maxmtu); +VNET_DEFINE(int, ip6_auto_linklocal); +VNET_DEFINE(struct callout, in6_tmpaddrtimer_ch); + +#define V_in6_tmpaddrtimer_ch VNET_GET(in6_tmpaddrtimer_ch) + +VNET_DECLARE(struct inpcbinfo, ripcbinfo); +#define V_ripcbinfo VNET_GET(ripcbinfo) static int get_rand_ifid(struct ifnet *, struct in6_addr *); static int generate_tmp_ifid(u_int8_t *, const u_int8_t *, u_int8_t *); @@ -142,7 +145,6 @@ get_rand_ifid(struct ifnet *ifp, struct in6_addr *in6) static int generate_tmp_ifid(u_int8_t *seed0, const u_int8_t *seed1, u_int8_t *ret) { - INIT_VNET_INET6(curvnet); MD5_CTX ctxt; u_int8_t seed[16], digest[16], nullbuf[8]; u_int32_t val32; @@ -379,8 +381,6 @@ static int get_ifid(struct ifnet *ifp0, struct ifnet *altifp, struct in6_addr *in6) { - INIT_VNET_NET(ifp0->if_vnet); - INIT_VNET_INET6(ifp0->if_vnet); struct ifnet *ifp; /* first, try to get it from the interface itself */ @@ -444,7 +444,6 @@ success: static int in6_ifattach_linklocal(struct ifnet *ifp, struct ifnet *altifp) { - INIT_VNET_INET6(curvnet); struct in6_ifaddr *ia; struct in6_aliasreq ifra; struct nd_prefixctl pr0; @@ -562,7 +561,6 @@ in6_ifattach_linklocal(struct ifnet *ifp, struct ifnet *altifp) static int in6_ifattach_loopback(struct ifnet *ifp) { - INIT_VNET_INET6(curvnet); struct in6_aliasreq ifra; int error; @@ -694,7 +692,6 @@ in6_nigroup(struct ifnet *ifp, const char *name, int namelen, void in6_ifattach(struct ifnet *ifp, struct ifnet *altifp) { - INIT_VNET_INET6(ifp->if_vnet); struct in6_ifaddr *ia; struct in6_addr in6; @@ -782,8 +779,6 @@ statinit: void in6_ifdetach(struct ifnet *ifp) { - INIT_VNET_INET(ifp->if_vnet); - INIT_VNET_INET6(ifp->if_vnet); struct in6_ifaddr *ia; struct ifaddr *ifa, *next; struct radix_node_head *rnh; @@ -908,8 +903,6 @@ void in6_tmpaddrtimer(void *arg) { CURVNET_SET((struct vnet *) arg); - INIT_VNET_NET(curvnet); - INIT_VNET_INET6(curvnet); struct nd_ifinfo *ndi; u_int8_t nullbuf[8]; struct ifnet *ifp; diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c index 4ea8e10..f7607de 100644 --- a/sys/netinet6/in6_mcast.c +++ b/sys/netinet6/in6_mcast.c @@ -66,9 +66,8 @@ __FBSDID("$FreeBSD$"); #include <netinet/in_pcb.h> #include <netinet/tcp_var.h> #include <netinet6/nd6.h> -#include <netinet/vinet.h> -#include <netinet6/vinet6.h> #include <netinet6/mld6_var.h> +#include <netinet6/scope6_var.h> #ifndef KTR_MLD #define KTR_MLD KTR_INET6 @@ -1319,7 +1318,6 @@ in6_mc_leave_locked(struct in6_multi *inm, /*const*/ struct in6_mfilter *imf) static int in6p_block_unblock_source(struct inpcb *inp, struct sockopt *sopt) { - INIT_VNET_NET(curvnet); struct group_source_req gsr; sockunion_t *gsa, *ssa; struct ifnet *ifp; @@ -1482,7 +1480,6 @@ out_in6p_locked: static struct ip6_moptions * in6p_findmoptions(struct inpcb *inp) { - INIT_VNET_INET6(curvnet); struct ip6_moptions *imo; struct in6_multi **immp; struct in6_mfilter *imfp; @@ -1560,7 +1557,6 @@ ip6_freemoptions(struct ip6_moptions *imo) static int in6p_get_source_filters(struct inpcb *inp, struct sockopt *sopt) { - INIT_VNET_NET(curvnet); struct __msfilterreq msfr; sockunion_t *gsa; struct ifnet *ifp; @@ -1685,7 +1681,6 @@ in6p_get_source_filters(struct inpcb *inp, struct sockopt *sopt) int ip6_getmoptions(struct inpcb *inp, struct sockopt *sopt) { - INIT_VNET_INET6(curvnet); struct ip6_moptions *im6o; int error; u_int optval; @@ -1808,7 +1803,6 @@ in6p_lookup_mcast_ifp(const struct inpcb *in6p __unused, static int in6p_join_group(struct inpcb *inp, struct sockopt *sopt) { - INIT_VNET_NET(curvnet); struct group_source_req gsr; sockunion_t *gsa, *ssa; struct ifnet *ifp; @@ -2055,8 +2049,6 @@ out_in6p_locked: static int in6p_leave_group(struct inpcb *inp, struct sockopt *sopt) { - INIT_VNET_NET(curvnet); - INIT_VNET_INET6(curvnet); struct ipv6_mreq mreq; struct group_source_req gsr; sockunion_t *gsa, *ssa; @@ -2292,7 +2284,6 @@ out_in6p_locked: static int in6p_set_multicast_if(struct inpcb *inp, struct sockopt *sopt) { - INIT_VNET_NET(curvnet); struct ifnet *ifp; struct ip6_moptions *imo; u_int ifindex; @@ -2326,7 +2317,6 @@ in6p_set_multicast_if(struct inpcb *inp, struct sockopt *sopt) static int in6p_set_source_filters(struct inpcb *inp, struct sockopt *sopt) { - INIT_VNET_NET(curvnet); struct __msfilterreq msfr; sockunion_t *gsa; struct ifnet *ifp; @@ -2507,7 +2497,6 @@ out_in6p_locked: int ip6_setmoptions(struct inpcb *inp, struct sockopt *sopt) { - INIT_VNET_INET6(curvnet); struct ip6_moptions *im6o; int error; @@ -2615,7 +2604,6 @@ ip6_setmoptions(struct inpcb *inp, struct sockopt *sopt) static int sysctl_ip6_mcast_filters(SYSCTL_HANDLER_ARGS) { - INIT_VNET_NET(curvnet); struct in6_addr mcaddr; struct in6_addr src; struct ifnet *ifp; diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 9df8c33..924e15d 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -95,14 +95,12 @@ __FBSDID("$FreeBSD$"); #include <netinet/tcp_var.h> #include <netinet/ip6.h> #include <netinet/ip_var.h> -#include <netinet/vinet.h> #include <netinet6/ip6_var.h> #include <netinet6/nd6.h> #include <netinet/in_pcb.h> #include <netinet6/in6_pcb.h> #include <netinet6/scope6_var.h> -#include <netinet6/vinet6.h> #include <security/mac/mac_framework.h> @@ -112,8 +110,6 @@ int in6_pcbbind(register struct inpcb *inp, struct sockaddr *nam, struct ucred *cred) { - INIT_VNET_INET6(inp->inp_vnet); - INIT_VNET_INET(inp->inp_vnet); struct socket *so = inp->inp_socket; struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)NULL; struct inpcbinfo *pcbinfo = inp->inp_pcbinfo; @@ -291,7 +287,6 @@ int in6_pcbladdr(register struct inpcb *inp, struct sockaddr *nam, struct in6_addr *plocal_addr6) { - INIT_VNET_INET6(inp->inp_vnet); register struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)nam; int error = 0; struct ifnet *ifp = NULL; diff --git a/sys/netinet6/in6_proto.c b/sys/netinet6/in6_proto.c index 21a4a03..1a536dc 100644 --- a/sys/netinet6/in6_proto.c +++ b/sys/netinet6/in6_proto.c @@ -130,7 +130,6 @@ __FBSDID("$FreeBSD$"); #endif /* IPSEC */ #include <netinet6/ip6protosw.h> -#include <netinet6/vinet6.h> /* * TCP/IP protocol family: IP6, ICMP6, UDP, TCP. @@ -381,26 +380,25 @@ DOMAIN_SET(inet6); /* * Internet configuration info */ -#ifdef VIMAGE_GLOBALS -int ip6_forwarding; -int ip6_sendredirects; -int ip6_defhlim; -int ip6_defmcasthlim; -int ip6_accept_rtadv; -int ip6_maxfragpackets; -int ip6_maxfrags; -int ip6_log_interval; -int ip6_hdrnestlimit; -int ip6_dad_count; -int ip6_auto_flowlabel; -int ip6_use_deprecated; -int ip6_rr_prune; -int ip6_mcast_pmtu; -int ip6_v6only; -int ip6_keepfaith; -time_t ip6_log_time; -int ip6stealth; -int nd6_onlink_ns_rfc4861; +VNET_DEFINE(int, ip6_forwarding); +VNET_DEFINE(int, ip6_sendredirects); +VNET_DEFINE(int, ip6_defhlim); +VNET_DEFINE(int, ip6_defmcasthlim); +VNET_DEFINE(int, ip6_accept_rtadv); +VNET_DEFINE(int, ip6_maxfragpackets); +VNET_DEFINE(int, ip6_maxfrags); +VNET_DEFINE(int, ip6_log_interval); +VNET_DEFINE(int, ip6_hdrnestlimit); +VNET_DEFINE(int, ip6_dad_count); +VNET_DEFINE(int, ip6_auto_flowlabel); +VNET_DEFINE(int, ip6_use_deprecated); +VNET_DEFINE(int, ip6_rr_prune); +VNET_DEFINE(int, ip6_mcast_pmtu); +VNET_DEFINE(int, ip6_v6only); +VNET_DEFINE(int, ip6_keepfaith); +VNET_DEFINE(time_t, ip6_log_time); +VNET_DEFINE(int, ip6stealth); +VNET_DEFINE(int, nd6_onlink_ns_rfc4861); /* icmp6 */ /* @@ -408,27 +406,26 @@ int nd6_onlink_ns_rfc4861; * XXX: what if we don't define INET? Should we define pmtu6_expire * or so? (jinmei@kame.net 19990310) */ -int pmtu_expire; -int pmtu_probe; +VNET_DEFINE(int, pmtu_expire); +VNET_DEFINE(int, pmtu_probe); /* raw IP6 parameters */ /* * Nominal space allocated to a raw ip socket. */ -u_long rip6_sendspace; -u_long rip6_recvspace; +VNET_DEFINE(u_long, rip6_sendspace); +VNET_DEFINE(u_long, rip6_recvspace); /* ICMPV6 parameters */ -int icmp6_rediraccept; -int icmp6_redirtimeout; -int icmp6errppslim; +VNET_DEFINE(int, icmp6_rediraccept); +VNET_DEFINE(int, icmp6_redirtimeout); +VNET_DEFINE(int, icmp6errppslim); /* control how to respond to NI queries */ -int icmp6_nodeinfo; +VNET_DEFINE(int, icmp6_nodeinfo); /* UDP on IP6 parameters */ -int udp6_sendspace; -int udp6_recvspace; -#endif /* VIMAGE_GLOBALS */ +VNET_DEFINE(int, udp6_sendspace); +VNET_DEFINE(int, udp6_recvspace); /* * sysctl related items. @@ -452,11 +449,14 @@ SYSCTL_NODE(_net_inet6, IPPROTO_ESP, ipsec6, CTLFLAG_RW, 0, "IPSEC6"); static int sysctl_ip6_temppltime(SYSCTL_HANDLER_ARGS) { - INIT_VNET_INET6(curvnet); int error = 0; int old; - SYSCTL_RESOLVE_V_ARG1(); +#ifdef VIMAGE + if (arg1 != NULL) + arg1 = (void *)(TD_TO_VNET(req->td)->vnet_data_base + + (uintptr_t)arg1); +#endif error = SYSCTL_OUT(req, arg1, sizeof(int)); if (error || !req->newptr) @@ -474,11 +474,14 @@ sysctl_ip6_temppltime(SYSCTL_HANDLER_ARGS) static int sysctl_ip6_tempvltime(SYSCTL_HANDLER_ARGS) { - INIT_VNET_INET6(curvnet); int error = 0; int old; - SYSCTL_RESOLVE_V_ARG1(); +#ifdef VIMAGE + if (arg1 != NULL) + arg1 = (void *)(TD_TO_VNET(req->td)->vnet_data_base + + (uintptr_t)arg1); +#endif error = SYSCTL_OUT(req, arg1, sizeof(int)); if (error || !req->newptr) @@ -492,89 +495,89 @@ sysctl_ip6_tempvltime(SYSCTL_HANDLER_ARGS) return (error); } -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_FORWARDING, - forwarding, CTLFLAG_RW, ip6_forwarding, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_SENDREDIRECTS, - redirect, CTLFLAG_RW, ip6_sendredirects, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_DEFHLIM, - hlim, CTLFLAG_RW, ip6_defhlim, 0, ""); -SYSCTL_V_STRUCT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_STATS, stats, - CTLFLAG_RD, ip6stat, ip6stat, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_MAXFRAGPACKETS, - maxfragpackets, CTLFLAG_RW, ip6_maxfragpackets, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_ACCEPT_RTADV, - accept_rtadv, CTLFLAG_RW, ip6_accept_rtadv, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_KEEPFAITH, - keepfaith, CTLFLAG_RW, ip6_keepfaith, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_LOG_INTERVAL, - log_interval, CTLFLAG_RW, ip6_log_interval, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_HDRNESTLIMIT, - hdrnestlimit, CTLFLAG_RW, ip6_hdrnestlimit, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_DAD_COUNT, - dad_count, CTLFLAG_RW, ip6_dad_count, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_AUTO_FLOWLABEL, - auto_flowlabel, CTLFLAG_RW, ip6_auto_flowlabel, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_DEFMCASTHLIM, - defmcasthlim, CTLFLAG_RW, ip6_defmcasthlim, 0, ""); -SYSCTL_STRING(_net_inet6_ip6, IPV6CTL_KAME_VERSION, - kame_version, CTLFLAG_RD, __KAME_VERSION, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_USE_DEPRECATED, - use_deprecated, CTLFLAG_RW, ip6_use_deprecated, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_RR_PRUNE, - rr_prune, CTLFLAG_RW, ip6_rr_prune, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_USETEMPADDR, - use_tempaddr, CTLFLAG_RW, ip6_use_tempaddr, 0, ""); -SYSCTL_V_OID(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_TEMPPLTIME, temppltime, - CTLTYPE_INT|CTLFLAG_RW, ip6_temp_preferred_lifetime, 0, +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_FORWARDING, forwarding, CTLFLAG_RW, + &VNET_NAME(ip6_forwarding), 0, ""); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_SENDREDIRECTS, redirect, CTLFLAG_RW, + &VNET_NAME(ip6_sendredirects), 0, ""); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_DEFHLIM, hlim, CTLFLAG_RW, + &VNET_NAME(ip6_defhlim), 0, ""); +SYSCTL_VNET_STRUCT(_net_inet6_ip6, IPV6CTL_STATS, stats, CTLFLAG_RD, + &VNET_NAME(ip6stat), ip6stat, ""); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGPACKETS, maxfragpackets, + CTLFLAG_RW, &VNET_NAME(ip6_maxfragpackets), 0, ""); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_ACCEPT_RTADV, accept_rtadv, + CTLFLAG_RW, &VNET_NAME(ip6_accept_rtadv), 0, ""); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_KEEPFAITH, keepfaith, CTLFLAG_RW, + &VNET_NAME(ip6_keepfaith), 0, ""); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_LOG_INTERVAL, log_interval, + CTLFLAG_RW, &VNET_NAME(ip6_log_interval), 0, ""); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_HDRNESTLIMIT, hdrnestlimit, + CTLFLAG_RW, &VNET_NAME(ip6_hdrnestlimit), 0, ""); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_DAD_COUNT, dad_count, CTLFLAG_RW, + &VNET_NAME(ip6_dad_count), 0, ""); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_AUTO_FLOWLABEL, auto_flowlabel, + CTLFLAG_RW, &VNET_NAME(ip6_auto_flowlabel), 0, ""); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_DEFMCASTHLIM, defmcasthlim, + CTLFLAG_RW, &VNET_NAME(ip6_defmcasthlim), 0, ""); +SYSCTL_STRING(_net_inet6_ip6, IPV6CTL_KAME_VERSION, kame_version, + CTLFLAG_RD, __KAME_VERSION, 0, ""); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_USE_DEPRECATED, use_deprecated, + CTLFLAG_RW, &VNET_NAME(ip6_use_deprecated), 0, ""); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_RR_PRUNE, rr_prune, CTLFLAG_RW, + &VNET_NAME(ip6_rr_prune), 0, ""); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_USETEMPADDR, use_tempaddr, + CTLFLAG_RW, &VNET_NAME(ip6_use_tempaddr), 0, ""); +SYSCTL_VNET_PROC(_net_inet6_ip6, IPV6CTL_TEMPPLTIME, temppltime, + CTLTYPE_INT|CTLFLAG_RW, &VNET_NAME(ip6_temp_preferred_lifetime), 0, sysctl_ip6_temppltime, "I", ""); -SYSCTL_V_OID(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_TEMPVLTIME, tempvltime, - CTLTYPE_INT|CTLFLAG_RW, ip6_temp_valid_lifetime, 0, +SYSCTL_VNET_PROC(_net_inet6_ip6, IPV6CTL_TEMPVLTIME, tempvltime, + CTLTYPE_INT|CTLFLAG_RW, &VNET_NAME(ip6_temp_valid_lifetime), 0, sysctl_ip6_tempvltime, "I", ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_V6ONLY, - v6only, CTLFLAG_RW, ip6_v6only, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_AUTO_LINKLOCAL, - auto_linklocal, CTLFLAG_RW, ip6_auto_linklocal, 0, ""); -SYSCTL_V_STRUCT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_RIP6STATS, - rip6stats, CTLFLAG_RD, rip6stat, rip6stat, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_PREFER_TEMPADDR, - prefer_tempaddr, CTLFLAG_RW, ip6_prefer_tempaddr, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_USE_DEFAULTZONE, - use_defaultzone, CTLFLAG_RW, ip6_use_defzone, 0,""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_MAXFRAGS, - maxfrags, CTLFLAG_RW, ip6_maxfrags, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_MCAST_PMTU, - mcast_pmtu, CTLFLAG_RW, ip6_mcast_pmtu, 0, ""); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_V6ONLY, v6only, CTLFLAG_RW, + &VNET_NAME(ip6_v6only), 0, ""); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_AUTO_LINKLOCAL, auto_linklocal, + CTLFLAG_RW, &VNET_NAME(ip6_auto_linklocal), 0, ""); +SYSCTL_VNET_STRUCT(_net_inet6_ip6, IPV6CTL_RIP6STATS, rip6stats, CTLFLAG_RD, + &VNET_NAME(rip6stat), rip6stat, ""); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_PREFER_TEMPADDR, prefer_tempaddr, + CTLFLAG_RW, &VNET_NAME(ip6_prefer_tempaddr), 0, ""); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_USE_DEFAULTZONE, use_defaultzone, + CTLFLAG_RW, &VNET_NAME(ip6_use_defzone), 0,""); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGS, maxfrags, CTLFLAG_RW, + &VNET_NAME(ip6_maxfrags), 0, ""); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_MCAST_PMTU, mcast_pmtu, CTLFLAG_RW, + &VNET_NAME(ip6_mcast_pmtu), 0, ""); #ifdef IPSTEALTH -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_STEALTH, - stealth, CTLFLAG_RW, ip6stealth, 0, ""); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_STEALTH, stealth, CTLFLAG_RW, + &VNET_NAME(ip6stealth), 0, ""); #endif /* net.inet6.icmp6 */ -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_REDIRACCEPT, - rediraccept, CTLFLAG_RW, icmp6_rediraccept, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_REDIRTIMEOUT, - redirtimeout, CTLFLAG_RW, icmp6_redirtimeout, 0, ""); -SYSCTL_V_STRUCT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_STATS, - stats, CTLFLAG_RD, icmp6stat, icmp6stat, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_PRUNE, - nd6_prune, CTLFLAG_RW, nd6_prune, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_DELAY, - nd6_delay, CTLFLAG_RW, nd6_delay, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_UMAXTRIES, - nd6_umaxtries, CTLFLAG_RW, nd6_umaxtries, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_MMAXTRIES, - nd6_mmaxtries, CTLFLAG_RW, nd6_mmaxtries, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_USELOOPBACK, - nd6_useloopback, CTLFLAG_RW, nd6_useloopback, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_NODEINFO, - nodeinfo, CTLFLAG_RW, icmp6_nodeinfo, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ERRPPSLIMIT, - errppslimit, CTLFLAG_RW, icmp6errppslim, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_MAXNUDHINT, - nd6_maxnudhint, CTLFLAG_RW, nd6_maxnudhint, 0, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_DEBUG, - nd6_debug, CTLFLAG_RW, nd6_debug, 0, ""); - -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_ONLINKNSRFC4861, - nd6_onlink_ns_rfc4861, CTLFLAG_RW, nd6_onlink_ns_rfc4861, 0, - "Accept 'on-link' nd6 NS in compliance with RFC 4861."); +SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6CTL_REDIRACCEPT, rediraccept, + CTLFLAG_RW, &VNET_NAME(icmp6_rediraccept), 0, ""); +SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6CTL_REDIRTIMEOUT, redirtimeout, + CTLFLAG_RW, &VNET_NAME(icmp6_redirtimeout), 0, ""); +SYSCTL_VNET_STRUCT(_net_inet6_icmp6, ICMPV6CTL_STATS, stats, CTLFLAG_RD, + &VNET_NAME(icmp6stat), icmp6stat, ""); +SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_PRUNE, nd6_prune, CTLFLAG_RW, + &VNET_NAME(nd6_prune), 0, ""); +SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_DELAY, nd6_delay, CTLFLAG_RW, + &VNET_NAME(nd6_delay), 0, ""); +SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_UMAXTRIES, nd6_umaxtries, + CTLFLAG_RW, &VNET_NAME(nd6_umaxtries), 0, ""); +SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_MMAXTRIES, nd6_mmaxtries, + CTLFLAG_RW, &VNET_NAME(nd6_mmaxtries), 0, ""); +SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_USELOOPBACK, nd6_useloopback, + CTLFLAG_RW, &VNET_NAME(nd6_useloopback), 0, ""); +SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6CTL_NODEINFO, nodeinfo, CTLFLAG_RW, + &VNET_NAME(icmp6_nodeinfo), 0, ""); +SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6CTL_ERRPPSLIMIT, errppslimit, + CTLFLAG_RW, &VNET_NAME(icmp6errppslim), 0, ""); +SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_MAXNUDHINT, nd6_maxnudhint, + CTLFLAG_RW, &VNET_NAME(nd6_maxnudhint), 0, ""); +SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_DEBUG, nd6_debug, CTLFLAG_RW, + &VNET_NAME(nd6_debug), 0, ""); + +SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_ONLINKNSRFC4861, + nd6_onlink_ns_rfc4861, CTLFLAG_RW, &VNET_NAME(nd6_onlink_ns_rfc4861), + 0, "Accept 'on-link' nd6 NS in compliance with RFC 4861."); diff --git a/sys/netinet6/in6_rmx.c b/sys/netinet6/in6_rmx.c index f05a093..b378f5a 100644 --- a/sys/netinet6/in6_rmx.c +++ b/sys/netinet6/in6_rmx.c @@ -101,7 +101,6 @@ __FBSDID("$FreeBSD$"); #include <netinet/icmp6.h> #include <netinet6/nd6.h> -#include <netinet6/vinet6.h> #include <netinet/tcp.h> #include <netinet/tcp_seq.h> @@ -206,22 +205,22 @@ in6_matroute(void *v_arg, struct radix_node_head *head) SYSCTL_DECL(_net_inet6_ip6); -#ifdef VIMAGE_GLOBALS -static int rtq_reallyold6; -static int rtq_minreallyold6; -static int rtq_toomany6; -#endif - -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_RTEXPIRE, - rtexpire, CTLFLAG_RW, rtq_reallyold6 , 0, ""); +static VNET_DEFINE(int, rtq_reallyold6); +static VNET_DEFINE(int, rtq_minreallyold6); +static VNET_DEFINE(int, rtq_toomany6); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_RTMINEXPIRE, - rtminexpire, CTLFLAG_RW, rtq_minreallyold6 , 0, ""); +#define V_rtq_reallyold6 VNET_GET(rtq_reallyold6) +#define V_rtq_minreallyold6 VNET_GET(rtq_minreallyold6) +#define V_rtq_toomany6 VNET_GET(rtq_toomany6) -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_RTMAXCACHE, - rtmaxcache, CTLFLAG_RW, rtq_toomany6 , 0, ""); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_RTEXPIRE, rtexpire, CTLFLAG_RW, + &VNET_NAME(rtq_reallyold6) , 0, ""); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_RTMINEXPIRE, rtminexpire, CTLFLAG_RW, + &VNET_NAME(rtq_minreallyold6) , 0, ""); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_RTMAXCACHE, rtmaxcache, CTLFLAG_RW, + &VNET_NAME(rtq_toomany6) , 0, ""); struct rtqk_arg { struct radix_node_head *rnh; @@ -241,7 +240,6 @@ struct rtqk_arg { static int in6_rtqkill(struct radix_node *rn, void *rock) { - INIT_VNET_INET6(curvnet); struct rtqk_arg *ap = rock; struct rtentry *rt = (struct rtentry *)rn; int err; @@ -280,16 +278,16 @@ in6_rtqkill(struct radix_node *rn, void *rock) } #define RTQ_TIMEOUT 60*10 /* run no less than once every ten minutes */ -#ifdef VIMAGE_GLOBALS -static int rtq_timeout6; -static struct callout rtq_timer6; -#endif +static VNET_DEFINE(int, rtq_timeout6); +static VNET_DEFINE(struct callout, rtq_timer6); + +#define V_rtq_timeout6 VNET_GET(rtq_timeout6) +#define V_rtq_timer6 VNET_GET(rtq_timer6) static void in6_rtqtimo(void *rock) { CURVNET_SET_QUIET((struct vnet *) rock); - INIT_VNET_INET6(curvnet); struct radix_node_head *rnh; struct rtqk_arg arg; struct timeval atv; @@ -349,9 +347,9 @@ struct mtuex_arg { struct radix_node_head *rnh; time_t nextstop; }; -#ifdef VIMAGE_GLOBALS -static struct callout rtq_mtutimer; -#endif + +static VNET_DEFINE(struct callout, rtq_mtutimer); +#define V_rtq_mtutimer VNET_GET(rtq_mtutimer) static int in6_mtuexpire(struct radix_node *rn, void *rock) @@ -381,7 +379,6 @@ static void in6_mtutimo(void *rock) { CURVNET_SET_QUIET((struct vnet *) rock); - INIT_VNET_INET6(curvnet); struct radix_node_head *rnh; struct mtuex_arg arg; struct timeval atv; @@ -418,7 +415,6 @@ in6_mtutimo(void *rock) int in6_inithead(void **head, int off) { - INIT_VNET_INET6(curvnet); struct radix_node_head *rnh; if (!rn_inithead(head, offsetof(struct sockaddr_in6, sin6_addr) << 3)) @@ -447,7 +443,6 @@ in6_inithead(void **head, int off) int in6_detachhead(void **head, int off) { - INIT_VNET_INET6(curvnet); callout_drain(&V_rtq_timer6); callout_drain(&V_rtq_mtutimer); diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index f1ccca1..ffa6c3e 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -100,7 +100,6 @@ __FBSDID("$FreeBSD$"); #include <netinet/ip_var.h> #include <netinet/udp.h> #include <netinet/udp_var.h> -#include <netinet/vinet.h> #include <netinet6/in6_var.h> #include <netinet/ip6.h> @@ -108,7 +107,6 @@ __FBSDID("$FreeBSD$"); #include <netinet6/ip6_var.h> #include <netinet6/scope6_var.h> #include <netinet6/nd6.h> -#include <netinet6/vinet6.h> static struct mtx addrsel_lock; #define ADDRSEL_LOCK_INIT() mtx_init(&addrsel_lock, "addrsel_lock", NULL, MTX_DEF) @@ -125,10 +123,10 @@ static struct sx addrsel_sxlock; #define ADDR_LABEL_NOTAPP (-1) -#ifdef VIMAGE_GLOBALS -struct in6_addrpolicy defaultaddrpolicy; -int ip6_prefer_tempaddr; -#endif +static VNET_DEFINE(struct in6_addrpolicy, defaultaddrpolicy); +VNET_DEFINE(int, ip6_prefer_tempaddr); + +#define V_defaultaddrpolicy VNET_GET(defaultaddrpolicy) static int selectroute __P((struct sockaddr_in6 *, struct ip6_pktopts *, struct ip6_moptions *, struct route_in6 *, struct ifnet **, @@ -184,7 +182,6 @@ in6_selectsrc(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, struct inpcb *inp, struct route_in6 *ro, struct ucred *cred, struct ifnet **ifpp, struct in6_addr *srcp) { - INIT_VNET_INET6(curvnet); struct in6_addr dst; struct ifnet *ifp = NULL; struct in6_ifaddr *ia = NULL, *ia_best = NULL; @@ -488,7 +485,6 @@ selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, struct ip6_moptions *mopts, struct route_in6 *ro, struct ifnet **retifp, struct rtentry **retrt, int norouteok) { - INIT_VNET_INET6(curvnet); int error = 0; struct ifnet *ifp = NULL; struct rtentry *rt = NULL; @@ -793,7 +789,6 @@ in6_selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, int in6_selecthlim(struct inpcb *in6p, struct ifnet *ifp) { - INIT_VNET_INET6(curvnet); if (in6p && in6p->in6p_hops >= 0) return (in6p->in6p_hops); @@ -826,7 +821,6 @@ in6_selecthlim(struct inpcb *in6p, struct ifnet *ifp) int in6_pcbsetport(struct in6_addr *laddr, struct inpcb *inp, struct ucred *cred) { - INIT_VNET_INET(curvnet); struct socket *so = inp->inp_socket; u_int16_t lport = 0, first, last, *lastport; int count, error, wild = 0, dorandom; @@ -928,7 +922,6 @@ in6_pcbsetport(struct in6_addr *laddr, struct inpcb *inp, struct ucred *cred) void addrsel_policy_init(void) { - INIT_VNET_INET6(curvnet); V_ip6_prefer_tempaddr = 0; @@ -948,7 +941,6 @@ addrsel_policy_init(void) static struct in6_addrpolicy * lookup_addrsel_policy(struct sockaddr_in6 *key) { - INIT_VNET_INET6(curvnet); struct in6_addrpolicy *match = NULL; ADDRSEL_LOCK(); @@ -1035,14 +1027,12 @@ struct addrsel_policyent { TAILQ_HEAD(addrsel_policyhead, addrsel_policyent); -#ifdef VIMAGE_GLOBALS -struct addrsel_policyhead addrsel_policytab; -#endif +static VNET_DEFINE(struct addrsel_policyhead, addrsel_policytab); +#define V_addrsel_policytab VNET_GET(addrsel_policytab) static void init_policy_queue(void) { - INIT_VNET_INET6(curvnet); TAILQ_INIT(&V_addrsel_policytab); } @@ -1050,7 +1040,6 @@ init_policy_queue(void) static int add_addrsel_policyent(struct in6_addrpolicy *newpolicy) { - INIT_VNET_INET6(curvnet); struct addrsel_policyent *new, *pol; new = malloc(sizeof(*new), M_IFADDR, @@ -1086,7 +1075,6 @@ add_addrsel_policyent(struct in6_addrpolicy *newpolicy) static int delete_addrsel_policyent(struct in6_addrpolicy *key) { - INIT_VNET_INET6(curvnet); struct addrsel_policyent *pol; ADDRSEL_XLOCK(); @@ -1118,7 +1106,6 @@ static int walk_addrsel_policy(int (*callback)(struct in6_addrpolicy *, void *), void *w) { - INIT_VNET_INET6(curvnet); struct addrsel_policyent *pol; int error = 0; @@ -1147,7 +1134,6 @@ dump_addrsel_policyent(struct in6_addrpolicy *pol, void *arg) static struct in6_addrpolicy * match_addrsel_policy(struct sockaddr_in6 *key) { - INIT_VNET_INET6(curvnet); struct addrsel_policyent *pent; struct in6_addrpolicy *bestpol = NULL, *pol; int matchlen, bestmatchlen = -1; diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h index 6fe9df0..f5f5954 100644 --- a/sys/netinet6/in6_var.h +++ b/sys/netinet6/in6_var.h @@ -486,13 +486,13 @@ struct in6_rrenumreq { #endif #ifdef _KERNEL -#ifdef VIMAGE_GLOBALS -extern struct in6_ifaddrhead in6_ifaddrhead; +VNET_DECLARE(struct in6_ifaddrhead, in6_ifaddrhead); +VNET_DECLARE(struct icmp6stat, icmp6stat); +VNET_DECLARE(unsigned long, in6_maxmtu); -extern struct icmp6stat icmp6stat; - -extern unsigned long in6_maxmtu; -#endif /* VIMAGE_GLOBALS */ +#define V_in6_ifaddrhead VNET_GET(in6_ifaddrhead) +#define V_icmp6stat VNET_GET(icmp6stat) +#define V_in6_maxmtu VNET_GET(in6_maxmtu) extern struct rwlock in6_ifaddr_lock; #define IN6_IFADDR_LOCK_ASSERT( ) rw_assert(&in6_ifaddr_lock, RA_LOCKED) diff --git a/sys/netinet6/ip6_forward.c b/sys/netinet6/ip6_forward.c index 10a6c45..896d67c 100644 --- a/sys/netinet6/ip6_forward.c +++ b/sys/netinet6/ip6_forward.c @@ -65,7 +65,6 @@ __FBSDID("$FreeBSD$"); #include <netinet6/scope6_var.h> #include <netinet/icmp6.h> #include <netinet6/nd6.h> -#include <netinet6/vinet6.h> #include <netinet/in_pcb.h> @@ -92,7 +91,6 @@ __FBSDID("$FreeBSD$"); void ip6_forward(struct mbuf *m, int srcrt) { - INIT_VNET_INET6(curvnet); struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); struct sockaddr_in6 *dst = NULL; struct rtentry *rt = NULL; @@ -103,7 +101,6 @@ ip6_forward(struct mbuf *m, int srcrt) u_int32_t inzone, outzone; struct in6_addr src_in6, dst_in6; #ifdef IPSEC - INIT_VNET_IPSEC(curvnet); struct secpolicy *sp = NULL; int ipsecrt = 0; #endif diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index b9d594c..78c0901 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -96,7 +96,6 @@ __FBSDID("$FreeBSD$"); #ifdef INET #include <netinet/ip.h> #include <netinet/ip_icmp.h> -#include <netinet/vinet.h> #endif /* INET */ #include <netinet/ip6.h> #include <netinet6/in6_var.h> @@ -106,7 +105,6 @@ __FBSDID("$FreeBSD$"); #include <netinet6/scope6_var.h> #include <netinet6/in6_ifattach.h> #include <netinet6/nd6.h> -#include <netinet6/vinet6.h> #ifdef IPSEC #include <netipsec/ipsec.h> @@ -127,28 +125,30 @@ static struct netisr_handler ip6_nh = { .nh_policy = NETISR_POLICY_FLOW, }; -#ifndef VIMAGE -#ifndef VIMAGE_GLOBALS -struct vnet_inet6 vnet_inet6_0; -#endif -#endif - -#ifdef VIMAGE_GLOBALS -struct in6_ifaddrhead in6_ifaddrhead; -struct ip6stat ip6stat; - -extern struct callout in6_tmpaddrtimer_ch; - -extern int dad_init; -extern int pmtu_expire; -extern int pmtu_probe; -extern u_long rip6_sendspace; -extern u_long rip6_recvspace; -extern int icmp6errppslim; -extern int icmp6_nodeinfo; -extern int udp6_sendspace; -extern int udp6_recvspace; -#endif +VNET_DEFINE(struct in6_ifaddrhead, in6_ifaddrhead); +VNET_DEFINE(struct ip6stat, ip6stat); + +VNET_DECLARE(struct callout, in6_tmpaddrtimer_ch); +VNET_DECLARE(int, dad_init); +VNET_DECLARE(int, pmtu_expire); +VNET_DECLARE(int, pmtu_probe); +VNET_DECLARE(u_long, rip6_sendspace); +VNET_DECLARE(u_long, rip6_recvspace); +VNET_DECLARE(int, icmp6errppslim); +VNET_DECLARE(int, icmp6_nodeinfo); +VNET_DECLARE(int, udp6_sendspace); +VNET_DECLARE(int, udp6_recvspace); + +#define V_in6_tmpaddrtimer_ch VNET_GET(in6_tmpaddrtimer_ch) +#define V_dad_init VNET_GET(dad_init) +#define V_pmtu_expire VNET_GET(pmtu_expire) +#define V_pmtu_probe VNET_GET(pmtu_probe) +#define V_rip6_sendspace VNET_GET(rip6_sendspace) +#define V_rip6_recvspace VNET_GET(rip6_recvspace) +#define V_icmp6errppslim VNET_GET(icmp6errppslim) +#define V_icmp6_nodeinfo VNET_GET(icmp6_nodeinfo) +#define V_udp6_sendspace VNET_GET(udp6_sendspace) +#define V_udp6_recvspace VNET_GET(udp6_recvspace) struct rwlock in6_ifaddr_lock; RW_SYSINIT(in6_ifaddr_lock, &in6_ifaddr_lock, "in6_ifaddr_lock"); @@ -162,13 +162,13 @@ static int ip6_hopopts_input(u_int32_t *, u_int32_t *, struct mbuf **, int *); static struct mbuf *ip6_pullexthdr(struct mbuf *, size_t, int); #endif -#ifndef VIMAGE_GLOBALS +#ifdef VIMAGE +/* XXX only has to stay for .vmi_dependson elsewhere. */ static void vnet_inet6_register(void); static const vnet_modinfo_t vnet_inet6_modinfo = { .vmi_id = VNET_MOD_INET6, .vmi_name = "inet6", - .vmi_size = sizeof(struct vnet_inet6), .vmi_dependson = VNET_MOD_INET /* XXX revisit - TCP/UDP needs this? */ }; @@ -189,7 +189,6 @@ SYSINIT(inet6, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST, vnet_inet6_register, 0); void ip6_init(void) { - INIT_VNET_INET6(curvnet); struct ip6protosw *pr; int i; @@ -311,7 +310,6 @@ ip6_init(void) void ip6_destroy() { - INIT_VNET_INET6(curvnet); nd6_destroy(); callout_drain(&V_in6_tmpaddrtimer_ch); @@ -321,7 +319,6 @@ ip6_destroy() static int ip6_init2_vnet(const void *unused __unused) { - INIT_VNET_INET6(curvnet); /* nd6_timer_init */ callout_init(&V_nd6_timer_ch, 0); @@ -351,8 +348,6 @@ SYSINIT(netinet6init2, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE, ip6_init2, NULL); void ip6_input(struct mbuf *m) { - INIT_VNET_NET(curvnet); - INIT_VNET_INET6(curvnet); struct ip6_hdr *ip6; int off = sizeof(struct ip6_hdr), nest; u_int32_t plen; @@ -967,7 +962,6 @@ static int ip6_hopopts_input(u_int32_t *plenp, u_int32_t *rtalertp, struct mbuf **mp, int *offp) { - INIT_VNET_INET6(curvnet); struct mbuf *m = *mp; int off = *offp, hbhlen; struct ip6_hbh *hbh; @@ -1023,7 +1017,6 @@ int ip6_process_hopopts(struct mbuf *m, u_int8_t *opthead, int hbhlen, u_int32_t *rtalertp, u_int32_t *plenp) { - INIT_VNET_INET6(curvnet); struct ip6_hdr *ip6; int optlen = 0; u_int8_t *opt = opthead; @@ -1156,7 +1149,6 @@ ip6_process_hopopts(struct mbuf *m, u_int8_t *opthead, int hbhlen, int ip6_unknown_opt(u_int8_t *optp, struct mbuf *m, int off) { - INIT_VNET_INET6(curvnet); struct ip6_hdr *ip6; switch (IP6OPT_TYPE(*optp)) { diff --git a/sys/netinet6/ip6_ipsec.c b/sys/netinet6/ip6_ipsec.c index 57a5044..e763187 100644 --- a/sys/netinet6/ip6_ipsec.c +++ b/sys/netinet6/ip6_ipsec.c @@ -30,6 +30,7 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include "opt_inet6.h" #include "opt_ipsec.h" #include <sys/param.h> @@ -46,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include <net/if.h> #include <net/route.h> +#include <net/vnet.h> #include <netinet/in.h> #include <netinet/in_systm.h> @@ -72,13 +74,25 @@ __FBSDID("$FreeBSD$"); #include <netinet6/ip6_ipsec.h> #include <netinet6/ip6_var.h> -#include <netinet6/vinet6.h> extern struct protosw inet6sw[]; -#ifdef VIMAGE_GLOBALS -int ip6_ipsec6_filtertunnel; + +#ifdef INET6 +#ifdef IPSEC +#ifdef IPSEC_FILTERTUNNEL +static VNET_DEFINE(int, ip6_ipsec6_filtertunnel) = 1; +#else +static VNET_DEFINE(int, ip6_ipsec6_filtertunnel) = 0; #endif +#define V_ip6_ipsec6_filtertunnel VNET_GET(ip6_ipsec6_filtertunnel) + +SYSCTL_DECL(_net_inet6_ipsec6); +SYSCTL_VNET_INT(_net_inet6_ipsec6, OID_AUTO, + filtertunnel, CTLFLAG_RW, &VNET_NAME(ip6_ipsec6_filtertunnel), 0, + "If set filter packets from an IPsec tunnel."); +#endif /* IPSEC */ +#endif /* INET6 */ /* * Check if we have to jump over firewall processing for this packet. @@ -89,7 +103,6 @@ int ip6_ipsec_filtertunnel(struct mbuf *m) { #if defined(IPSEC) - INIT_VNET_IPSEC(curvnet); /* * Bypass packet filtering for packets from a tunnel. @@ -111,8 +124,6 @@ int ip6_ipsec_fwd(struct mbuf *m) { #ifdef IPSEC - INIT_VNET_INET6(curvnet); - INIT_VNET_IPSEC(curvnet); struct m_tag *mtag; struct tdb_ident *tdbi; struct secpolicy *sp; @@ -158,7 +169,6 @@ int ip6_ipsec_input(struct mbuf *m, int nxt) { #ifdef IPSEC - INIT_VNET_IPSEC(curvnet); struct m_tag *mtag; struct tdb_ident *tdbi; struct secpolicy *sp; diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c index 46bfcf1..ccdbbdc 100644 --- a/sys/netinet6/ip6_mroute.c +++ b/sys/netinet6/ip6_mroute.c @@ -113,7 +113,6 @@ __FBSDID("$FreeBSD$"); #include <netinet/in.h> #include <netinet/in_var.h> #include <netinet/icmp6.h> -#include <netinet/vinet.h> #include <netinet/ip_encap.h> #include <netinet/ip6.h> @@ -124,7 +123,6 @@ __FBSDID("$FreeBSD$"); #include <netinet6/ip6protosw.h> #include <netinet6/pim6.h> #include <netinet6/pim6_var.h> -#include <netinet6/vinet6.h> static MALLOC_DEFINE(M_MRTABLE6, "mf6c", "multicast forwarding cache entry"); @@ -156,9 +154,8 @@ static const struct ip6protosw in6_pim_protosw = { }; static int pim6_encapcheck(const struct mbuf *, int, int, void *); -#ifdef VIMAGE_GLOBALS -static int ip6_mrouter_ver; -#endif +static VNET_DEFINE(int, ip6_mrouter_ver); +#define V_ip6_mrouter_ver VNET_GET(ip6_mrouter_ver) SYSCTL_DECL(_net_inet6); SYSCTL_DECL(_net_inet6_ip6); @@ -216,9 +213,8 @@ static struct mtx mif6_mtx; #define MIF6_LOCK_DESTROY() mtx_destroy(&mif6_mtx) #ifdef MRT6DEBUG -#ifdef VIMAGE_GLOBALS -static u_int mrt6debug; /* debug level */ -#endif +static VNET_DEFINE(u_int, mrt6debug); /* debug level */ +#define V_mrt6debug VNET_GET(mrt6debug) #define DEBUG_MFC 0x02 #define DEBUG_FORWARD 0x04 #define DEBUG_EXPIRE 0x08 @@ -261,9 +257,8 @@ SYSCTL_STRUCT(_net_inet6_pim, PIM6CTL_STATS, stats, CTLFLAG_RD, &pim6stat, pim6stat, "PIM Statistics (struct pim6stat, netinet6/pim_var.h)"); -#ifdef VIMAGE_GLOBALS -static int pim6; -#endif +static VNET_DEFINE(int, pim6); +#define V_pim6 VNET_GET(pim6) /* * Hash function for a source, group entry @@ -347,9 +342,7 @@ int X_mrt6_ioctl(u_long, caddr_t); static void pim6_init(void) { - INIT_VNET_INET6(curvnet); - V_ip6_mrouter_ver = 0; #ifdef MRT6DEBUG V_mrt6debug = 0; /* debug level */ #endif @@ -361,7 +354,6 @@ pim6_init(void) int X_ip6_mrouter_set(struct socket *so, struct sockopt *sopt) { - INIT_VNET_INET6(curvnet); int error = 0; int optval; struct mif6ctl mifc; @@ -430,7 +422,6 @@ X_ip6_mrouter_set(struct socket *so, struct sockopt *sopt) int X_ip6_mrouter_get(struct socket *so, struct sockopt *sopt) { - INIT_VNET_INET6(curvnet); int error = 0; if (so != V_ip6_mrouter) @@ -528,7 +519,6 @@ get_mif6_cnt(struct sioc_mif_req6 *req) static int set_pim6(int *i) { - INIT_VNET_INET6(curvnet); if ((*i != 1) && (*i != 0)) return (EINVAL); @@ -543,7 +533,6 @@ set_pim6(int *i) static int ip6_mrouter_init(struct socket *so, int v, int cmd) { - INIT_VNET_INET6(curvnet); V_ip6_mrouter_ver = 0; @@ -598,7 +587,6 @@ ip6_mrouter_init(struct socket *so, int v, int cmd) int X_ip6_mrouter_done(void) { - INIT_VNET_INET6(curvnet); mifi_t mifi; int i; struct mf6c *rt; @@ -683,7 +671,6 @@ static struct sockaddr_in6 sin6 = { sizeof(sin6), AF_INET6 }; static int add_m6if(struct mif6ctl *mifcp) { - INIT_VNET_NET(curvnet); struct mif6 *mifp; struct ifnet *ifp; int error; @@ -1100,7 +1087,6 @@ socket_send(struct socket *s, struct mbuf *mm, struct sockaddr_in6 *src) int X_ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m) { - INIT_VNET_INET6(curvnet); struct mf6c *rt; struct mif6 *mifp; struct mbuf *mm; @@ -1425,7 +1411,6 @@ expire_upcalls(void *unused) static int ip6_mdq(struct mbuf *m, struct ifnet *ifp, struct mf6c *rt) { - INIT_VNET_INET6(curvnet); struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); mifi_t mifi, iif; struct mif6 *mifp; @@ -1604,7 +1589,6 @@ ip6_mdq(struct mbuf *m, struct ifnet *ifp, struct mf6c *rt) static void phyint_send(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m) { - INIT_VNET_INET6(curvnet); struct mbuf *mb_copy; struct ifnet *ifp = mifp->m6_ifp; int error = 0; @@ -1714,7 +1698,6 @@ phyint_send(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m) static int register_send(struct ip6_hdr *ip6, struct mif6 *mif, struct mbuf *m) { - INIT_VNET_INET6(curvnet); struct mbuf *mm; int i, len = m->m_pkthdr.len; static struct sockaddr_in6 sin6 = { sizeof(sin6), AF_INET6 }; @@ -1805,7 +1788,6 @@ pim6_encapcheck(const struct mbuf *m, int off, int proto, void *arg) int pim6_input(struct mbuf **mp, int *offp, int proto) { - INIT_VNET_INET6(curvnet); struct pim *pim; /* pointer to a pim struct */ struct ip6_hdr *ip6; int pimlen; @@ -2036,7 +2018,6 @@ pim6_input(struct mbuf **mp, int *offp, int proto) static int ip6_mroute_modevent(module_t mod, int type, void *unused) { - INIT_VNET_INET6(curvnet); switch (type) { case MOD_LOAD: diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 713dd28..c208ca7 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -96,7 +96,6 @@ __FBSDID("$FreeBSD$"); #include <netinet/in_pcb.h> #include <netinet/tcp_var.h> #include <netinet6/nd6.h> -#include <netinet/vinet.h> #ifdef IPSEC #include <netipsec/ipsec.h> @@ -107,7 +106,6 @@ __FBSDID("$FreeBSD$"); #include <netinet6/ip6protosw.h> #include <netinet6/scope6_var.h> -#include <netinet6/vinet6.h> extern int in6_mcast_loop; @@ -191,8 +189,6 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt, struct route_in6 *ro, int flags, struct ip6_moptions *im6o, struct ifnet **ifpp, struct inpcb *inp) { - INIT_VNET_NET(curvnet); - INIT_VNET_INET6(curvnet); struct ip6_hdr *ip6, *mhip6; struct ifnet *ifp, *origifp; struct mbuf *m = m0; @@ -2420,8 +2416,6 @@ static int ip6_setpktopt(int optname, u_char *buf, int len, struct ip6_pktopts *opt, struct ucred *cred, int sticky, int cmsg, int uproto) { - INIT_VNET_NET(curvnet); - INIT_VNET_INET6(curvnet); int minmtupolicy, preftemp; int error; 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 */ diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c index 61fff11..98c9021 100644 --- a/sys/netinet6/mld6.c +++ b/sys/netinet6/mld6.c @@ -94,8 +94,6 @@ __FBSDID("$FreeBSD$"); #include <netinet/icmp6.h> #include <netinet6/mld6.h> #include <netinet6/mld6_var.h> -#include <netinet/vinet.h> -#include <netinet6/vinet6.h> #include <security/mac/mac_framework.h> @@ -207,13 +205,17 @@ MALLOC_DEFINE(M_MLD, "mld", "mld state"); /* * VIMAGE-wide globals. */ -#ifdef VIMAGE_GLOBALS -struct timeval mld_gsrdelay; -LIST_HEAD(, mld_ifinfo) mli_head; -int interface_timers_running6; -int state_change_timers_running6; -int current_state_timers_running6; -#endif /* VIMAGE_GLOBALS */ +static VNET_DEFINE(struct timeval, mld_gsrdelay) = {10, 0}; +static VNET_DEFINE(LIST_HEAD(, mld_ifinfo), mli_head); +static VNET_DEFINE(int, interface_timers_running6); +static VNET_DEFINE(int, state_change_timers_running6); +static VNET_DEFINE(int, current_state_timers_running6); + +#define V_mld_gsrdelay VNET_GET(mld_gsrdelay) +#define V_mli_head VNET_GET(mli_head) +#define V_interface_timers_running6 VNET_GET(interface_timers_running6) +#define V_state_change_timers_running6 VNET_GET(state_change_timers_running6) +#define V_current_state_timers_running6 VNET_GET(current_state_timers_running6) SYSCTL_DECL(_net_inet6); /* Note: Not in any common header. */ @@ -223,9 +225,9 @@ SYSCTL_NODE(_net_inet6, OID_AUTO, mld, CTLFLAG_RW, 0, /* * Virtualized sysctls. */ -SYSCTL_V_PROC(V_NET, vnet_inet6, _net_inet6_mld, OID_AUTO, gsrdelay, - CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, mld_gsrdelay.tv_sec, 0, - sysctl_mld_gsr, "I", +SYSCTL_VNET_PROC(_net_inet6_mld, OID_AUTO, gsrdelay, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, + &VNET_NAME(mld_gsrdelay.tv_sec), 0, sysctl_mld_gsr, "I", "Rate limit for MLDv2 Group-and-Source queries in seconds"); /* @@ -308,7 +310,6 @@ mld_restore_context(struct mbuf *m) static int sysctl_mld_gsr(SYSCTL_HANDLER_ARGS) { - INIT_VNET_INET6(curvnet); int error; int i; @@ -349,8 +350,6 @@ out_locked: static int sysctl_mld_ifinfo(SYSCTL_HANDLER_ARGS) { - INIT_VNET_NET(curvnet); - INIT_VNET_INET6(curvnet); int *name; int error; u_int namelen; @@ -479,7 +478,6 @@ mld_domifattach(struct ifnet *ifp) static struct mld_ifinfo * mli_alloc_locked(/*const*/ struct ifnet *ifp) { - INIT_VNET_INET6(ifp->if_vnet); struct mld_ifinfo *mli; MLD_LOCK_ASSERT(); @@ -582,7 +580,6 @@ mld_domifdetach(struct ifnet *ifp) static void mli_delete_locked(const struct ifnet *ifp) { - INIT_VNET_INET6(ifp->if_vnet); struct mld_ifinfo *mli, *tmli; CTR3(KTR_MLD, "%s: freeing mld_ifinfo for ifp %p(%s)", @@ -747,7 +744,6 @@ mld_v1_input_query(struct ifnet *ifp, const struct ip6_hdr *ip6, static void mld_v1_update_group(struct in6_multi *inm, const int timer) { - INIT_VNET_INET6(curvnet); #ifdef KTR char ip6tbuf[INET6_ADDRSTRLEN]; #endif @@ -801,7 +797,6 @@ static int mld_v2_input_query(struct ifnet *ifp, const struct ip6_hdr *ip6, struct mbuf *m, const int off, const int icmp6len) { - INIT_VNET_INET6(curvnet); struct mld_ifinfo *mli; struct mldv2_query *mld; struct in6_multi *inm; @@ -980,7 +975,6 @@ static int mld_v2_process_group_query(struct in6_multi *inm, struct mld_ifinfo *mli, int timer, struct mbuf *m0, const int off) { - INIT_VNET_INET6(curvnet); struct mldv2_query *mld; int retval; uint16_t nsrc; @@ -1252,7 +1246,6 @@ mld_input(struct mbuf *m, int off, int icmp6len) CTR3(KTR_MLD, "%s: called w/mbuf (%p,%d)", __func__, m, off); ifp = m->m_pkthdr.rcvif; - INIT_VNET_INET6(ifp->if_vnet); ip6 = mtod(m, struct ip6_hdr *); @@ -1330,7 +1323,6 @@ mld_fasttimo(void) static void mld_fasttimo_vnet(void) { - INIT_VNET_INET6(curvnet); struct ifqueue scq; /* State-change packets */ struct ifqueue qrq; /* Query response packets */ struct ifnet *ifp; @@ -1458,7 +1450,6 @@ out_locked: static void mld_v1_process_group_timer(struct in6_multi *inm, const int version) { - INIT_VNET_INET6(curvnet); int report_timer_expired; IN6_MULTI_LOCK_ASSERT(); @@ -1505,7 +1496,6 @@ mld_v2_process_group_timers(struct mld_ifinfo *mli, struct ifqueue *qrq, struct ifqueue *scq, struct in6_multi *inm, const int uri_fasthz) { - INIT_VNET_INET6(curvnet); int query_response_timer_expired; int state_change_retransmit_timer_expired; #ifdef KTR @@ -1654,7 +1644,6 @@ mld_set_version(struct mld_ifinfo *mli, const int version) static void mld_v2_cancel_link_timers(struct mld_ifinfo *mli) { - INIT_VNET_INET6(curvnet); struct ifmultiaddr *ifma; struct ifnet *ifp; struct in6_multi *inm; @@ -1747,7 +1736,6 @@ mld_slowtimo(void) static void mld_slowtimo_vnet(void) { - INIT_VNET_INET6(curvnet); struct mld_ifinfo *mli; MLD_LOCK(); @@ -1951,7 +1939,6 @@ static int mld_initial_join(struct in6_multi *inm, struct mld_ifinfo *mli, const int delay) { - INIT_VNET_INET6(curvnet); struct ifnet *ifp; struct ifqueue *ifq; int error, retval, syncstates; @@ -2100,7 +2087,6 @@ mld_initial_join(struct in6_multi *inm, struct mld_ifinfo *mli, static int mld_handle_state_change(struct in6_multi *inm, struct mld_ifinfo *mli) { - INIT_VNET_INET6(curvnet); struct ifnet *ifp; int retval; #ifdef KTR @@ -2164,7 +2150,6 @@ mld_handle_state_change(struct in6_multi *inm, struct mld_ifinfo *mli) static void mld_final_leave(struct in6_multi *inm, struct mld_ifinfo *mli) { - INIT_VNET_INET6(curvnet); int syncstates; #ifdef KTR char ip6tbuf[INET6_ADDRSTRLEN]; @@ -2947,7 +2932,6 @@ mld_v2_merge_state_changes(struct in6_multi *inm, struct ifqueue *ifscq) static void mld_v2_dispatch_general_query(struct mld_ifinfo *mli) { - INIT_VNET_INET6(curvnet); struct ifmultiaddr *ifma, *tifma; struct ifnet *ifp; struct in6_multi *inm; @@ -3036,8 +3020,6 @@ mld_dispatch_packet(struct mbuf *m) * indexes to guard against interface detach, they are * unique to each VIMAGE and must be retrieved. */ - INIT_VNET_NET(curvnet); - INIT_VNET_INET6(curvnet); ifindex = mld_restore_context(m); /* @@ -3247,31 +3229,17 @@ mld_sysuninit(void) static int vnet_mld_iattach(const void *unused __unused) { - INIT_VNET_INET6(curvnet); CTR1(KTR_MLD, "%s: initializing", __func__); LIST_INIT(&V_mli_head); - V_current_state_timers_running6 = 0; - V_interface_timers_running6 = 0; - V_state_change_timers_running6 = 0; - - /* - * Initialize sysctls to default values. - */ - V_mld_gsrdelay.tv_sec = 10; - V_mld_gsrdelay.tv_usec = 0; - return (0); } static int vnet_mld_idetach(const void *unused __unused) { -#ifdef INVARIANTS - INIT_VNET_INET6(curvnet); -#endif CTR1(KTR_MLD, "%s: tearing down", __func__); @@ -3281,7 +3249,7 @@ vnet_mld_idetach(const void *unused __unused) return (0); } -#ifndef VIMAGE_GLOBALS +#ifdef VIMAGE static vnet_modinfo_t vnet_mld_modinfo = { .vmi_id = VNET_MOD_MLD, .vmi_name = "mld", @@ -3298,14 +3266,14 @@ mld_modevent(module_t mod, int type, void *unused __unused) switch (type) { case MOD_LOAD: mld_sysinit(); -#ifndef VIMAGE_GLOBALS +#ifdef VIMAGE vnet_mod_register(&vnet_mld_modinfo); #else vnet_mld_iattach(NULL); #endif break; case MOD_UNLOAD: -#ifndef VIMAGE_GLOBALS +#ifdef VIMAGE vnet_mod_deregister(&vnet_mld_modinfo); #else vnet_mld_idetach(NULL); diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 0e93aec..9c97988 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -72,7 +72,6 @@ __FBSDID("$FreeBSD$"); #include <netinet6/scope6_var.h> #include <netinet6/nd6.h> #include <netinet/icmp6.h> -#include <netinet6/vinet6.h> #include <sys/limits.h> @@ -83,32 +82,32 @@ __FBSDID("$FreeBSD$"); #define SIN6(s) ((struct sockaddr_in6 *)s) -#ifdef VIMAGE_GLOBALS -int nd6_prune; -int nd6_delay; -int nd6_umaxtries; -int nd6_mmaxtries; -int nd6_useloopback; -int nd6_gctimer; +VNET_DEFINE(int, nd6_prune); +VNET_DEFINE(int, nd6_delay); +VNET_DEFINE(int, nd6_umaxtries); +VNET_DEFINE(int, nd6_mmaxtries); +VNET_DEFINE(int, nd6_useloopback); +VNET_DEFINE(int, nd6_gctimer); /* preventing too many loops in ND option parsing */ -int nd6_maxndopt; +static VNET_DEFINE(int, nd6_maxndopt); +VNET_DEFINE(int, nd6_maxnudhint); +static VNET_DEFINE(int, nd6_maxqueuelen); +#define V_nd6_maxndopt VNET_GET(nd6_maxndopt) +#define V_nd6_maxqueuelen VNET_GET(nd6_maxqueuelen) -int nd6_maxnudhint; -int nd6_maxqueuelen; - -int nd6_debug; +VNET_DEFINE(int, nd6_debug); /* for debugging? */ #if 0 static int nd6_inuse, nd6_allocated; #endif -struct nd_drhead nd_defrouter; -struct nd_prhead nd_prefix; +VNET_DEFINE(struct nd_drhead, nd_defrouter); +VNET_DEFINE(struct nd_prhead, nd_prefix); -int nd6_recalc_reachtm_interval; -#endif /* VIMAGE_GLOBALS */ +VNET_DEFINE(int, nd6_recalc_reachtm_interval); +#define V_nd6_recalc_reachtm_interval VNET_GET(nd6_recalc_reachtm_interval) static struct sockaddr_in6 all1_sa; @@ -121,18 +120,19 @@ static struct llentry *nd6_free(struct llentry *, int); static void nd6_llinfo_timer(void *); static void clear_llinfo_pqueue(struct llentry *); -#ifdef VIMAGE_GLOBALS -struct callout nd6_slowtimo_ch; -struct callout nd6_timer_ch; -extern struct callout in6_tmpaddrtimer_ch; -extern int dad_ignore_ns; -extern int dad_maxtry; -#endif +static VNET_DEFINE(struct callout, nd6_slowtimo_ch); +#define V_nd6_slowtimo_ch VNET_GET(nd6_slowtimo_ch) + +VNET_DEFINE(struct callout, nd6_timer_ch); + +VNET_DECLARE(int, dad_ignore_ns); +VNET_DECLARE(int, dad_maxtry); +#define V_dad_ignore_ns VNET_GET(dad_ignore_ns) +#define V_dad_maxtry VNET_GET(dad_maxtry) void nd6_init(void) { - INIT_VNET_INET6(curvnet); int i; V_nd6_prune = 1; /* walk list every 1 seconds */ @@ -193,7 +193,6 @@ nd6_init(void) void nd6_destroy() { - INIT_VNET_INET6(curvnet); callout_drain(&V_nd6_slowtimo_ch); callout_drain(&V_nd6_timer_ch); @@ -249,7 +248,6 @@ nd6_setmtu(struct ifnet *ifp) void nd6_setmtu0(struct ifnet *ifp, struct nd_ifinfo *ndi) { - INIT_VNET_INET6(ifp->if_vnet); u_int32_t omaxmtu; omaxmtu = ndi->maxmtu; @@ -358,7 +356,6 @@ nd6_option(union nd_opts *ndopts) int nd6_options(union nd_opts *ndopts) { - INIT_VNET_INET6(curvnet); struct nd_opt_hdr *nd_opt; int i = 0; @@ -492,7 +489,6 @@ nd6_llinfo_timer(void *arg) panic("ln ifp == NULL"); CURVNET_SET(ifp->if_vnet); - INIT_VNET_INET6(curvnet); if (ln->ln_ntick > 0) { if (ln->ln_ntick > INT_MAX) { @@ -595,7 +591,6 @@ void nd6_timer(void *arg) { CURVNET_SET((struct vnet *) arg); - INIT_VNET_INET6(curvnet); int s; struct nd_defrouter *dr; struct nd_prefix *pr; @@ -794,7 +789,6 @@ regen_tmpaddr(struct in6_ifaddr *ia6) void nd6_purge(struct ifnet *ifp) { - INIT_VNET_INET6(ifp->if_vnet); struct nd_defrouter *dr, *ndr; struct nd_prefix *pr, *npr; @@ -908,7 +902,6 @@ nd6_lookup(struct in6_addr *addr6, int flags, struct ifnet *ifp) static int nd6_is_new_addr_neighbor(struct sockaddr_in6 *addr, struct ifnet *ifp) { - INIT_VNET_INET6(ifp->if_vnet); struct nd_prefix *pr; struct ifaddr *dstaddr; @@ -1017,7 +1010,6 @@ nd6_is_addr_neighbor(struct sockaddr_in6 *addr, struct ifnet *ifp) static struct llentry * nd6_free(struct llentry *ln, int gc) { - INIT_VNET_INET6(curvnet); struct llentry *next; struct nd_defrouter *dr; struct ifnet *ifp=NULL; @@ -1124,7 +1116,6 @@ nd6_free(struct llentry *ln, int gc) void nd6_nud_hint(struct rtentry *rt, struct in6_addr *dst6, int force) { - INIT_VNET_INET6(curvnet); struct llentry *ln; struct ifnet *ifp; @@ -1165,7 +1156,6 @@ done: int nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) { - INIT_VNET_INET6(ifp->if_vnet); struct in6_drlist *drl = (struct in6_drlist *)data; struct in6_oprlist *oprl = (struct in6_oprlist *)data; struct in6_ndireq *ndi = (struct in6_ndireq *)data; @@ -1406,7 +1396,6 @@ struct llentry * nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr, int lladdrlen, int type, int code) { - INIT_VNET_INET6(curvnet); struct llentry *ln = NULL; int is_newentry; int do_update; @@ -1669,8 +1658,6 @@ static void nd6_slowtimo(void *arg) { CURVNET_SET((struct vnet *) arg); - INIT_VNET_NET((struct vnet *) arg); - INIT_VNET_INET6((struct vnet *) arg); struct nd_ifinfo *nd6if; struct ifnet *ifp; @@ -1720,7 +1707,6 @@ nd6_output_lle(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *m0, struct sockaddr_in6 *dst, struct rtentry *rt0, struct llentry *lle, struct mbuf **chain) { - INIT_VNET_INET6(curvnet); struct mbuf *m = m0; struct llentry *ln = lle; int error = 0; @@ -2105,13 +2091,12 @@ SYSCTL_NODE(_net_inet6_icmp6, ICMPV6CTL_ND6_DRLIST, nd6_drlist, CTLFLAG_RD, nd6_sysctl_drlist, ""); SYSCTL_NODE(_net_inet6_icmp6, ICMPV6CTL_ND6_PRLIST, nd6_prlist, CTLFLAG_RD, nd6_sysctl_prlist, ""); -SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_MAXQLEN, - nd6_maxqueuelen, CTLFLAG_RW, nd6_maxqueuelen, 1, ""); +SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_MAXQLEN, nd6_maxqueuelen, + CTLFLAG_RW, &VNET_NAME(nd6_maxqueuelen), 1, ""); static int nd6_sysctl_drlist(SYSCTL_HANDLER_ARGS) { - INIT_VNET_INET6(curvnet); int error; char buf[1024] __aligned(4); struct in6_defrouter *d, *de; @@ -2152,7 +2137,6 @@ nd6_sysctl_drlist(SYSCTL_HANDLER_ARGS) static int nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS) { - INIT_VNET_INET6(curvnet); int error; char buf[1024] __aligned(4); struct in6_prefix *p, *pe; diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h index 0730d84..f54e02e 100644 --- a/sys/netinet6/nd6.h +++ b/sys/netinet6/nd6.h @@ -318,28 +318,44 @@ struct nd_pfxrouter { LIST_HEAD(nd_prhead, nd_prefix); /* nd6.c */ -#ifdef VIMAGE_GLOBALS -extern int nd6_prune; -extern int nd6_delay; -extern int nd6_umaxtries; -extern int nd6_mmaxtries; -extern int nd6_useloopback; -extern int nd6_maxnudhint; -extern int nd6_gctimer; -extern struct nd_drhead nd_defrouter; -extern struct nd_prhead nd_prefix; -extern int nd6_debug; -extern int nd6_onlink_ns_rfc4861; - -extern struct callout nd6_timer_ch; +VNET_DECLARE(int, nd6_prune); +VNET_DECLARE(int, nd6_delay); +VNET_DECLARE(int, nd6_umaxtries); +VNET_DECLARE(int, nd6_mmaxtries); +VNET_DECLARE(int, nd6_useloopback); +VNET_DECLARE(int, nd6_maxnudhint); +VNET_DECLARE(int, nd6_gctimer); +VNET_DECLARE(struct nd_drhead, nd_defrouter); +VNET_DECLARE(struct nd_prhead, nd_prefix); +VNET_DECLARE(int, nd6_debug); +VNET_DECLARE(int, nd6_onlink_ns_rfc4861); +VNET_DECLARE(struct callout, nd6_timer_ch); + +#define V_nd6_prune VNET_GET(nd6_prune) +#define V_nd6_delay VNET_GET(nd6_delay) +#define V_nd6_umaxtries VNET_GET(nd6_umaxtries) +#define V_nd6_mmaxtries VNET_GET(nd6_mmaxtries) +#define V_nd6_useloopback VNET_GET(nd6_useloopback) +#define V_nd6_maxnudhint VNET_GET(nd6_maxnudhint) +#define V_nd6_gctimer VNET_GET(nd6_gctimer) +#define V_nd_defrouter VNET_GET(nd_defrouter) +#define V_nd_prefix VNET_GET(nd_prefix) +#define V_nd6_debug VNET_GET(nd6_debug) +#define V_nd6_onlink_ns_rfc4861 VNET_GET(nd6_onlink_ns_rfc4861) +#define V_nd6_timer_ch VNET_GET(nd6_timer_ch) /* nd6_rtr.c */ -extern int nd6_defifindex; -extern int ip6_desync_factor; /* seconds */ -extern u_int32_t ip6_temp_preferred_lifetime; /* seconds */ -extern u_int32_t ip6_temp_valid_lifetime; /* seconds */ -extern int ip6_temp_regen_advance; /* seconds */ -#endif /* VIMAGE_GLOBALS */ +VNET_DECLARE(int, nd6_defifindex); +VNET_DECLARE(int, ip6_desync_factor); /* seconds */ +VNET_DECLARE(u_int32_t, ip6_temp_preferred_lifetime); /* seconds */ +VNET_DECLARE(u_int32_t, ip6_temp_valid_lifetime); /* seconds */ +VNET_DECLARE(int, ip6_temp_regen_advance); /* seconds */ + +#define V_nd6_defifindex VNET_GET(nd6_defifindex) +#define V_ip6_desync_factor VNET_GET(ip6_desync_factor) +#define V_ip6_temp_preferred_lifetime VNET_GET(ip6_temp_preferred_lifetime) +#define V_ip6_temp_valid_lifetime VNET_GET(ip6_temp_valid_lifetime) +#define V_ip6_temp_regen_advance VNET_GET(ip6_temp_regen_advance) #define nd6log(x) do { if (V_nd6_debug) log x; } while (/*CONSTCOND*/ 0) diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index 8c5bf89..751466e 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -74,7 +74,6 @@ __FBSDID("$FreeBSD$"); #include <netinet6/scope6_var.h> #include <netinet6/nd6.h> #include <netinet/icmp6.h> -#include <netinet6/vinet6.h> #ifdef DEV_CARP #include <netinet/ip_carp.h> @@ -91,10 +90,11 @@ static void nd6_dad_ns_output(struct dadq *, struct ifaddr *); static void nd6_dad_ns_input(struct ifaddr *); static void nd6_dad_na_input(struct ifaddr *); -#ifdef VIMAGE_GLOBALS -int dad_ignore_ns; -int dad_maxtry; -#endif +VNET_DEFINE(int, dad_ignore_ns); +VNET_DEFINE(int, dad_maxtry); + +#define V_dad_ignore_ns VNET_GET(dad_ignore_ns) +#define V_dad_maxtry VNET_GET(dad_maxtry) /* * Input a Neighbor Solicitation Message. @@ -105,7 +105,6 @@ int dad_maxtry; void nd6_ns_input(struct mbuf *m, int off, int icmp6len) { - INIT_VNET_INET6(curvnet); struct ifnet *ifp = m->m_pkthdr.rcvif; struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); struct nd_neighbor_solicit *nd_ns; @@ -389,7 +388,6 @@ void nd6_ns_output(struct ifnet *ifp, const struct in6_addr *daddr6, const struct in6_addr *taddr6, struct llentry *ln, int dad) { - INIT_VNET_INET6(ifp->if_vnet); struct mbuf *m; struct ip6_hdr *ip6; struct nd_neighbor_solicit *nd_ns; @@ -600,7 +598,6 @@ nd6_ns_output(struct ifnet *ifp, const struct in6_addr *daddr6, void nd6_na_input(struct mbuf *m, int off, int icmp6len) { - INIT_VNET_INET6(curvnet); struct ifnet *ifp = m->m_pkthdr.rcvif; struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); struct nd_neighbor_advert *nd_na; @@ -929,7 +926,6 @@ nd6_na_output(struct ifnet *ifp, const struct in6_addr *daddr6_0, const struct in6_addr *taddr6, u_long flags, int tlladdr, struct sockaddr *sdl0) { - INIT_VNET_INET6(ifp->if_vnet); struct mbuf *m; struct ip6_hdr *ip6; struct nd_neighbor_advert *nd_na; @@ -1128,15 +1124,15 @@ struct dadq { struct vnet *dad_vnet; }; -#ifdef VIMAGE_GLOBALS -static TAILQ_HEAD(, dadq) dadq; -int dad_init; -#endif +static VNET_DEFINE(TAILQ_HEAD(, dadq), dadq); +#define V_dadq VNET_GET(dadq) + +VNET_DEFINE(int, dad_init); +#define V_dad_init VNET_GET(dad_init) static struct dadq * nd6_dad_find(struct ifaddr *ifa) { - INIT_VNET_INET6(curvnet); struct dadq *dp; for (dp = V_dadq.tqh_first; dp; dp = dp->dad_list.tqe_next) { @@ -1167,7 +1163,6 @@ nd6_dad_stoptimer(struct dadq *dp) void nd6_dad_start(struct ifaddr *ifa, int delay) { - INIT_VNET_INET6(curvnet); struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa; struct dadq *dp; char ip6buf[INET6_ADDRSTRLEN]; @@ -1253,7 +1248,6 @@ nd6_dad_start(struct ifaddr *ifa, int delay) void nd6_dad_stop(struct ifaddr *ifa) { - INIT_VNET_INET6(curvnet); struct dadq *dp; if (!V_dad_init) @@ -1276,7 +1270,6 @@ static void nd6_dad_timer(struct dadq *dp) { CURVNET_SET(dp->dad_vnet); - INIT_VNET_INET6(curvnet); int s; struct ifaddr *ifa = dp->dad_ifa; struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa; @@ -1377,7 +1370,6 @@ done: void nd6_dad_duplicated(struct ifaddr *ifa) { - INIT_VNET_INET6(curvnet); struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa; struct ifnet *ifp; struct dadq *dp; @@ -1467,7 +1459,6 @@ nd6_dad_ns_output(struct dadq *dp, struct ifaddr *ifa) static void nd6_dad_ns_input(struct ifaddr *ifa) { - INIT_VNET_INET6(curvnet); struct in6_ifaddr *ia; struct ifnet *ifp; const struct in6_addr *taddr6; diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index c746fcd..86e8818 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -66,7 +66,6 @@ __FBSDID("$FreeBSD$"); #include <netinet6/nd6.h> #include <netinet/icmp6.h> #include <netinet6/scope6_var.h> -#include <netinet6/vinet6.h> static int rtpref(struct nd_defrouter *); static struct nd_defrouter *defrtrlist_update(struct nd_defrouter *); @@ -88,18 +87,18 @@ static void in6_init_address_ltimes __P((struct nd_prefix *, static int rt6_deleteroute(struct radix_node *, void *); -#ifdef VIMAGE_GLOBALS -extern int nd6_recalc_reachtm_interval; +VNET_DECLARE(int, nd6_recalc_reachtm_interval); +#define V_nd6_recalc_reachtm_interval VNET_GET(nd6_recalc_reachtm_interval) -static struct ifnet *nd6_defifp; -int nd6_defifindex; +static VNET_DEFINE(struct ifnet *, nd6_defifp); +#define V_nd6_defifp VNET_GET(nd6_defifp) -int ip6_use_tempaddr; -int ip6_desync_factor; -u_int32_t ip6_temp_preferred_lifetime; -u_int32_t ip6_temp_valid_lifetime; -int ip6_temp_regen_advance; -#endif +VNET_DEFINE(int, nd6_defifindex); +VNET_DEFINE(int, ip6_use_tempaddr); +VNET_DEFINE(int, ip6_desync_factor); +VNET_DEFINE(u_int32_t, ip6_temp_preferred_lifetime); +VNET_DEFINE(u_int32_t, ip6_temp_valid_lifetime); +VNET_DEFINE(int, ip6_temp_regen_advance); /* RTPREF_MEDIUM has to be 0! */ #define RTPREF_HIGH 1 @@ -118,7 +117,6 @@ int ip6_temp_regen_advance; void nd6_rs_input(struct mbuf *m, int off, int icmp6len) { - INIT_VNET_INET6(curvnet); struct ifnet *ifp = m->m_pkthdr.rcvif; struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); struct nd_router_solicit *nd_rs; @@ -203,7 +201,6 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len) void nd6_ra_input(struct mbuf *m, int off, int icmp6len) { - INIT_VNET_INET6(curvnet); struct ifnet *ifp = m->m_pkthdr.rcvif; struct nd_ifinfo *ndi = ND_IFINFO(ifp); struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); @@ -491,7 +488,6 @@ defrouter_addreq(struct nd_defrouter *new) struct nd_defrouter * defrouter_lookup(struct in6_addr *addr, struct ifnet *ifp) { - INIT_VNET_INET6(ifp->if_vnet); struct nd_defrouter *dr; for (dr = TAILQ_FIRST(&V_nd_defrouter); dr; @@ -540,7 +536,6 @@ defrouter_delreq(struct nd_defrouter *dr) void defrouter_reset(void) { - INIT_VNET_INET6(curvnet); struct nd_defrouter *dr; for (dr = TAILQ_FIRST(&V_nd_defrouter); dr; @@ -556,7 +551,6 @@ defrouter_reset(void) void defrtrlist_del(struct nd_defrouter *dr) { - INIT_VNET_INET6(curvnet); struct nd_defrouter *deldr = NULL; struct nd_prefix *pr; @@ -618,7 +612,6 @@ defrtrlist_del(struct nd_defrouter *dr) void defrouter_select(void) { - INIT_VNET_INET6(curvnet); int s = splnet(); struct nd_defrouter *dr, *selected_dr = NULL, *installed_dr = NULL; struct llentry *ln = NULL; @@ -743,7 +736,6 @@ rtpref(struct nd_defrouter *dr) static struct nd_defrouter * defrtrlist_update(struct nd_defrouter *new) { - INIT_VNET_INET6(curvnet); struct nd_defrouter *dr, *n; int s = splnet(); @@ -865,7 +857,6 @@ pfxrtr_del(struct nd_pfxrouter *pfr) struct nd_prefix * nd6_prefix_lookup(struct nd_prefixctl *key) { - INIT_VNET_INET6(curvnet); struct nd_prefix *search; for (search = V_nd_prefix.lh_first; @@ -885,7 +876,6 @@ int nd6_prelist_add(struct nd_prefixctl *pr, struct nd_defrouter *dr, struct nd_prefix **newp) { - INIT_VNET_INET6(curvnet); struct nd_prefix *new = NULL; int error = 0; int i, s; @@ -944,7 +934,6 @@ nd6_prelist_add(struct nd_prefixctl *pr, struct nd_defrouter *dr, void prelist_remove(struct nd_prefix *pr) { - INIT_VNET_INET6(curvnet); struct nd_pfxrouter *pfr, *next; int e, s; char ip6buf[INET6_ADDRSTRLEN]; @@ -997,7 +986,6 @@ static int prelist_update(struct nd_prefixctl *new, struct nd_defrouter *dr, struct mbuf *m, int mcast) { - INIT_VNET_INET6(curvnet); struct in6_ifaddr *ia6 = NULL, *ia6_match = NULL; struct ifaddr *ifa; struct ifnet *ifp = new->ndpr_ifp; @@ -1374,7 +1362,6 @@ find_pfxlist_reachable_router(struct nd_prefix *pr) void pfxlist_onlink_check() { - INIT_VNET_INET6(curvnet); struct nd_prefix *pr; struct in6_ifaddr *ifa; struct nd_defrouter *dr; @@ -1556,7 +1543,6 @@ pfxlist_onlink_check() int nd6_prefix_onlink(struct nd_prefix *pr) { - INIT_VNET_INET6(curvnet); struct ifaddr *ifa; struct ifnet *ifp = pr->ndpr_ifp; struct sockaddr_in6 mask6; @@ -1682,7 +1668,6 @@ nd6_prefix_onlink(struct nd_prefix *pr) int nd6_prefix_offlink(struct nd_prefix *pr) { - INIT_VNET_INET6(curvnet); int error = 0; struct ifnet *ifp = pr->ndpr_ifp; struct nd_prefix *opr; @@ -1774,7 +1759,6 @@ nd6_prefix_offlink(struct nd_prefix *pr) static struct in6_ifaddr * in6_ifadd(struct nd_prefixctl *pr, int mcast) { - INIT_VNET_INET6(curvnet); struct ifnet *ifp = pr->ndpr_ifp; struct ifaddr *ifa; struct in6_aliasreq ifra; @@ -1912,7 +1896,6 @@ in6_ifadd(struct nd_prefixctl *pr, int mcast) int in6_tmpifadd(const struct in6_ifaddr *ia0, int forcegen, int delay) { - INIT_VNET_INET6(curvnet); struct ifnet *ifp = ia0->ia_ifa.ifa_ifp; struct in6_ifaddr *newia, *ia; struct in6_aliasreq ifra; @@ -2141,8 +2124,6 @@ rt6_deleteroute(struct radix_node *rn, void *arg) int nd6_setdefaultiface(int ifindex) { - INIT_VNET_NET(curvnet); - INIT_VNET_INET6(curvnet); int error = 0; if (ifindex < 0 || V_if_index < ifindex) diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index 73bb966..32c3bca 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -90,7 +90,6 @@ __FBSDID("$FreeBSD$"); #include <netinet/in_var.h> #include <netinet/in_systm.h> #include <netinet/in_pcb.h> -#include <netinet/vinet.h> #include <netinet/icmp6.h> #include <netinet/ip6.h> @@ -101,7 +100,6 @@ __FBSDID("$FreeBSD$"); #include <netinet6/nd6.h> #include <netinet6/raw_ip6.h> #include <netinet6/scope6_var.h> -#include <netinet6/vinet6.h> #ifdef IPSEC #include <netipsec/ipsec.h> @@ -117,11 +115,12 @@ __FBSDID("$FreeBSD$"); * Raw interface to IP6 protocol. */ -#ifdef VIMAGE_GLOBALS -extern struct inpcbhead ripcb; -extern struct inpcbinfo ripcbinfo; -struct rip6stat rip6stat; -#endif +VNET_DECLARE(struct inpcbhead, ripcb); +VNET_DECLARE(struct inpcbinfo, ripcbinfo); +#define V_ripcb VNET_GET(ripcb) +#define V_ripcbinfo VNET_GET(ripcbinfo) + +VNET_DEFINE(struct rip6stat, rip6stat); extern u_long rip_sendspace; extern u_long rip_recvspace; @@ -134,9 +133,7 @@ extern u_long rip_recvspace; /* * The socket used to communicate with the multicast routing daemon. */ -#ifdef VIMAGE_GLOBALS -struct socket *ip6_mrouter; -#endif +VNET_DEFINE(struct socket *, ip6_mrouter); /* * The various mrouter functions. @@ -154,11 +151,6 @@ int (*mrt6_ioctl)(u_long, caddr_t); int rip6_input(struct mbuf **mp, int *offp, int proto) { - INIT_VNET_INET(curvnet); - INIT_VNET_INET6(curvnet); -#ifdef IPSEC - INIT_VNET_IPSEC(curvnet); -#endif struct ifnet *ifp; struct mbuf *m = *mp; register struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); @@ -320,7 +312,6 @@ rip6_input(struct mbuf **mp, int *offp, int proto) void rip6_ctlinput(int cmd, struct sockaddr *sa, void *d) { - INIT_VNET_INET(curvnet); struct ip6_hdr *ip6; struct mbuf *m; int off = 0; @@ -376,7 +367,6 @@ rip6_output(m, va_alist) va_dcl #endif { - INIT_VNET_INET6(curvnet); struct mbuf *control; struct socket *so; struct sockaddr_in6 *dstsock; @@ -609,7 +599,6 @@ rip6_ctloutput(struct socket *so, struct sockopt *sopt) static int rip6_attach(struct socket *so, int proto, struct thread *td) { - INIT_VNET_INET(so->so_vnet); struct inpcb *inp; struct icmp6_filter *filter; int error; @@ -648,8 +637,6 @@ rip6_attach(struct socket *so, int proto, struct thread *td) static void rip6_detach(struct socket *so) { - INIT_VNET_INET(so->so_vnet); - INIT_VNET_INET6(so->so_vnet); struct inpcb *inp; inp = sotoinpcb(so); @@ -707,9 +694,6 @@ rip6_disconnect(struct socket *so) static int rip6_bind(struct socket *so, struct sockaddr *nam, struct thread *td) { - INIT_VNET_NET(so->so_vnet); - INIT_VNET_INET(so->so_vnet); - INIT_VNET_INET6(so->so_vnet); struct inpcb *inp; struct sockaddr_in6 *addr = (struct sockaddr_in6 *)nam; struct ifaddr *ifa = NULL; @@ -750,9 +734,6 @@ rip6_bind(struct socket *so, struct sockaddr *nam, struct thread *td) static int rip6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) { - INIT_VNET_NET(so->so_vnet); - INIT_VNET_INET(so->so_vnet); - INIT_VNET_INET6(so->so_vnet); struct inpcb *inp; struct sockaddr_in6 *addr = (struct sockaddr_in6 *)nam; struct in6_addr in6a; diff --git a/sys/netinet6/raw_ip6.h b/sys/netinet6/raw_ip6.h index a57253e..b8d58a1 100644 --- a/sys/netinet6/raw_ip6.h +++ b/sys/netinet6/raw_ip6.h @@ -48,9 +48,8 @@ struct rip6stat { }; #ifdef _KERNEL -#ifdef VIMAGE_GLOBALS -extern struct rip6stat rip6stat; -#endif +VNET_DECLARE(struct rip6stat, rip6stat); +#define V_rip6stat VNET_GET(rip6stat) #endif #endif diff --git a/sys/netinet6/route6.c b/sys/netinet6/route6.c index 64f057e..9628960 100644 --- a/sys/netinet6/route6.c +++ b/sys/netinet6/route6.c @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include <netinet6/scope6_var.h> #include <netinet/icmp6.h> -#include <netinet6/vinet6.h> /* * proto - is unused @@ -60,7 +59,6 @@ __FBSDID("$FreeBSD$"); int route6_input(struct mbuf **mp, int *offp, int proto) { - INIT_VNET_INET6(curvnet); struct ip6_hdr *ip6; struct mbuf *m = *mp; struct ip6_rthdr *rh; diff --git a/sys/netinet6/scope6.c b/sys/netinet6/scope6.c index c9028b9..a4093b1 100644 --- a/sys/netinet6/scope6.c +++ b/sys/netinet6/scope6.c @@ -48,8 +48,8 @@ __FBSDID("$FreeBSD$"); #include <netinet/ip6.h> #include <netinet6/in6_var.h> +#include <netinet6/ip6_var.h> #include <netinet6/scope6_var.h> -#include <netinet6/vinet6.h> /* @@ -62,10 +62,10 @@ static struct mtx scope6_lock; #define SCOPE6_UNLOCK() mtx_unlock(&scope6_lock) #define SCOPE6_LOCK_ASSERT() mtx_assert(&scope6_lock, MA_OWNED) -#ifdef VIMAGE_GLOBALS -static struct scope6_id sid_default; -int ip6_use_defzone; -#endif +static VNET_DEFINE(struct scope6_id, sid_default); +VNET_DEFINE(int, ip6_use_defzone); + +#define V_sid_default VNET_GET(sid_default) #define SID(ifp) \ (((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->scope6_id) @@ -73,7 +73,6 @@ int ip6_use_defzone; void scope6_init(void) { - INIT_VNET_INET6(curvnet); #ifdef ENABLE_DEFAULT_SCOPE V_ip6_use_defzone = 1; @@ -121,7 +120,6 @@ scope6_ifdetach(struct scope6_id *sid) int scope6_set(struct ifnet *ifp, struct scope6_id *idlist) { - INIT_VNET_NET(ifp->if_vnet); int i; int error = 0; struct scope6_id *sid = NULL; @@ -276,7 +274,6 @@ in6_addrscope(struct in6_addr *addr) void scope6_setdefault(struct ifnet *ifp) { - INIT_VNET_INET6(ifp->if_vnet); /* * Currently, this function just sets the default "interfaces" @@ -300,7 +297,6 @@ scope6_setdefault(struct ifnet *ifp) int scope6_get_default(struct scope6_id *idlist) { - INIT_VNET_INET6(curvnet); SCOPE6_LOCK(); *idlist = V_sid_default; @@ -312,7 +308,6 @@ scope6_get_default(struct scope6_id *idlist) u_int32_t scope6_addr2default(struct in6_addr *addr) { - INIT_VNET_INET6(curvnet); u_int32_t id; /* @@ -343,7 +338,6 @@ scope6_addr2default(struct in6_addr *addr) int sa6_embedscope(struct sockaddr_in6 *sin6, int defaultok) { - INIT_VNET_NET(curvnet); struct ifnet *ifp; u_int32_t zoneid; @@ -380,7 +374,6 @@ sa6_embedscope(struct sockaddr_in6 *sin6, int defaultok) int sa6_recoverscope(struct sockaddr_in6 *sin6) { - INIT_VNET_NET(curvnet); char ip6buf[INET6_ADDRSTRLEN]; u_int32_t zoneid; diff --git a/sys/netinet6/tcp6_var.h b/sys/netinet6/tcp6_var.h index 18a48a3..3e0b6ec 100644 --- a/sys/netinet6/tcp6_var.h +++ b/sys/netinet6/tcp6_var.h @@ -65,10 +65,9 @@ #ifdef _KERNEL #ifdef SYSCTL_DECL SYSCTL_DECL(_net_inet6_tcp6); -#endif -#ifdef VIMAGE_GLOBALS -extern int tcp_v6mssdflt; /* XXX */ +VNET_DECLARE(int, tcp_v6mssdflt); /* XXX */ +#define V_tcp_v6mssdflt VNET_GET(tcp_v6mssdflt) #endif struct ip6_hdr; diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 5eb4a47..ab173a8 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -102,14 +102,12 @@ __FBSDID("$FreeBSD$"); #include <netinet/ip_var.h> #include <netinet/udp.h> #include <netinet/udp_var.h> -#include <netinet/vinet.h> #include <netinet6/ip6protosw.h> #include <netinet6/ip6_var.h> #include <netinet6/in6_pcb.h> #include <netinet6/udp6_var.h> #include <netinet6/scope6_var.h> -#include <netinet6/vinet6.h> #ifdef IPSEC #include <netipsec/ipsec.h> @@ -130,7 +128,6 @@ static void udp6_append(struct inpcb *inp, struct mbuf *n, int off, struct sockaddr_in6 *fromsa) { - INIT_VNET_INET(inp->inp_vnet); struct socket *so; struct mbuf *opts; @@ -139,7 +136,6 @@ udp6_append(struct inpcb *inp, struct mbuf *n, int off, #ifdef IPSEC /* Check AH/ESP integrity. */ if (ipsec6_in_reject(n, inp)) { - INIT_VNET_IPSEC(inp->inp_vnet); m_freem(n); V_ipsec6stat.in_polvio++; return; @@ -173,8 +169,6 @@ udp6_append(struct inpcb *inp, struct mbuf *n, int off, int udp6_input(struct mbuf **mp, int *offp, int proto) { - INIT_VNET_INET(curvnet); - INIT_VNET_INET6(curvnet); struct mbuf *m = *mp; struct ifnet *ifp; struct ip6_hdr *ip6; @@ -427,7 +421,6 @@ badunlocked: void udp6_ctlinput(int cmd, struct sockaddr *sa, void *d) { - INIT_VNET_INET(curvnet); struct udphdr uh; struct ip6_hdr *ip6; struct mbuf *m; @@ -493,8 +486,6 @@ udp6_ctlinput(int cmd, struct sockaddr *sa, void *d) static int udp6_getcred(SYSCTL_HANDLER_ARGS) { - INIT_VNET_INET(curvnet); - INIT_VNET_INET6(curvnet); struct xucred xuc; struct sockaddr_in6 addrs[2]; struct inpcb *inp; @@ -546,8 +537,6 @@ static int udp6_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr6, struct mbuf *control, struct thread *td) { - INIT_VNET_INET(curvnet); - INIT_VNET_INET6(curvnet); u_int32_t ulen = m->m_pkthdr.len; u_int32_t plen = sizeof(struct udphdr) + ulen; struct ip6_hdr *ip6; @@ -766,7 +755,6 @@ releaseopt: static void udp6_abort(struct socket *so) { - INIT_VNET_INET(so->so_vnet); struct inpcb *inp; inp = sotoinpcb(so); @@ -796,7 +784,6 @@ udp6_abort(struct socket *so) static int udp6_attach(struct socket *so, int proto, struct thread *td) { - INIT_VNET_INET(so->so_vnet); struct inpcb *inp; int error; @@ -843,7 +830,6 @@ udp6_attach(struct socket *so, int proto, struct thread *td) static int udp6_bind(struct socket *so, struct sockaddr *nam, struct thread *td) { - INIT_VNET_INET(so->so_vnet); struct inpcb *inp; int error; @@ -883,7 +869,6 @@ out: static void udp6_close(struct socket *so) { - INIT_VNET_INET(so->so_vnet); struct inpcb *inp; inp = sotoinpcb(so); @@ -912,7 +897,6 @@ udp6_close(struct socket *so) static int udp6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) { - INIT_VNET_INET(so->so_vnet); struct inpcb *inp; struct sockaddr_in6 *sin6; int error; @@ -969,7 +953,6 @@ out: static void udp6_detach(struct socket *so) { - INIT_VNET_INET(so->so_vnet); struct inpcb *inp; struct udpcb *up; @@ -989,7 +972,6 @@ udp6_detach(struct socket *so) static int udp6_disconnect(struct socket *so) { - INIT_VNET_INET(so->so_vnet); struct inpcb *inp; int error; @@ -1029,7 +1011,6 @@ static int udp6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, struct mbuf *control, struct thread *td) { - INIT_VNET_INET(so->so_vnet); struct inpcb *inp; int error = 0; diff --git a/sys/netinet6/vinet6.h b/sys/netinet6/vinet6.h deleted file mode 100644 index 2b0344f..0000000 --- a/sys/netinet6/vinet6.h +++ /dev/null @@ -1,270 +0,0 @@ -/*- - * Copyright (c) 2006-2008 University of Zagreb - * Copyright (c) 2006-2008 FreeBSD Foundation - * - * This software was developed by the University of Zagreb and the - * FreeBSD Foundation under sponsorship by the Stichting NLnet and the - * FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _NETINET6_VINET6_H_ -#define _NETINET6_VINET6_H_ - -#include <sys/callout.h> -#include <sys/queue.h> -#include <sys/types.h> - -#include <net/if_var.h> - -#include <netinet/icmp6.h> -#include <netinet/in.h> - -#include <netinet6/ip6_var.h> -#include <netinet6/nd6.h> -#include <netinet6/raw_ip6.h> -#include <netinet6/scope6_var.h> - -struct vnet_inet6 { - struct in6_ifaddrhead _in6_ifaddrhead; - - u_int _frag6_nfragpackets; - u_int _frag6_nfrags; - struct ip6q _ip6q; - - struct in6_addrpolicy _defaultaddrpolicy; - TAILQ_HEAD(, addrsel_policyent) _addrsel_policytab; - u_int _in6_maxmtu; - int _ip6_auto_linklocal; - int _rtq_minreallyold6; - int _rtq_reallyold6; - int _rtq_toomany6; - - struct ip6stat _ip6stat; - struct rip6stat _rip6stat; - struct icmp6stat _icmp6stat; - - int _rtq_timeout6; - struct callout _rtq_timer6; - struct callout _rtq_mtutimer; - struct callout _nd6_slowtimo_ch; - struct callout _nd6_timer_ch; - struct callout _in6_tmpaddrtimer_ch; - - int _nd6_inuse; - int _nd6_allocated; - int _nd6_onlink_ns_rfc4861; - struct nd_drhead _nd_defrouter; - struct nd_prhead _nd_prefix; - struct ifnet * _nd6_defifp; - int _nd6_defifindex; - - struct scope6_id _sid_default; - - TAILQ_HEAD(, dadq) _dadq; - int _dad_init; - - int _icmp6errpps_count; - struct timeval _icmp6errppslim_last; - - int _ip6_forwarding; - int _ip6_sendredirects; - int _ip6_defhlim; - int _ip6_defmcasthlim; - int _ip6_accept_rtadv; - int _ip6_maxfragpackets; - int _ip6_maxfrags; - int _ip6_log_interval; - int _ip6_hdrnestlimit; - int _ip6_dad_count; - int _ip6_auto_flowlabel; - int _ip6_use_deprecated; - int _ip6_rr_prune; - int _ip6_mcast_pmtu; - int _ip6_v6only; - int _ip6_keepfaith; - int _ip6stealth; - time_t _ip6_log_time; - - int _pmtu_expire; - int _pmtu_probe; - u_long _rip6_sendspace; - u_long _rip6_recvspace; - int _icmp6_rediraccept; - int _icmp6_redirtimeout; - int _icmp6errppslim; - int _icmp6_nodeinfo; - int _udp6_sendspace; - int _udp6_recvspace; - int _ip6_prefer_tempaddr; - - int _nd6_prune; - int _nd6_delay; - int _nd6_umaxtries; - int _nd6_mmaxtries; - int _nd6_useloopback; - int _nd6_gctimer; - int _nd6_maxndopt; - int _nd6_maxnudhint; - int _nd6_maxqueuelen; - int _nd6_debug; - int _nd6_recalc_reachtm_interval; - int _dad_ignore_ns; - int _dad_maxtry; - int _ip6_use_tempaddr; - int _ip6_desync_factor; - u_int32_t _ip6_temp_preferred_lifetime; - u_int32_t _ip6_temp_valid_lifetime; - - struct socket * _ip6_mrouter; - int _ip6_mrouter_ver; - int _pim6; - u_int _mrt6debug; - - int _ip6_temp_regen_advance; - int _ip6_use_defzone; - - struct ip6_pktopts _ip6_opts; - - struct timeval _mld_gsrdelay; - LIST_HEAD(, mld_ifinfo) _mli_head; - int _interface_timers_running6; - int _state_change_timers_running6; - int _current_state_timers_running6; -}; - -/* Size guard. See sys/vimage.h. */ -VIMAGE_CTASSERT(SIZEOF_vnet_inet6, sizeof(struct vnet_inet6)); - -#ifndef VIMAGE -#ifndef VIMAGE_GLOBALS -extern struct vnet_inet6 vnet_inet6_0; -#endif -#endif - -#define INIT_VNET_INET6(vnet) \ - INIT_FROM_VNET(vnet, VNET_MOD_INET6, struct vnet_inet6, vnet_inet6) - -#define VNET_INET6(sym) VSYM(vnet_inet6, sym) - -/* - * Symbol translation macros - */ -#define V_addrsel_policytab VNET_INET6(addrsel_policytab) -#define V_current_state_timers_running6 \ - VNET_INET6(current_state_timers_running6) -#define V_dad_ignore_ns VNET_INET6(dad_ignore_ns) -#define V_dad_init VNET_INET6(dad_init) -#define V_dad_maxtry VNET_INET6(dad_maxtry) -#define V_dadq VNET_INET6(dadq) -#define V_defaultaddrpolicy VNET_INET6(defaultaddrpolicy) -#define V_frag6_nfragpackets VNET_INET6(frag6_nfragpackets) -#define V_frag6_nfrags VNET_INET6(frag6_nfrags) -#define V_icmp6_nodeinfo VNET_INET6(icmp6_nodeinfo) -#define V_icmp6_rediraccept VNET_INET6(icmp6_rediraccept) -#define V_icmp6_redirtimeout VNET_INET6(icmp6_redirtimeout) -#define V_icmp6errpps_count VNET_INET6(icmp6errpps_count) -#define V_icmp6errppslim VNET_INET6(icmp6errppslim) -#define V_icmp6errppslim_last VNET_INET6(icmp6errppslim_last) -#define V_icmp6stat VNET_INET6(icmp6stat) -#define V_in6_ifaddrhead VNET_INET6(in6_ifaddrhead) -#define V_in6_maxmtu VNET_INET6(in6_maxmtu) -#define V_in6_tmpaddrtimer_ch VNET_INET6(in6_tmpaddrtimer_ch) -#define V_interface_timers_running6 \ - VNET_INET6(interface_timers_running6) -#define V_ip6_accept_rtadv VNET_INET6(ip6_accept_rtadv) -#define V_ip6_auto_flowlabel VNET_INET6(ip6_auto_flowlabel) -#define V_ip6_auto_linklocal VNET_INET6(ip6_auto_linklocal) -#define V_ip6_dad_count VNET_INET6(ip6_dad_count) -#define V_ip6_defhlim VNET_INET6(ip6_defhlim) -#define V_ip6_defmcasthlim VNET_INET6(ip6_defmcasthlim) -#define V_ip6_desync_factor VNET_INET6(ip6_desync_factor) -#define V_ip6_forwarding VNET_INET6(ip6_forwarding) -#define V_ip6_hdrnestlimit VNET_INET6(ip6_hdrnestlimit) -#define V_ip6_keepfaith VNET_INET6(ip6_keepfaith) -#define V_ip6_log_interval VNET_INET6(ip6_log_interval) -#define V_ip6_log_time VNET_INET6(ip6_log_time) -#define V_ip6_maxfragpackets VNET_INET6(ip6_maxfragpackets) -#define V_ip6_maxfrags VNET_INET6(ip6_maxfrags) -#define V_ip6_mcast_pmtu VNET_INET6(ip6_mcast_pmtu) -#define V_ip6_mrouter VNET_INET6(ip6_mrouter) -#define V_ip6_mrouter_ver VNET_INET6(ip6_mrouter_ver) -#define V_ip6_opts VNET_INET6(ip6_opts) -#define V_ip6_prefer_tempaddr VNET_INET6(ip6_prefer_tempaddr) -#define V_ip6_rr_prune VNET_INET6(ip6_rr_prune) -#define V_ip6_sendredirects VNET_INET6(ip6_sendredirects) -#define V_ip6_temp_preferred_lifetime VNET_INET6(ip6_temp_preferred_lifetime) -#define V_ip6_temp_regen_advance VNET_INET6(ip6_temp_regen_advance) -#define V_ip6_temp_valid_lifetime VNET_INET6(ip6_temp_valid_lifetime) -#define V_ip6_use_defzone VNET_INET6(ip6_use_defzone) -#define V_ip6_use_deprecated VNET_INET6(ip6_use_deprecated) -#define V_ip6_use_tempaddr VNET_INET6(ip6_use_tempaddr) -#define V_ip6_v6only VNET_INET6(ip6_v6only) -#define V_ip6q VNET_INET6(ip6q) -#define V_ip6stat VNET_INET6(ip6stat) -#define V_ip6stealth VNET_INET6(ip6stealth) -#define V_llinfo_nd6 VNET_INET6(llinfo_nd6) -#define V_mrt6debug VNET_INET6(mrt6debug) -#define V_mld_gsrdelay VNET_INET6(mld_gsrdelay) -#define V_mli_head VNET_INET6(mli_head) -#define V_nd6_allocated VNET_INET6(nd6_allocated) -#define V_nd6_debug VNET_INET6(nd6_debug) -#define V_nd6_defifindex VNET_INET6(nd6_defifindex) -#define V_nd6_defifp VNET_INET6(nd6_defifp) -#define V_nd6_delay VNET_INET6(nd6_delay) -#define V_nd6_gctimer VNET_INET6(nd6_gctimer) -#define V_nd6_inuse VNET_INET6(nd6_inuse) -#define V_nd6_maxndopt VNET_INET6(nd6_maxndopt) -#define V_nd6_maxnudhint VNET_INET6(nd6_maxnudhint) -#define V_nd6_maxqueuelen VNET_INET6(nd6_maxqueuelen) -#define V_nd6_mmaxtries VNET_INET6(nd6_mmaxtries) -#define V_nd6_onlink_ns_rfc4861 VNET_INET6(nd6_onlink_ns_rfc4861) -#define V_nd6_prune VNET_INET6(nd6_prune) -#define V_nd6_recalc_reachtm_interval VNET_INET6(nd6_recalc_reachtm_interval) -#define V_nd6_slowtimo_ch VNET_INET6(nd6_slowtimo_ch) -#define V_nd6_timer_ch VNET_INET6(nd6_timer_ch) -#define V_nd6_umaxtries VNET_INET6(nd6_umaxtries) -#define V_nd6_useloopback VNET_INET6(nd6_useloopback) -#define V_nd_defrouter VNET_INET6(nd_defrouter) -#define V_nd_prefix VNET_INET6(nd_prefix) -#define V_pim6 VNET_INET6(pim6) -#define V_pmtu_expire VNET_INET6(pmtu_expire) -#define V_pmtu_probe VNET_INET6(pmtu_probe) -#define V_rip6_recvspace VNET_INET6(rip6_recvspace) -#define V_rip6_sendspace VNET_INET6(rip6_sendspace) -#define V_rip6stat VNET_INET6(rip6stat) -#define V_rtq_minreallyold6 VNET_INET6(rtq_minreallyold6) -#define V_rtq_mtutimer VNET_INET6(rtq_mtutimer) -#define V_rtq_reallyold6 VNET_INET6(rtq_reallyold6) -#define V_rtq_timeout6 VNET_INET6(rtq_timeout6) -#define V_rtq_timer6 VNET_INET6(rtq_timer6) -#define V_rtq_toomany6 VNET_INET6(rtq_toomany6) -#define V_sid_default VNET_INET6(sid_default) -#define V_state_change_timers_running6 \ - VNET_INET6(state_change_timers_running6) -#define V_udp6_recvspace VNET_INET6(udp6_recvspace) -#define V_udp6_sendspace VNET_INET6(udp6_sendspace) - -#endif /* !_NETINET6_VINET6_H_ */ |