summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/in6_src.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet6/in6_src.c')
-rw-r--r--sys/netinet6/in6_src.c26
1 files changed, 6 insertions, 20 deletions
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;
OpenPOWER on IntegriCloud