PERFORCE change 113159 for review
Marko Zec
zec at FreeBSD.org
Fri Jan 19 13:29:00 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=113159
Change 113159 by zec at zec_tpx32 on 2007/01/19 13:28:56
First more or less systematic attempt on virtualizing the
INET6 code and structs, modulo simple tunable knobs.
Affected files ...
.. //depot/projects/vimage/src/sys/netinet/ip6.h#2 edit
.. //depot/projects/vimage/src/sys/netinet/tcp_input.c#5 edit
.. //depot/projects/vimage/src/sys/netinet6/dest6.c#2 edit
.. //depot/projects/vimage/src/sys/netinet6/frag6.c#3 edit
.. //depot/projects/vimage/src/sys/netinet6/icmp6.c#4 edit
.. //depot/projects/vimage/src/sys/netinet6/in6.c#4 edit
.. //depot/projects/vimage/src/sys/netinet6/in6_ifattach.c#5 edit
.. //depot/projects/vimage/src/sys/netinet6/in6_pcb.c#5 edit
.. //depot/projects/vimage/src/sys/netinet6/in6_proto.c#2 edit
.. //depot/projects/vimage/src/sys/netinet6/in6_rmx.c#3 edit
.. //depot/projects/vimage/src/sys/netinet6/in6_src.c#4 edit
.. //depot/projects/vimage/src/sys/netinet6/in6_var.h#3 edit
.. //depot/projects/vimage/src/sys/netinet6/ip6_forward.c#3 edit
.. //depot/projects/vimage/src/sys/netinet6/ip6_input.c#6 edit
.. //depot/projects/vimage/src/sys/netinet6/ip6_mroute.c#4 edit
.. //depot/projects/vimage/src/sys/netinet6/ip6_output.c#4 edit
.. //depot/projects/vimage/src/sys/netinet6/ip6_var.h#2 edit
.. //depot/projects/vimage/src/sys/netinet6/mld6.c#4 edit
.. //depot/projects/vimage/src/sys/netinet6/nd6.c#7 edit
.. //depot/projects/vimage/src/sys/netinet6/nd6.h#2 edit
.. //depot/projects/vimage/src/sys/netinet6/nd6_nbr.c#4 edit
.. //depot/projects/vimage/src/sys/netinet6/nd6_rtr.c#4 edit
.. //depot/projects/vimage/src/sys/netinet6/raw_ip6.c#5 edit
.. //depot/projects/vimage/src/sys/netinet6/route6.c#2 edit
.. //depot/projects/vimage/src/sys/netinet6/scope6.c#6 edit
.. //depot/projects/vimage/src/sys/netinet6/udp6_usrreq.c#6 edit
.. //depot/projects/vimage/src/sys/netinet6/vinet6.h#4 edit
.. //depot/projects/vimage/src/sys/sys/vimage.h#11 edit
Differences ...
==== //depot/projects/vimage/src/sys/netinet/ip6.h#2 (text+ko) ====
@@ -275,24 +275,24 @@
if (((m)->m_flags & M_LOOP) && \
((m)->m_len < (off) + (hlen)) && \
(((m) = m_pullup((m), (off) + (hlen))) == NULL)) { \
- ip6stat.ip6s_exthdrtoolong++; \
+ V_ip6stat.ip6s_exthdrtoolong++; \
return ret; \
} else if ((m)->m_flags & M_EXT) { \
if ((m)->m_len < (off) + (hlen)) { \
- ip6stat.ip6s_exthdrtoolong++; \
+ V_ip6stat.ip6s_exthdrtoolong++; \
m_freem(m); \
return ret; \
} \
} else { \
if ((m)->m_len < (off) + (hlen)) { \
- ip6stat.ip6s_exthdrtoolong++; \
+ V_ip6stat.ip6s_exthdrtoolong++; \
m_freem(m); \
return ret; \
} \
} \
} else { \
if ((m)->m_len < (off) + (hlen)) { \
- ip6stat.ip6s_tooshort++; \
+ V_ip6stat.ip6s_tooshort++; \
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); \
m_freem(m); \
return ret; \
==== //depot/projects/vimage/src/sys/netinet/tcp_input.c#5 (text+ko) ====
@@ -74,6 +74,7 @@
#include <netinet/ip_options.h>
#include <netinet/ip6.h>
#include <netinet/icmp6.h>
+#include <netinet6/vinet6.h>
#include <netinet6/in6_pcb.h>
#include <netinet6/ip6_var.h>
#include <netinet6/nd6.h>
@@ -411,6 +412,7 @@
struct mbuf **mp;
int *offp, proto;
{
+ INIT_VNET_INET6(curvnetb);
register struct mbuf *m = *mp;
struct in6_ifaddr *ia6;
@@ -441,6 +443,7 @@
int off0;
{
INIT_VNET_INET(curvnetb);
+ INIT_VNET_INET6(curvnetb);
register struct tcphdr *th;
register struct ip *ip = NULL;
register struct ipovly *ipov;
==== //depot/projects/vimage/src/sys/netinet6/dest6.c#2 (text+ko) ====
@@ -32,6 +32,7 @@
#include "opt_inet.h"
#include "opt_inet6.h"
+#include "opt_vimage.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -43,6 +44,8 @@
#include <sys/errno.h>
#include <sys/time.h>
#include <sys/kernel.h>
+#include <sys/proc.h>
+#include <sys/vimage.h>
#include <net/if.h>
#include <net/route.h>
@@ -50,6 +53,7 @@
#include <netinet/in.h>
#include <netinet/in_var.h>
#include <netinet/ip6.h>
+#include <netinet6/vinet6.h>
#include <netinet6/ip6_var.h>
#include <netinet/icmp6.h>
@@ -61,6 +65,7 @@
struct mbuf **mp;
int *offp, proto;
{
+ INIT_VNET_INET6(curvnetb);
struct mbuf *m = *mp;
int off = *offp, dstoptlen, optlen;
struct ip6_dest *dstopts;
@@ -93,7 +98,7 @@
for (optlen = 0; dstoptlen > 0; dstoptlen -= optlen, opt += optlen) {
if (*opt != IP6OPT_PAD1 &&
(dstoptlen < IP6OPT_MINLEN || *(opt + 1) + 2 > dstoptlen)) {
- ip6stat.ip6s_toosmall++;
+ V_ip6stat.ip6s_toosmall++;
goto bad;
}
==== //depot/projects/vimage/src/sys/netinet6/frag6.c#3 (text+ko) ====
@@ -30,6 +30,8 @@
* SUCH DAMAGE.
*/
+#include "opt_vimage.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
@@ -41,6 +43,8 @@
#include <sys/time.h>
#include <sys/kernel.h>
#include <sys/syslog.h>
+#include <sys/proc.h>
+#include <sys/vimage.h>
#include <net/if.h>
#include <net/route.h>
@@ -48,6 +52,7 @@
#include <netinet/in.h>
#include <netinet/in_var.h>
#include <netinet/ip6.h>
+#include <netinet6/vinet6.h>
#include <netinet6/ip6_var.h>
#include <netinet/icmp6.h>
#include <netinet/in_systm.h> /* for ECN definitions */
@@ -70,9 +75,11 @@
/*
* These fields all protected by ip6qlock.
*/
+#ifndef VIMAGE
static u_int frag6_nfragpackets;
static u_int frag6_nfrags;
static struct ip6q ip6q; /* ip6 reassemble queue */
+#endif
#define IP6Q_LOCK_INIT() mtx_init(&ip6qlock, "ip6qlock", NULL, MTX_DEF);
#define IP6Q_LOCK() mtx_lock(&ip6qlock)
@@ -96,15 +103,20 @@
void
frag6_init()
{
+ INIT_VNET_INET6(curvnetb);
+ V_ip6q.ip6q_next = V_ip6q.ip6q_prev = &V_ip6q;
+
+#ifdef VIMAGE
+ if (curvnetb != &vnetb_0)
+ return;
+#endif
ip6_maxfragpackets = nmbclusters / 4;
ip6_maxfrags = nmbclusters / 4;
EVENTHANDLER_REGISTER(nmbclusters_change,
frag6_change, NULL, EVENTHANDLER_PRI_ANY);
IP6Q_LOCK_INIT();
-
- ip6q.ip6q_next = ip6q.ip6q_prev = &ip6q;
}
/*
@@ -144,6 +156,7 @@
struct mbuf **mp;
int *offp, proto;
{
+ INIT_VNET_INET6(curvnetb);
struct mbuf *m = *mp, *t;
struct ip6_hdr *ip6;
struct ip6_frag *ip6f;
@@ -203,7 +216,7 @@
return IPPROTO_DONE;
}
- ip6stat.ip6s_fragments++;
+ V_ip6stat.ip6s_fragments++;
in6_ifstat_inc(dstifp, ifs6_reass_reqd);
/* offset now points to data portion */
@@ -218,16 +231,16 @@
*/
if (ip6_maxfrags < 0)
;
- else if (frag6_nfrags >= (u_int)ip6_maxfrags)
+ else if (V_frag6_nfrags >= (u_int)ip6_maxfrags)
goto dropfrag;
- for (q6 = ip6q.ip6q_next; q6 != &ip6q; q6 = q6->ip6q_next)
+ for (q6 = V_ip6q.ip6q_next; q6 != &V_ip6q; q6 = q6->ip6q_next)
if (ip6f->ip6f_ident == q6->ip6q_ident &&
IN6_ARE_ADDR_EQUAL(&ip6->ip6_src, &q6->ip6q_src) &&
IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, &q6->ip6q_dst))
break;
- if (q6 == &ip6q) {
+ if (q6 == &V_ip6q) {
/*
* the first fragment to arrive, create a reassembly queue.
*/
@@ -242,16 +255,16 @@
*/
if (ip6_maxfragpackets < 0)
;
- else if (frag6_nfragpackets >= (u_int)ip6_maxfragpackets)
+ else if (V_frag6_nfragpackets >= (u_int)ip6_maxfragpackets)
goto dropfrag;
- frag6_nfragpackets++;
+ V_frag6_nfragpackets++;
q6 = (struct ip6q *)malloc(sizeof(struct ip6q), M_FTABLE,
M_NOWAIT);
if (q6 == NULL)
goto dropfrag;
bzero(q6, sizeof(*q6));
- frag6_insque(q6, &ip6q);
+ frag6_insque(q6, &V_ip6q);
/* ip6q_nxt will be filled afterwards, from 1st fragment */
q6->ip6q_down = q6->ip6q_up = (struct ip6asfrag *)q6;
@@ -465,12 +478,12 @@
* the most recently active fragmented packet.
*/
frag6_enq(ip6af, af6->ip6af_up);
- frag6_nfrags++;
+ V_frag6_nfrags++;
q6->ip6q_nfrag++;
#if 0 /* xxx */
- if (q6 != ip6q.ip6q_next) {
+ if (q6 != V_ip6q.ip6q_next) {
frag6_remque(q6);
- frag6_insque(q6, &ip6q);
+ frag6_insque(q6, &V_ip6q);
}
#endif
next = 0;
@@ -529,9 +542,9 @@
/* this comes with no copy if the boundary is on cluster */
if ((t = m_split(m, offset, M_DONTWAIT)) == NULL) {
frag6_remque(q6);
- frag6_nfrags -= q6->ip6q_nfrag;
+ V_frag6_nfrags -= q6->ip6q_nfrag;
free(q6, M_FTABLE);
- frag6_nfragpackets--;
+ V_frag6_nfragpackets--;
goto dropfrag;
}
m_adj(t, sizeof(struct ip6_frag));
@@ -547,9 +560,9 @@
}
frag6_remque(q6);
- frag6_nfrags -= q6->ip6q_nfrag;
+ V_frag6_nfrags -= q6->ip6q_nfrag;
free(q6, M_FTABLE);
- frag6_nfragpackets--;
+ V_frag6_nfragpackets--;
if (m->m_flags & M_PKTHDR) { /* Isn't it always true? */
int plen = 0;
@@ -558,7 +571,7 @@
m->m_pkthdr.len = plen;
}
- ip6stat.ip6s_reassembled++;
+ V_ip6stat.ip6s_reassembled++;
in6_ifstat_inc(dstifp, ifs6_reass_ok);
/*
@@ -574,7 +587,7 @@
dropfrag:
IP6Q_UNLOCK();
in6_ifstat_inc(dstifp, ifs6_reass_fail);
- ip6stat.ip6s_fragdropped++;
+ V_ip6stat.ip6s_fragdropped++;
m_freem(m);
return IPPROTO_DONE;
}
@@ -587,6 +600,7 @@
frag6_freef(q6)
struct ip6q *q6;
{
+ INIT_VNET_INET6(curvnetb);
struct ip6asfrag *af6, *down6;
IP6Q_LOCK_ASSERT();
@@ -619,9 +633,9 @@
free(af6, M_FTABLE);
}
frag6_remque(q6);
- frag6_nfrags -= q6->ip6q_nfrag;
+ V_frag6_nfrags -= q6->ip6q_nfrag;
free(q6, M_FTABLE);
- frag6_nfragpackets--;
+ V_frag6_nfragpackets--;
}
/*
@@ -694,13 +708,15 @@
#endif
IP6Q_LOCK();
- q6 = ip6q.ip6q_next;
+ VNETB_ITERLOOP_BEGIN()
+ INIT_VNET_INET6(curvnetb);
+ q6 = V_ip6q.ip6q_next;
if (q6)
- while (q6 != &ip6q) {
+ while (q6 != &V_ip6q) {
--q6->ip6q_ttl;
q6 = q6->ip6q_next;
if (q6->ip6q_prev->ip6q_ttl == 0) {
- ip6stat.ip6s_fragtimeout++;
+ V_ip6stat.ip6s_fragtimeout++;
/* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */
frag6_freef(q6->ip6q_prev);
}
@@ -710,12 +726,13 @@
* (due to the limit being lowered), drain off
* enough to get down to the new limit.
*/
- while (frag6_nfragpackets > (u_int)ip6_maxfragpackets &&
- ip6q.ip6q_prev) {
- ip6stat.ip6s_fragoverflow++;
+ while (V_frag6_nfragpackets > (u_int)ip6_maxfragpackets &&
+ V_ip6q.ip6q_prev) {
+ V_ip6stat.ip6s_fragoverflow++;
/* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */
- frag6_freef(ip6q.ip6q_prev);
+ frag6_freef(V_ip6q.ip6q_prev);
}
+ VNETB_ITERLOOP_END()
IP6Q_UNLOCK();
#if 0
@@ -724,9 +741,9 @@
* make sure we notice eventually, even if forwarding only for one
* destination and the cache is never replaced.
*/
- if (ip6_forward_rt.ro_rt) {
- RTFREE(ip6_forward_rt.ro_rt);
- ip6_forward_rt.ro_rt = 0;
+ if (V_ip6_forward_rt.ro_rt) {
+ RTFREE(V_ip6_forward_rt.ro_rt);
+ V_ip6_forward_rt.ro_rt = 0;
}
if (ipsrcchk_rt.ro_rt) {
RTFREE(ipsrcchk_rt.ro_rt);
@@ -744,10 +761,13 @@
if (IP6Q_TRYLOCK() == 0)
return;
- while (ip6q.ip6q_next != &ip6q) {
- ip6stat.ip6s_fragdropped++;
+ VNETB_ITERLOOP_BEGIN()
+ INIT_VNET_INET6(curvnetb);
+ while (V_ip6q.ip6q_next != &V_ip6q) {
+ V_ip6stat.ip6s_fragdropped++;
/* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */
- frag6_freef(ip6q.ip6q_next);
+ frag6_freef(V_ip6q.ip6q_next);
}
+ VNETB_ITERLOOP_END()
IP6Q_UNLOCK();
}
==== //depot/projects/vimage/src/sys/netinet6/icmp6.c#4 (text+ko) ====
@@ -95,6 +95,7 @@
#include <netinet/ip6.h>
#include <netinet/icmp6.h>
#include <netinet/tcp_var.h>
+#include <netinet6/vinet6.h>
#include <netinet6/in6_ifattach.h>
#include <netinet6/in6_pcb.h>
#include <netinet6/ip6protosw.h>
@@ -115,9 +116,9 @@
extern struct domain inet6domain;
+#ifndef VIMAGE
struct icmp6stat icmp6stat;
-#ifndef VIMAGE
extern struct inpcbinfo ripcbinfo;
extern struct inpcbhead ripcb;
#endif
@@ -215,6 +216,7 @@
int type, code, param;
struct ifnet *ifp;
{
+ INIT_VNET_INET6(curvnetb);
struct ip6_hdr *ip6;
if (ifp == NULL)
@@ -248,20 +250,21 @@
struct mbuf *m;
int type, code, param;
{
+ INIT_VNET_INET6(curvnetb);
struct ip6_hdr *oip6, *nip6;
struct icmp6_hdr *icmp6;
u_int preplen;
int off;
int nxt;
- icmp6stat.icp6s_error++;
+ V_icmp6stat.icp6s_error++;
/* count per-type-code statistics */
- icmp6_errcount(&icmp6stat.icp6s_outerrhist, type, code);
+ icmp6_errcount(&V_icmp6stat.icp6s_outerrhist, type, code);
#ifdef M_DECRYPTED /*not openbsd*/
if (m->m_flags & M_DECRYPTED) {
- icmp6stat.icp6s_canterror++;
+ V_icmp6stat.icp6s_canterror++;
goto freeit;
}
#endif
@@ -319,7 +322,7 @@
IP6_EXTHDR_GET(icp, struct icmp6_hdr *, m, off,
sizeof(*icp));
if (icp == NULL) {
- icmp6stat.icp6s_tooshort++;
+ V_icmp6stat.icp6s_tooshort++;
return;
}
#endif
@@ -330,7 +333,7 @@
* Special case: for redirect (which is
* informational) we must not send icmp6 error.
*/
- icmp6stat.icp6s_canterror++;
+ V_icmp6stat.icp6s_canterror++;
goto freeit;
} else {
/* ICMPv6 informational - send the error */
@@ -343,7 +346,7 @@
/* Finally, do rate limitation check. */
if (icmp6_ratelimit(&oip6->ip6_src, type, code)) {
- icmp6stat.icp6s_toofreq++;
+ V_icmp6stat.icp6s_toofreq++;
goto freeit;
}
@@ -384,7 +387,7 @@
*/
m->m_pkthdr.rcvif = NULL;
- icmp6stat.icp6s_outhist[type]++;
+ V_icmp6stat.icp6s_outhist[type]++;
icmp6_reflect(m, sizeof(struct ip6_hdr)); /* header order: IPv6 - ICMPv6 */
return;
@@ -404,6 +407,7 @@
struct mbuf **mp;
int *offp, proto;
{
+ INIT_VNET_INET6(curvnetb);
struct mbuf *m = *mp, *n;
struct ip6_hdr *ip6, *nip6;
struct icmp6_hdr *icmp6, *nicmp6;
@@ -424,7 +428,7 @@
ip6 = mtod(m, struct ip6_hdr *);
if (icmp6len < sizeof(struct icmp6_hdr)) {
- icmp6stat.icp6s_tooshort++;
+ V_icmp6stat.icp6s_tooshort++;
goto freeit;
}
@@ -436,7 +440,7 @@
#else
IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off, sizeof(*icmp6));
if (icmp6 == NULL) {
- icmp6stat.icp6s_tooshort++;
+ V_icmp6stat.icp6s_tooshort++;
return IPPROTO_DONE;
}
#endif
@@ -447,7 +451,7 @@
"ICMP6 checksum error(%d|%x) %s\n",
icmp6->icmp6_type, sum,
ip6_sprintf(ip6bufs, &ip6->ip6_src)));
- icmp6stat.icp6s_checksum++;
+ V_icmp6stat.icp6s_checksum++;
goto freeit;
}
@@ -467,7 +471,7 @@
}
}
- icmp6stat.icp6s_inhist[icmp6->icmp6_type]++;
+ V_icmp6stat.icp6s_inhist[icmp6->icmp6_type]++;
icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_msg);
if (icmp6->icmp6_type < ICMP6_INFOMSG_MASK)
icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_error);
@@ -600,8 +604,8 @@
nicmp6->icmp6_type = ICMP6_ECHO_REPLY;
nicmp6->icmp6_code = 0;
if (n) {
- icmp6stat.icp6s_reflect++;
- icmp6stat.icp6s_outhist[ICMP6_ECHO_REPLY]++;
+ V_icmp6stat.icp6s_reflect++;
+ V_icmp6stat.icp6s_outhist[ICMP6_ECHO_REPLY]++;
icmp6_reflect(n, noff);
}
break;
@@ -727,8 +731,8 @@
}
#undef hostnamelen
if (n) {
- icmp6stat.icp6s_reflect++;
- icmp6stat.icp6s_outhist[ICMP6_WRUREPLY]++;
+ V_icmp6stat.icp6s_reflect++;
+ V_icmp6stat.icp6s_outhist[ICMP6_WRUREPLY]++;
icmp6_reflect(n, noff);
}
break;
@@ -849,11 +853,11 @@
break;
badcode:
- icmp6stat.icp6s_badcode++;
+ V_icmp6stat.icp6s_badcode++;
break;
badlen:
- icmp6stat.icp6s_badlen++;
+ V_icmp6stat.icp6s_badlen++;
break;
}
@@ -872,6 +876,7 @@
struct mbuf **mp;
int off, icmp6len, code;
{
+ INIT_VNET_INET6(curvnetb);
struct mbuf *m = *mp;
struct icmp6_hdr *icmp6;
struct ip6_hdr *eip6;
@@ -879,7 +884,7 @@
struct sockaddr_in6 icmp6src, icmp6dst;
if (icmp6len < sizeof(struct icmp6_hdr) + sizeof(struct ip6_hdr)) {
- icmp6stat.icp6s_tooshort++;
+ V_icmp6stat.icp6s_tooshort++;
goto freeit;
}
#ifndef PULLDOWN_TEST
@@ -890,7 +895,7 @@
IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off,
sizeof(*icmp6) + sizeof(struct ip6_hdr));
if (icmp6 == NULL) {
- icmp6stat.icp6s_tooshort++;
+ V_icmp6stat.icp6s_tooshort++;
return (-1);
}
#endif
@@ -925,7 +930,7 @@
IP6_EXTHDR_GET(eh, struct ip6_ext *, m,
eoff, sizeof(*eh));
if (eh == NULL) {
- icmp6stat.icp6s_tooshort++;
+ V_icmp6stat.icp6s_tooshort++;
return (-1);
}
#endif
@@ -953,7 +958,7 @@
IP6_EXTHDR_GET(rth, struct ip6_rthdr *, m,
eoff, sizeof(*rth));
if (rth == NULL) {
- icmp6stat.icp6s_tooshort++;
+ V_icmp6stat.icp6s_tooshort++;
return (-1);
}
#endif
@@ -979,7 +984,7 @@
struct ip6_rthdr0 *, m,
eoff, rthlen);
if (rth0 == NULL) {
- icmp6stat.icp6s_tooshort++;
+ V_icmp6stat.icp6s_tooshort++;
return (-1);
}
#endif
@@ -1001,7 +1006,7 @@
IP6_EXTHDR_GET(fh, struct ip6_frag *, m,
eoff, sizeof(*fh));
if (fh == NULL) {
- icmp6stat.icp6s_tooshort++;
+ V_icmp6stat.icp6s_tooshort++;
return (-1);
}
#endif
@@ -1036,7 +1041,7 @@
IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off,
sizeof(*icmp6) + sizeof(struct ip6_hdr));
if (icmp6 == NULL) {
- icmp6stat.icp6s_tooshort++;
+ V_icmp6stat.icp6s_tooshort++;
return (-1);
}
#endif
@@ -1105,6 +1110,7 @@
struct ip6ctlparam *ip6cp;
int validated;
{
+ INIT_VNET_INET6(curvnetb);
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 */
@@ -1142,7 +1148,7 @@
if (mtu < tcp_maxmtu6(&inc, NULL)) {
tcp_hc_updatemtu(&inc, mtu);
- icmp6stat.icp6s_pmtuchg++;
+ V_icmp6stat.icp6s_pmtuchg++;
}
}
@@ -1871,6 +1877,7 @@
int off;
{
INIT_VNET_INET(curvnetb);
+ INIT_VNET_INET6(curvnetb);
struct mbuf *m = *mp;
struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
struct in6pcb *in6p;
@@ -2020,7 +2027,7 @@
INP_UNLOCK(last);
} else {
m_freem(m);
- ip6stat.ip6s_delivered--;
+ V_ip6stat.ip6s_delivered--;
}
INP_INFO_RUNLOCK(&V_ripcbinfo);
return IPPROTO_DONE;
@@ -2218,6 +2225,7 @@
struct mbuf *m;
int off;
{
+ INIT_VNET_INET6(curvnetb);
struct ifnet *ifp = m->m_pkthdr.rcvif;
struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
struct nd_redirect *nd_rd;
@@ -2250,7 +2258,7 @@
#else
IP6_EXTHDR_GET(nd_rd, struct nd_redirect *, m, off, icmp6len);
if (nd_rd == NULL) {
- icmp6stat.icp6s_tooshort++;
+ V_icmp6stat.icp6s_tooshort++;
return;
}
#endif
@@ -2413,7 +2421,7 @@
return;
bad:
- icmp6stat.icp6s_badredirect++;
+ V_icmp6stat.icp6s_badredirect++;
m_freem(m);
}
@@ -2422,6 +2430,7 @@
struct mbuf *m0;
struct rtentry *rt;
{
+ INIT_VNET_INET6(curvnetb);
struct ifnet *ifp; /* my outgoing interface */
struct in6_addr *ifp_ll6;
struct in6_addr *router_ll6;
@@ -2434,7 +2443,7 @@
struct ifnet *outif = NULL;
struct sockaddr_in6 src_sa;
- icmp6_errcount(&icmp6stat.icp6s_outerrhist, ND_REDIRECT, 0);
+ icmp6_errcount(&V_icmp6stat.icp6s_outerrhist, ND_REDIRECT, 0);
/* if we are not router, we don't send icmp6 redirect */
if (!ip6_forwarding)
@@ -2689,7 +2698,7 @@
icmp6_ifstat_inc(outif, ifs6_out_msg);
icmp6_ifstat_inc(outif, ifs6_out_redirect);
}
- icmp6stat.icp6s_outhist[ND_REDIRECT]++;
+ V_icmp6stat.icp6s_outhist[ND_REDIRECT]++;
return;
==== //depot/projects/vimage/src/sys/netinet6/in6.c#4 (text+ko) ====
@@ -93,6 +93,7 @@
#include <netinet/in_pcb.h>
#include <netinet/ip6.h>
+#include <netinet6/vinet6.h>
#include <netinet6/ip6_var.h>
#include <netinet6/nd6.h>
#include <netinet6/mld6_var.h>
@@ -231,6 +232,7 @@
void
in6_ifremloop(struct ifaddr *ifa)
{
+ INIT_VNET_INET6(curvnetb);
struct in6_ifaddr *ia;
struct rtentry *rt;
int ia_count = 0;
@@ -250,7 +252,7 @@
* (probably p2p) interfaces.
* XXX: we should avoid such a configuration in IPv6...
*/
- for (ia = in6_ifaddr; ia; ia = ia->ia_next) {
+ for (ia = V_in6_ifaddr; ia; ia = ia->ia_next) {
if (IN6_ARE_ADDR_EQUAL(IFA_IN6(ifa), &ia->ia_addr.sin6_addr)) {
ia_count++;
if (ia_count > 1)
@@ -804,6 +806,7 @@
struct in6_ifaddr *ia;
int flags;
{
+ INIT_VNET_INET6(ifp->if_vnetb);
int error = 0, hostIsNew = 0, plen = -1;
struct in6_ifaddr *oia;
struct sockaddr_in6 dst6;
@@ -948,12 +951,12 @@
ia->ia_ifa.ifa_netmask = (struct sockaddr *)&ia->ia_prefixmask;
ia->ia_ifp = ifp;
- if ((oia = in6_ifaddr) != NULL) {
+ if ((oia = V_in6_ifaddr) != NULL) {
for ( ; oia->ia_next; oia = oia->ia_next)
continue;
oia->ia_next = ia;
} else
- in6_ifaddr = ia;
+ V_in6_ifaddr = ia;
ia->ia_ifa.ifa_refcnt = 1;
TAILQ_INSERT_TAIL(&ifp->if_addrlist, &ia->ia_ifa, ifa_list);
@@ -1381,14 +1384,15 @@
struct in6_ifaddr *ia;
struct ifnet *ifp;
{
+ INIT_VNET_INET6(ifp->if_vnetb);
struct in6_ifaddr *oia;
int s = splnet();
TAILQ_REMOVE(&ifp->if_addrlist, &ia->ia_ifa, ifa_list);
oia = ia;
- if (oia == (ia = in6_ifaddr))
- in6_ifaddr = ia->ia_next;
+ if (oia == (ia = V_in6_ifaddr))
+ V_in6_ifaddr = ia->ia_next;
else {
while (ia->ia_next && (ia->ia_next != oia))
ia = ia->ia_next;
@@ -1964,12 +1968,13 @@
in6_localaddr(in6)
struct in6_addr *in6;
{
+ INIT_VNET_INET6(curvnetb);
struct in6_ifaddr *ia;
if (IN6_IS_ADDR_LOOPBACK(in6) || IN6_IS_ADDR_LINKLOCAL(in6))
return 1;
- for (ia = in6_ifaddr; ia; ia = ia->ia_next) {
+ for (ia = V_in6_ifaddr; ia; ia = ia->ia_next) {
if (IN6_ARE_MASKED_ADDR_EQUAL(in6, &ia->ia_addr.sin6_addr,
&ia->ia_prefixmask.sin6_addr)) {
return 1;
@@ -1983,9 +1988,10 @@
in6_is_addr_deprecated(sa6)
struct sockaddr_in6 *sa6;
{
+ INIT_VNET_INET6(curvnetb);
struct in6_ifaddr *ia;
- for (ia = in6_ifaddr; ia; ia = ia->ia_next) {
+ for (ia = V_in6_ifaddr; ia; ia = ia->ia_next) {
if (IN6_ARE_ADDR_EQUAL(&ia->ia_addr.sin6_addr,
&sa6->sin6_addr) &&
(ia->ia6_flags & IN6_IFF_DEPRECATED) != 0)
==== //depot/projects/vimage/src/sys/netinet6/in6_ifattach.c#5 (text+ko) ====
@@ -55,6 +55,7 @@
#include <netinet/in_pcb.h>
#include <netinet/ip6.h>
+#include <netinet6/vinet6.h>
#include <netinet6/ip6_var.h>
#include <netinet6/in6_var.h>
#include <netinet6/in6_pcb.h>
@@ -736,6 +737,7 @@
{
INIT_VNET_NET(ifp->if_vnetb);
INIT_VNET_INET(ifp->if_vnetb);
+ INIT_VNET_INET6(ifp->if_vnetb);
struct in6_ifaddr *ia, *oia;
struct ifaddr *ifa, *next;
struct rtentry *rt;
@@ -783,8 +785,8 @@
/* also remove from the IPv6 address chain(itojun&jinmei) */
oia = ia;
- if (oia == (ia = in6_ifaddr))
- in6_ifaddr = ia->ia_next;
+ if (oia == (ia = V_in6_ifaddr))
+ V_in6_ifaddr = ia->ia_next;
else {
while (ia->ia_next && (ia->ia_next != oia))
ia = ia->ia_next;
@@ -873,8 +875,8 @@
}
void
-in6_tmpaddrtimer(ignored_arg)
- void *ignored_arg;
+in6_tmpaddrtimer(arg)
+ void *arg;
{
struct nd_ifinfo *ndi;
u_int8_t nullbuf[8];
==== //depot/projects/vimage/src/sys/netinet6/in6_pcb.c#5 (text+ko) ====
@@ -97,6 +97,8 @@
#include <netinet/tcp_var.h>
#include <netinet/ip6.h>
#include <netinet/ip_var.h>
+
+#include <netinet6/vinet6.h>
#include <netinet6/ip6_var.h>
#include <netinet6/nd6.h>
#include <netinet/in_pcb.h>
@@ -129,6 +131,7 @@
struct sockaddr *nam;
struct ucred *cred;
{
+ INIT_VNET_INET6(inp->inp_vnetb);
struct socket *so = inp->inp_socket;
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)NULL;
struct inpcbinfo *pcbinfo = inp->inp_pcbinfo;
@@ -138,7 +141,7 @@
INP_INFO_WLOCK_ASSERT(pcbinfo);
INP_LOCK_ASSERT(inp);
- if (!in6_ifaddr) /* XXX broken! */
+ if (!V_in6_ifaddr) /* XXX broken! */
return (EADDRNOTAVAIL);
if (inp->inp_lport || !IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr))
return (EINVAL);
@@ -301,6 +304,7 @@
struct sockaddr *nam;
struct in6_addr **plocal_addr6;
{
+ INIT_VNET_INET6(inp->inp_vnetb);
register struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)nam;
int error = 0;
struct ifnet *ifp = NULL;
@@ -321,7 +325,7 @@
if ((error = sa6_embedscope(sin6, ip6_use_defzone)) != 0)
return(error);
- if (in6_ifaddr) {
+ if (V_in6_ifaddr) {
/*
* If the destination address is UNSPECIFIED addr,
* use the loopback addr, e.g ::1.
==== //depot/projects/vimage/src/sys/netinet6/in6_proto.c#2 (text+ko) ====
@@ -67,6 +67,7 @@
#include "opt_ipstealth.h"
#include "opt_carp.h"
#include "opt_sctp.h"
+#include "opt_vimage.h"
#include <sys/param.h>
#include <sys/socket.h>
@@ -77,6 +78,7 @@
#include <sys/mbuf.h>
#include <sys/systm.h>
#include <sys/sysctl.h>
+#include <sys/vimage.h>
#include <net/if.h>
#include <net/radix.h>
@@ -89,6 +91,7 @@
#include <netinet/ip.h>
#include <netinet/ip_var.h>
#include <netinet/ip6.h>
+#include <netinet6/vinet6.h>
#include <netinet6/ip6_var.h>
#include <netinet/icmp6.h>
@@ -512,8 +515,8 @@
redirect, CTLFLAG_RW, &ip6_sendredirects, 0, "");
SYSCTL_INT(_net_inet6_ip6, IPV6CTL_DEFHLIM,
hlim, CTLFLAG_RW, &ip6_defhlim, 0, "");
-SYSCTL_STRUCT(_net_inet6_ip6, IPV6CTL_STATS, stats, CTLFLAG_RD,
- &ip6stat, ip6stat, "");
+SYSCTL_V_STRUCT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_STATS, stats,
+ CTLFLAG_RD, ip6stat, ip6stat, "");
SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGPACKETS,
maxfragpackets, CTLFLAG_RW, &ip6_maxfragpackets, 0, "");
SYSCTL_INT(_net_inet6_ip6, IPV6CTL_ACCEPT_RTADV,
@@ -551,8 +554,8 @@
TUNABLE_INT("net.inet6.ip6.auto_linklocal", &ip6_auto_linklocal);
SYSCTL_INT(_net_inet6_ip6, IPV6CTL_AUTO_LINKLOCAL,
auto_linklocal, CTLFLAG_RW, &ip6_auto_linklocal, 0, "");
-SYSCTL_STRUCT(_net_inet6_ip6, IPV6CTL_RIP6STATS, rip6stats, CTLFLAG_RD,
- &rip6stat, rip6stat, "");
+SYSCTL_V_STRUCT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_RIP6STATS,
+ rip6stats, CTLFLAG_RD, rip6stat, rip6stat, "");
SYSCTL_INT(_net_inet6_ip6, IPV6CTL_PREFER_TEMPADDR,
prefer_tempaddr, CTLFLAG_RW, &ip6_prefer_tempaddr, 0, "");
SYSCTL_INT(_net_inet6_ip6, IPV6CTL_USE_DEFAULTZONE,
@@ -571,8 +574,8 @@
rediraccept, CTLFLAG_RW, &icmp6_rediraccept, 0, "");
SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_REDIRTIMEOUT,
redirtimeout, CTLFLAG_RW, &icmp6_redirtimeout, 0, "");
-SYSCTL_STRUCT(_net_inet6_icmp6, ICMPV6CTL_STATS, stats, CTLFLAG_RD,
- &icmp6stat, icmp6stat, "");
+SYSCTL_V_STRUCT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_STATS,
+ stats, CTLFLAG_RD, icmp6stat, icmp6stat, "");
SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_PRUNE,
nd6_prune, CTLFLAG_RW, &nd6_prune, 0, "");
SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_DELAY,
==== //depot/projects/vimage/src/sys/netinet6/in6_rmx.c#3 (text+ko) ====
@@ -94,6 +94,8 @@
#include <netinet/ip_var.h>
#include <netinet/in_var.h>
+#include <netinet6/vinet6.h>
+
#include <netinet/ip6.h>
#include <netinet6/ip6_var.h>
@@ -323,20 +325,29 @@
}
#define RTQ_TIMEOUT 60*10 /* run no less than once every ten minutes */
-static int rtq_timeout = RTQ_TIMEOUT;
-static struct callout rtq_timer;
+#ifndef VIMAGE
+static int rtq_timeout6;
+static struct callout rtq_timer6;
+#endif
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list