diff options
author | bz <bz@FreeBSD.org> | 2008-08-17 23:27:27 +0000 |
---|---|---|
committer | bz <bz@FreeBSD.org> | 2008-08-17 23:27:27 +0000 |
commit | 1021d43b569bfc8d2c5544bde2f540fa432b011f (patch) | |
tree | 1496da534aec03cf2f9d2d0735d80e4c1e3b5715 /sys/netinet6/scope6.c | |
parent | 7fc341305a3e341fca7f202fc1219358f8d9dbbd (diff) | |
download | FreeBSD-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/netinet6/scope6.c')
-rw-r--r-- | sys/netinet6/scope6.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/sys/netinet6/scope6.c b/sys/netinet6/scope6.c index 881db7e..5dce8ce 100644 --- a/sys/netinet6/scope6.c +++ b/sys/netinet6/scope6.c @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include <sys/systm.h> #include <sys/queue.h> #include <sys/syslog.h> +#include <sys/vimage.h> #include <net/route.h> #include <net/if.h> @@ -73,7 +74,7 @@ scope6_init(void) { SCOPE6_LOCK_INIT(); - bzero(&sid_default, sizeof(sid_default)); + bzero(&V_sid_default, sizeof(V_sid_default)); } struct scope6_id * @@ -147,7 +148,7 @@ scope6_set(struct ifnet *ifp, struct scope6_id *idlist) } if (i == IPV6_ADDR_SCOPE_LINKLOCAL && - idlist->s6id_list[i] > if_index) { + idlist->s6id_list[i] > V_if_index) { /* * XXX: theoretically, there should be no * relationship between link IDs and interface @@ -271,13 +272,13 @@ scope6_setdefault(struct ifnet *ifp) */ SCOPE6_LOCK(); if (ifp) { - sid_default.s6id_list[IPV6_ADDR_SCOPE_INTFACELOCAL] = + V_sid_default.s6id_list[IPV6_ADDR_SCOPE_INTFACELOCAL] = ifp->if_index; - sid_default.s6id_list[IPV6_ADDR_SCOPE_LINKLOCAL] = + V_sid_default.s6id_list[IPV6_ADDR_SCOPE_LINKLOCAL] = ifp->if_index; } else { - sid_default.s6id_list[IPV6_ADDR_SCOPE_INTFACELOCAL] = 0; - sid_default.s6id_list[IPV6_ADDR_SCOPE_LINKLOCAL] = 0; + V_sid_default.s6id_list[IPV6_ADDR_SCOPE_INTFACELOCAL] = 0; + V_sid_default.s6id_list[IPV6_ADDR_SCOPE_LINKLOCAL] = 0; } SCOPE6_UNLOCK(); } @@ -287,7 +288,7 @@ scope6_get_default(struct scope6_id *idlist) { SCOPE6_LOCK(); - *idlist = sid_default; + *idlist = V_sid_default; SCOPE6_UNLOCK(); return (0); @@ -310,7 +311,7 @@ scope6_addr2default(struct in6_addr *addr) * not to lock here? */ SCOPE6_LOCK(); - id = sid_default.s6id_list[in6_addrscope(addr)]; + id = V_sid_default.s6id_list[in6_addrscope(addr)]; SCOPE6_UNLOCK(); return (id); } @@ -341,7 +342,7 @@ sa6_embedscope(struct sockaddr_in6 *sin6, int defaultok) * zone IDs assuming a one-to-one mapping between interfaces * and links. */ - if (if_index < zoneid) + if (V_if_index < zoneid) return (ENXIO); ifp = ifnet_byindex(zoneid); if (ifp == NULL) /* XXX: this can happen for some OS */ @@ -379,7 +380,7 @@ sa6_recoverscope(struct sockaddr_in6 *sin6) zoneid = ntohs(sin6->sin6_addr.s6_addr16[1]); if (zoneid) { /* sanity check */ - if (zoneid < 0 || if_index < zoneid) + if (zoneid < 0 || V_if_index < zoneid) return (ENXIO); if (!ifnet_byindex(zoneid)) return (ENXIO); |