summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2008-08-17 23:27:27 +0000
committerbz <bz@FreeBSD.org>2008-08-17 23:27:27 +0000
commit1021d43b569bfc8d2c5544bde2f540fa432b011f (patch)
tree1496da534aec03cf2f9d2d0735d80e4c1e3b5715 /sys/net
parent7fc341305a3e341fca7f202fc1219358f8d9dbbd (diff)
downloadFreeBSD-src-1021d43b569bfc8d2c5544bde2f540fa432b011f.zip
FreeBSD-src-1021d43b569bfc8d2c5544bde2f540fa432b011f.tar.gz
Commit step 1 of the vimage project, (network stack)
virtualization work done by Marko Zec (zec@). This is the first in a series of commits over the course of the next few weeks. Mark all uses of global variables to be virtualized with a V_ prefix. Use macros to map them back to their global names for now, so this is a NOP change only. We hope to have caught at least 85-90% of what is needed so we do not invalidate a lot of outstanding patches again. Obtained from: //depot/projects/vimage-commit2/... Reviewed by: brooks, des, ed, mav, julian, jamie, kris, rwatson, zec, ... (various people I forgot, different versions) md5 (with a bit of help) Sponsored by: NLnet Foundation, The FreeBSD Foundation X-MFC after: never V_Commit_Message_Reviewed_By: more people than the patch
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/bridgestp.c3
-rw-r--r--sys/net/if.c79
-rw-r--r--sys/net/if_bridge.c27
-rw-r--r--sys/net/if_ef.c3
-rw-r--r--sys/net/if_ethersubr.c7
-rw-r--r--sys/net/if_faith.c3
-rw-r--r--sys/net/if_gif.c15
-rw-r--r--sys/net/if_loop.c13
-rw-r--r--sys/net/if_mib.c3
-rw-r--r--sys/net/if_spppsubr.c1
-rw-r--r--sys/net/if_stf.c3
-rw-r--r--sys/net/if_vlan.c3
-rw-r--r--sys/net/raw_cb.c3
-rw-r--r--sys/net/raw_usrreq.c5
-rw-r--r--sys/net/route.c31
-rw-r--r--sys/net/rtsock.c9
16 files changed, 112 insertions, 96 deletions
diff --git a/sys/net/bridgestp.c b/sys/net/bridgestp.c
index 993318a..aa9671e 100644
--- a/sys/net/bridgestp.c
+++ b/sys/net/bridgestp.c
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/taskqueue.h>
+#include <sys/vimage.h>
#include <net/if.h>
#include <net/if_dl.h>
@@ -2031,7 +2032,7 @@ bstp_reinit(struct bstp_state *bs)
* value.
*/
IFNET_RLOCK();
- TAILQ_FOREACH(ifp, &ifnet, if_link) {
+ TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
if (ifp->if_type != IFT_ETHER)
continue;
diff --git a/sys/net/if.c b/sys/net/if.c
index afc8243..a3ef17d 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -56,6 +56,7 @@
#include <sys/taskqueue.h>
#include <sys/domain.h>
#include <sys/jail.h>
+#include <sys/vimage.h>
#include <machine/stdarg.h>
#include <net/if.h>
@@ -170,7 +171,7 @@ ifnet_byindex(u_short idx)
struct ifnet *ifp;
IFNET_RLOCK();
- ifp = ifindex_table[idx].ife_ifnet;
+ ifp = V_ifindex_table[idx].ife_ifnet;
IFNET_RUNLOCK();
return (ifp);
}
@@ -181,7 +182,7 @@ ifnet_setbyindex(u_short idx, struct ifnet *ifp)
IFNET_WLOCK_ASSERT();
- ifindex_table[idx].ife_ifnet = ifp;
+ V_ifindex_table[idx].ife_ifnet = ifp;
}
struct ifaddr *
@@ -201,7 +202,7 @@ ifdev_byindex(u_short idx)
struct cdev *cdev;
IFNET_RLOCK();
- cdev = ifindex_table[idx].ife_dev;
+ cdev = V_ifindex_table[idx].ife_dev;
IFNET_RUNLOCK();
return (cdev);
}
@@ -211,7 +212,7 @@ ifdev_setbyindex(u_short idx, struct cdev *cdev)
{
IFNET_WLOCK();
- ifindex_table[idx].ife_dev = cdev;
+ V_ifindex_table[idx].ife_dev = cdev;
IFNET_WUNLOCK();
}
@@ -292,7 +293,7 @@ netkqfilter(struct cdev *dev, struct knote *kn)
idx = minor(dev);
if (idx == 0) {
- klist = &ifklist;
+ klist = &V_ifklist;
} else {
ifp = ifnet_byindex(idx);
if (ifp == NULL)
@@ -349,9 +350,9 @@ if_init(void *dummy __unused)
{
IFNET_LOCK_INIT();
- TAILQ_INIT(&ifnet);
- TAILQ_INIT(&ifg_head);
- knlist_init(&ifklist, NULL, NULL, NULL, NULL);
+ TAILQ_INIT(&V_ifnet);
+ TAILQ_INIT(&V_ifg_head);
+ knlist_init(&V_ifklist, NULL, NULL, NULL, NULL);
if_grow(); /* create initial table */
ifdev_setbyindex(0, make_dev(&net_cdevsw, 0, UID_ROOT, GID_WHEEL,
0600, "network"));
@@ -364,14 +365,14 @@ if_grow(void)
u_int n;
struct ifindex_entry *e;
- if_indexlim <<= 1;
- n = if_indexlim * sizeof(*e);
+ V_if_indexlim <<= 1;
+ n = V_if_indexlim * sizeof(*e);
e = malloc(n, M_IFNET, M_WAITOK | M_ZERO);
- if (ifindex_table != NULL) {
- memcpy((caddr_t)e, (caddr_t)ifindex_table, n/2);
- free((caddr_t)ifindex_table, M_IFNET);
+ if (V_ifindex_table != NULL) {
+ memcpy((caddr_t)e, (caddr_t)V_ifindex_table, n/2);
+ free((caddr_t)V_ifindex_table, M_IFNET);
}
- ifindex_table = e;
+ V_ifindex_table = e;
}
/*
@@ -392,7 +393,7 @@ if_alloc(u_char type)
*
* XXX: should be locked!
*/
- for (ifp->if_index = 1; ifp->if_index <= if_index; ifp->if_index++) {
+ for (ifp->if_index = 1; ifp->if_index <= V_if_index; ifp->if_index++) {
if (ifnet_byindex(ifp->if_index) == NULL)
break;
}
@@ -401,9 +402,9 @@ if_alloc(u_char type)
free(ifp, M_IFNET);
return (NULL);
}
- if (ifp->if_index > if_index)
- if_index = ifp->if_index;
- if (if_index >= if_indexlim)
+ if (ifp->if_index > V_if_index)
+ V_if_index = ifp->if_index;
+ if (V_if_index >= V_if_indexlim)
if_grow();
ifp->if_type = type;
@@ -455,8 +456,8 @@ if_free_type(struct ifnet *ifp, u_char type)
ifnet_setbyindex(ifp->if_index, NULL);
/* XXX: should be locked with if_findindex() */
- while (if_index > 0 && ifnet_byindex(if_index) == NULL)
- if_index--;
+ while (V_if_index > 0 && ifnet_byindex(V_if_index) == NULL)
+ V_if_index--;
IFNET_WUNLOCK();
if (if_com_free[type] != NULL)
@@ -571,7 +572,7 @@ if_attach(struct ifnet *ifp)
ifp->if_snd.altq_ifp = ifp;
IFNET_WLOCK();
- TAILQ_INSERT_TAIL(&ifnet, ifp, if_link);
+ TAILQ_INSERT_TAIL(&V_ifnet, ifp, if_link);
IFNET_WUNLOCK();
if (domain_init_status >= 2)
@@ -598,7 +599,7 @@ if_attachdomain(void *dummy)
int s;
s = splnet();
- TAILQ_FOREACH(ifp, &ifnet, if_link)
+ TAILQ_FOREACH(ifp, &V_ifnet, if_link)
if_attachdomain1(ifp);
splx(s);
}
@@ -713,9 +714,9 @@ if_detach(struct ifnet *ifp)
int found = 0;
IFNET_WLOCK();
- TAILQ_FOREACH(iter, &ifnet, if_link)
+ TAILQ_FOREACH(iter, &V_ifnet, if_link)
if (iter == ifp) {
- TAILQ_REMOVE(&ifnet, ifp, if_link);
+ TAILQ_REMOVE(&V_ifnet, ifp, if_link);
found = 1;
break;
}
@@ -781,7 +782,7 @@ if_detach(struct ifnet *ifp)
for (i = 1; i <= AF_MAX; i++) {
int j;
for (j = 0; j < rt_numfibs; j++) {
- if ((rnh = rt_tables[j][i]) == NULL)
+ if ((rnh = V_rt_tables[j][i]) == NULL)
continue;
RADIX_NODE_HEAD_LOCK(rnh);
(void) rnh->rnh_walktree(rnh, if_rtdel, ifp);
@@ -847,7 +848,7 @@ if_addgroup(struct ifnet *ifp, const char *groupname)
return (ENOMEM);
}
- TAILQ_FOREACH(ifg, &ifg_head, ifg_next)
+ TAILQ_FOREACH(ifg, &V_ifg_head, ifg_next)
if (!strcmp(ifg->ifg_group, groupname))
break;
@@ -863,7 +864,7 @@ if_addgroup(struct ifnet *ifp, const char *groupname)
ifg->ifg_refcnt = 0;
TAILQ_INIT(&ifg->ifg_members);
EVENTHANDLER_INVOKE(group_attach_event, ifg);
- TAILQ_INSERT_TAIL(&ifg_head, ifg, ifg_next);
+ TAILQ_INSERT_TAIL(&V_ifg_head, ifg, ifg_next);
}
ifg->ifg_refcnt++;
@@ -914,7 +915,7 @@ if_delgroup(struct ifnet *ifp, const char *groupname)
}
if (--ifgl->ifgl_group->ifg_refcnt == 0) {
- TAILQ_REMOVE(&ifg_head, ifgl->ifgl_group, ifg_next);
+ TAILQ_REMOVE(&V_ifg_head, ifgl->ifgl_group, ifg_next);
EVENTHANDLER_INVOKE(group_detach_event, ifgl->ifgl_group);
free(ifgl->ifgl_group, M_TEMP);
}
@@ -984,7 +985,7 @@ if_getgroupmembers(struct ifgroupreq *data)
int len, error;
IFNET_RLOCK();
- TAILQ_FOREACH(ifg, &ifg_head, ifg_next)
+ TAILQ_FOREACH(ifg, &V_ifg_head, ifg_next)
if (!strcmp(ifg->ifg_group, ifgr->ifgr_name))
break;
if (ifg == NULL) {
@@ -1090,7 +1091,7 @@ ifa_ifwithaddr(struct sockaddr *addr)
struct ifaddr *ifa;
IFNET_RLOCK();
- TAILQ_FOREACH(ifp, &ifnet, if_link)
+ TAILQ_FOREACH(ifp, &V_ifnet, if_link)
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
if (ifa->ifa_addr->sa_family != addr->sa_family)
continue;
@@ -1120,7 +1121,7 @@ ifa_ifwithbroadaddr(struct sockaddr *addr)
struct ifaddr *ifa;
IFNET_RLOCK();
- TAILQ_FOREACH(ifp, &ifnet, if_link)
+ TAILQ_FOREACH(ifp, &V_ifnet, if_link)
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
if (ifa->ifa_addr->sa_family != addr->sa_family)
continue;
@@ -1147,7 +1148,7 @@ ifa_ifwithdstaddr(struct sockaddr *addr)
struct ifaddr *ifa;
IFNET_RLOCK();
- TAILQ_FOREACH(ifp, &ifnet, if_link) {
+ TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
if ((ifp->if_flags & IFF_POINTOPOINT) == 0)
continue;
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
@@ -1183,7 +1184,7 @@ ifa_ifwithnet(struct sockaddr *addr)
*/
if (af == AF_LINK) {
struct sockaddr_dl *sdl = (struct sockaddr_dl *)addr;
- if (sdl->sdl_index && sdl->sdl_index <= if_index)
+ if (sdl->sdl_index && sdl->sdl_index <= V_if_index)
return (ifaddr_byindex(sdl->sdl_index));
}
@@ -1192,7 +1193,7 @@ ifa_ifwithnet(struct sockaddr *addr)
* addresses in this address family.
*/
IFNET_RLOCK();
- TAILQ_FOREACH(ifp, &ifnet, if_link) {
+ TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
char *cp, *cp2, *cp3;
@@ -1516,7 +1517,7 @@ if_slowtimo(void *arg)
int s = splimp();
IFNET_RLOCK();
- TAILQ_FOREACH(ifp, &ifnet, if_link) {
+ TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
if (ifp->if_timer == 0 || --ifp->if_timer)
continue;
if (ifp->if_watchdog)
@@ -1537,7 +1538,7 @@ ifunit(const char *name)
struct ifnet *ifp;
IFNET_RLOCK();
- TAILQ_FOREACH(ifp, &ifnet, if_link) {
+ TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
if (strncmp(name, ifp->if_xname, IFNAMSIZ) == 0)
break;
}
@@ -2141,7 +2142,7 @@ again:
valid_len = 0;
IFNET_RLOCK(); /* could sleep XXX */
- TAILQ_FOREACH(ifp, &ifnet, if_link) {
+ TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
int addrs;
/*
@@ -2467,7 +2468,7 @@ if_delmulti(struct ifnet *ifp, struct sockaddr *sa)
struct ifnet *oifp;
IFNET_RLOCK();
- TAILQ_FOREACH(oifp, &ifnet, if_link)
+ TAILQ_FOREACH(oifp, &V_ifnet, if_link)
if (ifp == oifp)
break;
if (ifp != oifp)
@@ -2520,7 +2521,7 @@ if_delmulti_ifma(struct ifmultiaddr *ifma)
struct ifnet *oifp;
IFNET_RLOCK();
- TAILQ_FOREACH(oifp, &ifnet, if_link)
+ TAILQ_FOREACH(oifp, &V_ifnet, if_link)
if (ifp == oifp)
break;
if (ifp != oifp) {
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index 35e019a..88eda1d 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -100,6 +100,7 @@ __FBSDID("$FreeBSD$");
#include <sys/proc.h>
#include <sys/lock.h>
#include <sys/mutex.h>
+#include <sys/vimage.h>
#include <net/bpf.h>
#include <net/if.h>
@@ -3035,7 +3036,7 @@ bridge_pfil(struct mbuf **mp, struct ifnet *bifp, struct ifnet *ifp, int dir)
if (IPFW_LOADED && pfil_ipfw != 0 && dir == PFIL_OUT && ifp != NULL) {
error = -1;
args.rule = ip_dn_claim_rule(*mp);
- if (args.rule != NULL && fw_one_pass)
+ if (args.rule != NULL && V_fw_one_pass)
goto ipfwpass; /* packet already partially processed */
args.m = *mp;
@@ -3229,12 +3230,12 @@ bridge_ip_checkbasic(struct mbuf **mp)
if ((m = m_copyup(m, sizeof(struct ip),
(max_linkhdr + 3) & ~3)) == NULL) {
/* XXXJRT new stat, please */
- ipstat.ips_toosmall++;
+ V_ipstat.ips_toosmall++;
goto bad;
}
} else if (__predict_false(m->m_len < sizeof (struct ip))) {
if ((m = m_pullup(m, sizeof (struct ip))) == NULL) {
- ipstat.ips_toosmall++;
+ V_ipstat.ips_toosmall++;
goto bad;
}
}
@@ -3242,17 +3243,17 @@ bridge_ip_checkbasic(struct mbuf **mp)
if (ip == NULL) goto bad;
if (ip->ip_v != IPVERSION) {
- ipstat.ips_badvers++;
+ V_ipstat.ips_badvers++;
goto bad;
}
hlen = ip->ip_hl << 2;
if (hlen < sizeof(struct ip)) { /* minimum header length */
- ipstat.ips_badhlen++;
+ V_ipstat.ips_badhlen++;
goto bad;
}
if (hlen > m->m_len) {
if ((m = m_pullup(m, hlen)) == 0) {
- ipstat.ips_badhlen++;
+ V_ipstat.ips_badhlen++;
goto bad;
}
ip = mtod(m, struct ip *);
@@ -3269,7 +3270,7 @@ bridge_ip_checkbasic(struct mbuf **mp)
}
}
if (sum) {
- ipstat.ips_badsum++;
+ V_ipstat.ips_badsum++;
goto bad;
}
@@ -3280,7 +3281,7 @@ bridge_ip_checkbasic(struct mbuf **mp)
* Check for additional length bogosity
*/
if (len < hlen) {
- ipstat.ips_badlen++;
+ V_ipstat.ips_badlen++;
goto bad;
}
@@ -3290,7 +3291,7 @@ bridge_ip_checkbasic(struct mbuf **mp)
* Drop packet if shorter than we expect.
*/
if (m->m_pkthdr.len < len) {
- ipstat.ips_tooshort++;
+ V_ipstat.ips_tooshort++;
goto bad;
}
@@ -3326,14 +3327,14 @@ bridge_ip6_checkbasic(struct mbuf **mp)
if ((m = m_copyup(m, sizeof(struct ip6_hdr),
(max_linkhdr + 3) & ~3)) == NULL) {
/* XXXJRT new stat, please */
- ip6stat.ip6s_toosmall++;
+ V_ip6stat.ip6s_toosmall++;
in6_ifstat_inc(inifp, ifs6_in_hdrerr);
goto bad;
}
} else if (__predict_false(m->m_len < sizeof(struct ip6_hdr))) {
struct ifnet *inifp = m->m_pkthdr.rcvif;
if ((m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL) {
- ip6stat.ip6s_toosmall++;
+ V_ip6stat.ip6s_toosmall++;
in6_ifstat_inc(inifp, ifs6_in_hdrerr);
goto bad;
}
@@ -3342,7 +3343,7 @@ bridge_ip6_checkbasic(struct mbuf **mp)
ip6 = mtod(m, struct ip6_hdr *);
if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) {
- ip6stat.ip6s_badvers++;
+ V_ip6stat.ip6s_badvers++;
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr);
goto bad;
}
@@ -3403,7 +3404,7 @@ bridge_fragment(struct ifnet *ifp, struct mbuf *m, struct ether_header *eh,
}
if (error == 0)
- ipstat.ips_fragmented++;
+ V_ipstat.ips_fragmented++;
return (error);
diff --git a/sys/net/if_ef.c b/sys/net/if_ef.c
index cf12fab..c60e615 100644
--- a/sys/net/if_ef.c
+++ b/sys/net/if_ef.c
@@ -39,6 +39,7 @@
#include <sys/syslog.h>
#include <sys/kernel.h>
#include <sys/module.h>
+#include <sys/vimage.h>
#include <net/ethernet.h>
#include <net/if_llc.h>
@@ -489,7 +490,7 @@ ef_load(void)
int error = 0, d;
IFNET_RLOCK();
- TAILQ_FOREACH(ifp, &ifnet, if_link) {
+ TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
if (ifp->if_type != IFT_ETHER) continue;
EFDEBUG("Found interface %s\n", ifp->if_xname);
efl = (struct ef_link*)malloc(sizeof(struct ef_link),
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index c4edca6..25004b4 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -49,6 +49,7 @@
#include <sys/socket.h>
#include <sys/sockio.h>
#include <sys/sysctl.h>
+#include <sys/vimage.h>
#include <net/if.h>
#include <net/if_arp.h>
@@ -389,7 +390,7 @@ ether_output_frame(struct ifnet *ifp, struct mbuf *m)
#if defined(INET) || defined(INET6)
struct ip_fw *rule = ip_dn_claim_rule(m);
- if (IPFW_LOADED && ether_ipfw != 0) {
+ if (IPFW_LOADED && V_ether_ipfw != 0) {
if (ether_ipfw_chk(&m, ifp, &rule, 0) == 0) {
if (m) {
m_freem(m);
@@ -424,7 +425,7 @@ ether_ipfw_chk(struct mbuf **m0, struct ifnet *dst,
int i;
struct ip_fw_args args;
- if (*rule != NULL && fw_one_pass)
+ if (*rule != NULL && V_fw_one_pass)
return 1; /* dummynet packet, already partially processed */
/*
@@ -714,7 +715,7 @@ ether_demux(struct ifnet *ifp, struct mbuf *m)
* Allow dummynet and/or ipfw to claim the frame.
* Do not do this for PROMISC frames in case we are re-entered.
*/
- if (IPFW_LOADED && ether_ipfw != 0 && !(m->m_flags & M_PROMISC)) {
+ if (IPFW_LOADED && V_ether_ipfw != 0 && !(m->m_flags & M_PROMISC)) {
struct ip_fw *rule = ip_dn_claim_rule(m);
if (ether_ipfw_chk(&m, NULL, &rule, 0) == 0) {
diff --git a/sys/net/if_faith.c b/sys/net/if_faith.c
index 2b0f30e..6388820 100644
--- a/sys/net/if_faith.c
+++ b/sys/net/if_faith.c
@@ -54,6 +54,7 @@
#include <sys/queue.h>
#include <sys/types.h>
#include <sys/malloc.h>
+#include <sys/vimage.h>
#include <net/if.h>
#include <net/if_clone.h>
@@ -327,7 +328,7 @@ faithprefix(in6)
struct sockaddr_in6 sin6;
int ret;
- if (ip6_keepfaith == 0)
+ if (V_ip6_keepfaith == 0)
return 0;
bzero(&sin6, sizeof(sin6));
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
index 8310881..685f282 100644
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -49,6 +49,7 @@
#include <sys/proc.h>
#include <sys/protosw.h>
#include <sys/conf.h>
+#include <sys/vimage.h>
#include <machine/cpu.h>
#include <net/if.h>
@@ -187,7 +188,7 @@ gif_clone_create(ifc, unit, params)
(*ng_gif_attach_p)(GIF2IFP(sc));
mtx_lock(&gif_mtx);
- LIST_INSERT_HEAD(&gif_softc_list, sc, gif_list);
+ LIST_INSERT_HEAD(&V_gif_softc_list, sc, gif_list);
mtx_unlock(&gif_mtx);
return (0);
@@ -239,11 +240,11 @@ gifmodevent(mod, type, data)
switch (type) {
case MOD_LOAD:
mtx_init(&gif_mtx, "gif_mtx", NULL, MTX_DEF);
- LIST_INIT(&gif_softc_list);
+ LIST_INIT(&V_gif_softc_list);
if_clone_attach(&gif_cloner);
#ifdef INET6
- ip6_gif_hlim = GIF_HLIM;
+ V_ip6_gif_hlim = GIF_HLIM;
#endif
break;
@@ -251,7 +252,7 @@ gifmodevent(mod, type, data)
if_clone_detach(&gif_cloner);
mtx_destroy(&gif_mtx);
#ifdef INET6
- ip6_gif_hlim = 0;
+ V_ip6_gif_hlim = 0;
#endif
break;
default:
@@ -398,7 +399,7 @@ gif_output(ifp, m, dst, rt)
mtag = m_tag_locate(m, MTAG_GIF, MTAG_GIF_CALLED, mtag);
gif_called++;
}
- if (gif_called > max_gif_nesting) {
+ if (gif_called > V_max_gif_nesting) {
log(LOG_NOTICE,
"gif_output: recursively called too many times(%d)\n",
gif_called);
@@ -859,7 +860,7 @@ gif_set_tunnel(ifp, src, dst)
int error = 0;
mtx_lock(&gif_mtx);
- LIST_FOREACH(sc2, &gif_softc_list, gif_list) {
+ LIST_FOREACH(sc2, &V_gif_softc_list, gif_list) {
if (sc2 == sc)
continue;
if (!sc2->gif_pdst || !sc2->gif_psrc)
@@ -874,7 +875,7 @@ gif_set_tunnel(ifp, src, dst)
* Disallow parallel tunnels unless instructed
* otherwise.
*/
- if (!parallel_tunnels &&
+ if (!V_parallel_tunnels &&
bcmp(sc2->gif_pdst, dst, dst->sa_len) == 0 &&
bcmp(sc2->gif_psrc, src, src->sa_len) == 0) {
error = EADDRNOTAVAIL;
diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c
index ea41517..eebae0c 100644
--- a/sys/net/if_loop.c
+++ b/sys/net/if_loop.c
@@ -49,6 +49,7 @@
#include <sys/socket.h>
#include <sys/sockio.h>
#include <sys/sysctl.h>
+#include <sys/vimage.h>
#include <net/if.h>
#include <net/if_clone.h>
@@ -104,7 +105,7 @@ lo_clone_destroy(struct ifnet *ifp)
{
/* XXX: destroying lo0 will lead to panics. */
- KASSERT(loif != ifp, ("%s: destroying lo0", __func__));
+ KASSERT(V_loif != ifp, ("%s: destroying lo0", __func__));
bpfdetach(ifp);
if_detach(ifp);
@@ -128,8 +129,8 @@ lo_clone_create(struct if_clone *ifc, int unit, caddr_t params)
ifp->if_snd.ifq_maxlen = ifqmaxlen;
if_attach(ifp);
bpfattach(ifp, DLT_NULL, sizeof(u_int32_t));
- if (loif == NULL)
- loif = ifp;
+ if (V_loif == NULL)
+ V_loif = ifp;
return (0);
}
@@ -234,15 +235,15 @@ if_simloop(struct ifnet *ifp, struct mbuf *m, int af, int hlen)
bpf_mtap(ifp->if_bpf, m);
}
} else {
- if (bpf_peers_present(loif->if_bpf)) {
- if ((m->m_flags & M_MCAST) == 0 || loif == ifp) {
+ if (bpf_peers_present(V_loif->if_bpf)) {
+ if ((m->m_flags & M_MCAST) == 0 || V_loif == ifp) {
/* XXX beware sizeof(af) != 4 */
u_int32_t af1 = af;
/*
* We need to prepend the address family.
*/
- bpf_mtap2(loif->if_bpf, &af1, sizeof(af1), m);
+ bpf_mtap2(V_loif->if_bpf, &af1, sizeof(af1), m);
}
}
}
diff --git a/sys/net/if_mib.c b/sys/net/if_mib.c
index dc2b8e1..8c472c1 100644
--- a/sys/net/if_mib.c
+++ b/sys/net/if_mib.c
@@ -34,6 +34,7 @@
#include <sys/kernel.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
+#include <sys/vimage.h>
#include <net/if.h>
#include <net/if_mib.h>
@@ -81,7 +82,7 @@ sysctl_ifdata(SYSCTL_HANDLER_ARGS) /* XXX bad syntax! */
if (namelen != 2)
return EINVAL;
- if (name[0] <= 0 || name[0] > if_index ||
+ if (name[0] <= 0 || name[0] > V_if_index ||
ifnet_byindex(name[0]) == NULL)
return ENOENT;
diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c
index 9d82399..cde005c 100644
--- a/sys/net/if_spppsubr.c
+++ b/sys/net/if_spppsubr.c
@@ -48,6 +48,7 @@
#endif
#include <sys/malloc.h>
#include <sys/mbuf.h>
+#include <sys/vimage.h>
#if defined (__OpenBSD__)
#include <sys/md5k.h>
diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c
index f373eaa..bc644e9 100644
--- a/sys/net/if_stf.c
+++ b/sys/net/if_stf.c
@@ -92,6 +92,7 @@
#include <machine/cpu.h>
#include <sys/malloc.h>
+#include <sys/vimage.h>
#include <net/if.h>
#include <net/if_clone.h>
@@ -582,7 +583,7 @@ stf_checkaddr4(sc, in, inifp)
/*
* reject packets with broadcast
*/
- for (ia4 = TAILQ_FIRST(&in_ifaddrhead);
+ for (ia4 = TAILQ_FIRST(&V_in_ifaddrhead);
ia4;
ia4 = TAILQ_NEXT(ia4, ia_link))
{
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index d3bf622..439d14a 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -55,6 +55,7 @@
#include <sys/sockio.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
+#include <sys/vimage.h>
#include <net/bpf.h>
#include <net/ethernet.h>
@@ -578,7 +579,7 @@ vlan_clone_match_ethertag(struct if_clone *ifc, const char *name, int *tag)
/* Check for <etherif>.<vlan> style interface names. */
IFNET_RLOCK();
- TAILQ_FOREACH(ifp, &ifnet, if_link) {
+ TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
if (ifp->if_type != IFT_ETHER)
continue;
if (strncmp(ifp->if_xname, name, strlen(ifp->if_xname)) != 0)
diff --git a/sys/net/raw_cb.c b/sys/net/raw_cb.c
index 38d090c..ee8628c 100644
--- a/sys/net/raw_cb.c
+++ b/sys/net/raw_cb.c
@@ -42,6 +42,7 @@
#include <sys/socketvar.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
+#include <sys/vimage.h>
#include <net/raw_cb.h>
@@ -92,7 +93,7 @@ raw_attach(struct socket *so, int proto)
rp->rcb_proto.sp_family = so->so_proto->pr_domain->dom_family;
rp->rcb_proto.sp_protocol = proto;
mtx_lock(&rawcb_mtx);
- LIST_INSERT_HEAD(&rawcb_list, rp, list);
+ LIST_INSERT_HEAD(&V_rawcb_list, rp, list);
mtx_unlock(&rawcb_mtx);
return (0);
}
diff --git a/sys/net/raw_usrreq.c b/sys/net/raw_usrreq.c
index 47afb4f..09752fc 100644
--- a/sys/net/raw_usrreq.c
+++ b/sys/net/raw_usrreq.c
@@ -44,6 +44,7 @@
#include <sys/socketvar.h>
#include <sys/sx.h>
#include <sys/systm.h>
+#include <sys/vimage.h>
#include <net/raw_cb.h>
@@ -56,7 +57,7 @@ void
raw_init(void)
{
- LIST_INIT(&rawcb_list);
+ LIST_INIT(&V_rawcb_list);
}
/*
@@ -75,7 +76,7 @@ raw_input(struct mbuf *m0, struct sockproto *proto, struct sockaddr *src)
last = 0;
mtx_lock(&rawcb_mtx);
- LIST_FOREACH(rp, &rawcb_list, list) {
+ LIST_FOREACH(rp, &V_rawcb_list, list) {
if (rp->rcb_proto.sp_family != proto->sp_family)
continue;
if (rp->rcb_proto.sp_protocol &&
diff --git a/sys/net/route.c b/sys/net/route.c
index 08a70c5..70f218b 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -49,6 +49,7 @@
#include <sys/proc.h>
#include <sys/domain.h>
#include <sys/kernel.h>
+#include <sys/vimage.h>
#include <net/if.h>
#include <net/route.h>
@@ -189,7 +190,7 @@ route_init(void)
* which don't need it anyhow)
*/
dom->dom_rtattach(
- (void **)&rt_tables[table][fam],
+ (void **)&V_rt_tables[table][fam],
dom->dom_rtoffset);
} else {
break;
@@ -287,13 +288,13 @@ rtalloc1_fib(struct sockaddr *dst, int report, u_long ignflags,
KASSERT((fibnum < rt_numfibs), ("rtalloc1_fib: bad fibnum"));
if (dst->sa_family != AF_INET) /* Only INET supports > 1 fib now */
fibnum = 0;
- rnh = rt_tables[fibnum][dst->sa_family];
+ rnh = V_rt_tables[fibnum][dst->sa_family];
newrt = NULL;
/*
* Look up the address in the table for that Address Family
*/
if (rnh == NULL) {
- rtstat.rts_unreach++;
+ V_rtstat.rts_unreach++;
goto miss2;
}
RADIX_NODE_HEAD_LOCK(rnh);
@@ -355,7 +356,7 @@ rtalloc1_fib(struct sockaddr *dst, int report, u_long ignflags,
* Which basically means
* "caint get there frm here"
*/
- rtstat.rts_unreach++;
+ V_rtstat.rts_unreach++;
miss:
RADIX_NODE_HEAD_UNLOCK(rnh);
miss2: if (report) {
@@ -384,7 +385,7 @@ rtfree(struct rtentry *rt)
struct radix_node_head *rnh;
KASSERT(rt != NULL,("%s: NULL rt", __func__));
- rnh = rt_tables[rt->rt_fibnum][rt_key(rt)->sa_family];
+ rnh = V_rt_tables[rt->rt_fibnum][rt_key(rt)->sa_family];
KASSERT(rnh != NULL,("%s: NULL rnh", __func__));
RT_LOCK_ASSERT(rt);
@@ -423,7 +424,7 @@ rtfree(struct rtentry *rt)
* the rtentry must have been removed from the routing table
* so it is represented in rttrash.. remove that now.
*/
- rttrash--;
+ V_rttrash--;
#ifdef DIAGNOSTIC
if (rt->rt_refcnt < 0) {
printf("rtfree: %p not freed (neg refs)\n", rt);
@@ -544,7 +545,7 @@ rtredirect_fib(struct sockaddr *dst,
if (rt0)
RTFREE_LOCKED(rt0);
- stat = &rtstat.rts_dynamic;
+ stat = &V_rtstat.rts_dynamic;
} else {
struct rtentry *gwrt;
@@ -554,7 +555,7 @@ rtredirect_fib(struct sockaddr *dst,
*/
rt->rt_flags |= RTF_MODIFIED;
flags |= RTF_MODIFIED;
- stat = &rtstat.rts_newgateway;
+ stat = &V_rtstat.rts_newgateway;
/*
* add the key and gateway (in one malloc'd chunk).
*/
@@ -570,7 +571,7 @@ done:
RTFREE_LOCKED(rt);
out:
if (error)
- rtstat.rts_badredirect++;
+ V_rtstat.rts_badredirect++;
else if (stat != NULL)
(*stat)++;
bzero((caddr_t)&info, sizeof(info));
@@ -804,7 +805,7 @@ rtexpunge(struct rtentry *rt)
/*
* Find the correct routing tree to use for this Address Family
*/
- rnh = rt_tables[rt->rt_fibnum][rt_key(rt)->sa_family];
+ rnh = V_rt_tables[rt->rt_fibnum][rt_key(rt)->sa_family];
if (rnh == NULL)
return (EAFNOSUPPORT);
@@ -862,7 +863,7 @@ rtexpunge(struct rtentry *rt)
* one more rtentry floating around that is not
* linked to the routing table.
*/
- rttrash++;
+ V_rttrash++;
bad:
RADIX_NODE_HEAD_UNLOCK(rnh);
return (error);
@@ -892,7 +893,7 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
/*
* Find the correct routing tree to use for this Address Family
*/
- rnh = rt_tables[fibnum][dst->sa_family];
+ rnh = V_rt_tables[fibnum][dst->sa_family];
if (rnh == NULL)
return (EAFNOSUPPORT);
RADIX_NODE_HEAD_LOCK(rnh);
@@ -1015,7 +1016,7 @@ deldone:
* linked to the routing table. rttrash will be decremented
* when RTFREE(rt) is eventually called.
*/
- rttrash++;
+ V_rttrash++;
/*
* If the caller wants it, then it can have it,
@@ -1309,7 +1310,7 @@ int
rt_setgate(struct rtentry *rt, struct sockaddr *dst, struct sockaddr *gate)
{
/* XXX dst may be overwritten, can we move this to below */
- struct radix_node_head *rnh = rt_tables[rt->rt_fibnum][dst->sa_family];
+ struct radix_node_head *rnh = V_rt_tables[rt->rt_fibnum][dst->sa_family];
int dlen = SA_SIZE(dst), glen = SA_SIZE(gate);
again:
@@ -1517,7 +1518,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int flags, int fibnum)
* Look up an rtentry that is in the routing tree and
* contains the correct info.
*/
- if ((rnh = rt_tables[fibnum][dst->sa_family]) == NULL)
+ if ((rnh = V_rt_tables[fibnum][dst->sa_family]) == NULL)
/* this table doesn't exist but others might */
continue;
RADIX_NODE_HEAD_LOCK(rnh);
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 2f2f7cb..34db369 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -46,6 +46,7 @@
#include <sys/socketvar.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
+#include <sys/vimage.h>
#include <net/if.h>
#include <net/netisr.h>
@@ -413,7 +414,7 @@ route_output(struct mbuf *m, struct socket *so)
case RTM_GET:
case RTM_CHANGE:
case RTM_LOCK:
- rnh = rt_tables[so->so_fibnum][info.rti_info[RTAX_DST]->sa_family];
+ rnh = V_rt_tables[so->so_fibnum][info.rti_info[RTAX_DST]->sa_family];
if (rnh == NULL)
senderr(EAFNOSUPPORT);
RADIX_NODE_HEAD_LOCK(rnh);
@@ -1144,7 +1145,7 @@ sysctl_iflist(int af, struct walkarg *w)
bzero((caddr_t)&info, sizeof(info));
IFNET_RLOCK();
- TAILQ_FOREACH(ifp, &ifnet, if_link) {
+ TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
if (w->w_arg && w->w_arg != ifp->if_index)
continue;
ifa = ifp->if_addr;
@@ -1205,7 +1206,7 @@ sysctl_ifmalist(int af, struct walkarg *w)
bzero((caddr_t)&info, sizeof(info));
IFNET_RLOCK();
- TAILQ_FOREACH(ifp, &ifnet, if_link) {
+ TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
if (w->w_arg && w->w_arg != ifp->if_index)
continue;
ifa = ifp->if_addr;
@@ -1280,7 +1281,7 @@ sysctl_rtsock(SYSCTL_HANDLER_ARGS)
} else /* dump only one table */
i = lim = af;
for (error = 0; error == 0 && i <= lim; i++)
- if ((rnh = rt_tables[curthread->td_proc->p_fibnum][i]) != NULL) {
+ if ((rnh = V_rt_tables[curthread->td_proc->p_fibnum][i]) != NULL) {
RADIX_NODE_HEAD_LOCK(rnh);
error = rnh->rnh_walktree(rnh,
sysctl_dumpentry, &w);
OpenPOWER on IntegriCloud