diff options
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/dest6.c | 3 | ||||
-rw-r--r-- | sys/netinet6/frag6.c | 77 | ||||
-rw-r--r-- | sys/netinet6/icmp6.c | 109 | ||||
-rw-r--r-- | sys/netinet6/in6.c | 31 | ||||
-rw-r--r-- | sys/netinet6/in6_gif.c | 9 | ||||
-rw-r--r-- | sys/netinet6/in6_ifattach.c | 35 | ||||
-rw-r--r-- | sys/netinet6/in6_pcb.c | 15 | ||||
-rw-r--r-- | sys/netinet6/in6_proto.c | 15 | ||||
-rw-r--r-- | sys/netinet6/in6_rmx.c | 35 | ||||
-rw-r--r-- | sys/netinet6/in6_src.c | 63 | ||||
-rw-r--r-- | sys/netinet6/ip6_forward.c | 85 | ||||
-rw-r--r-- | sys/netinet6/ip6_input.c | 153 | ||||
-rw-r--r-- | sys/netinet6/ip6_ipsec.c | 3 | ||||
-rw-r--r-- | sys/netinet6/ip6_mroute.c | 91 | ||||
-rw-r--r-- | sys/netinet6/ip6_output.c | 53 | ||||
-rw-r--r-- | sys/netinet6/mld6.c | 11 | ||||
-rw-r--r-- | sys/netinet6/nd6.c | 109 | ||||
-rw-r--r-- | sys/netinet6/nd6.h | 2 | ||||
-rw-r--r-- | sys/netinet6/nd6_nbr.c | 51 | ||||
-rw-r--r-- | sys/netinet6/nd6_rtr.c | 121 | ||||
-rw-r--r-- | sys/netinet6/raw_ip6.c | 73 | ||||
-rw-r--r-- | sys/netinet6/route6.c | 19 | ||||
-rw-r--r-- | sys/netinet6/scope6.c | 21 | ||||
-rw-r--r-- | sys/netinet6/udp6_usrreq.c | 101 |
24 files changed, 654 insertions, 631 deletions
diff --git a/sys/netinet6/dest6.c b/sys/netinet6/dest6.c index fb508fc..20b5e9d 100644 --- a/sys/netinet6/dest6.c +++ b/sys/netinet6/dest6.c @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include <sys/errno.h> #include <sys/time.h> #include <sys/kernel.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/route.h> @@ -93,7 +94,7 @@ dest6_input(struct mbuf **mp, int *offp, int proto) 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; } diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c index 9826f6b..bad4410 100644 --- a/sys/netinet6/frag6.c +++ b/sys/netinet6/frag6.c @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include <sys/time.h> #include <sys/kernel.h> #include <sys/syslog.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/route.h> @@ -91,22 +92,22 @@ static void frag6_change(void *tag) { - ip6_maxfragpackets = nmbclusters / 4; - ip6_maxfrags = nmbclusters / 4; + V_ip6_maxfragpackets = nmbclusters / 4; + V_ip6_maxfrags = nmbclusters / 4; } void frag6_init(void) { - ip6_maxfragpackets = nmbclusters / 4; - ip6_maxfrags = nmbclusters / 4; + V_ip6_maxfragpackets = nmbclusters / 4; + V_ip6_maxfrags = nmbclusters / 4; EVENTHANDLER_REGISTER(nmbclusters_change, frag6_change, NULL, EVENTHANDLER_PRI_ANY); IP6Q_LOCK_INIT(); - ip6q.ip6q_next = ip6q.ip6q_prev = &ip6q; + V_ip6q.ip6q_next = V_ip6q.ip6q_prev = &V_ip6q; } /* @@ -203,7 +204,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) return IPPROTO_DONE; } - ip6stat.ip6s_fragments++; + V_ip6stat.ip6s_fragments++; in6_ifstat_inc(dstifp, ifs6_reass_reqd); /* offset now points to data portion */ @@ -216,18 +217,18 @@ frag6_input(struct mbuf **mp, int *offp, int proto) * If maxfrag is 0, never accept fragments. * If maxfrag is -1, accept all fragments without limitation. */ - if (ip6_maxfrags < 0) + if (V_ip6_maxfrags < 0) ; - else if (frag6_nfrags >= (u_int)ip6_maxfrags) + else if (V_frag6_nfrags >= (u_int)V_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. */ @@ -240,18 +241,18 @@ frag6_input(struct mbuf **mp, int *offp, int proto) * If maxfragpackets is -1, accept all fragments without * limitation. */ - if (ip6_maxfragpackets < 0) + if (V_ip6_maxfragpackets < 0) ; - else if (frag6_nfragpackets >= (u_int)ip6_maxfragpackets) + else if (V_frag6_nfragpackets >= (u_int)V_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 +466,12 @@ insert: * 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; @@ -528,9 +529,9 @@ insert: /* 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)); @@ -546,9 +547,9 @@ insert: } 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; @@ -557,7 +558,7 @@ insert: m->m_pkthdr.len = plen; } - ip6stat.ip6s_reassembled++; + V_ip6stat.ip6s_reassembled++; in6_ifstat_inc(dstifp, ifs6_reass_ok); /* @@ -573,7 +574,7 @@ insert: dropfrag: IP6Q_UNLOCK(); in6_ifstat_inc(dstifp, ifs6_reass_fail); - ip6stat.ip6s_fragdropped++; + V_ip6stat.ip6s_fragdropped++; m_freem(m); return IPPROTO_DONE; } @@ -617,9 +618,9 @@ frag6_freef(struct ip6q *q6) 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--; } /* @@ -684,13 +685,13 @@ frag6_slowtimo(void) struct ip6q *q6; IP6Q_LOCK(); - q6 = ip6q.ip6q_next; + 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); } @@ -700,11 +701,11 @@ frag6_slowtimo(void) * (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)V_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); } IP6Q_UNLOCK(); @@ -714,9 +715,9 @@ frag6_slowtimo(void) * 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); @@ -734,10 +735,10 @@ frag6_drain(void) if (IP6Q_TRYLOCK() == 0) return; - while (ip6q.ip6q_next != &ip6q) { - ip6stat.ip6s_fragdropped++; + 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); } IP6Q_UNLOCK(); } diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 89fbe29..3391d57 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -81,6 +81,7 @@ __FBSDID("$FreeBSD$"); #include <sys/syslog.h> #include <sys/systm.h> #include <sys/time.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/if_dl.h> @@ -240,14 +241,14 @@ icmp6_error(struct mbuf *m, int type, int code, int param) 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 @@ -305,7 +306,7 @@ icmp6_error(struct mbuf *m, int type, int code, int param) IP6_EXTHDR_GET(icp, struct icmp6_hdr *, m, off, sizeof(*icp)); if (icp == NULL) { - icmp6stat.icp6s_tooshort++; + V_icmp6stat.icp6s_tooshort++; return; } #endif @@ -316,7 +317,7 @@ icmp6_error(struct mbuf *m, int type, int code, int param) * 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 */ @@ -329,7 +330,7 @@ icmp6_error(struct mbuf *m, int type, int code, int param) /* Finally, do rate limitation check. */ if (icmp6_ratelimit(&oip6->ip6_src, type, code)) { - icmp6stat.icp6s_toofreq++; + V_icmp6stat.icp6s_toofreq++; goto freeit; } @@ -370,7 +371,7 @@ icmp6_error(struct mbuf *m, int type, int code, int param) */ 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; @@ -408,7 +409,7 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) ip6 = mtod(m, struct ip6_hdr *); if (icmp6len < sizeof(struct icmp6_hdr)) { - icmp6stat.icp6s_tooshort++; + V_icmp6stat.icp6s_tooshort++; goto freeit; } @@ -420,7 +421,7 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) #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 @@ -431,7 +432,7 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) "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; } @@ -451,7 +452,7 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) } } - 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); @@ -585,8 +586,8 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) 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; @@ -631,7 +632,7 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) { enum { WRU, FQDN } mode; - if (!icmp6_nodeinfo) + if (!V_icmp6_nodeinfo) break; if (icmp6len == sizeof(struct icmp6_hdr) + 4) @@ -641,7 +642,7 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) else goto badlen; -#define hostnamelen strlen(hostname) +#define hostnamelen strlen(V_hostname) if (mode == FQDN) { #ifndef PULLDOWN_TEST IP6_EXTHDR_CHECK(m, off, sizeof(struct icmp6_nodeinfo), @@ -660,7 +661,7 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) * XXX: this combination of flags is pointless, * but should we keep this for compatibility? */ - if ((icmp6_nodeinfo & 5) != 5) + if ((V_icmp6_nodeinfo & 5) != 5) break; if (code != 0) @@ -708,7 +709,7 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) bcopy(icmp6, nicmp6, sizeof(struct icmp6_hdr)); p = (u_char *)(nicmp6 + 1); bzero(p, 4); - bcopy(hostname, p + 4, maxhlen); /* meaningless TTL */ + bcopy(V_hostname, p + 4, maxhlen); /* meaningless TTL */ mtx_unlock(&hostname_mtx); noff = sizeof(struct ip6_hdr); n->m_pkthdr.len = n->m_len = sizeof(struct ip6_hdr) + @@ -718,8 +719,8 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) } #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; @@ -840,11 +841,11 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) break; badcode: - icmp6stat.icp6s_badcode++; + V_icmp6stat.icp6s_badcode++; break; badlen: - icmp6stat.icp6s_badlen++; + V_icmp6stat.icp6s_badlen++; break; } @@ -868,7 +869,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp6len, int code) 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 @@ -879,7 +880,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp6len, int code) 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 @@ -914,7 +915,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp6len, int code) IP6_EXTHDR_GET(eh, struct ip6_ext *, m, eoff, sizeof(*eh)); if (eh == NULL) { - icmp6stat.icp6s_tooshort++; + V_icmp6stat.icp6s_tooshort++; return (-1); } #endif @@ -942,7 +943,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp6len, int code) IP6_EXTHDR_GET(rth, struct ip6_rthdr *, m, eoff, sizeof(*rth)); if (rth == NULL) { - icmp6stat.icp6s_tooshort++; + V_icmp6stat.icp6s_tooshort++; return (-1); } #endif @@ -968,7 +969,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp6len, int code) struct ip6_rthdr0 *, m, eoff, rthlen); if (rth0 == NULL) { - icmp6stat.icp6s_tooshort++; + V_icmp6stat.icp6s_tooshort++; return (-1); } #endif @@ -990,7 +991,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp6len, int code) IP6_EXTHDR_GET(fh, struct ip6_frag *, m, eoff, sizeof(*fh)); if (fh == NULL) { - icmp6stat.icp6s_tooshort++; + V_icmp6stat.icp6s_tooshort++; return (-1); } #endif @@ -1025,7 +1026,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp6len, int code) 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 @@ -1129,7 +1130,7 @@ icmp6_mtudisc_update(struct ip6ctlparam *ip6cp, int validated) if (mtu < tcp_maxmtu6(&inc, NULL)) { tcp_hc_updatemtu(&inc, mtu); - icmp6stat.icp6s_pmtuchg++; + V_icmp6stat.icp6s_pmtuchg++; } } @@ -1144,7 +1145,7 @@ icmp6_mtudisc_update(struct ip6ctlparam *ip6cp, int validated) * - joins NI group address at in6_ifattach() time only, does not cope * with hostname changes by sethostname(3) */ -#define hostnamelen strlen(hostname) +#define hostnamelen strlen(V_hostname) static struct mbuf * ni6_input(struct mbuf *m, int off) { @@ -1186,7 +1187,7 @@ ni6_input(struct mbuf *m, int off) * link-local (note that site-local unicast was deprecated and * ULA is defined as global scope-wise) */ - if ((icmp6_nodeinfo & ICMP6_NODEINFO_GLOBALOK) == 0 && + if ((V_icmp6_nodeinfo & ICMP6_NODEINFO_GLOBALOK) == 0 && !IN6_IS_ADDR_LOOPBACK(&ip6->ip6_src) && !IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_src)) goto bad; @@ -1208,7 +1209,7 @@ ni6_input(struct mbuf *m, int off) goto bad; /* XXX impossible */ if ((ia6->ia6_flags & IN6_IFF_TEMPORARY) && - !(icmp6_nodeinfo & ICMP6_NODEINFO_TMPADDROK)) { + !(V_icmp6_nodeinfo & ICMP6_NODEINFO_TMPADDROK)) { nd6log((LOG_DEBUG, "ni6_input: ignore node info to " "a temporary address in %s:%d", __FILE__, __LINE__)); @@ -1299,7 +1300,7 @@ ni6_input(struct mbuf *m, int off) * truncated hostname. */ mtx_lock(&hostname_mtx); - n = ni6_nametodns(hostname, hostnamelen, 0); + n = ni6_nametodns(V_hostname, hostnamelen, 0); mtx_unlock(&hostname_mtx); if (!n || n->m_next || n->m_len == 0) goto bad; @@ -1325,12 +1326,12 @@ ni6_input(struct mbuf *m, int off) /* refuse based on configuration. XXX ICMP6_NI_REFUSED? */ switch (qtype) { case NI_QTYPE_FQDN: - if ((icmp6_nodeinfo & ICMP6_NODEINFO_FQDNOK) == 0) + if ((V_icmp6_nodeinfo & ICMP6_NODEINFO_FQDNOK) == 0) goto bad; break; case NI_QTYPE_NODEADDR: case NI_QTYPE_IPV4ADDR: - if ((icmp6_nodeinfo & ICMP6_NODEINFO_NODEADDROK) == 0) + if ((V_icmp6_nodeinfo & ICMP6_NODEINFO_NODEADDROK) == 0) goto bad; break; } @@ -1425,7 +1426,7 @@ ni6_input(struct mbuf *m, int off) * XXX do we really have FQDN in variable "hostname"? */ mtx_lock(&hostname_mtx); - n->m_next = ni6_nametodns(hostname, hostnamelen, oldfqdn); + n->m_next = ni6_nametodns(V_hostname, hostnamelen, oldfqdn); mtx_unlock(&hostname_mtx); if (n->m_next == NULL) goto bad; @@ -1655,7 +1656,7 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, struct mbuf *m, struct ifnet **ifpp, } IFNET_RLOCK(); - for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) { + for (ifp = TAILQ_FIRST(&V_ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) { addrsofif = 0; TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET6) @@ -1702,7 +1703,7 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, struct mbuf *m, struct ifnet **ifpp, (niflags & NI_NODEADDR_FLAG_ANYCAST) == 0) continue; /* we need only unicast addresses */ if ((ifa6->ia6_flags & IN6_IFF_TEMPORARY) != 0 && - (icmp6_nodeinfo & ICMP6_NODEINFO_TMPADDROK) == 0) { + (V_icmp6_nodeinfo & ICMP6_NODEINFO_TMPADDROK) == 0) { continue; } addrsofif++; /* count the address */ @@ -1724,7 +1725,7 @@ static int ni6_store_addrs(struct icmp6_nodeinfo *ni6, struct icmp6_nodeinfo *nni6, struct ifnet *ifp0, int resid) { - struct ifnet *ifp = ifp0 ? ifp0 : TAILQ_FIRST(&ifnet); + struct ifnet *ifp = ifp0 ? ifp0 : TAILQ_FIRST(&V_ifnet); struct in6_ifaddr *ifa6; struct ifaddr *ifa; struct ifnet *ifp_dep = NULL; @@ -1788,7 +1789,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *ni6, struct icmp6_nodeinfo *nni6, (niflags & NI_NODEADDR_FLAG_ANYCAST) == 0) continue; if ((ifa6->ia6_flags & IN6_IFF_TEMPORARY) != 0 && - (icmp6_nodeinfo & ICMP6_NODEINFO_TMPADDROK) == 0) { + (V_icmp6_nodeinfo & ICMP6_NODEINFO_TMPADDROK) == 0) { continue; } @@ -1895,8 +1896,8 @@ icmp6_rip6_input(struct mbuf **mp, int off) return (IPPROTO_DONE); } - INP_INFO_RLOCK(&ripcbinfo); - LIST_FOREACH(in6p, &ripcb, inp_list) { + INP_INFO_RLOCK(&V_ripcbinfo); + LIST_FOREACH(in6p, &V_ripcb, inp_list) { if ((in6p->inp_vflag & INP_IPV6) == 0) continue; if (in6p->in6p_ip6_nxt != IPPROTO_ICMPV6) @@ -1973,7 +1974,7 @@ icmp6_rip6_input(struct mbuf **mp, int off) } last = in6p; } - INP_INFO_RUNLOCK(&ripcbinfo); + INP_INFO_RUNLOCK(&V_ripcbinfo); if (last) { if (last->in6p_flags & IN6P_CONTROLOPTS) ip6_savecontrol(last, m, &opts); @@ -2011,7 +2012,7 @@ icmp6_rip6_input(struct mbuf **mp, int off) INP_RUNLOCK(last); } else { m_freem(m); - ip6stat.ip6s_delivered--; + V_ip6stat.ip6s_delivered--; } return IPPROTO_DONE; } @@ -2155,7 +2156,7 @@ icmp6_reflect(struct mbuf *m, size_t off) /* XXX: This may not be the outgoing interface */ ip6->ip6_hlim = ND_IFINFO(m->m_pkthdr.rcvif)->chlim; } else - ip6->ip6_hlim = ip6_defhlim; + ip6->ip6_hlim = V_ip6_defhlim; icmp6->icmp6_cksum = 0; icmp6->icmp6_cksum = in6_cksum(m, IPPROTO_ICMPV6, @@ -2228,9 +2229,9 @@ icmp6_redirect_input(struct mbuf *m, int off) return; /* XXX if we are router, we don't update route by icmp6 redirect */ - if (ip6_forwarding) + if (V_ip6_forwarding) goto freeit; - if (!icmp6_rediraccept) + if (!V_icmp6_rediraccept) goto freeit; #ifndef PULLDOWN_TEST @@ -2239,7 +2240,7 @@ icmp6_redirect_input(struct mbuf *m, int off) #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 @@ -2402,7 +2403,7 @@ icmp6_redirect_input(struct mbuf *m, int off) return; bad: - icmp6stat.icp6s_badredirect++; + V_icmp6stat.icp6s_badredirect++; m_freem(m); } @@ -2421,10 +2422,10 @@ icmp6_redirect_output(struct mbuf *m0, struct rtentry *rt) 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) + if (!V_ip6_forwarding) goto fail; /* sanity check */ @@ -2676,7 +2677,7 @@ noredhdropt:; 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; @@ -2780,8 +2781,8 @@ icmp6_ratelimit(const struct in6_addr *dst, const int type, ret = 0; /* okay to send */ /* PPS limit */ - if (!ppsratecheck(&icmp6errppslim_last, &icmp6errpps_count, - icmp6errppslim)) { + if (!ppsratecheck(&V_icmp6errppslim_last, &V_icmp6errpps_count, + V_icmp6errppslim)) { /* The packet is subject to rate limit */ ret++; } diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index bc9dcc9..cddb3ab 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #include <sys/time.h> #include <sys/kernel.h> #include <sys/syslog.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/if_types.h> @@ -249,7 +250,7 @@ in6_ifremloop(struct ifaddr *ifa) * (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) @@ -733,7 +734,7 @@ in6_control(struct socket *so, u_long cmd, caddr_t data, * (when required). */ if ((ia->ia6_flags & IN6_IFF_AUTOCONF) && - ip6_use_tempaddr && pr->ndpr_refcnt == 1) { + V_ip6_use_tempaddr && pr->ndpr_refcnt == 1) { int e; if ((e = in6_tmpifadd(ia, 1, 0)) != 0) { log(LOG_NOTICE, "in6_control: failed " @@ -939,12 +940,12 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, 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); @@ -1149,7 +1150,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, /* * join node information group address */ -#define hostnamelen strlen(hostname) +#define hostnamelen strlen(V_hostname) delay = 0; if ((flags & IN6_IFAUPDATE_DADDELAY)) { /* @@ -1160,8 +1161,8 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, (MAX_RTR_SOLICITATION_DELAY * hz); } mtx_lock(&hostname_mtx); - if (in6_nigroup(ifp, hostname, hostnamelen, &mltaddr.sin6_addr) - == 0) { + if (in6_nigroup(ifp, V_hostname, hostnamelen, + &mltaddr.sin6_addr) == 0) { mtx_unlock(&hostname_mtx); imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error, delay); /* XXX jinmei */ @@ -1328,8 +1329,8 @@ in6_unlink_ifa(struct in6_ifaddr *ia, struct ifnet *ifp) 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; @@ -1894,7 +1895,7 @@ in6_localaddr(struct in6_addr *in6) 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; @@ -1909,7 +1910,7 @@ in6_is_addr_deprecated(struct sockaddr_in6 *sa6) { 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) @@ -2022,7 +2023,7 @@ in6_ifawithifp(struct ifnet *ifp, struct in6_addr *dst) if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_DETACHED) continue; if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_DEPRECATED) { - if (ip6_use_deprecated) + if (V_ip6_use_deprecated) dep[0] = (struct in6_ifaddr *)ifa; continue; } @@ -2056,7 +2057,7 @@ in6_ifawithifp(struct ifnet *ifp, struct in6_addr *dst) if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_DETACHED) continue; if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_DEPRECATED) { - if (ip6_use_deprecated) + if (V_ip6_use_deprecated) dep[1] = (struct in6_ifaddr *)ifa; continue; } @@ -2151,7 +2152,7 @@ in6_setmaxmtu(void) struct ifnet *ifp; IFNET_RLOCK(); - for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) { + for (ifp = TAILQ_FIRST(&V_ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) { /* this function can be called during ifnet initialization */ if (!ifp->if_afdata[AF_INET6]) continue; @@ -2161,7 +2162,7 @@ in6_setmaxmtu(void) } IFNET_RUNLOCK(); if (maxmtu) /* update only when maxmtu is positive */ - in6_maxmtu = maxmtu; + V_in6_maxmtu = maxmtu; } /* diff --git a/sys/netinet6/in6_gif.c b/sys/netinet6/in6_gif.c index d05f8a3..1220244 100644 --- a/sys/netinet6/in6_gif.c +++ b/sys/netinet6/in6_gif.c @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include <sys/protosw.h> #include <sys/malloc.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/route.h> @@ -175,7 +176,7 @@ in6_gif_output(struct ifnet *ifp, ip6->ip6_vfc |= IPV6_VERSION; ip6->ip6_plen = htons((u_short)m->m_pkthdr.len); ip6->ip6_nxt = proto; - ip6->ip6_hlim = ip6_gif_hlim; + ip6->ip6_hlim = V_ip6_gif_hlim; ip6->ip6_src = sin6_src->sin6_addr; /* bidirectional configured tunnel mode */ if (!IN6_IS_ADDR_UNSPECIFIED(&sin6_dst->sin6_addr)) @@ -258,14 +259,14 @@ in6_gif_input(struct mbuf **mp, int *offp, int proto) sc = (struct gif_softc *)encap_getarg(m); if (sc == NULL) { m_freem(m); - ip6stat.ip6s_nogif++; + V_ip6stat.ip6s_nogif++; return IPPROTO_DONE; } gifp = GIF2IFP(sc); if (gifp == NULL || (gifp->if_flags & IFF_UP) == 0) { m_freem(m); - ip6stat.ip6s_nogif++; + V_ip6stat.ip6s_nogif++; return IPPROTO_DONE; } @@ -320,7 +321,7 @@ in6_gif_input(struct mbuf **mp, int *offp, int proto) break; default: - ip6stat.ip6s_nogif++; + V_ip6stat.ip6s_nogif++; m_freem(m); return IPPROTO_DONE; } diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index 8714377..a1b832b 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include <sys/kernel.h> #include <sys/syslog.h> #include <sys/md5.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/if_dl.h> @@ -108,7 +109,7 @@ get_rand_ifid(struct ifnet *ifp, struct in6_addr *in6) int hostnamelen; mtx_lock(&hostname_mtx); - hostnamelen = strlen(hostname); + hostnamelen = strlen(V_hostname); #if 0 /* we need at least several letters as seed for ifid */ if (hostnamelen < 3) @@ -118,7 +119,7 @@ get_rand_ifid(struct ifnet *ifp, struct in6_addr *in6) /* generate 8 bytes of pseudo-random value. */ bzero(&ctxt, sizeof(ctxt)); MD5Init(&ctxt); - MD5Update(&ctxt, hostname, hostnamelen); + MD5Update(&ctxt, V_hostname, hostnamelen); mtx_unlock(&hostname_mtx); MD5Final(digest, &ctxt); @@ -375,7 +376,7 @@ get_ifid(struct ifnet *ifp0, struct ifnet *altifp, /* next, try to get it from some other hardware interface */ IFNET_RLOCK(); - for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_list.tqe_next) { + for (ifp = V_ifnet.tqh_first; ifp; ifp = ifp->if_list.tqe_next) { if (ifp == ifp0) continue; if (in6_get_hw_ifid(ifp, in6) != 0) @@ -701,7 +702,7 @@ in6_ifattach(struct ifnet *ifp, struct ifnet *altifp) /* * assign a link-local address, if there's none. */ - if (ip6_auto_linklocal && ifp->if_type != IFT_BRIDGE) { + if (V_ip6_auto_linklocal && ifp->if_type != IFT_BRIDGE) { ia = in6ifa_ifpforlinklocal(ifp, 0); if (ia == NULL) { if (in6_ifattach_linklocal(ifp, altifp) == 0) { @@ -717,8 +718,8 @@ statinit: #endif /* update dynamically. */ - if (in6_maxmtu < ifp->if_mtu) - in6_maxmtu = ifp->if_mtu; + if (V_in6_maxmtu < ifp->if_mtu) + V_in6_maxmtu = ifp->if_mtu; } /* @@ -783,8 +784,8 @@ in6_ifdetach(struct ifnet *ifp) /* 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; @@ -800,8 +801,8 @@ in6_ifdetach(struct ifnet *ifp) IFAFREE(&oia->ia_ifa); } - in6_pcbpurgeif0(&udbinfo, ifp); - in6_pcbpurgeif0(&ripcbinfo, ifp); + in6_pcbpurgeif0(&V_udbinfo, ifp); + in6_pcbpurgeif0(&V_ripcbinfo, ifp); /* leave from all multicast groups joined */ in6_purgemaddrs(ifp); @@ -824,15 +825,15 @@ in6_ifdetach(struct ifnet *ifp) /* XXX: should not fail */ return; /* XXX grab lock first to avoid LOR */ - if (rt_tables[0][AF_INET6] != NULL) { - RADIX_NODE_HEAD_LOCK(rt_tables[0][AF_INET6]); + if (V_rt_tables[0][AF_INET6] != NULL) { + RADIX_NODE_HEAD_LOCK(V_rt_tables[0][AF_INET6]); rt = rtalloc1((struct sockaddr *)&sin6, 0, 0UL); if (rt) { if (rt->rt_ifp == ifp) rtexpunge(rt); RTFREE_LOCKED(rt); } - RADIX_NODE_HEAD_UNLOCK(rt_tables[0][AF_INET6]); + RADIX_NODE_HEAD_UNLOCK(V_rt_tables[0][AF_INET6]); } } @@ -869,12 +870,12 @@ in6_tmpaddrtimer(void *ignored_arg) struct ifnet *ifp; int s = splnet(); - callout_reset(&in6_tmpaddrtimer_ch, - (ip6_temp_preferred_lifetime - ip6_desync_factor - - ip6_temp_regen_advance) * hz, in6_tmpaddrtimer, NULL); + callout_reset(&V_in6_tmpaddrtimer_ch, + (V_ip6_temp_preferred_lifetime - V_ip6_desync_factor - + V_ip6_temp_regen_advance) * hz, in6_tmpaddrtimer, NULL); bzero(nullbuf, sizeof(nullbuf)); - for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) { + for (ifp = TAILQ_FIRST(&V_ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) { ndi = ND_IFINFO(ifp); if (bcmp(ndi->randomid, nullbuf, sizeof(nullbuf)) != 0) { /* diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 619c087..c60d8f6 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); #include <sys/priv.h> #include <sys/proc.h> #include <sys/jail.h> +#include <sys/vimage.h> #include <vm/uma.h> @@ -124,7 +125,7 @@ in6_pcbbind(register struct inpcb *inp, struct sockaddr *nam, INP_INFO_WLOCK_ASSERT(pcbinfo); INP_WLOCK_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); @@ -142,7 +143,7 @@ in6_pcbbind(register struct inpcb *inp, struct sockaddr *nam, if (nam->sa_family != AF_INET6) return (EAFNOSUPPORT); - if ((error = sa6_embedscope(sin6, ip6_use_defzone)) != 0) + if ((error = sa6_embedscope(sin6, V_ip6_use_defzone)) != 0) return(error); lport = sin6->sin6_port; @@ -179,8 +180,8 @@ in6_pcbbind(register struct inpcb *inp, struct sockaddr *nam, struct inpcb *t; /* GROSS */ - if (ntohs(lport) <= ipport_reservedhigh && - ntohs(lport) >= ipport_reservedlow && + if (ntohs(lport) <= V_ipport_reservedhigh && + ntohs(lport) >= V_ipport_reservedlow && priv_check_cred(cred, PRIV_NETINET_RESERVEDPORT, 0)) return (EACCES); @@ -297,12 +298,12 @@ in6_pcbladdr(register struct inpcb *inp, struct sockaddr *nam, if (sin6->sin6_port == 0) return (EADDRNOTAVAIL); - if (sin6->sin6_scope_id == 0 && !ip6_use_defzone) + if (sin6->sin6_scope_id == 0 && !V_ip6_use_defzone) scope_ambiguous = 1; - if ((error = sa6_embedscope(sin6, ip6_use_defzone)) != 0) + if ((error = sa6_embedscope(sin6, V_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. diff --git a/sys/netinet6/in6_proto.c b/sys/netinet6/in6_proto.c index 9cf8091..c35a1b6 100644 --- a/sys/netinet6/in6_proto.c +++ b/sys/netinet6/in6_proto.c @@ -80,6 +80,7 @@ __FBSDID("$FreeBSD$"); #include <sys/mbuf.h> #include <sys/systm.h> #include <sys/sysctl.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/radix.h> @@ -462,11 +463,11 @@ sysctl_ip6_temppltime(SYSCTL_HANDLER_ARGS) error = SYSCTL_OUT(req, arg1, sizeof(int)); if (error || !req->newptr) return (error); - old = ip6_temp_preferred_lifetime; + old = V_ip6_temp_preferred_lifetime; error = SYSCTL_IN(req, arg1, sizeof(int)); - if (ip6_temp_preferred_lifetime < - ip6_desync_factor + ip6_temp_regen_advance) { - ip6_temp_preferred_lifetime = old; + if (V_ip6_temp_preferred_lifetime < + V_ip6_desync_factor + V_ip6_temp_regen_advance) { + V_ip6_temp_preferred_lifetime = old; return (EINVAL); } return (error); @@ -481,10 +482,10 @@ sysctl_ip6_tempvltime(SYSCTL_HANDLER_ARGS) error = SYSCTL_OUT(req, arg1, sizeof(int)); if (error || !req->newptr) return (error); - old = ip6_temp_valid_lifetime; + old = V_ip6_temp_valid_lifetime; error = SYSCTL_IN(req, arg1, sizeof(int)); - if (ip6_temp_valid_lifetime < ip6_temp_preferred_lifetime) { - ip6_temp_preferred_lifetime = old; + if (V_ip6_temp_valid_lifetime < V_ip6_temp_preferred_lifetime) { + V_ip6_temp_preferred_lifetime = old; return (EINVAL); } return (error); diff --git a/sys/netinet6/in6_rmx.c b/sys/netinet6/in6_rmx.c index 2164c33..88c4dec 100644 --- a/sys/netinet6/in6_rmx.c +++ b/sys/netinet6/in6_rmx.c @@ -85,6 +85,7 @@ __FBSDID("$FreeBSD$"); #include <sys/mbuf.h> #include <sys/syslog.h> #include <sys/callout.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/route.h> @@ -259,9 +260,9 @@ in6_clsroute(struct radix_node *rn, struct radix_node_head *head) * If rtq_reallyold is 0, just delete the route without * waiting for a timeout cycle to kill it. */ - if (rtq_reallyold != 0) { + if (V_rtq_reallyold != 0) { rt->rt_flags |= RTPRF_OURS; - rt->rt_rmx.rmx_expire = time_uptime + rtq_reallyold; + rt->rt_rmx.rmx_expire = time_uptime + V_rtq_reallyold; } else { rtexpunge(rt); } @@ -308,9 +309,9 @@ in6_rtqkill(struct radix_node *rn, void *rock) } else { if (ap->updating && (rt->rt_rmx.rmx_expire - time_uptime - > rtq_reallyold)) { + > V_rtq_reallyold)) { rt->rt_rmx.rmx_expire = time_uptime - + rtq_reallyold; + + V_rtq_reallyold; } ap->nextstop = lmin(ap->nextstop, rt->rt_rmx.rmx_expire); @@ -334,7 +335,7 @@ in6_rtqtimo(void *rock) arg.found = arg.killed = 0; arg.rnh = rnh; - arg.nextstop = time_uptime + rtq_timeout6; + arg.nextstop = time_uptime + V_rtq_timeout6; arg.draining = arg.updating = 0; RADIX_NODE_HEAD_LOCK(rnh); rnh->rnh_walktree(rnh, in6_rtqkill, &arg); @@ -348,18 +349,18 @@ in6_rtqtimo(void *rock) * than once in rtq_timeout6 seconds, to keep from cranking down too * hard. */ - if ((arg.found - arg.killed > rtq_toomany) - && (time_uptime - last_adjusted_timeout >= rtq_timeout6) - && rtq_reallyold > rtq_minreallyold) { - rtq_reallyold = 2*rtq_reallyold / 3; - if (rtq_reallyold < rtq_minreallyold) { - rtq_reallyold = rtq_minreallyold; + if ((arg.found - arg.killed > V_rtq_toomany) + && (time_uptime - last_adjusted_timeout >= V_rtq_timeout6) + && V_rtq_reallyold > V_rtq_minreallyold) { + V_rtq_reallyold = 2*V_rtq_reallyold / 3; + if (V_rtq_reallyold < V_rtq_minreallyold) { + V_rtq_reallyold = V_rtq_minreallyold; } last_adjusted_timeout = time_uptime; #ifdef DIAGNOSTIC log(LOG_DEBUG, "in6_rtqtimo: adjusted rtq_reallyold to %d", - rtq_reallyold); + V_rtq_reallyold); #endif arg.found = arg.killed = 0; arg.updating = 1; @@ -370,7 +371,7 @@ in6_rtqtimo(void *rock) atv.tv_usec = 0; atv.tv_sec = arg.nextstop - time_uptime; - callout_reset(&rtq_timer6, tvtohz(&atv), in6_rtqtimo, rock); + callout_reset(&V_rtq_timer6, tvtohz(&atv), in6_rtqtimo, rock); } /* @@ -426,14 +427,14 @@ in6_mtutimo(void *rock) arg.nextstop = time_uptime + 30; /* last resort */ atv.tv_sec = 30; } - callout_reset(&rtq_mtutimer, tvtohz(&atv), in6_mtutimo, rock); + callout_reset(&V_rtq_mtutimer, tvtohz(&atv), in6_mtutimo, rock); } #if 0 void in6_rtqdrain(void) { - struct radix_node_head *rnh = rt_tables[AF_INET6]; + struct radix_node_head *rnh = V_rt_tables[AF_INET6]; struct rtqk_arg arg; arg.found = arg.killed = 0; @@ -469,9 +470,9 @@ in6_inithead(void **head, int off) rnh->rnh_addaddr = in6_addroute; rnh->rnh_matchaddr = in6_matroute; rnh->rnh_close = in6_clsroute; - callout_init(&rtq_timer6, CALLOUT_MPSAFE); + callout_init(&V_rtq_timer6, CALLOUT_MPSAFE); in6_rtqtimo(rnh); /* kick off timeout first time */ - callout_init(&rtq_mtutimer, CALLOUT_MPSAFE); + callout_init(&V_rtq_mtutimer, CALLOUT_MPSAFE); in6_mtutimo(rnh); /* kick off timeout first time */ return 1; } diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index 3464445..7a0d7d1 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); #include <sys/time.h> #include <sys/kernel.h> #include <sys/sx.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/route.h> @@ -142,9 +143,9 @@ static struct in6_addrpolicy *match_addrsel_policy(struct sockaddr_in6 *); * an entry to the caller for later use. */ #define REPLACE(r) do {\ - if ((r) < sizeof(ip6stat.ip6s_sources_rule) / \ - sizeof(ip6stat.ip6s_sources_rule[0])) /* check for safety */ \ - ip6stat.ip6s_sources_rule[(r)]++; \ + if ((r) < sizeof(V_ip6stat.ip6s_sources_rule) / \ + sizeof(V_ip6stat.ip6s_sources_rule[0])) /* check for safety */ \ + V_ip6stat.ip6s_sources_rule[(r)]++; \ /* { \ char ip6buf[INET6_ADDRSTRLEN], ip6b[INET6_ADDRSTRLEN]; \ printf("in6_selectsrc: replace %s with %s by %d\n", ia_best ? ip6_sprintf(ip6buf, &ia_best->ia_addr.sin6_addr) : "none", ip6_sprintf(ip6b, &ia->ia_addr.sin6_addr), (r)); \ @@ -152,9 +153,9 @@ static struct in6_addrpolicy *match_addrsel_policy(struct sockaddr_in6 *); goto replace; \ } while(0) #define NEXT(r) do {\ - if ((r) < sizeof(ip6stat.ip6s_sources_rule) / \ - sizeof(ip6stat.ip6s_sources_rule[0])) /* check for safety */ \ - ip6stat.ip6s_sources_rule[(r)]++; \ + if ((r) < sizeof(V_ip6stat.ip6s_sources_rule) / \ + sizeof(V_ip6stat.ip6s_sources_rule[0])) /* check for safety */ \ + V_ip6stat.ip6s_sources_rule[(r)]++; \ /* { \ char ip6buf[INET6_ADDRSTRLEN], ip6b[INET6_ADDRSTRLEN]; \ printf("in6_selectsrc: keep %s against %s by %d\n", ia_best ? ip6_sprintf(ip6buf, &ia_best->ia_addr.sin6_addr) : "none", ip6_sprintf(ip6b, &ia->ia_addr.sin6_addr), (r)); \ @@ -162,9 +163,9 @@ static struct in6_addrpolicy *match_addrsel_policy(struct sockaddr_in6 *); goto next; /* XXX: we can't use 'continue' here */ \ } while(0) #define BREAK(r) do { \ - if ((r) < sizeof(ip6stat.ip6s_sources_rule) / \ - sizeof(ip6stat.ip6s_sources_rule[0])) /* check for safety */ \ - ip6stat.ip6s_sources_rule[(r)]++; \ + if ((r) < sizeof(V_ip6stat.ip6s_sources_rule) / \ + sizeof(V_ip6stat.ip6s_sources_rule[0])) /* check for safety */ \ + V_ip6stat.ip6s_sources_rule[(r)]++; \ goto out; /* XXX: we can't use 'break' here */ \ } while(0) @@ -264,7 +265,7 @@ in6_selectsrc(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, if (*errorp != 0) return (NULL); - for (ia = in6_ifaddr; ia; ia = ia->ia_next) { + for (ia = V_in6_ifaddr; ia; ia = ia->ia_next) { int new_scope = -1, new_matchlen = -1; struct in6_addrpolicy *new_policy = NULL; u_int32_t srczone, osrczone, dstzone; @@ -293,7 +294,7 @@ in6_selectsrc(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, (IN6_IFF_NOTREADY | IN6_IFF_ANYCAST | IN6_IFF_DETACHED))) { continue; } - if (!ip6_use_deprecated && IFA6_IS_DEPRECATED(ia)) + if (!V_ip6_use_deprecated && IFA6_IS_DEPRECATED(ia)) continue; /* Rule 1: Prefer same address */ @@ -364,7 +365,7 @@ in6_selectsrc(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, */ if (opts == NULL || opts->ip6po_prefer_tempaddr == IP6PO_TEMPADDR_SYSTEM) { - prefer_tempaddr = ip6_prefer_tempaddr; + prefer_tempaddr = V_ip6_prefer_tempaddr; } else if (opts->ip6po_prefer_tempaddr == IP6PO_TEMPADDR_NOTPREFER) { prefer_tempaddr = 0; @@ -641,7 +642,7 @@ selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, error = EHOSTUNREACH; } if (error == EHOSTUNREACH) - ip6stat.ip6s_noroute++; + V_ip6stat.ip6s_noroute++; if (retifp != NULL) *retifp = ifp; @@ -754,9 +755,9 @@ in6_selecthlim(struct in6pcb *in6p, struct ifnet *ifp) if (lifp) return (ND_IFINFO(lifp)->chlim); } else - return (ip6_defhlim); + return (V_ip6_defhlim); } - return (ip6_defhlim); + return (V_ip6_defhlim); } /* @@ -781,19 +782,19 @@ in6_pcbsetport(struct in6_addr *laddr, struct inpcb *inp, struct ucred *cred) inp->inp_flags |= INP_ANONPORT; if (inp->inp_flags & INP_HIGHPORT) { - first = ipport_hifirstauto; /* sysctl */ - last = ipport_hilastauto; + first = V_ipport_hifirstauto; /* sysctl */ + last = V_ipport_hilastauto; lastport = &pcbinfo->ipi_lasthi; } else if (inp->inp_flags & INP_LOWPORT) { error = priv_check_cred(cred, PRIV_NETINET_RESERVEDPORT, 0); if (error) return error; - first = ipport_lowfirstauto; /* 1023 */ - last = ipport_lowlastauto; /* 600 */ + first = V_ipport_lowfirstauto; /* 1023 */ + last = V_ipport_lowlastauto; /* 600 */ lastport = &pcbinfo->ipi_lastlow; } else { - first = ipport_firstauto; /* sysctl */ - last = ipport_lastauto; + first = V_ipport_firstauto; /* sysctl */ + last = V_ipport_lastauto; lastport = &pcbinfo->ipi_lastport; } /* @@ -866,8 +867,8 @@ addrsel_policy_init(void) init_policy_queue(); /* initialize the "last resort" policy */ - bzero(&defaultaddrpolicy, sizeof(defaultaddrpolicy)); - defaultaddrpolicy.label = ADDR_LABEL_NOTAPP; + bzero(&V_defaultaddrpolicy, sizeof(V_defaultaddrpolicy)); + V_defaultaddrpolicy.label = ADDR_LABEL_NOTAPP; } static struct in6_addrpolicy * @@ -879,7 +880,7 @@ lookup_addrsel_policy(struct sockaddr_in6 *key) match = match_addrsel_policy(key); if (match == NULL) - match = &defaultaddrpolicy; + match = &V_defaultaddrpolicy; else match->use++; ADDRSEL_UNLOCK(); @@ -965,7 +966,7 @@ static void init_policy_queue(void) { - TAILQ_INIT(&addrsel_policytab); + TAILQ_INIT(&V_addrsel_policytab); } static int @@ -979,7 +980,7 @@ add_addrsel_policyent(struct in6_addrpolicy *newpolicy) ADDRSEL_LOCK(); /* duplication check */ - TAILQ_FOREACH(pol, &addrsel_policytab, ape_entry) { + TAILQ_FOREACH(pol, &V_addrsel_policytab, ape_entry) { if (IN6_ARE_ADDR_EQUAL(&newpolicy->addr.sin6_addr, &pol->ape_policy.addr.sin6_addr) && IN6_ARE_ADDR_EQUAL(&newpolicy->addrmask.sin6_addr, @@ -996,7 +997,7 @@ add_addrsel_policyent(struct in6_addrpolicy *newpolicy) /* XXX: should validate entry */ new->ape_policy = *newpolicy; - TAILQ_INSERT_TAIL(&addrsel_policytab, new, ape_entry); + TAILQ_INSERT_TAIL(&V_addrsel_policytab, new, ape_entry); ADDRSEL_UNLOCK(); ADDRSEL_XUNLOCK(); @@ -1012,7 +1013,7 @@ delete_addrsel_policyent(struct in6_addrpolicy *key) ADDRSEL_LOCK(); /* search for the entry in the table */ - TAILQ_FOREACH(pol, &addrsel_policytab, ape_entry) { + TAILQ_FOREACH(pol, &V_addrsel_policytab, ape_entry) { if (IN6_ARE_ADDR_EQUAL(&key->addr.sin6_addr, &pol->ape_policy.addr.sin6_addr) && IN6_ARE_ADDR_EQUAL(&key->addrmask.sin6_addr, @@ -1026,7 +1027,7 @@ delete_addrsel_policyent(struct in6_addrpolicy *key) return (ESRCH); } - TAILQ_REMOVE(&addrsel_policytab, pol, ape_entry); + TAILQ_REMOVE(&V_addrsel_policytab, pol, ape_entry); ADDRSEL_UNLOCK(); ADDRSEL_XUNLOCK(); @@ -1041,7 +1042,7 @@ walk_addrsel_policy(int (*callback)(struct in6_addrpolicy *, void *), int error = 0; ADDRSEL_SLOCK(); - TAILQ_FOREACH(pol, &addrsel_policytab, ape_entry) { + TAILQ_FOREACH(pol, &V_addrsel_policytab, ape_entry) { if ((error = (*callback)(&pol->ape_policy, w)) != 0) { ADDRSEL_SUNLOCK(); return (error); @@ -1070,7 +1071,7 @@ match_addrsel_policy(struct sockaddr_in6 *key) int matchlen, bestmatchlen = -1; u_char *mp, *ep, *k, *p, m; - TAILQ_FOREACH(pent, &addrsel_policytab, ape_entry) { + TAILQ_FOREACH(pent, &V_addrsel_policytab, ape_entry) { matchlen = 0; pol = &pent->ape_policy; diff --git a/sys/netinet6/ip6_forward.c b/sys/netinet6/ip6_forward.c index 8bf0595..ec25a31 100644 --- a/sys/netinet6/ip6_forward.c +++ b/sys/netinet6/ip6_forward.c @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include <sys/time.h> #include <sys/kernel.h> #include <sys/syslog.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/route.h> @@ -117,7 +118,7 @@ ip6_forward(struct mbuf *m, int srcrt) * before forwarding packet actually. */ if (ipsec6_in_reject(m, NULL)) { - ipsec6stat.in_polvio++; + V_ipsec6stat.in_polvio++; m_freem(m); return; } @@ -132,10 +133,10 @@ ip6_forward(struct mbuf *m, int srcrt) if ((m->m_flags & (M_BCAST|M_MCAST)) != 0 || IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) || IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src)) { - ip6stat.ip6s_cantforward++; + V_ip6stat.ip6s_cantforward++; /* XXX in6_ifstat_inc(rt->rt_ifp, ifs6_in_discard) */ - if (ip6_log_time + ip6_log_interval < time_second) { - ip6_log_time = time_second; + if (V_ip6_log_time + V_ip6_log_interval < time_second) { + V_ip6_log_time = time_second; log(LOG_DEBUG, "cannot forward " "from %s to %s nxt %d received on %s\n", @@ -149,7 +150,7 @@ ip6_forward(struct mbuf *m, int srcrt) } #ifdef IPSTEALTH - if (!ip6stealth) { + if (!V_ip6stealth) { #endif if (ip6->ip6_hlim <= IPV6_HLIMDEC) { /* XXX in6_ifstat_inc(rt->rt_ifp, ifs6_in_discard) */ @@ -179,8 +180,8 @@ ip6_forward(struct mbuf *m, int srcrt) sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_OUTBOUND, IP_FORWARDING, &error); if (sp == NULL) { - ipsec6stat.out_inval++; - ip6stat.ip6s_cantforward++; + V_ipsec6stat.out_inval++; + V_ip6stat.ip6s_cantforward++; if (mcopy) { #if 0 /* XXX: what icmp ? */ @@ -200,8 +201,8 @@ ip6_forward(struct mbuf *m, int srcrt) /* * This packet is just discarded. */ - ipsec6stat.out_polvio++; - ip6stat.ip6s_cantforward++; + V_ipsec6stat.out_polvio++; + V_ip6stat.ip6s_cantforward++; KEY_FREESP(&sp); if (mcopy) { #if 0 @@ -223,7 +224,7 @@ ip6_forward(struct mbuf *m, int srcrt) if (sp->req == NULL) { /* XXX should be panic ? */ printf("ip6_forward: No IPsec request specified.\n"); - ip6stat.ip6s_cantforward++; + V_ip6stat.ip6s_cantforward++; KEY_FREESP(&sp); if (mcopy) { #if 0 @@ -307,7 +308,7 @@ ip6_forward(struct mbuf *m, int srcrt) /* don't show these error codes to the user */ break; } - ip6stat.ip6s_cantforward++; + V_ip6stat.ip6s_cantforward++; if (mcopy) { #if 0 /* XXX: what icmp ? */ @@ -352,22 +353,22 @@ ip6_forward(struct mbuf *m, int srcrt) goto skip_routing; #endif - dst = (struct sockaddr_in6 *)&ip6_forward_rt.ro_dst; + dst = (struct sockaddr_in6 *)&V_ip6_forward_rt.ro_dst; if (!srcrt) { /* ip6_forward_rt.ro_dst.sin6_addr is equal to ip6->ip6_dst */ - if (ip6_forward_rt.ro_rt == 0 || - (ip6_forward_rt.ro_rt->rt_flags & RTF_UP) == 0) { - 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 == 0 || + (V_ip6_forward_rt.ro_rt->rt_flags & RTF_UP) == 0) { + if (V_ip6_forward_rt.ro_rt) { + RTFREE(V_ip6_forward_rt.ro_rt); + V_ip6_forward_rt.ro_rt = 0; } /* this probably fails but give it a try again */ - rtalloc((struct route *)&ip6_forward_rt); + rtalloc((struct route *)&V_ip6_forward_rt); } - if (ip6_forward_rt.ro_rt == 0) { - ip6stat.ip6s_noroute++; + if (V_ip6_forward_rt.ro_rt == 0) { + V_ip6stat.ip6s_noroute++; in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_noroute); if (mcopy) { icmp6_error(mcopy, ICMP6_DST_UNREACH, @@ -376,20 +377,20 @@ ip6_forward(struct mbuf *m, int srcrt) m_freem(m); return; } - } else if ((rt = ip6_forward_rt.ro_rt) == 0 || + } else if ((rt = V_ip6_forward_rt.ro_rt) == 0 || !IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, &dst->sin6_addr)) { - 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; } bzero(dst, sizeof(*dst)); dst->sin6_len = sizeof(struct sockaddr_in6); dst->sin6_family = AF_INET6; dst->sin6_addr = ip6->ip6_dst; - rtalloc((struct route *)&ip6_forward_rt); - if (ip6_forward_rt.ro_rt == 0) { - ip6stat.ip6s_noroute++; + rtalloc((struct route *)&V_ip6_forward_rt); + if (V_ip6_forward_rt.ro_rt == 0) { + V_ip6stat.ip6s_noroute++; in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_noroute); if (mcopy) { icmp6_error(mcopy, ICMP6_DST_UNREACH, @@ -399,7 +400,7 @@ ip6_forward(struct mbuf *m, int srcrt) return; } } - rt = ip6_forward_rt.ro_rt; + rt = V_ip6_forward_rt.ro_rt; #ifdef IPSEC skip_routing:; #endif @@ -416,14 +417,14 @@ ip6_forward(struct mbuf *m, int srcrt) src_in6 = ip6->ip6_src; if (in6_setscope(&src_in6, rt->rt_ifp, &outzone)) { /* XXX: this should not happen */ - ip6stat.ip6s_cantforward++; - ip6stat.ip6s_badscope++; + V_ip6stat.ip6s_cantforward++; + V_ip6stat.ip6s_badscope++; m_freem(m); return; } if (in6_setscope(&src_in6, m->m_pkthdr.rcvif, &inzone)) { - ip6stat.ip6s_cantforward++; - ip6stat.ip6s_badscope++; + V_ip6stat.ip6s_cantforward++; + V_ip6stat.ip6s_badscope++; m_freem(m); return; } @@ -432,12 +433,12 @@ ip6_forward(struct mbuf *m, int srcrt) && !ipsecrt #endif ) { - ip6stat.ip6s_cantforward++; - ip6stat.ip6s_badscope++; + V_ip6stat.ip6s_cantforward++; + V_ip6stat.ip6s_badscope++; in6_ifstat_inc(rt->rt_ifp, ifs6_in_discard); - if (ip6_log_time + ip6_log_interval < time_second) { - ip6_log_time = time_second; + if (V_ip6_log_time + V_ip6_log_interval < time_second) { + V_ip6_log_time = time_second; log(LOG_DEBUG, "cannot forward " "src %s, dst %s, nxt %d, rcvif %s, outif %s\n", @@ -464,8 +465,8 @@ ip6_forward(struct mbuf *m, int srcrt) if (in6_setscope(&dst_in6, m->m_pkthdr.rcvif, &inzone) != 0 || in6_setscope(&dst_in6, rt->rt_ifp, &outzone) != 0 || inzone != outzone) { - ip6stat.ip6s_cantforward++; - ip6stat.ip6s_badscope++; + V_ip6stat.ip6s_cantforward++; + V_ip6stat.ip6s_badscope++; m_freem(m); return; } @@ -523,7 +524,7 @@ ip6_forward(struct mbuf *m, int srcrt) * Also, don't send redirect if forwarding using a route * modified by a redirect. */ - if (ip6_sendredirects && rt->rt_ifp == m->m_pkthdr.rcvif && !srcrt && + if (V_ip6_sendredirects && rt->rt_ifp == m->m_pkthdr.rcvif && !srcrt && #ifdef IPSEC !ipsecrt && #endif /* IPSEC */ @@ -607,12 +608,12 @@ pass: error = nd6_output(rt->rt_ifp, origifp, m, dst, rt); if (error) { in6_ifstat_inc(rt->rt_ifp, ifs6_out_discard); - ip6stat.ip6s_cantforward++; + V_ip6stat.ip6s_cantforward++; } else { - ip6stat.ip6s_forward++; + V_ip6stat.ip6s_forward++; in6_ifstat_inc(rt->rt_ifp, ifs6_out_forward); if (type) - ip6stat.ip6s_redirectsent++; + V_ip6stat.ip6s_redirectsent++; else { if (mcopy) goto freecopy; diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index e6ca375..6bd9557 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -80,6 +80,7 @@ __FBSDID("$FreeBSD$"); #include <sys/time.h> #include <sys/kernel.h> #include <sys/syslog.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/if_types.h> @@ -178,14 +179,14 @@ ip6_init(void) printf("%s: WARNING: unable to register pfil hook, " "error %d\n", __func__, i); - ip6intrq.ifq_maxlen = ip6qmaxlen; + ip6intrq.ifq_maxlen = V_ip6qmaxlen; mtx_init(&ip6intrq.ifq_mtx, "ip6_inq", NULL, MTX_DEF); netisr_register(NETISR_IPV6, ip6_input, &ip6intrq, 0); scope6_init(); addrsel_policy_init(); nd6_init(); frag6_init(); - ip6_desync_factor = arc4random() % MAX_TEMP_DESYNC_FACTOR; + V_ip6_desync_factor = arc4random() % MAX_TEMP_DESYNC_FACTOR; } static void @@ -193,14 +194,14 @@ ip6_init2(void *dummy) { /* nd6_timer_init */ - callout_init(&nd6_timer_ch, 0); - callout_reset(&nd6_timer_ch, hz, nd6_timer, NULL); + callout_init(&V_nd6_timer_ch, 0); + callout_reset(&V_nd6_timer_ch, hz, nd6_timer, NULL); /* timer for regeneranation of temporary addresses randomize ID */ - callout_init(&in6_tmpaddrtimer_ch, 0); - callout_reset(&in6_tmpaddrtimer_ch, - (ip6_temp_preferred_lifetime - ip6_desync_factor - - ip6_temp_regen_advance) * hz, + callout_init(&V_in6_tmpaddrtimer_ch, 0); + callout_reset(&V_in6_tmpaddrtimer_ch, + (V_ip6_temp_preferred_lifetime - V_ip6_desync_factor - + V_ip6_temp_regen_advance) * hz, in6_tmpaddrtimer, NULL); } @@ -244,20 +245,20 @@ ip6_input(struct mbuf *m) */ if (m->m_flags & M_EXT) { if (m->m_next) - ip6stat.ip6s_mext2m++; + V_ip6stat.ip6s_mext2m++; else - ip6stat.ip6s_mext1++; + V_ip6stat.ip6s_mext1++; } else { -#define M2MMAX (sizeof(ip6stat.ip6s_m2m)/sizeof(ip6stat.ip6s_m2m[0])) +#define M2MMAX (sizeof(V_ip6stat.ip6s_m2m)/sizeof(V_ip6stat.ip6s_m2m[0])) if (m->m_next) { if (m->m_flags & M_LOOP) { - ip6stat.ip6s_m2m[loif[0].if_index]++; /* XXX */ + V_ip6stat.ip6s_m2m[V_loif[0].if_index]++; /* XXX */ } else if (m->m_pkthdr.rcvif->if_index < M2MMAX) - ip6stat.ip6s_m2m[m->m_pkthdr.rcvif->if_index]++; + V_ip6stat.ip6s_m2m[m->m_pkthdr.rcvif->if_index]++; else - ip6stat.ip6s_m2m[0]++; + V_ip6stat.ip6s_m2m[0]++; } else - ip6stat.ip6s_m1++; + V_ip6stat.ip6s_m1++; #undef M2MMAX } @@ -268,7 +269,7 @@ ip6_input(struct mbuf *m) } in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_receive); - ip6stat.ip6s_total++; + V_ip6stat.ip6s_total++; #ifndef PULLDOWN_TEST /* @@ -306,7 +307,7 @@ ip6_input(struct mbuf *m) struct ifnet *inifp; 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); return; } @@ -315,12 +316,12 @@ ip6_input(struct mbuf *m) 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; } - ip6stat.ip6s_nxthist[ip6->ip6_nxt]++; + V_ip6stat.ip6s_nxthist[ip6->ip6_nxt]++; /* * Check against address spoofing/corruption. @@ -330,7 +331,7 @@ ip6_input(struct mbuf *m) /* * XXX: "badscope" is not very suitable for a multicast source. */ - ip6stat.ip6s_badscope++; + V_ip6stat.ip6s_badscope++; in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); goto bad; } @@ -342,7 +343,7 @@ ip6_input(struct mbuf *m) * because ip6_mloopback() passes the "actual" interface * as the outgoing/incoming interface. */ - ip6stat.ip6s_badscope++; + V_ip6stat.ip6s_badscope++; in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); goto bad; } @@ -367,7 +368,7 @@ ip6_input(struct mbuf *m) */ if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) || IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst)) { - ip6stat.ip6s_badscope++; + V_ip6stat.ip6s_badscope++; in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); goto bad; } @@ -381,7 +382,7 @@ ip6_input(struct mbuf *m) */ if (IN6_IS_ADDR_V4COMPAT(&ip6->ip6_src) || IN6_IS_ADDR_V4COMPAT(&ip6->ip6_dst)) { - ip6stat.ip6s_badscope++; + V_ip6stat.ip6s_badscope++; in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); goto bad; } @@ -419,12 +420,12 @@ passin: * is not loopback. */ if (in6_clearscope(&ip6->ip6_src) || in6_clearscope(&ip6->ip6_dst)) { - ip6stat.ip6s_badscope++; /* XXX */ + V_ip6stat.ip6s_badscope++; /* XXX */ goto bad; } if (in6_setscope(&ip6->ip6_src, m->m_pkthdr.rcvif, NULL) || in6_setscope(&ip6->ip6_dst, m->m_pkthdr.rcvif, NULL)) { - ip6stat.ip6s_badscope++; + V_ip6stat.ip6s_badscope++; goto bad; } @@ -443,8 +444,8 @@ passin: if (in6m) ours = 1; else if (!ip6_mrouter) { - ip6stat.ip6s_notmember++; - ip6stat.ip6s_cantforward++; + V_ip6stat.ip6s_notmember++; + V_ip6stat.ip6s_cantforward++; in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard); goto bad; } @@ -455,28 +456,28 @@ passin: /* * Unicast check */ - if (ip6_forward_rt.ro_rt != NULL && - (ip6_forward_rt.ro_rt->rt_flags & RTF_UP) != 0 && + if (V_ip6_forward_rt.ro_rt != NULL && + (V_ip6_forward_rt.ro_rt->rt_flags & RTF_UP) != 0 && IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, - &((struct sockaddr_in6 *)(&ip6_forward_rt.ro_dst))->sin6_addr)) - ip6stat.ip6s_forward_cachehit++; + &((struct sockaddr_in6 *)(&V_ip6_forward_rt.ro_dst))->sin6_addr)) + V_ip6stat.ip6s_forward_cachehit++; else { struct sockaddr_in6 *dst6; - if (ip6_forward_rt.ro_rt) { + if (V_ip6_forward_rt.ro_rt) { /* route is down or destination is different */ - ip6stat.ip6s_forward_cachemiss++; - RTFREE(ip6_forward_rt.ro_rt); - ip6_forward_rt.ro_rt = 0; + V_ip6stat.ip6s_forward_cachemiss++; + RTFREE(V_ip6_forward_rt.ro_rt); + V_ip6_forward_rt.ro_rt = 0; } - bzero(&ip6_forward_rt.ro_dst, sizeof(struct sockaddr_in6)); - dst6 = (struct sockaddr_in6 *)&ip6_forward_rt.ro_dst; + bzero(&V_ip6_forward_rt.ro_dst, sizeof(struct sockaddr_in6)); + dst6 = (struct sockaddr_in6 *)&V_ip6_forward_rt.ro_dst; dst6->sin6_len = sizeof(struct sockaddr_in6); dst6->sin6_family = AF_INET6; dst6->sin6_addr = ip6->ip6_dst; - rtalloc((struct route *)&ip6_forward_rt); + rtalloc((struct route *)&V_ip6_forward_rt); } #define rt6_key(r) ((struct sockaddr_in6 *)((r)->rt_nodes->rn_key)) @@ -501,14 +502,14 @@ passin: * while it would be less efficient. Or, should we rather install a * reject route for such a case? */ - if (ip6_forward_rt.ro_rt && - (ip6_forward_rt.ro_rt->rt_flags & + if (V_ip6_forward_rt.ro_rt && + (V_ip6_forward_rt.ro_rt->rt_flags & (RTF_HOST|RTF_GATEWAY)) == RTF_HOST && #ifdef RTF_WASCLONED - !(ip6_forward_rt.ro_rt->rt_flags & RTF_WASCLONED) && + !(V_ip6_forward_rt.ro_rt->rt_flags & RTF_WASCLONED) && #endif #ifdef RTF_CLONED - !(ip6_forward_rt.ro_rt->rt_flags & RTF_CLONED) && + !(V_ip6_forward_rt.ro_rt->rt_flags & RTF_CLONED) && #endif #if 0 /* @@ -517,11 +518,11 @@ passin: * already done through looking up the routing table. */ IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, - &rt6_key(ip6_forward_rt.ro_rt)->sin6_addr) + &rt6_key(V_ip6_forward_rt.ro_rt)->sin6_addr) #endif - ip6_forward_rt.ro_rt->rt_ifp->if_type == IFT_LOOP) { + V_ip6_forward_rt.ro_rt->rt_ifp->if_type == IFT_LOOP) { struct in6_ifaddr *ia6 = - (struct in6_ifaddr *)ip6_forward_rt.ro_rt->rt_ifa; + (struct in6_ifaddr *)V_ip6_forward_rt.ro_rt->rt_ifa; /* * record address information into m_tag. @@ -556,12 +557,12 @@ passin: /* * FAITH (Firewall Aided Internet Translator) */ - if (ip6_keepfaith) { - if (ip6_forward_rt.ro_rt && ip6_forward_rt.ro_rt->rt_ifp - && ip6_forward_rt.ro_rt->rt_ifp->if_type == IFT_FAITH) { + if (V_ip6_keepfaith) { + if (V_ip6_forward_rt.ro_rt && V_ip6_forward_rt.ro_rt->rt_ifp + && V_ip6_forward_rt.ro_rt->rt_ifp->if_type == IFT_FAITH) { /* XXX do we need more sanity checks? */ ours = 1; - deliverifp = ip6_forward_rt.ro_rt->rt_ifp; /* faith */ + deliverifp = V_ip6_forward_rt.ro_rt->rt_ifp; /* faith */ goto hbhcheck; } } @@ -570,8 +571,8 @@ passin: * Now there is no reason to process the packet if it's not our own * and we're not a router. */ - if (!ip6_forwarding) { - ip6stat.ip6s_cantforward++; + if (!V_ip6_forwarding) { + V_ip6stat.ip6s_cantforward++; in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard); goto bad; } @@ -628,7 +629,7 @@ passin: * contained, ip6_hopopts_input() must set a valid * (non-zero) payload length to the variable plen. */ - ip6stat.ip6s_badoptions++; + V_ip6stat.ip6s_badoptions++; in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr); icmp6_error(m, ICMP6_PARAM_PROB, @@ -643,7 +644,7 @@ passin: IP6_EXTHDR_GET(hbh, struct ip6_hbh *, m, sizeof(struct ip6_hdr), sizeof(struct ip6_hbh)); if (hbh == NULL) { - ip6stat.ip6s_tooshort++; + V_ip6stat.ip6s_tooshort++; return; } #endif @@ -656,7 +657,7 @@ passin: * case we should pass the packet to the multicast routing * daemon. */ - if (rtalert != ~0 && ip6_forwarding) { + if (rtalert != ~0 && V_ip6_forwarding) { switch (rtalert) { case IP6OPT_RTALERT_MLD: ours = 1; @@ -679,7 +680,7 @@ passin: * Drop packet if shorter than we expect. */ if (m->m_pkthdr.len - sizeof(struct ip6_hdr) < plen) { - ip6stat.ip6s_tooshort++; + V_ip6stat.ip6s_tooshort++; in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); goto bad; } @@ -705,7 +706,7 @@ passin: */ if (ip6_mrouter && ip6_mforward && ip6_mforward(ip6, m->m_pkthdr.rcvif, m)) { - ip6stat.ip6s_cantforward++; + V_ip6stat.ip6s_cantforward++; m_freem(m); return; } @@ -731,7 +732,7 @@ passin: */ if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) || IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst)) { - ip6stat.ip6s_badscope++; + V_ip6stat.ip6s_badscope++; in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); goto bad; } @@ -739,13 +740,13 @@ passin: /* * Tell launch routine the next header */ - ip6stat.ip6s_delivered++; + V_ip6stat.ip6s_delivered++; in6_ifstat_inc(deliverifp, ifs6_in_deliver); nest = 0; while (nxt != IPPROTO_DONE) { - if (ip6_hdrnestlimit && (++nest > ip6_hdrnestlimit)) { - ip6stat.ip6s_toomanyhdr++; + if (V_ip6_hdrnestlimit && (++nest > V_ip6_hdrnestlimit)) { + V_ip6stat.ip6s_toomanyhdr++; goto bad; } @@ -754,7 +755,7 @@ passin: * more sanity checks in header chain processing. */ if (m->m_pkthdr.len < off) { - ip6stat.ip6s_tooshort++; + V_ip6stat.ip6s_tooshort++; in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); goto bad; } @@ -829,14 +830,14 @@ ip6_hopopts_input(u_int32_t *plenp, u_int32_t *rtalertp, IP6_EXTHDR_GET(hbh, struct ip6_hbh *, m, sizeof(struct ip6_hdr), sizeof(struct ip6_hbh)); if (hbh == NULL) { - ip6stat.ip6s_tooshort++; + V_ip6stat.ip6s_tooshort++; return -1; } hbhlen = (hbh->ip6h_len + 1) << 3; IP6_EXTHDR_GET(hbh, struct ip6_hbh *, m, sizeof(struct ip6_hdr), hbhlen); if (hbh == NULL) { - ip6stat.ip6s_tooshort++; + V_ip6stat.ip6s_tooshort++; return -1; } #endif @@ -881,7 +882,7 @@ ip6_process_hopopts(struct mbuf *m, u_int8_t *opthead, int hbhlen, break; case IP6OPT_PADN: if (hbhlen < IP6OPT_MINLEN) { - ip6stat.ip6s_toosmall++; + V_ip6stat.ip6s_toosmall++; goto bad; } optlen = *(opt + 1) + 2; @@ -889,7 +890,7 @@ ip6_process_hopopts(struct mbuf *m, u_int8_t *opthead, int hbhlen, case IP6OPT_ROUTER_ALERT: /* XXX may need check for alignment */ if (hbhlen < IP6OPT_RTALERT_LEN) { - ip6stat.ip6s_toosmall++; + V_ip6stat.ip6s_toosmall++; goto bad; } if (*(opt + 1) != IP6OPT_RTALERT_LEN - 2) { @@ -906,7 +907,7 @@ ip6_process_hopopts(struct mbuf *m, u_int8_t *opthead, int hbhlen, case IP6OPT_JUMBO: /* XXX may need check for alignment */ if (hbhlen < IP6OPT_JUMBO_LEN) { - ip6stat.ip6s_toosmall++; + V_ip6stat.ip6s_toosmall++; goto bad; } if (*(opt + 1) != IP6OPT_JUMBO_LEN - 2) { @@ -924,7 +925,7 @@ ip6_process_hopopts(struct mbuf *m, u_int8_t *opthead, int hbhlen, */ ip6 = mtod(m, struct ip6_hdr *); if (ip6->ip6_plen) { - ip6stat.ip6s_badoptions++; + V_ip6stat.ip6s_badoptions++; icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, erroff + opt - opthead); @@ -948,7 +949,7 @@ ip6_process_hopopts(struct mbuf *m, u_int8_t *opthead, int hbhlen, * there's no explicit mention in specification. */ if (*plenp != 0) { - ip6stat.ip6s_badoptions++; + V_ip6stat.ip6s_badoptions++; icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, erroff + opt + 2 - opthead); @@ -960,7 +961,7 @@ ip6_process_hopopts(struct mbuf *m, u_int8_t *opthead, int hbhlen, * jumbo payload length must be larger than 65535. */ if (jumboplen <= IPV6_MAXPACKET) { - ip6stat.ip6s_badoptions++; + V_ip6stat.ip6s_badoptions++; icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, erroff + opt + 2 - opthead); @@ -971,7 +972,7 @@ ip6_process_hopopts(struct mbuf *m, u_int8_t *opthead, int hbhlen, break; default: /* unknown option */ if (hbhlen < IP6OPT_MINLEN) { - ip6stat.ip6s_toosmall++; + V_ip6stat.ip6s_toosmall++; goto bad; } optlen = ip6_unknown_opt(opt, m, @@ -1008,11 +1009,11 @@ ip6_unknown_opt(u_int8_t *optp, struct mbuf *m, int off) m_freem(m); return (-1); case IP6OPT_TYPE_FORCEICMP: /* send ICMP even if multicasted */ - ip6stat.ip6s_badoptions++; + V_ip6stat.ip6s_badoptions++; icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_OPTION, off); return (-1); case IP6OPT_TYPE_ICMP: /* send ICMP if not multicasted */ - ip6stat.ip6s_badoptions++; + V_ip6stat.ip6s_badoptions++; ip6 = mtod(m, struct ip6_hdr *); if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) || (m->m_flags & (M_BCAST|M_MCAST))) @@ -1151,14 +1152,14 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, struct mbuf **mp) ext = ip6_pullexthdr(m, sizeof(struct ip6_hdr), ip6->ip6_nxt); if (ext == NULL) { - ip6stat.ip6s_tooshort++; + V_ip6stat.ip6s_tooshort++; return; } hbh = mtod(ext, struct ip6_hbh *); hbhlen = (hbh->ip6h_len + 1) << 3; if (hbhlen != ext->m_len) { m_freem(ext); - ip6stat.ip6s_tooshort++; + V_ip6stat.ip6s_tooshort++; return; } #endif @@ -1225,7 +1226,7 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, struct mbuf **mp) #else ext = ip6_pullexthdr(m, off, nxt); if (ext == NULL) { - ip6stat.ip6s_tooshort++; + V_ip6stat.ip6s_tooshort++; return; } ip6e = mtod(ext, struct ip6_ext *); @@ -1235,7 +1236,7 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, struct mbuf **mp) elen = (ip6e->ip6e_len + 1) << 3; if (elen != ext->m_len) { m_freem(ext); - ip6stat.ip6s_tooshort++; + V_ip6stat.ip6s_tooshort++; return; } #endif diff --git a/sys/netinet6/ip6_ipsec.c b/sys/netinet6/ip6_ipsec.c index 9867e66..a8aaedb 100644 --- a/sys/netinet6/ip6_ipsec.c +++ b/sys/netinet6/ip6_ipsec.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include <sys/socket.h> #include <sys/socketvar.h> #include <sys/sysctl.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/route.h> @@ -129,7 +130,7 @@ ip6_ipsec_fwd(struct mbuf *m) KEY_FREESP(&sp); splx(s); if (error) { - ip6stat.ip6s_cantforward++; + V_ip6stat.ip6s_cantforward++; return 1; } #endif /* IPSEC */ diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c index 1465a90..1b234c7 100644 --- a/sys/netinet6/ip6_mroute.c +++ b/sys/netinet6/ip6_mroute.c @@ -101,6 +101,7 @@ __FBSDID("$FreeBSD$"); #include <sys/syslog.h> #include <sys/systm.h> #include <sys/time.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/if_types.h> @@ -382,7 +383,7 @@ X_ip6_mrouter_get(struct socket *so, struct sockopt *sopt) switch (sopt->sopt_name) { case MRT6_PIM: - error = sooptcopyout(sopt, &pim6, sizeof(pim6)); + error = sooptcopyout(sopt, &V_pim6, sizeof(V_pim6)); break; } return (error); @@ -454,7 +455,7 @@ set_pim6(int *i) if ((*i != 1) && (*i != 0)) return (EINVAL); - pim6 = *i; + V_pim6 = *i; return (0); } @@ -466,7 +467,7 @@ static int ip6_mrouter_init(struct socket *so, int v, int cmd) { #ifdef MRT6DEBUG - if (mrt6debug) + if (V_mrt6debug) log(LOG_DEBUG, "ip6_mrouter_init: so_type = %d, pr_protocol = %d\n", so->so_type, so->so_proto->pr_protocol); @@ -483,19 +484,19 @@ ip6_mrouter_init(struct socket *so, int v, int cmd) return (EADDRINUSE); ip6_mrouter = so; - ip6_mrouter_ver = cmd; + V_ip6_mrouter_ver = cmd; bzero((caddr_t)mf6ctable, sizeof(mf6ctable)); bzero((caddr_t)n6expire, sizeof(n6expire)); - pim6 = 0;/* used for stubbing out/in pim stuff */ + V_pim6 = 0;/* used for stubbing out/in pim stuff */ callout_init(&expire_upcalls_ch, 0); callout_reset(&expire_upcalls_ch, EXPIRE_TIMEOUT, expire_upcalls, NULL); #ifdef MRT6DEBUG - if (mrt6debug) + if (V_mrt6debug) log(LOG_DEBUG, "ip6_mrouter_init\n"); #endif @@ -528,7 +529,7 @@ X_ip6_mrouter_done(void) * XXX: there may be an interface in which the IPv4 multicast * daemon is not interested... */ - if (!ip_mrouter) + if (!V_ip_mrouter) #endif #endif { @@ -542,7 +543,7 @@ X_ip6_mrouter_done(void) bzero((caddr_t)mif6table, sizeof(mif6table)); nummifs = 0; - pim6 = 0; /* used to stub out/in pim specific code */ + V_pim6 = 0; /* used to stub out/in pim specific code */ callout_stop(&expire_upcalls_ch); @@ -580,12 +581,12 @@ X_ip6_mrouter_done(void) } ip6_mrouter = NULL; - ip6_mrouter_ver = 0; + V_ip6_mrouter_ver = 0; splx(s); #ifdef MRT6DEBUG - if (mrt6debug) + if (V_mrt6debug) log(LOG_DEBUG, "ip6_mrouter_done\n"); #endif @@ -609,7 +610,7 @@ add_m6if(struct mif6ctl *mifcp) mifp = mif6table + mifcp->mif6c_mifi; if (mifp->m6_ifp) return (EADDRINUSE); /* XXX: is it appropriate? */ - if (mifcp->mif6c_pifi == 0 || mifcp->mif6c_pifi > if_index) + if (mifcp->mif6c_pifi == 0 || mifcp->mif6c_pifi > V_if_index) return (ENXIO); ifp = ifnet_byindex(mifcp->mif6c_pifi); @@ -661,7 +662,7 @@ add_m6if(struct mif6ctl *mifcp) nummifs = mifcp->mif6c_mifi + 1; #ifdef MRT6DEBUG - if (mrt6debug) + if (V_mrt6debug) log(LOG_DEBUG, "add_mif #%d, phyint %s\n", mifcp->mif6c_mifi, @@ -718,7 +719,7 @@ del_m6if(mifi_t *mifip) splx(s); #ifdef MRT6DEBUG - if (mrt6debug) + if (V_mrt6debug) log(LOG_DEBUG, "del_m6if %d, nummifs %d\n", *mifip, nummifs); #endif @@ -744,7 +745,7 @@ add_m6fc(struct mf6cctl *mfccp) /* If an entry already exists, just update the fields */ if (rt) { #ifdef MRT6DEBUG - if (mrt6debug & DEBUG_MFC) { + if (V_mrt6debug & DEBUG_MFC) { log(LOG_DEBUG, "add_m6fc no upcall h %d o %s g %s p %x\n", ip6_sprintf(ip6bufo, &mfccp->mf6cc_origin.sin6_addr), @@ -784,7 +785,7 @@ add_m6fc(struct mf6cctl *mfccp) mfccp->mf6cc_parent, rt->mf6c_stall); #ifdef MRT6DEBUG - if (mrt6debug & DEBUG_MFC) + if (V_mrt6debug & DEBUG_MFC) log(LOG_DEBUG, "add_m6fc o %s g %s p %x dbg %x\n", ip6_sprintf(ip6bufo, @@ -826,7 +827,7 @@ add_m6fc(struct mf6cctl *mfccp) */ if (nstl == 0) { #ifdef MRT6DEBUG - if (mrt6debug & DEBUG_MFC) + if (V_mrt6debug & DEBUG_MFC) log(LOG_DEBUG, "add_mfc no upcall h %d o %s g %s p %x\n", hash, @@ -930,7 +931,7 @@ del_m6fc(struct mf6cctl *mfccp) hash = MF6CHASH(origin.sin6_addr, mcastgrp.sin6_addr); #ifdef MRT6DEBUG - if (mrt6debug & DEBUG_MFC) { + if (V_mrt6debug & DEBUG_MFC) { char ip6bufo[INET6_ADDRSTRLEN], ip6bufg[INET6_ADDRSTRLEN]; log(LOG_DEBUG,"del_m6fc orig %s mcastgrp %s\n", ip6_sprintf(ip6bufo, &origin.sin6_addr), @@ -1009,7 +1010,7 @@ X_ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m) char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; #ifdef MRT6DEBUG - if (mrt6debug & DEBUG_FORWARD) + if (V_mrt6debug & DEBUG_FORWARD) log(LOG_DEBUG, "ip6_mforward: src %s, dst %s, ifindex %d\n", ip6_sprintf(ip6bufs, &ip6->ip6_src), ip6_sprintf(ip6bufd, &ip6->ip6_dst), @@ -1033,9 +1034,9 @@ X_ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m) * (although such packets must normally set 1 to the hop limit field). */ if (IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src)) { - ip6stat.ip6s_cantforward++; - if (ip6_log_time + ip6_log_interval < time_second) { - ip6_log_time = time_second; + V_ip6stat.ip6s_cantforward++; + if (V_ip6_log_time + V_ip6_log_interval < time_second) { + V_ip6_log_time = time_second; log(LOG_DEBUG, "cannot forward " "from %s to %s nxt %d received on %s\n", @@ -1076,7 +1077,7 @@ X_ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m) mrt6stat.mrt6s_no_route++; #ifdef MRT6DEBUG - if (mrt6debug & (DEBUG_FORWARD | DEBUG_MFC)) + if (V_mrt6debug & (DEBUG_FORWARD | DEBUG_MFC)) log(LOG_DEBUG, "ip6_mforward: no rte s %s g %s\n", ip6_sprintf(ip6bufs, &ip6->ip6_src), ip6_sprintf(ip6bufd, &ip6->ip6_dst)); @@ -1155,7 +1156,7 @@ X_ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m) #ifdef MRT6_OINIT oim = NULL; #endif - switch (ip6_mrouter_ver) { + switch (V_ip6_mrouter_ver) { #ifdef MRT6_OINIT case MRT6_OINIT: oim = mtod(mm, struct omrt6msg *); @@ -1177,7 +1178,7 @@ X_ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m) } #ifdef MRT6DEBUG - if (mrt6debug & DEBUG_FORWARD) + if (V_mrt6debug & DEBUG_FORWARD) log(LOG_DEBUG, "getting the iif info in the kernel\n"); #endif @@ -1187,7 +1188,7 @@ X_ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m) mifp++, mifi++) ; - switch (ip6_mrouter_ver) { + switch (V_ip6_mrouter_ver) { #ifdef MRT6_OINIT case MRT6_OINIT: oim->im6_mif = mifi; @@ -1287,7 +1288,7 @@ expire_upcalls(void *unused) mfc->mf6c_expire != 0 && --mfc->mf6c_expire == 0) { #ifdef MRT6DEBUG - if (mrt6debug & DEBUG_EXPIRE) { + if (V_mrt6debug & DEBUG_EXPIRE) { char ip6bufo[INET6_ADDRSTRLEN]; char ip6bufg[INET6_ADDRSTRLEN]; log(LOG_DEBUG, "expire_upcalls: expiring (%s %s)\n", @@ -1355,7 +1356,7 @@ ip6_mdq(struct mbuf *m, struct ifnet *ifp, struct mf6c *rt) if ((mifi >= nummifs) || (mif6table[mifi].m6_ifp != ifp)) { /* came in the wrong interface */ #ifdef MRT6DEBUG - if (mrt6debug & DEBUG_FORWARD) + if (V_mrt6debug & DEBUG_FORWARD) log(LOG_DEBUG, "wrong if: ifid %d mifi %d mififid %x\n", ifp->if_index, mifi, @@ -1370,7 +1371,7 @@ ip6_mdq(struct mbuf *m, struct ifnet *ifp, struct mf6c *rt) */ /* have to make sure this is a valid mif */ if (mifi < nummifs && mif6table[mifi].m6_ifp) - if (pim6 && (m->m_flags & M_LOOP) == 0) { + if (V_pim6 && (m->m_flags & M_LOOP) == 0) { /* * Check the M_LOOP flag to avoid an * unnecessary PIM assert. @@ -1397,7 +1398,7 @@ ip6_mdq(struct mbuf *m, struct ifnet *ifp, struct mf6c *rt) oim = NULL; #endif im = NULL; - switch (ip6_mrouter_ver) { + switch (V_ip6_mrouter_ver) { #ifdef MRT6_OINIT case MRT6_OINIT: oim = mtod(mm, struct omrt6msg *); @@ -1421,7 +1422,7 @@ ip6_mdq(struct mbuf *m, struct ifnet *ifp, struct mf6c *rt) mifp++, iif++) ; - switch (ip6_mrouter_ver) { + switch (V_ip6_mrouter_ver) { #ifdef MRT6_OINIT case MRT6_OINIT: oim->im6_mif = iif; @@ -1438,7 +1439,7 @@ ip6_mdq(struct mbuf *m, struct ifnet *ifp, struct mf6c *rt) if (socket_send(ip6_mrouter, mm, &sin6) < 0) { #ifdef MRT6DEBUG - if (mrt6debug) + if (V_mrt6debug) log(LOG_WARNING, "mdq, ip6_mrouter socket queue full\n"); #endif ++mrt6stat.mrt6s_upq_sockfull; @@ -1468,7 +1469,7 @@ ip6_mdq(struct mbuf *m, struct ifnet *ifp, struct mf6c *rt) dst0 = ip6->ip6_dst; if ((error = in6_setscope(&src0, ifp, &iszone)) != 0 || (error = in6_setscope(&dst0, ifp, &idzone)) != 0) { - ip6stat.ip6s_badscope++; + V_ip6stat.ip6s_badscope++; return (error); } for (mifp = mif6table, mifi = 0; mifi < nummifs; mifp++, mifi++) { @@ -1488,7 +1489,7 @@ ip6_mdq(struct mbuf *m, struct ifnet *ifp, struct mf6c *rt) &odzone) || iszone != oszone || idzone != odzone) { - ip6stat.ip6s_badscope++; + V_ip6stat.ip6s_badscope++; continue; } } @@ -1547,7 +1548,7 @@ phyint_send(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m) IPV6_FORWARDING, &im6o, NULL, NULL); #ifdef MRT6DEBUG - if (mrt6debug & DEBUG_XMIT) + if (V_mrt6debug & DEBUG_XMIT) log(LOG_DEBUG, "phyint_send on mif %d err %d\n", mifp - mif6table, error); #endif @@ -1583,7 +1584,7 @@ phyint_send(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m) error = (*ifp->if_output)(ifp, mb_copy, (struct sockaddr *)&ro.ro_dst, NULL); #ifdef MRT6DEBUG - if (mrt6debug & DEBUG_XMIT) + if (V_mrt6debug & DEBUG_XMIT) log(LOG_DEBUG, "phyint_send on mif %d err %d\n", mifp - mif6table, error); #endif @@ -1593,11 +1594,11 @@ phyint_send(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m) * various router may notify pMTU in multicast, which can be * a DDoS to a router */ - if (ip6_mcast_pmtu) + if (V_ip6_mcast_pmtu) icmp6_error(mb_copy, ICMP6_PACKET_TOO_BIG, 0, linkmtu); else { #ifdef MRT6DEBUG - if (mrt6debug & DEBUG_XMIT) { + if (V_mrt6debug & DEBUG_XMIT) { char ip6bufs[INET6_ADDRSTRLEN]; char ip6bufd[INET6_ADDRSTRLEN]; log(LOG_DEBUG, @@ -1625,7 +1626,7 @@ register_send(struct ip6_hdr *ip6, struct mif6 *mif, struct mbuf *m) struct mrt6msg *im6; #ifdef MRT6DEBUG - if (mrt6debug) { + if (V_mrt6debug) { char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; log(LOG_DEBUG, "** IPv6 register_send **\n src %s dst %s\n", ip6_sprintf(ip6bufs, &ip6->ip6_src), @@ -1671,7 +1672,7 @@ register_send(struct ip6_hdr *ip6, struct mif6 *mif, struct mbuf *m) if (socket_send(ip6_mrouter, mm, &sin6) < 0) { #ifdef MRT6DEBUG - if (mrt6debug) + if (V_mrt6debug) log(LOG_WARNING, "register_send: ip6_mrouter socket queue full\n"); #endif @@ -1709,7 +1710,7 @@ pim6_input(struct mbuf **mp, int *offp, int proto) if (pimlen < PIM_MINLEN) { ++pim6stat.pim6s_rcv_tooshort; #ifdef MRT6DEBUG - if (mrt6debug & DEBUG_PIM) + if (V_mrt6debug & DEBUG_PIM) log(LOG_DEBUG,"pim6_input: PIM packet too short\n"); #endif m_freem(m); @@ -1762,7 +1763,7 @@ pim6_input(struct mbuf **mp, int *offp, int proto) if (in6_cksum(m, IPPROTO_PIM, off, cksumlen)) { ++pim6stat.pim6s_rcv_badsum; #ifdef MRT6DEBUG - if (mrt6debug & DEBUG_PIM) + if (V_mrt6debug & DEBUG_PIM) log(LOG_DEBUG, "pim6_input: invalid checksum\n"); #endif @@ -1804,7 +1805,7 @@ pim6_input(struct mbuf **mp, int *offp, int proto) if ((reg_mif_num >= nummifs) || (reg_mif_num == (mifi_t) -1)) { #ifdef MRT6DEBUG - if (mrt6debug & DEBUG_PIM) + if (V_mrt6debug & DEBUG_PIM) log(LOG_DEBUG, "pim6_input: register mif not set: %d\n", reg_mif_num); @@ -1836,7 +1837,7 @@ pim6_input(struct mbuf **mp, int *offp, int proto) eip6 = (struct ip6_hdr *) (reghdr + 1); #ifdef MRT6DEBUG - if (mrt6debug & DEBUG_PIM) + if (V_mrt6debug & DEBUG_PIM) log(LOG_DEBUG, "pim6_input[register], eip6: %s -> %s, " "eip6 plen %d\n", @@ -1861,7 +1862,7 @@ pim6_input(struct mbuf **mp, int *offp, int proto) if (!IN6_IS_ADDR_MULTICAST(&eip6->ip6_dst)) { ++pim6stat.pim6s_rcv_badregisters; #ifdef MRT6DEBUG - if (mrt6debug & DEBUG_PIM) + if (V_mrt6debug & DEBUG_PIM) log(LOG_DEBUG, "pim6_input: inner packet of register " "is not multicast %s\n", @@ -1890,7 +1891,7 @@ pim6_input(struct mbuf **mp, int *offp, int proto) */ m_adj(m, off + PIM_MINLEN); #ifdef MRT6DEBUG - if (mrt6debug & DEBUG_PIM) { + if (V_mrt6debug & DEBUG_PIM) { log(LOG_DEBUG, "pim6_input: forwarding decapsulated register: " "src %s, dst %s, mif %d\n", diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 492e93b..7c07bdf 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #include <sys/socket.h> #include <sys/socketvar.h> #include <sys/ucred.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/netisr.h> @@ -460,7 +461,7 @@ skip_ipsec2:; sa.sin6_len = sizeof(sa); sa.sin6_addr = addr[0]; if ((error = sa6_embedscope(&sa, - ip6_use_defzone)) != 0) { + V_ip6_use_defzone)) != 0) { goto bad; } ip6->ip6_dst = sa.sin6_addr; @@ -480,16 +481,16 @@ skip_ipsec2:; if (IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src) && (flags & IPV6_UNSPECSRC) == 0) { error = EOPNOTSUPP; - ip6stat.ip6s_badscope++; + V_ip6stat.ip6s_badscope++; goto bad; } if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_src)) { error = EOPNOTSUPP; - ip6stat.ip6s_badscope++; + V_ip6stat.ip6s_badscope++; goto bad; } - ip6stat.ip6s_localout++; + V_ip6stat.ip6s_localout++; /* * Route packet. @@ -527,7 +528,7 @@ again: if (im6o != NULL) ip6->ip6_hlim = im6o->im6o_multicast_hlim; else - ip6->ip6_hlim = ip6_defmcasthlim; + ip6->ip6_hlim = V_ip6_defmcasthlim; } #ifdef IPSEC @@ -612,7 +613,7 @@ again: &ifp, &rt, 0)) != 0) { switch (error) { case EHOSTUNREACH: - ip6stat.ip6s_noroute++; + V_ip6stat.ip6s_noroute++; break; case EADDRNOTAVAIL: default: @@ -678,7 +679,7 @@ again: goto routefound; badscope: - ip6stat.ip6s_badscope++; + V_ip6stat.ip6s_badscope++; in6_ifstat_inc(origifp, ifs6_out_discard); if (error == 0) error = EHOSTUNREACH; /* XXX */ @@ -711,7 +712,7 @@ again: * Confirm that the outgoing interface supports multicast. */ if (!(ifp->if_flags & IFF_MULTICAST)) { - ip6stat.ip6s_noroute++; + V_ip6stat.ip6s_noroute++; in6_ifstat_inc(ifp, ifs6_out_discard); error = ENETUNREACH; goto bad; @@ -861,7 +862,7 @@ again: /* If destination is now ourself drop to ip6_input(). */ if (in6_localaddr(&ip6->ip6_dst)) { if (m->m_pkthdr.rcvif == NULL) - m->m_pkthdr.rcvif = loif; + m->m_pkthdr.rcvif = V_loif; if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; @@ -991,7 +992,7 @@ passout: if (qslots <= 0 || ((u_int)qslots * (mtu - hlen) < tlen /* - hlen */)) { error = ENOBUFS; - ip6stat.ip6s_odropped++; + V_ip6stat.ip6s_odropped++; goto bad; } @@ -1025,7 +1026,7 @@ passout: MGETHDR(m, M_DONTWAIT, MT_HEADER); if (!m) { error = ENOBUFS; - ip6stat.ip6s_odropped++; + V_ip6stat.ip6s_odropped++; goto sendorfree; } m->m_pkthdr.rcvif = NULL; @@ -1038,7 +1039,7 @@ passout: m->m_len = sizeof(*mhip6); error = ip6_insertfraghdr(m0, m, hlen, &ip6f); if (error) { - ip6stat.ip6s_odropped++; + V_ip6stat.ip6s_odropped++; goto sendorfree; } ip6f->ip6f_offlg = htons((u_short)((off - hlen) & ~7)); @@ -1050,7 +1051,7 @@ passout: sizeof(*ip6f) - sizeof(struct ip6_hdr))); if ((m_frgpart = m_copy(m0, off, len)) == 0) { error = ENOBUFS; - ip6stat.ip6s_odropped++; + V_ip6stat.ip6s_odropped++; goto sendorfree; } m_cat(m, m_frgpart); @@ -1059,7 +1060,7 @@ passout: ip6f->ip6f_reserved = 0; ip6f->ip6f_ident = id; ip6f->ip6f_nxt = nextproto; - ip6stat.ip6s_ofragments++; + V_ip6stat.ip6s_ofragments++; in6_ifstat_inc(ifp, ifs6_out_fragcreat); } @@ -1088,7 +1089,7 @@ sendorfree: } if (error == 0) - ip6stat.ip6s_fragmented++; + V_ip6stat.ip6s_fragmented++; done: if (ro == &ip6route && ro->ro_rt) { /* brace necessary for RTFREE */ @@ -2439,7 +2440,7 @@ ip6_setmoptions(int optname, struct ip6_moptions **im6op, struct mbuf *m) return (ENOBUFS); *im6op = im6o; im6o->im6o_multicast_ifp = NULL; - im6o->im6o_multicast_hlim = ip6_defmcasthlim; + im6o->im6o_multicast_hlim = V_ip6_defmcasthlim; im6o->im6o_multicast_loop = IPV6_DEFAULT_MULTICAST_LOOP; LIST_INIT(&im6o->im6o_memberships); } @@ -2455,7 +2456,7 @@ ip6_setmoptions(int optname, struct ip6_moptions **im6op, struct mbuf *m) break; } bcopy(mtod(m, u_int *), &ifindex, sizeof(ifindex)); - if (ifindex < 0 || if_index < ifindex) { + if (ifindex < 0 || V_if_index < ifindex) { error = ENXIO; /* XXX EINVAL? */ break; } @@ -2481,7 +2482,7 @@ ip6_setmoptions(int optname, struct ip6_moptions **im6op, struct mbuf *m) if (optval < -1 || optval >= 256) error = EINVAL; else if (optval == -1) - im6o->im6o_multicast_hlim = ip6_defmcasthlim; + im6o->im6o_multicast_hlim = V_ip6_defmcasthlim; else im6o->im6o_multicast_hlim = optval; break; @@ -2560,7 +2561,7 @@ ip6_setmoptions(int optname, struct ip6_moptions **im6op, struct mbuf *m) * If the interface is specified, validate it. */ if (mreq->ipv6mr_interface < 0 || - if_index < mreq->ipv6mr_interface) { + V_if_index < mreq->ipv6mr_interface) { error = ENXIO; /* XXX EINVAL? */ break; } @@ -2624,7 +2625,7 @@ ip6_setmoptions(int optname, struct ip6_moptions **im6op, struct mbuf *m) * to its ifnet structure. */ if (mreq->ipv6mr_interface < 0 || - if_index < mreq->ipv6mr_interface) { + V_if_index < mreq->ipv6mr_interface) { error = ENXIO; /* XXX EINVAL? */ break; } @@ -2665,7 +2666,7 @@ ip6_setmoptions(int optname, struct ip6_moptions **im6op, struct mbuf *m) sa6_mc.sin6_family = AF_INET6; sa6_mc.sin6_len = sizeof(sa6_mc); sa6_mc.sin6_addr = mreq->ipv6mr_multiaddr; - error = sa6_embedscope(&sa6_mc, ip6_use_defzone); + error = sa6_embedscope(&sa6_mc, V_ip6_use_defzone); if (error != 0) break; mreq->ipv6mr_multiaddr = sa6_mc.sin6_addr; @@ -2704,7 +2705,7 @@ ip6_setmoptions(int optname, struct ip6_moptions **im6op, struct mbuf *m) * If all options have default values, no need to keep the mbuf. */ if (im6o->im6o_multicast_ifp == NULL && - im6o->im6o_multicast_hlim == ip6_defmcasthlim && + im6o->im6o_multicast_hlim == V_ip6_defmcasthlim && im6o->im6o_multicast_loop == IPV6_DEFAULT_MULTICAST_LOOP && im6o->im6o_memberships.lh_first == NULL) { free(*im6op, M_IP6MOPTS); @@ -2739,7 +2740,7 @@ ip6_getmoptions(int optname, struct ip6_moptions *im6o, struct mbuf **mp) hlim = mtod(*mp, u_int *); (*mp)->m_len = sizeof(u_int); if (im6o == NULL) - *hlim = ip6_defmcasthlim; + *hlim = V_ip6_defmcasthlim; else *hlim = im6o->im6o_multicast_hlim; return (0); @@ -2748,7 +2749,7 @@ ip6_getmoptions(int optname, struct ip6_moptions *im6o, struct mbuf **mp) loop = mtod(*mp, u_int *); (*mp)->m_len = sizeof(u_int); if (im6o == NULL) - *loop = ip6_defmcasthlim; + *loop = V_ip6_defmcasthlim; else *loop = im6o->im6o_multicast_loop; return (0); @@ -2924,7 +2925,7 @@ ip6_setpktopt(int optname, u_char *buf, int len, struct ip6_pktopts *opt, } /* validate the interface index if specified. */ - if (pktinfo->ipi6_ifindex > if_index || + if (pktinfo->ipi6_ifindex > V_if_index || pktinfo->ipi6_ifindex < 0) { return (ENXIO); } @@ -3021,7 +3022,7 @@ ip6_setpktopt(int optname, u_char *buf, int len, struct ip6_pktopts *opt, IN6_IS_ADDR_MULTICAST(&sa6->sin6_addr)) { return (EINVAL); } - if ((error = sa6_embedscope(sa6, ip6_use_defzone)) + if ((error = sa6_embedscope(sa6, V_ip6_use_defzone)) != 0) { return (error); } diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c index b8f54bf..661724f 100644 --- a/sys/netinet6/mld6.c +++ b/sys/netinet6/mld6.c @@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$"); #include <sys/kernel.h> #include <sys/callout.h> #include <sys/malloc.h> +#include <sys/vimage.h> #include <net/if.h> @@ -128,8 +129,8 @@ mld6_init(void) hbh_buf[5] = IP6OPT_RTALERT_LEN - 2; bcopy((caddr_t)&rtalert_code, &hbh_buf[6], sizeof(u_int16_t)); - ip6_initpktopts(&ip6_opts); - ip6_opts.ip6po_hbh = hbh; + ip6_initpktopts(&V_ip6_opts); + V_ip6_opts.ip6po_hbh = hbh; } static void @@ -282,7 +283,7 @@ mld6_input(struct mbuf *m, int off) #else IP6_EXTHDR_GET(mldh, struct mld_hdr *, m, off, sizeof(*mldh)); if (mldh == NULL) { - icmp6stat.icp6s_tooshort++; + V_icmp6stat.icp6s_tooshort++; return; } #endif @@ -510,9 +511,9 @@ mld6_sendpkt(struct in6_multi *in6m, int type, const struct in6_addr *dst) im6o.im6o_multicast_loop = (ip6_mrouter != NULL); /* increment output statictics */ - icmp6stat.icp6s_outhist[type]++; + V_icmp6stat.icp6s_outhist[type]++; - ip6_output(mh, &ip6_opts, NULL, 0, &im6o, &outif, NULL); + ip6_output(mh, &V_ip6_opts, NULL, 0, &im6o, &outif, NULL); if (outif) { icmp6_ifstat_inc(outif, ifs6_out_msg); switch (type) { diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 5964570..e02ceab 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include <netinet/icmp6.h> #include <sys/limits.h> +#include <sys/vimage.h> #include <security/mac/mac_framework.h> @@ -138,13 +139,13 @@ nd6_init(void) all1_sa.sin6_addr.s6_addr[i] = 0xff; /* initialization of the default router list */ - TAILQ_INIT(&nd_defrouter); + TAILQ_INIT(&V_nd_defrouter); nd6_init_done = 1; /* start timer */ - callout_init(&nd6_slowtimo_ch, 0); - callout_reset(&nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL * hz, + callout_init(&V_nd6_slowtimo_ch, 0); + callout_reset(&V_nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL * hz, nd6_slowtimo, NULL); } @@ -228,7 +229,7 @@ nd6_setmtu0(struct ifnet *ifp, struct nd_ifinfo *ndi) if_name(ifp), (unsigned long)ndi->maxmtu); } - if (ndi->maxmtu > in6_maxmtu) + if (ndi->maxmtu > V_in6_maxmtu) in6_setmaxmtu(); /* check all interfaces just in case */ #undef MIN @@ -323,7 +324,7 @@ nd6_options(union nd_opts *ndopts) * Message validation requires that all included * options have a length that is greater than zero. */ - icmp6stat.icp6s_nd_badopt++; + V_icmp6stat.icp6s_nd_badopt++; bzero(ndopts, sizeof(*ndopts)); return -1; } @@ -366,8 +367,8 @@ nd6_options(union nd_opts *ndopts) skip1: i++; - if (i > nd6_maxndopt) { - icmp6stat.icp6s_nd_toomanyopt++; + if (i > V_nd6_maxndopt) { + V_icmp6stat.icp6s_nd_toomanyopt++; nd6log((LOG_INFO, "too many loop in nd opt\n")); break; } @@ -442,7 +443,7 @@ nd6_llinfo_timer(void *arg) switch (ln->ln_state) { case ND6_LLINFO_INCOMPLETE: - if (ln->ln_asked < nd6_mmaxtries) { + if (ln->ln_asked < V_nd6_mmaxtries) { ln->ln_asked++; nd6_llinfo_settimer(ln, (long)ndi->retrans * hz / 1000); nd6_ns_output(ifp, NULL, dst, ln, 0); @@ -471,7 +472,7 @@ nd6_llinfo_timer(void *arg) case ND6_LLINFO_REACHABLE: if (!ND6_LLINFO_PERMANENT(ln)) { ln->ln_state = ND6_LLINFO_STALE; - nd6_llinfo_settimer(ln, (long)nd6_gctimer * hz); + nd6_llinfo_settimer(ln, (long)V_nd6_gctimer * hz); } break; @@ -493,11 +494,11 @@ nd6_llinfo_timer(void *arg) nd6_ns_output(ifp, dst, dst, ln, 0); } else { ln->ln_state = ND6_LLINFO_STALE; /* XXX */ - nd6_llinfo_settimer(ln, (long)nd6_gctimer * hz); + nd6_llinfo_settimer(ln, (long)V_nd6_gctimer * hz); } break; case ND6_LLINFO_PROBE: - if (ln->ln_asked < nd6_umaxtries) { + if (ln->ln_asked < V_nd6_umaxtries) { ln->ln_asked++; nd6_llinfo_settimer(ln, (long)ndi->retrans * hz / 1000); nd6_ns_output(ifp, dst, dst, ln, 0); @@ -536,12 +537,12 @@ nd6_timer(void *ignored_arg) struct in6_ifaddr *ia6, *nia6; struct in6_addrlifetime *lt6; - callout_reset(&nd6_timer_ch, nd6_prune * hz, + callout_reset(&V_nd6_timer_ch, V_nd6_prune * hz, nd6_timer, NULL); /* expire default router list */ s = splnet(); - dr = TAILQ_FIRST(&nd_defrouter); + dr = TAILQ_FIRST(&V_nd_defrouter); while (dr) { if (dr->expire && dr->expire < time_second) { struct nd_defrouter *t; @@ -560,7 +561,7 @@ nd6_timer(void *ignored_arg) * rather separate address lifetimes and prefix lifetimes. */ addrloop: - for (ia6 = in6_ifaddr; ia6; ia6 = nia6) { + for (ia6 = V_in6_ifaddr; ia6; ia6 = nia6) { nia6 = ia6->ia_next; /* check address lifetime */ lt6 = &ia6->ia6_lifetime; @@ -577,7 +578,7 @@ nd6_timer(void *ignored_arg) * address. Otherwise, we'd see an infinite loop of * regeneration. */ - if (ip6_use_tempaddr && + if (V_ip6_use_tempaddr && (ia6->ia6_flags & IN6_IFF_TEMPORARY) != 0) { if (regen_tmpaddr(ia6) == 0) regen = 1; @@ -596,7 +597,7 @@ nd6_timer(void *ignored_arg) * If a temporary address has just become deprecated, * regenerate a new one if possible. */ - if (ip6_use_tempaddr && + if (V_ip6_use_tempaddr && (ia6->ia6_flags & IN6_IFF_TEMPORARY) != 0 && (oldflags & IN6_IFF_DEPRECATED) == 0) { @@ -626,7 +627,7 @@ nd6_timer(void *ignored_arg) } /* expire prefix list */ - pr = nd_prefix.lh_first; + pr = V_nd_prefix.lh_first; while (pr) { /* * check prefix lifetime. @@ -733,7 +734,7 @@ nd6_purge(struct ifnet *ifp) * in the routing table, in order to keep additional side effects as * small as possible. */ - for (dr = TAILQ_FIRST(&nd_defrouter); dr; dr = ndr) { + for (dr = TAILQ_FIRST(&V_nd_defrouter); dr; dr = ndr) { ndr = TAILQ_NEXT(dr, dr_entry); if (dr->installed) continue; @@ -742,7 +743,7 @@ nd6_purge(struct ifnet *ifp) defrtrlist_del(dr); } - for (dr = TAILQ_FIRST(&nd_defrouter); dr; dr = ndr) { + for (dr = TAILQ_FIRST(&V_nd_defrouter); dr; dr = ndr) { ndr = TAILQ_NEXT(dr, dr_entry); if (!dr->installed) continue; @@ -752,7 +753,7 @@ nd6_purge(struct ifnet *ifp) } /* Nuke prefix list entries toward ifp */ - for (pr = nd_prefix.lh_first; pr; pr = npr) { + for (pr = V_nd_prefix.lh_first; pr; pr = npr) { npr = pr->ndpr_next; if (pr->ndpr_ifp == ifp) { /* @@ -776,10 +777,10 @@ nd6_purge(struct ifnet *ifp) } /* cancel default outgoing interface setting */ - if (nd6_defifindex == ifp->if_index) + if (V_nd6_defifindex == ifp->if_index) nd6_setdefaultiface(0); - if (!ip6_forwarding && ip6_accept_rtadv) { /* XXX: too restrictive? */ + if (!V_ip6_forwarding && V_ip6_accept_rtadv) { /* XXX: too restrictive? */ /* refresh default router list */ defrouter_select(); } @@ -790,8 +791,8 @@ nd6_purge(struct ifnet *ifp) * due to KAME goto ours hack. See RTM_RESOLVE case in * nd6_rtrequest(), and ip6_input(). */ - ln = llinfo_nd6.ln_next; - while (ln && ln != &llinfo_nd6) { + ln = V_llinfo_nd6.ln_next; + while (ln && ln != &V_llinfo_nd6) { struct rtentry *rt; struct sockaddr_dl *sdl; @@ -947,7 +948,7 @@ nd6_is_new_addr_neighbor(struct sockaddr_in6 *addr, struct ifnet *ifp) * If the address matches one of our on-link prefixes, it should be a * neighbor. */ - for (pr = nd_prefix.lh_first; pr; pr = pr->ndpr_next) { + for (pr = V_nd_prefix.lh_first; pr; pr = pr->ndpr_next) { if (pr->ndpr_ifp != ifp) continue; @@ -973,8 +974,8 @@ nd6_is_new_addr_neighbor(struct sockaddr_in6 *addr, struct ifnet *ifp) * XXX: we restrict the condition to hosts, because routers usually do * not have the "default router list". */ - if (!ip6_forwarding && TAILQ_FIRST(&nd_defrouter) == NULL && - nd6_defifindex == ifp->if_index) { + if (!V_ip6_forwarding && TAILQ_FIRST(&V_nd_defrouter) == NULL && + V_nd6_defifindex == ifp->if_index) { return (1); } @@ -1024,7 +1025,7 @@ nd6_free(struct rtentry *rt, int gc) /* cancel timer */ nd6_llinfo_settimer(ln, -1); - if (!ip6_forwarding) { + if (!V_ip6_forwarding) { int s; s = splnet(); dr = defrouter_lookup(&((struct sockaddr_in6 *)rt_key(rt))->sin6_addr, @@ -1048,7 +1049,7 @@ nd6_free(struct rtentry *rt, int gc) nd6_llinfo_settimer(ln, (dr->expire - time_second) * hz); else - nd6_llinfo_settimer(ln, (long)nd6_gctimer * hz); + nd6_llinfo_settimer(ln, (long)V_nd6_gctimer * hz); splx(s); return (ln->ln_next); } @@ -1152,7 +1153,7 @@ nd6_nud_hint(struct rtentry *rt, struct in6_addr *dst6, int force) */ if (!force) { ln->ln_byhint++; - if (ln->ln_byhint > nd6_maxnudhint) + if (ln->ln_byhint > V_nd6_maxnudhint) return; } @@ -1287,8 +1288,8 @@ nd6_rtrequest(int req, struct rtentry *rt, struct rt_addrinfo *info) log(LOG_DEBUG, "nd6_rtrequest: malloc failed\n"); break; } - nd6_inuse++; - nd6_allocated++; + V_nd6_inuse++; + V_nd6_allocated++; bzero(ln, sizeof(*ln)); RT_ADDREF(rt); ln->ln_rt = rt; @@ -1312,9 +1313,9 @@ nd6_rtrequest(int req, struct rtentry *rt, struct rt_addrinfo *info) nd6_llinfo_settimer(ln, 0); } rt->rt_flags |= RTF_LLINFO; - ln->ln_next = llinfo_nd6.ln_next; - llinfo_nd6.ln_next = ln; - ln->ln_prev = &llinfo_nd6; + ln->ln_next = V_llinfo_nd6.ln_next; + V_llinfo_nd6.ln_next = ln; + ln->ln_prev = &V_llinfo_nd6; ln->ln_next->ln_prev = ln; /* @@ -1332,8 +1333,8 @@ nd6_rtrequest(int req, struct rtentry *rt, struct rt_addrinfo *info) bcopy(macp, LLADDR(SDL(gate)), ifp->if_addrlen); SDL(gate)->sdl_alen = ifp->if_addrlen; } - if (nd6_useloopback) { - rt->rt_ifp = &loif[0]; /* XXX */ + if (V_nd6_useloopback) { + rt->rt_ifp = &V_loif[0]; /* XXX */ /* * Make sure rt_ifa be equal to the ifaddr * corresponding to the address. @@ -1398,7 +1399,7 @@ nd6_rtrequest(int req, struct rtentry *rt, struct rt_addrinfo *info) } else ; /* XXX: should not happen. bark here? */ } - nd6_inuse--; + V_nd6_inuse--; ln->ln_next->ln_prev = ln->ln_prev; ln->ln_prev->ln_next = ln->ln_next; ln->ln_prev = NULL; @@ -1432,7 +1433,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) */ bzero(drl, sizeof(*drl)); s = splnet(); - dr = TAILQ_FIRST(&nd_defrouter); + dr = TAILQ_FIRST(&V_nd_defrouter); while (dr && i < DRLSTSIZ) { drl->defrouter[i].rtaddr = dr->rtaddr; in6_clearscope(&drl->defrouter[i].rtaddr); @@ -1461,7 +1462,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) */ bzero(oprl, sizeof(*oprl)); s = splnet(); - pr = nd_prefix.lh_first; + pr = V_nd_prefix.lh_first; while (pr && i < PRLSTSIZ) { struct nd_pfxrouter *pfr; int j; @@ -1570,7 +1571,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) struct nd_prefix *pr, *next; s = splnet(); - for (pr = nd_prefix.lh_first; pr; pr = next) { + for (pr = V_nd_prefix.lh_first; pr; pr = next) { struct in6_ifaddr *ia, *ia_next; next = pr->ndpr_next; @@ -1579,7 +1580,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) continue; /* XXX */ /* do we really have to remove addresses as well? */ - for (ia = in6_ifaddr; ia; ia = ia_next) { + for (ia = V_in6_ifaddr; ia; ia = ia_next) { /* ia might be removed. keep the next ptr. */ ia_next = ia->ia_next; @@ -1601,7 +1602,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) s = splnet(); defrouter_reset(); - for (dr = TAILQ_FIRST(&nd_defrouter); dr; dr = next) { + for (dr = TAILQ_FIRST(&V_nd_defrouter); dr; dr = next) { next = TAILQ_NEXT(dr, dr_entry); defrtrlist_del(dr); } @@ -1633,7 +1634,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) break; } case SIOCGDEFIFACE_IN6: /* XXX: should be implemented as a sysctl? */ - ndif->ifindex = nd6_defifindex; + ndif->ifindex = V_nd6_defifindex; break; case SIOCSDEFIFACE_IN6: /* XXX: should be implemented as a sysctl? */ return (nd6_setdefaultiface(ndif->ifindex)); @@ -1764,7 +1765,7 @@ fail: * we must set the timer now, although it is actually * meaningless. */ - nd6_llinfo_settimer(ln, (long)nd6_gctimer * hz); + nd6_llinfo_settimer(ln, (long)V_nd6_gctimer * hz); if (ln->ln_hold) { struct mbuf *m_hold, *m_hold_next; @@ -1875,7 +1876,7 @@ fail: * for those are not autoconfigured hosts, we explicitly avoid such * cases for safety. */ - if (do_update && ln->ln_router && !ip6_forwarding && ip6_accept_rtadv) + if (do_update && ln->ln_router && !V_ip6_forwarding && V_ip6_accept_rtadv) defrouter_select(); return rt; @@ -1887,10 +1888,10 @@ nd6_slowtimo(void *ignored_arg) struct nd_ifinfo *nd6if; struct ifnet *ifp; - callout_reset(&nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL * hz, + callout_reset(&V_nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL * hz, nd6_slowtimo, NULL); IFNET_RLOCK(); - for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) { + for (ifp = TAILQ_FIRST(&V_ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) { nd6if = ND_IFINFO(ifp); if (nd6if->basereachable && /* already initialized */ (nd6if->recalctm -= ND6_SLOWTIMER_INTERVAL) <= 0) { @@ -1900,7 +1901,7 @@ nd6_slowtimo(void *ignored_arg) * value gets recomputed at least once every few hours. * (RFC 2461, 6.3.4) */ - nd6if->recalctm = nd6_recalc_reachtm_interval; + nd6if->recalctm = V_nd6_recalc_reachtm_interval; nd6if->reachable = ND_COMPUTE_RTIME(nd6if->basereachable); } } @@ -2041,7 +2042,7 @@ again: if ((ifp->if_flags & IFF_POINTOPOINT) != 0 && ln->ln_state < ND6_LLINFO_REACHABLE) { ln->ln_state = ND6_LLINFO_STALE; - nd6_llinfo_settimer(ln, (long)nd6_gctimer * hz); + nd6_llinfo_settimer(ln, (long)V_nd6_gctimer * hz); } /* @@ -2054,7 +2055,7 @@ again: if (ln->ln_state == ND6_LLINFO_STALE) { ln->ln_asked = 0; ln->ln_state = ND6_LLINFO_DELAY; - nd6_llinfo_settimer(ln, (long)nd6_delay * hz); + nd6_llinfo_settimer(ln, (long)V_nd6_delay * hz); } /* @@ -2086,7 +2087,7 @@ again: break; } } - while (i >= nd6_maxqueuelen) { + while (i >= V_nd6_maxqueuelen) { m_hold = ln->ln_hold; ln->ln_hold = ln->ln_hold->m_nextpkt; m_freem(m_hold); @@ -2277,7 +2278,7 @@ nd6_sysctl_drlist(SYSCTL_HANDLER_ARGS) return EPERM; error = 0; - for (dr = TAILQ_FIRST(&nd_defrouter); dr; + for (dr = TAILQ_FIRST(&V_nd_defrouter); dr; dr = TAILQ_NEXT(dr, dr_entry)) { d = (struct in6_defrouter *)buf; de = (struct in6_defrouter *)(buf + sizeof(buf)); @@ -2318,7 +2319,7 @@ nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS) return EPERM; error = 0; - for (pr = nd_prefix.lh_first; pr; pr = pr->ndpr_next) { + for (pr = V_nd_prefix.lh_first; pr; pr = pr->ndpr_next) { u_short advrtrs; size_t advance; struct sockaddr_in6 *sin6, *s6; diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h index 8b932a9..f191d2d 100644 --- a/sys/netinet6/nd6.h +++ b/sys/netinet6/nd6.h @@ -340,7 +340,7 @@ extern struct nd_drhead nd_defrouter; extern struct nd_prhead nd_prefix; extern int nd6_debug; -#define nd6log(x) do { if (nd6_debug) log x; } while (/*CONSTCOND*/ 0) +#define nd6log(x) do { if (V_nd6_debug) log x; } while (/*CONSTCOND*/ 0) extern struct callout nd6_timer_ch; diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index 86f6ff8..46b3a1e 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include <sys/syslog.h> #include <sys/queue.h> #include <sys/callout.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/if_types.h> @@ -119,7 +120,7 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len) #else IP6_EXTHDR_GET(nd_ns, struct nd_neighbor_solicit *, m, off, icmp6len); if (nd_ns == NULL) { - icmp6stat.icp6s_tooshort++; + V_icmp6stat.icp6s_tooshort++; return; } #endif @@ -315,7 +316,7 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len) goto bad; nd6_na_output(ifp, &in6_all, &taddr6, ((anycast || proxy || !tlladdr) ? 0 : ND_NA_FLAG_OVERRIDE) | - (ip6_forwarding ? ND_NA_FLAG_ROUTER : 0), + (V_ip6_forwarding ? ND_NA_FLAG_ROUTER : 0), tlladdr, (struct sockaddr *)proxydl); goto freeit; } @@ -325,7 +326,7 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len) nd6_na_output(ifp, &saddr6, &taddr6, ((anycast || proxy || !tlladdr) ? 0 : ND_NA_FLAG_OVERRIDE) | - (ip6_forwarding ? ND_NA_FLAG_ROUTER : 0) | ND_NA_FLAG_SOLICITED, + (V_ip6_forwarding ? ND_NA_FLAG_ROUTER : 0) | ND_NA_FLAG_SOLICITED, tlladdr, (struct sockaddr *)proxydl); freeit: m_freem(m); @@ -338,7 +339,7 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len) ip6_sprintf(ip6bufs, &daddr6))); nd6log((LOG_ERR, "nd6_ns_input: tgt=%s\n", ip6_sprintf(ip6bufs, &taddr6))); - icmp6stat.icp6s_badns++; + V_icmp6stat.icp6s_badns++; m_freem(m); } @@ -535,7 +536,7 @@ nd6_ns_output(struct ifnet *ifp, const struct in6_addr *daddr6, ip6_output(m, NULL, &ro, dad ? IPV6_UNSPECSRC : 0, &im6o, NULL, NULL); icmp6_ifstat_inc(ifp, ifs6_out_msg); icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); - icmp6stat.icp6s_outhist[ND_NEIGHBOR_SOLICIT]++; + V_icmp6stat.icp6s_outhist[ND_NEIGHBOR_SOLICIT]++; if (ro.ro_rt) { /* we don't cache this route. */ RTFREE(ro.ro_rt); @@ -595,7 +596,7 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) #else IP6_EXTHDR_GET(nd_na, struct nd_neighbor_advert *, m, off, icmp6len); if (nd_na == NULL) { - icmp6stat.icp6s_tooshort++; + V_icmp6stat.icp6s_tooshort++; return; } #endif @@ -700,7 +701,7 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) } } else { ln->ln_state = ND6_LLINFO_STALE; - nd6_llinfo_settimer(ln, (long)nd6_gctimer * hz); + nd6_llinfo_settimer(ln, (long)V_nd6_gctimer * hz); } if ((ln->ln_router = is_router) != 0) { /* @@ -754,7 +755,7 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) */ if (ln->ln_state == ND6_LLINFO_REACHABLE) { ln->ln_state = ND6_LLINFO_STALE; - nd6_llinfo_settimer(ln, (long)nd6_gctimer * hz); + nd6_llinfo_settimer(ln, (long)V_nd6_gctimer * hz); } goto freeit; } else if (is_override /* (2a) */ @@ -784,7 +785,7 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) if (lladdr != NULL && llchange) { ln->ln_state = ND6_LLINFO_STALE; nd6_llinfo_settimer(ln, - (long)nd6_gctimer * hz); + (long)V_nd6_gctimer * hz); } } } @@ -811,7 +812,7 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) dr = defrouter_lookup(in6, ifp); if (dr) defrtrlist_del(dr); - else if (!ip6_forwarding) { + else if (!V_ip6_forwarding) { /* * Even if the neighbor is not in the default * router list, the neighbor may be used @@ -854,7 +855,7 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) return; bad: - icmp6stat.icp6s_badna++; + V_icmp6stat.icp6s_badna++; m_freem(m); } @@ -1021,7 +1022,7 @@ nd6_na_output(struct ifnet *ifp, const struct in6_addr *daddr6_0, ip6_output(m, NULL, &ro, 0, &im6o, NULL, NULL); icmp6_ifstat_inc(ifp, ifs6_out_msg); icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); - icmp6stat.icp6s_outhist[ND_NEIGHBOR_ADVERT]++; + V_icmp6stat.icp6s_outhist[ND_NEIGHBOR_ADVERT]++; if (ro.ro_rt) { /* we don't cache this route. */ RTFREE(ro.ro_rt); @@ -1081,7 +1082,7 @@ nd6_dad_find(struct ifaddr *ifa) { struct dadq *dp; - for (dp = dadq.tqh_first; dp; dp = dp->dad_list.tqe_next) { + for (dp = V_dadq.tqh_first; dp; dp = dp->dad_list.tqe_next) { if (dp->dad_ifa == ifa) return dp; } @@ -1113,9 +1114,9 @@ nd6_dad_start(struct ifaddr *ifa, int delay) struct dadq *dp; char ip6buf[INET6_ADDRSTRLEN]; - if (!dad_init) { - TAILQ_INIT(&dadq); - dad_init++; + if (!V_dad_init) { + TAILQ_INIT(&V_dadq); + V_dad_init++; } /* @@ -1136,7 +1137,7 @@ nd6_dad_start(struct ifaddr *ifa, int delay) ia->ia6_flags &= ~IN6_IFF_TENTATIVE; return; } - if (!ip6_dad_count) { + if (!V_ip6_dad_count) { ia->ia6_flags &= ~IN6_IFF_TENTATIVE; return; } @@ -1173,7 +1174,7 @@ nd6_dad_start(struct ifaddr *ifa, int delay) */ dp->dad_ifa = ifa; IFAREF(ifa); /* just for safety */ - dp->dad_count = ip6_dad_count; + dp->dad_count = V_ip6_dad_count; dp->dad_ns_icount = dp->dad_na_icount = 0; dp->dad_ns_ocount = dp->dad_ns_tcount = 0; if (delay == 0) { @@ -1193,7 +1194,7 @@ nd6_dad_stop(struct ifaddr *ifa) { struct dadq *dp; - if (!dad_init) + if (!V_dad_init) return; dp = nd6_dad_find(ifa); if (!dp) { @@ -1203,7 +1204,7 @@ nd6_dad_stop(struct ifaddr *ifa) nd6_dad_stoptimer(dp); - TAILQ_REMOVE(&dadq, (struct dadq *)dp, dad_list); + TAILQ_REMOVE(&V_dadq, (struct dadq *)dp, dad_list); free(dp, M_IP6NDP); dp = NULL; IFAFREE(ifa); @@ -1245,11 +1246,11 @@ nd6_dad_timer(struct ifaddr *ifa) } /* timeouted with IFF_{RUNNING,UP} check */ - if (dp->dad_ns_tcount > dad_maxtry) { + if (dp->dad_ns_tcount > V_dad_maxtry) { nd6log((LOG_INFO, "%s: could not run DAD, driver problem?\n", if_name(ifa->ifa_ifp))); - TAILQ_REMOVE(&dadq, (struct dadq *)dp, dad_list); + TAILQ_REMOVE(&V_dadq, (struct dadq *)dp, dad_list); free(dp, M_IP6NDP); dp = NULL; IFAFREE(ifa); @@ -1302,7 +1303,7 @@ nd6_dad_timer(struct ifaddr *ifa) if_name(ifa->ifa_ifp), ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr))); - TAILQ_REMOVE(&dadq, (struct dadq *)dp, dad_list); + TAILQ_REMOVE(&V_dadq, (struct dadq *)dp, dad_list); free(dp, M_IP6NDP); dp = NULL; IFAFREE(ifa); @@ -1378,7 +1379,7 @@ nd6_dad_duplicated(struct ifaddr *ifa) } } - TAILQ_REMOVE(&dadq, (struct dadq *)dp, dad_list); + TAILQ_REMOVE(&V_dadq, (struct dadq *)dp, dad_list); free(dp, M_IP6NDP); dp = NULL; IFAFREE(ifa); @@ -1421,7 +1422,7 @@ nd6_dad_ns_input(struct ifaddr *ifa) dp = nd6_dad_find(ifa); /* Quickhack - completely ignore DAD NS packets */ - if (dad_ignore_ns) { + if (V_dad_ignore_ns) { char ip6buf[INET6_ADDRSTRLEN]; nd6log((LOG_INFO, "nd6_dad_ns_input: ignoring DAD NS packet for " diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 39f5382..b8dacc9 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include <sys/errno.h> #include <sys/syslog.h> #include <sys/queue.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/if_types.h> @@ -128,7 +129,7 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len) char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; /* If I'm not a router, ignore it. */ - if (ip6_accept_rtadv != 0 || ip6_forwarding != 1) + if (V_ip6_accept_rtadv != 0 || V_ip6_forwarding != 1) goto freeit; /* Sanity checks */ @@ -153,7 +154,7 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len) #else IP6_EXTHDR_GET(nd_rs, struct nd_router_solicit *, m, off, icmp6len); if (nd_rs == NULL) { - icmp6stat.icp6s_tooshort++; + V_icmp6stat.icp6s_tooshort++; return; } #endif @@ -188,7 +189,7 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len) return; bad: - icmp6stat.icp6s_badrs++; + V_icmp6stat.icp6s_badrs++; m_freem(m); } @@ -217,7 +218,7 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) * the system-wide variable allows the acceptance, and * per-interface variable allows RAs on the receiving interface. */ - if (ip6_accept_rtadv == 0) + if (V_ip6_accept_rtadv == 0) goto freeit; if (!(ndi->flags & ND6_IFF_ACCEPT_RTADV)) goto freeit; @@ -243,7 +244,7 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) #else IP6_EXTHDR_GET(nd_ra, struct nd_router_advert *, m, off, icmp6len); if (nd_ra == NULL) { - icmp6stat.icp6s_tooshort++; + V_icmp6stat.icp6s_tooshort++; return; } #endif @@ -278,7 +279,7 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) ndi->basereachable != advreachable) { ndi->basereachable = advreachable; ndi->reachable = ND_COMPUTE_RTIME(ndi->basereachable); - ndi->recalctm = nd6_recalc_reachtm_interval; /* reset */ + ndi->recalctm = V_nd6_recalc_reachtm_interval; /* reset */ } } if (nd_ra->nd_ra_retransmit) @@ -419,7 +420,7 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) return; bad: - icmp6stat.icp6s_badra++; + V_icmp6stat.icp6s_badra++; m_freem(m); } @@ -484,7 +485,7 @@ defrouter_lookup(struct in6_addr *addr, struct ifnet *ifp) { struct nd_defrouter *dr; - for (dr = TAILQ_FIRST(&nd_defrouter); dr; + for (dr = TAILQ_FIRST(&V_nd_defrouter); dr; dr = TAILQ_NEXT(dr, dr_entry)) { if (dr->ifp == ifp && IN6_ARE_ADDR_EQUAL(addr, &dr->rtaddr)) return (dr); @@ -532,7 +533,7 @@ defrouter_reset(void) { struct nd_defrouter *dr; - for (dr = TAILQ_FIRST(&nd_defrouter); dr; + for (dr = TAILQ_FIRST(&V_nd_defrouter); dr; dr = TAILQ_NEXT(dr, dr_entry)) defrouter_delreq(dr); @@ -552,19 +553,19 @@ defrtrlist_del(struct nd_defrouter *dr) * Flush all the routing table entries that use the router * as a next hop. */ - if (!ip6_forwarding && ip6_accept_rtadv) /* XXX: better condition? */ + if (!V_ip6_forwarding && V_ip6_accept_rtadv) /* XXX: better condition? */ rt6_flush(&dr->rtaddr, dr->ifp); if (dr->installed) { deldr = dr; defrouter_delreq(dr); } - TAILQ_REMOVE(&nd_defrouter, dr, dr_entry); + TAILQ_REMOVE(&V_nd_defrouter, dr, dr_entry); /* * Also delete all the pointers to the router in each prefix lists. */ - for (pr = nd_prefix.lh_first; pr; pr = pr->ndpr_next) { + for (pr = V_nd_prefix.lh_first; pr; pr = pr->ndpr_next) { struct nd_pfxrouter *pfxrtr; if ((pfxrtr = pfxrtr_lookup(pr, dr)) != NULL) pfxrtr_del(pfxrtr); @@ -617,10 +618,10 @@ defrouter_select(void) * if the node is not an autoconfigured host, we explicitly exclude * such cases here for safety. */ - if (ip6_forwarding || !ip6_accept_rtadv) { + if (V_ip6_forwarding || !V_ip6_accept_rtadv) { nd6log((LOG_WARNING, "defrouter_select: called unexpectedly (forwarding=%d, " - "accept_rtadv=%d)\n", ip6_forwarding, ip6_accept_rtadv)); + "accept_rtadv=%d)\n", V_ip6_forwarding, V_ip6_accept_rtadv)); splx(s); return; } @@ -629,7 +630,7 @@ defrouter_select(void) * Let's handle easy case (3) first: * If default router list is empty, there's nothing to be done. */ - if (!TAILQ_FIRST(&nd_defrouter)) { + if (!TAILQ_FIRST(&V_nd_defrouter)) { splx(s); return; } @@ -639,7 +640,7 @@ defrouter_select(void) * We just pick up the first reachable one (if any), assuming that * the ordering rule of the list described in defrtrlist_update(). */ - for (dr = TAILQ_FIRST(&nd_defrouter); dr; + for (dr = TAILQ_FIRST(&V_nd_defrouter); dr; dr = TAILQ_NEXT(dr, dr_entry)) { if (selected_dr == NULL && (rt = nd6_lookup(&dr->rtaddr, 0, dr->ifp)) && @@ -666,7 +667,7 @@ defrouter_select(void) */ if (selected_dr == NULL) { if (installed_dr == NULL || !TAILQ_NEXT(installed_dr, dr_entry)) - selected_dr = TAILQ_FIRST(&nd_defrouter); + selected_dr = TAILQ_FIRST(&V_nd_defrouter); else selected_dr = TAILQ_NEXT(installed_dr, dr_entry); } else if (installed_dr && @@ -756,7 +757,7 @@ defrtrlist_update(struct nd_defrouter *new) * defrouter_select() below will handle routing * changes later. */ - TAILQ_REMOVE(&nd_defrouter, dr, dr_entry); + TAILQ_REMOVE(&V_nd_defrouter, dr, dr_entry); n = dr; goto insert; } @@ -787,7 +788,7 @@ insert: */ /* insert at the end of the group */ - for (dr = TAILQ_FIRST(&nd_defrouter); dr; + for (dr = TAILQ_FIRST(&V_nd_defrouter); dr; dr = TAILQ_NEXT(dr, dr_entry)) { if (rtpref(n) > rtpref(dr)) break; @@ -795,7 +796,7 @@ insert: if (dr) TAILQ_INSERT_BEFORE(dr, n, dr_entry); else - TAILQ_INSERT_TAIL(&nd_defrouter, n, dr_entry); + TAILQ_INSERT_TAIL(&V_nd_defrouter, n, dr_entry); defrouter_select(); @@ -845,7 +846,7 @@ nd6_prefix_lookup(struct nd_prefixctl *key) { struct nd_prefix *search; - for (search = nd_prefix.lh_first; search; search = search->ndpr_next) { + for (search = V_nd_prefix.lh_first; search; search = search->ndpr_next) { if (key->ndpr_ifp == search->ndpr_ifp && key->ndpr_plen == search->ndpr_plen && in6_are_prefix_equal(&key->ndpr_prefix.sin6_addr, @@ -894,7 +895,7 @@ nd6_prelist_add(struct nd_prefixctl *pr, struct nd_defrouter *dr, s = splnet(); /* link ndpr_entry to nd_prefix list */ - LIST_INSERT_HEAD(&nd_prefix, new, ndpr_entry); + LIST_INSERT_HEAD(&V_nd_prefix, new, ndpr_entry); splx(s); /* ND_OPT_PI_FLAG_ONLINK processing */ @@ -1194,20 +1195,20 @@ prelist_update(struct nd_prefixctl *new, struct nd_defrouter *dr, if ((ifa6->ia6_flags & IN6_IFF_TEMPORARY) != 0) { u_int32_t maxvltime, maxpltime; - if (ip6_temp_valid_lifetime > + if (V_ip6_temp_valid_lifetime > (u_int32_t)((time_second - ifa6->ia6_createtime) + - ip6_desync_factor)) { - maxvltime = ip6_temp_valid_lifetime - + V_ip6_desync_factor)) { + maxvltime = V_ip6_temp_valid_lifetime - (time_second - ifa6->ia6_createtime) - - ip6_desync_factor; + V_ip6_desync_factor; } else maxvltime = 0; - if (ip6_temp_preferred_lifetime > + if (V_ip6_temp_preferred_lifetime > (u_int32_t)((time_second - ifa6->ia6_createtime) + - ip6_desync_factor)) { - maxpltime = ip6_temp_preferred_lifetime - + V_ip6_desync_factor)) { + maxpltime = V_ip6_temp_preferred_lifetime - (time_second - ifa6->ia6_createtime) - - ip6_desync_factor; + V_ip6_desync_factor; } else maxpltime = 0; @@ -1274,7 +1275,7 @@ prelist_update(struct nd_prefixctl *new, struct nd_defrouter *dr, * addresses. Thus, we specifiy 1 as the 2nd arg of * in6_tmpifadd(). */ - if (ip6_use_tempaddr) { + if (V_ip6_use_tempaddr) { int e; if ((e = in6_tmpifadd(ia6, 1, 1)) != 0) { nd6log((LOG_NOTICE, "prelist_update: " @@ -1350,7 +1351,7 @@ pfxlist_onlink_check() * Check if there is a prefix that has a reachable advertising * router. */ - for (pr = nd_prefix.lh_first; pr; pr = pr->ndpr_next) { + for (pr = V_nd_prefix.lh_first; pr; pr = pr->ndpr_next) { if (pr->ndpr_raf_onlink && find_pfxlist_reachable_router(pr)) break; } @@ -1360,11 +1361,11 @@ pfxlist_onlink_check() * that does not advertise any prefixes. */ if (pr == NULL) { - for (dr = TAILQ_FIRST(&nd_defrouter); dr; + for (dr = TAILQ_FIRST(&V_nd_defrouter); dr; dr = TAILQ_NEXT(dr, dr_entry)) { struct nd_prefix *pr0; - for (pr0 = nd_prefix.lh_first; pr0; + for (pr0 = V_nd_prefix.lh_first; pr0; pr0 = pr0->ndpr_next) { if ((pfxrtr = pfxrtr_lookup(pr0, dr)) != NULL) break; @@ -1373,7 +1374,7 @@ pfxlist_onlink_check() break; } } - if (pr != NULL || (TAILQ_FIRST(&nd_defrouter) && pfxrtr == NULL)) { + if (pr != NULL || (TAILQ_FIRST(&V_nd_defrouter) && pfxrtr == NULL)) { /* * There is at least one prefix that has a reachable router, * or at least a router which probably does not advertise @@ -1383,7 +1384,7 @@ pfxlist_onlink_check() * Detach prefixes which have no reachable advertising * router, and attach other prefixes. */ - for (pr = nd_prefix.lh_first; pr; pr = pr->ndpr_next) { + for (pr = V_nd_prefix.lh_first; pr; pr = pr->ndpr_next) { /* XXX: a link-local prefix should never be detached */ if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr)) continue; @@ -1404,7 +1405,7 @@ pfxlist_onlink_check() } } else { /* there is no prefix that has a reachable router */ - for (pr = nd_prefix.lh_first; pr; pr = pr->ndpr_next) { + for (pr = V_nd_prefix.lh_first; pr; pr = pr->ndpr_next) { if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr)) continue; @@ -1424,7 +1425,7 @@ pfxlist_onlink_check() * interfaces. Such cases will be handled in nd6_prefix_onlink, * so we don't have to care about them. */ - for (pr = nd_prefix.lh_first; pr; pr = pr->ndpr_next) { + for (pr = V_nd_prefix.lh_first; pr; pr = pr->ndpr_next) { int e; char ip6buf[INET6_ADDRSTRLEN]; @@ -1467,7 +1468,7 @@ pfxlist_onlink_check() * always be attached. * The precise detection logic is same as the one for prefixes. */ - for (ifa = in6_ifaddr; ifa; ifa = ifa->ia_next) { + for (ifa = V_in6_ifaddr; ifa; ifa = ifa->ia_next) { if (!(ifa->ia6_flags & IN6_IFF_AUTOCONF)) continue; @@ -1484,7 +1485,7 @@ pfxlist_onlink_check() break; } if (ifa) { - for (ifa = in6_ifaddr; ifa; ifa = ifa->ia_next) { + for (ifa = V_in6_ifaddr; ifa; ifa = ifa->ia_next) { if ((ifa->ia6_flags & IN6_IFF_AUTOCONF) == 0) continue; @@ -1503,7 +1504,7 @@ pfxlist_onlink_check() } } else { - for (ifa = in6_ifaddr; ifa; ifa = ifa->ia_next) { + for (ifa = V_in6_ifaddr; ifa; ifa = ifa->ia_next) { if ((ifa->ia6_flags & IN6_IFF_AUTOCONF) == 0) continue; @@ -1545,7 +1546,7 @@ nd6_prefix_onlink(struct nd_prefix *pr) * Although such a configuration is expected to be rare, we explicitly * allow it. */ - for (opr = nd_prefix.lh_first; opr; opr = opr->ndpr_next) { + for (opr = V_nd_prefix.lh_first; opr; opr = opr->ndpr_next) { if (opr == pr) continue; @@ -1674,7 +1675,7 @@ nd6_prefix_offlink(struct nd_prefix *pr) * If there's one, try to make the prefix on-link on the * interface. */ - for (opr = nd_prefix.lh_first; opr; opr = opr->ndpr_next) { + for (opr = V_nd_prefix.lh_first; opr; opr = opr->ndpr_next) { if (opr == pr) continue; @@ -1890,7 +1891,7 @@ in6_tmpifadd(const struct in6_ifaddr *ia0, int forcegen, int delay) * there may be a time lag between generation of the ID and generation * of the address. So, we'll do one more sanity check. */ - 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, &ifra.ifra_addr.sin6_addr)) { if (trylimit-- == 0) { @@ -1918,20 +1919,20 @@ in6_tmpifadd(const struct in6_ifaddr *ia0, int forcegen, int delay) vltime0 = IFA6_IS_INVALID(ia0) ? 0 : (ia0->ia6_lifetime.ia6t_vltime - (time_second - ia0->ia6_updatetime)); - if (vltime0 > ip6_temp_valid_lifetime) - vltime0 = ip6_temp_valid_lifetime; + if (vltime0 > V_ip6_temp_valid_lifetime) + vltime0 = V_ip6_temp_valid_lifetime; } else - vltime0 = ip6_temp_valid_lifetime; + vltime0 = V_ip6_temp_valid_lifetime; if (ia0->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME) { pltime0 = IFA6_IS_DEPRECATED(ia0) ? 0 : (ia0->ia6_lifetime.ia6t_pltime - (time_second - ia0->ia6_updatetime)); - if (pltime0 > ip6_temp_preferred_lifetime - ip6_desync_factor){ - pltime0 = ip6_temp_preferred_lifetime - - ip6_desync_factor; + if (pltime0 > V_ip6_temp_preferred_lifetime - V_ip6_desync_factor){ + pltime0 = V_ip6_temp_preferred_lifetime - + V_ip6_desync_factor; } } else - pltime0 = ip6_temp_preferred_lifetime - ip6_desync_factor; + pltime0 = V_ip6_temp_preferred_lifetime - V_ip6_desync_factor; ifra.ifra_lifetime.ia6t_vltime = vltime0; ifra.ifra_lifetime.ia6t_pltime = pltime0; @@ -1939,7 +1940,7 @@ in6_tmpifadd(const struct in6_ifaddr *ia0, int forcegen, int delay) * A temporary address is created only if this calculated Preferred * Lifetime is greater than REGEN_ADVANCE time units. */ - if (ifra.ifra_lifetime.ia6t_pltime <= ip6_temp_regen_advance) + if (ifra.ifra_lifetime.ia6t_pltime <= V_ip6_temp_regen_advance) return (0); /* XXX: scope zone ID? */ @@ -2020,7 +2021,7 @@ void rt6_flush(struct in6_addr *gateway, struct ifnet *ifp) { - struct radix_node_head *rnh = rt_tables[0][AF_INET6]; + struct radix_node_head *rnh = V_rt_tables[0][AF_INET6]; int s = splnet(); /* We'll care only link-local addresses */ @@ -2074,24 +2075,24 @@ nd6_setdefaultiface(int ifindex) { int error = 0; - if (ifindex < 0 || if_index < ifindex) + if (ifindex < 0 || V_if_index < ifindex) return (EINVAL); if (ifindex != 0 && !ifnet_byindex(ifindex)) return (EINVAL); - if (nd6_defifindex != ifindex) { - nd6_defifindex = ifindex; - if (nd6_defifindex > 0) - nd6_defifp = ifnet_byindex(nd6_defifindex); + if (V_nd6_defifindex != ifindex) { + V_nd6_defifindex = ifindex; + if (V_nd6_defifindex > 0) + V_nd6_defifp = ifnet_byindex(V_nd6_defifindex); else - nd6_defifp = NULL; + V_nd6_defifp = NULL; /* * Our current implementation assumes one-to-one maping between * interfaces and links, so it would be natural to use the * default interface as the default link. */ - scope6_setdefault(nd6_defifp); + scope6_setdefault(V_nd6_defifp); } return (error); diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index 9a35dc1..cbdca81 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #include <sys/socketvar.h> #include <sys/sx.h> #include <sys/syslog.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/if_types.h> @@ -142,7 +143,7 @@ rip6_input(struct mbuf **mp, int *offp, int proto) struct mbuf *opts = NULL; struct sockaddr_in6 fromsa; - rip6stat.rip6s_ipackets++; + V_rip6stat.rip6s_ipackets++; if (faithprefix_p != NULL && (*faithprefix_p)(&ip6->ip6_dst)) { /* XXX Send icmp6 host/port unreach? */ @@ -152,8 +153,8 @@ rip6_input(struct mbuf **mp, int *offp, int proto) init_sin6(&fromsa, m); /* general init */ - INP_INFO_RLOCK(&ripcbinfo); - LIST_FOREACH(in6p, &ripcb, inp_list) { + INP_INFO_RLOCK(&V_ripcbinfo); + LIST_FOREACH(in6p, &V_ripcb, inp_list) { if ((in6p->in6p_vflag & INP_IPV6) == 0) continue; if (in6p->in6p_ip6_nxt && @@ -167,11 +168,11 @@ rip6_input(struct mbuf **mp, int *offp, int proto) continue; INP_RLOCK(in6p); if (in6p->in6p_cksum != -1) { - rip6stat.rip6s_isum++; + V_rip6stat.rip6s_isum++; if (in6_cksum(m, proto, *offp, m->m_pkthdr.len - *offp)) { INP_RUNLOCK(in6p); - rip6stat.rip6s_badsum++; + V_rip6stat.rip6s_badsum++; continue; } } @@ -184,7 +185,7 @@ rip6_input(struct mbuf **mp, int *offp, int proto) */ if (n && ipsec6_in_reject(n, last)) { m_freem(n); - ipsec6stat.in_polvio++; + V_ipsec6stat.in_polvio++; /* Do not inject data into pcb. */ } else #endif /* IPSEC */ @@ -200,7 +201,7 @@ rip6_input(struct mbuf **mp, int *offp, int proto) m_freem(n); if (opts) m_freem(opts); - rip6stat.rip6s_fullsock++; + V_rip6stat.rip6s_fullsock++; } else sorwakeup(last->in6p_socket); opts = NULL; @@ -209,15 +210,15 @@ rip6_input(struct mbuf **mp, int *offp, int proto) } last = in6p; } - INP_INFO_RUNLOCK(&ripcbinfo); + INP_INFO_RUNLOCK(&V_ripcbinfo); #ifdef IPSEC /* * Check AH/ESP integrity. */ if (last && ipsec6_in_reject(m, last)) { m_freem(m); - ipsec6stat.in_polvio++; - ip6stat.ip6s_delivered--; + V_ipsec6stat.in_polvio++; + V_ip6stat.ip6s_delivered--; /* Do not inject data into pcb. */ INP_RUNLOCK(last); } else @@ -233,14 +234,14 @@ rip6_input(struct mbuf **mp, int *offp, int proto) m_freem(m); if (opts) m_freem(opts); - rip6stat.rip6s_fullsock++; + V_rip6stat.rip6s_fullsock++; } else sorwakeup(last->in6p_socket); INP_RUNLOCK(last); } else { - rip6stat.rip6s_nosock++; + V_rip6stat.rip6s_nosock++; if (m->m_flags & M_MCAST) - rip6stat.rip6s_nosockmcast++; + V_rip6stat.rip6s_nosockmcast++; if (proto == IPPROTO_NONE) m_freem(m); else { @@ -249,7 +250,7 @@ rip6_input(struct mbuf **mp, int *offp, int proto) ICMP6_PARAMPROB_NEXTHEADER, prvnxtp - mtod(m, char *)); } - ip6stat.ip6s_delivered--; + V_ip6stat.ip6s_delivered--; } return (IPPROTO_DONE); } @@ -295,7 +296,7 @@ rip6_ctlinput(int cmd, struct sockaddr *sa, void *d) sa6_src = &sa6_any; } - (void) in6_pcbnotify(&ripcbinfo, sa, 0, + (void) in6_pcbnotify(&V_ripcbinfo, sa, 0, (const struct sockaddr *)sa6_src, 0, cmd, cmdarg, notify); } @@ -353,9 +354,9 @@ rip6_output(m, va_alist) * XXX: we may still need to determine the zone later. */ if (!(so->so_state & SS_ISCONNECTED)) { - if (dstsock->sin6_scope_id == 0 && !ip6_use_defzone) + if (dstsock->sin6_scope_id == 0 && !V_ip6_use_defzone) scope_ambiguous = 1; - if ((error = sa6_embedscope(dstsock, ip6_use_defzone)) != 0) + if ((error = sa6_embedscope(dstsock, V_ip6_use_defzone)) != 0) goto bad; } @@ -455,9 +456,9 @@ rip6_output(m, va_alist) if (so->so_proto->pr_protocol == IPPROTO_ICMPV6) { if (oifp) icmp6_ifoutstat_inc(oifp, type, code); - icmp6stat.icp6s_outhist[type]++; + V_icmp6stat.icp6s_outhist[type]++; } else - rip6stat.rip6s_opackets++; + V_rip6stat.rip6s_opackets++; goto freectl; @@ -560,15 +561,15 @@ rip6_attach(struct socket *so, int proto, struct thread *td) sizeof(struct icmp6_filter), M_PCB, M_NOWAIT); if (filter == NULL) return (ENOMEM); - INP_INFO_WLOCK(&ripcbinfo); - error = in_pcballoc(so, &ripcbinfo); + INP_INFO_WLOCK(&V_ripcbinfo); + error = in_pcballoc(so, &V_ripcbinfo); if (error) { - INP_INFO_WUNLOCK(&ripcbinfo); + INP_INFO_WUNLOCK(&V_ripcbinfo); FREE(filter, M_PCB); return (error); } inp = (struct inpcb *)so->so_pcb; - INP_INFO_WUNLOCK(&ripcbinfo); + INP_INFO_WUNLOCK(&V_ripcbinfo); inp->inp_vflag |= INP_IPV6; inp->in6p_ip6_nxt = (long)proto; inp->in6p_hops = -1; /* use kernel default */ @@ -590,12 +591,12 @@ rip6_detach(struct socket *so) if (so == ip6_mrouter && ip6_mrouter_done) ip6_mrouter_done(); /* xxx: RSVP */ - INP_INFO_WLOCK(&ripcbinfo); + INP_INFO_WLOCK(&V_ripcbinfo); INP_WLOCK(inp); FREE(inp->in6p_icmp6filt, M_PCB); in6_pcbdetach(inp); in6_pcbfree(inp); - INP_INFO_WUNLOCK(&ripcbinfo); + INP_INFO_WUNLOCK(&V_ripcbinfo); } /* XXXRW: This can't ever be called. */ @@ -649,9 +650,9 @@ rip6_bind(struct socket *so, struct sockaddr *nam, struct thread *td) if (nam->sa_len != sizeof(*addr)) return (EINVAL); - if (TAILQ_EMPTY(&ifnet) || addr->sin6_family != AF_INET6) + if (TAILQ_EMPTY(&V_ifnet) || addr->sin6_family != AF_INET6) return (EADDRNOTAVAIL); - if ((error = sa6_embedscope(addr, ip6_use_defzone)) != 0) + if ((error = sa6_embedscope(addr, V_ip6_use_defzone)) != 0) return (error); if (!IN6_IS_ADDR_UNSPECIFIED(&addr->sin6_addr) && @@ -663,11 +664,11 @@ rip6_bind(struct socket *so, struct sockaddr *nam, struct thread *td) IN6_IFF_DETACHED|IN6_IFF_DEPRECATED)) { return (EADDRNOTAVAIL); } - INP_INFO_WLOCK(&ripcbinfo); + INP_INFO_WLOCK(&V_ripcbinfo); INP_WLOCK(inp); inp->in6p_laddr = addr->sin6_addr; INP_WUNLOCK(inp); - INP_INFO_WUNLOCK(&ripcbinfo); + INP_INFO_WUNLOCK(&V_ripcbinfo); return (0); } @@ -685,7 +686,7 @@ rip6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) if (nam->sa_len != sizeof(*addr)) return (EINVAL); - if (TAILQ_EMPTY(&ifnet)) + if (TAILQ_EMPTY(&V_ifnet)) return (EADDRNOTAVAIL); if (addr->sin6_family != AF_INET6) return (EAFNOSUPPORT); @@ -698,12 +699,12 @@ rip6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) * the outgoing interface. If we can, determine the zone ID based on * the interface below. */ - if (addr->sin6_scope_id == 0 && !ip6_use_defzone) + if (addr->sin6_scope_id == 0 && !V_ip6_use_defzone) scope_ambiguous = 1; - if ((error = sa6_embedscope(addr, ip6_use_defzone)) != 0) + if ((error = sa6_embedscope(addr, V_ip6_use_defzone)) != 0) return (error); - INP_INFO_WLOCK(&ripcbinfo); + INP_INFO_WLOCK(&V_ripcbinfo); INP_WLOCK(inp); /* Source address selection. XXX: need pcblookup? */ in6a = in6_selectsrc(addr, inp->in6p_outputopts, @@ -711,7 +712,7 @@ rip6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) &ifp, &error); if (in6a == NULL) { INP_WUNLOCK(inp); - INP_INFO_WUNLOCK(&ripcbinfo); + INP_INFO_WUNLOCK(&V_ripcbinfo); return (error ? error : EADDRNOTAVAIL); } @@ -719,14 +720,14 @@ rip6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) if (ifp && scope_ambiguous && (error = in6_setscope(&addr->sin6_addr, ifp, NULL)) != 0) { INP_WUNLOCK(inp); - INP_INFO_WUNLOCK(&ripcbinfo); + INP_INFO_WUNLOCK(&V_ripcbinfo); return (error); } inp->in6p_faddr = addr->sin6_addr; inp->in6p_laddr = *in6a; soisconnected(so); INP_WUNLOCK(inp); - INP_INFO_WUNLOCK(&ripcbinfo); + INP_INFO_WUNLOCK(&V_ripcbinfo); return (0); } diff --git a/sys/netinet6/route6.c b/sys/netinet6/route6.c index e607bea..c058f3b 100644 --- a/sys/netinet6/route6.c +++ b/sys/netinet6/route6.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include <sys/socket.h> #include <sys/systm.h> #include <sys/queue.h> +#include <sys/vimage.h> #include <net/if.h> @@ -74,7 +75,7 @@ route6_input(struct mbuf **mp, int *offp, int proto) if (ip6a) { /* XXX reject home-address option before rthdr */ if (ip6a->ip6a_flags & IP6A_SWAP) { - ip6stat.ip6s_badoptions++; + V_ip6stat.ip6s_badoptions++; m_freem(m); return IPPROTO_DONE; } @@ -88,7 +89,7 @@ route6_input(struct mbuf **mp, int *offp, int proto) ip6 = mtod(m, struct ip6_hdr *); IP6_EXTHDR_GET(rh, struct ip6_rthdr *, m, off, sizeof(*rh)); if (rh == NULL) { - ip6stat.ip6s_tooshort++; + V_ip6stat.ip6s_tooshort++; return IPPROTO_DONE; } #endif @@ -115,7 +116,7 @@ route6_input(struct mbuf **mp, int *offp, int proto) */ IP6_EXTHDR_GET(rh, struct ip6_rthdr *, m, off, rhlen); if (rh == NULL) { - ip6stat.ip6s_tooshort++; + V_ip6stat.ip6s_tooshort++; return IPPROTO_DONE; } #endif @@ -129,7 +130,7 @@ route6_input(struct mbuf **mp, int *offp, int proto) rhlen = (rh->ip6r_len + 1) << 3; break; /* Final dst. Just ignore the header. */ } - ip6stat.ip6s_badoptions++; + V_ip6stat.ip6s_badoptions++; icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, (caddr_t)&rh->ip6r_type - (caddr_t)ip6); return (IPPROTO_DONE); @@ -166,14 +167,14 @@ ip6_rthdr0(struct mbuf *m, struct ip6_hdr *ip6, struct ip6_rthdr0 *rh0) * RFC 2462: this limitation was removed since strict/loose * bitmap field was deleted. */ - ip6stat.ip6s_badoptions++; + V_ip6stat.ip6s_badoptions++; icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, (caddr_t)&rh0->ip6r0_len - (caddr_t)ip6); return (-1); } if ((addrs = rh0->ip6r0_len / 2) < rh0->ip6r0_segleft) { - ip6stat.ip6s_badoptions++; + V_ip6stat.ip6s_badoptions++; icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, (caddr_t)&rh0->ip6r0_segleft - (caddr_t)ip6); return (-1); @@ -192,7 +193,7 @@ ip6_rthdr0(struct mbuf *m, struct ip6_hdr *ip6, struct ip6_rthdr0 *rh0) IN6_IS_ADDR_UNSPECIFIED(nextaddr) || IN6_IS_ADDR_V4MAPPED(nextaddr) || IN6_IS_ADDR_V4COMPAT(nextaddr)) { - ip6stat.ip6s_badoptions++; + V_ip6stat.ip6s_badoptions++; m_freem(m); return (-1); } @@ -200,7 +201,7 @@ ip6_rthdr0(struct mbuf *m, struct ip6_hdr *ip6, struct ip6_rthdr0 *rh0) IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_dst) || IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst) || IN6_IS_ADDR_V4COMPAT(&ip6->ip6_dst)) { - ip6stat.ip6s_badoptions++; + V_ip6stat.ip6s_badoptions++; m_freem(m); return (-1); } @@ -213,7 +214,7 @@ ip6_rthdr0(struct mbuf *m, struct ip6_hdr *ip6, struct ip6_rthdr0 *rh0) if ((ifa = ip6_getdstifaddr(m)) == NULL) goto bad; if (in6_setscope(nextaddr, ifa->ia_ifp, NULL) != 0) { - ip6stat.ip6s_badscope++; + V_ip6stat.ip6s_badscope++; goto bad; } 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); diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 03f5ee2..f593e6f 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$"); #include <sys/sysctl.h> #include <sys/syslog.h> #include <sys/systm.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/if_types.h> @@ -135,7 +136,7 @@ udp6_append(struct inpcb *inp, struct mbuf *n, int off, /* Check AH/ESP integrity. */ if (ipsec6_in_reject(n, inp)) { m_freem(n); - ipsec6stat.in_polvio++; + V_ipsec6stat.in_polvio++; return; } #endif /* IPSEC */ @@ -159,7 +160,7 @@ udp6_append(struct inpcb *inp, struct mbuf *n, int off, m_freem(n); if (opts) m_freem(opts); - udpstat.udps_fullsock++; + V_udpstat.udps_fullsock++; } else sorwakeup_locked(so); } @@ -193,7 +194,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto) return (IPPROTO_DONE); #endif - udpstat.udps_ipackets++; + V_udpstat.udps_ipackets++; /* * Destination port of 0 is illegal, based on RFC768. @@ -205,7 +206,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto) ulen = ntohs((u_short)uh->uh_ulen); if (plen != ulen) { - udpstat.udps_badlen++; + V_udpstat.udps_badlen++; goto badunlocked; } @@ -213,11 +214,11 @@ udp6_input(struct mbuf **mp, int *offp, int proto) * Checksum extended UDP header and data. */ if (uh->uh_sum == 0) { - udpstat.udps_nosum++; + V_udpstat.udps_nosum++; goto badunlocked; } if (in6_cksum(m, IPPROTO_UDP, off, ulen) != 0) { - udpstat.udps_badsum++; + V_udpstat.udps_badsum++; goto badunlocked; } @@ -227,7 +228,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto) init_sin6(&fromsa, m); fromsa.sin6_port = uh->uh_sport; - INP_INFO_RLOCK(&udbinfo); + INP_INFO_RLOCK(&V_udbinfo); if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { struct inpcb *last; @@ -247,7 +248,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto) * later. */ last = NULL; - LIST_FOREACH(inp, &udb, inp_list) { + LIST_FOREACH(inp, &V_udb, inp_list) { if ((inp->inp_vflag & INP_IPV6) == 0) continue; if (inp->in6p_lport != uh->uh_dport) @@ -302,20 +303,20 @@ udp6_input(struct mbuf **mp, int *offp, int proto) * to send an ICMP Port Unreachable for a broadcast * or multicast datgram.) */ - udpstat.udps_noport++; - udpstat.udps_noportmcast++; + V_udpstat.udps_noport++; + V_udpstat.udps_noportmcast++; goto badheadlocked; } INP_RLOCK(last); udp6_append(last, m, off, &fromsa); INP_RUNLOCK(last); - INP_INFO_RUNLOCK(&udbinfo); + INP_INFO_RUNLOCK(&V_udbinfo); return (IPPROTO_DONE); } /* * Locate pcb for datagram. */ - inp = in6_pcblookup_hash(&udbinfo, &ip6->ip6_src, uh->uh_sport, + inp = in6_pcblookup_hash(&V_udbinfo, &ip6->ip6_src, uh->uh_sport, &ip6->ip6_dst, uh->uh_dport, 1, m->m_pkthdr.rcvif); if (inp == NULL) { if (udp_log_in_vain) { @@ -329,14 +330,14 @@ udp6_input(struct mbuf **mp, int *offp, int proto) ip6_sprintf(ip6bufs, &ip6->ip6_src), ntohs(uh->uh_sport)); } - udpstat.udps_noport++; + V_udpstat.udps_noport++; if (m->m_flags & M_MCAST) { printf("UDP6: M_MCAST is set in a unicast packet.\n"); - udpstat.udps_noportmcast++; + V_udpstat.udps_noportmcast++; goto badheadlocked; } - INP_INFO_RUNLOCK(&udbinfo); - if (udp_blackhole) + INP_INFO_RUNLOCK(&V_udbinfo); + if (V_udp_blackhole) goto badunlocked; if (badport_bandlim(BANDLIM_ICMP6_UNREACH) < 0) goto badunlocked; @@ -344,13 +345,13 @@ udp6_input(struct mbuf **mp, int *offp, int proto) return (IPPROTO_DONE); } INP_RLOCK(inp); - INP_INFO_RUNLOCK(&udbinfo); + INP_INFO_RUNLOCK(&V_udbinfo); udp6_append(inp, m, off, &fromsa); INP_RUNLOCK(inp); return (IPPROTO_DONE); badheadlocked: - INP_INFO_RUNLOCK(&udbinfo); + INP_INFO_RUNLOCK(&V_udbinfo); badunlocked: if (m) m_freem(m); @@ -414,11 +415,11 @@ udp6_ctlinput(int cmd, struct sockaddr *sa, void *d) bzero(&uh, sizeof(uh)); m_copydata(m, off, sizeof(*uhp), (caddr_t)&uh); - (void) in6_pcbnotify(&udbinfo, sa, uh.uh_dport, + (void) in6_pcbnotify(&V_udbinfo, sa, uh.uh_dport, (struct sockaddr *)ip6cp->ip6c_src, uh.uh_sport, cmd, cmdarg, notify); } else - (void) in6_pcbnotify(&udbinfo, sa, 0, + (void) in6_pcbnotify(&V_udbinfo, sa, 0, (const struct sockaddr *)sa6_src, 0, cmd, cmdarg, notify); } @@ -441,17 +442,17 @@ udp6_getcred(SYSCTL_HANDLER_ARGS) error = SYSCTL_IN(req, addrs, sizeof(addrs)); if (error) return (error); - if ((error = sa6_embedscope(&addrs[0], ip6_use_defzone)) != 0 || - (error = sa6_embedscope(&addrs[1], ip6_use_defzone)) != 0) { + if ((error = sa6_embedscope(&addrs[0], V_ip6_use_defzone)) != 0 || + (error = sa6_embedscope(&addrs[1], V_ip6_use_defzone)) != 0) { return (error); } - INP_INFO_RLOCK(&udbinfo); - inp = in6_pcblookup_hash(&udbinfo, &addrs[1].sin6_addr, + INP_INFO_RLOCK(&V_udbinfo); + inp = in6_pcblookup_hash(&V_udbinfo, &addrs[1].sin6_addr, addrs[1].sin6_port, &addrs[0].sin6_addr, addrs[0].sin6_port, 1, NULL); if (inp != NULL) { INP_RLOCK(inp); - INP_INFO_RUNLOCK(&udbinfo); + INP_INFO_RUNLOCK(&V_udbinfo); if (inp->inp_socket == NULL) error = ENOENT; if (error == 0) @@ -461,11 +462,11 @@ udp6_getcred(SYSCTL_HANDLER_ARGS) cru2x(inp->inp_socket->so_cred, &xuc); INP_RUNLOCK(inp); } else { - INP_INFO_RUNLOCK(&udbinfo); + INP_INFO_RUNLOCK(&V_udbinfo); error = ENOENT; } INP_RUNLOCK(inp); - INP_INFO_RUNLOCK(&udbinfo); + INP_INFO_RUNLOCK(&V_udbinfo); if (error == 0) error = SYSCTL_OUT(req, &xuc, sizeof(struct xucred)); return (error); @@ -511,9 +512,9 @@ udp6_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr6, * we'll see if we can determine the outgoing interface. If we * can, determine the zone ID based on the interface below. */ - if (sin6->sin6_scope_id == 0 && !ip6_use_defzone) + if (sin6->sin6_scope_id == 0 && !V_ip6_use_defzone) scope_ambiguous = 1; - if ((error = sa6_embedscope(sin6, ip6_use_defzone)) != 0) + if ((error = sa6_embedscope(sin6, V_ip6_use_defzone)) != 0) return (error); } @@ -669,7 +670,7 @@ udp6_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr6, flags = 0; - udpstat.udps_opackets++; + V_udpstat.udps_opackets++; error = ip6_output(m, optp, NULL, flags, inp->in6p_moptions, NULL, inp); break; @@ -708,7 +709,7 @@ udp6_abort(struct socket *so) } #endif - INP_INFO_WLOCK(&udbinfo); + INP_INFO_WLOCK(&V_udbinfo); INP_WLOCK(inp); if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) { in6_pcbdisconnect(inp); @@ -716,7 +717,7 @@ udp6_abort(struct socket *so) soisdisconnected(so); } INP_WUNLOCK(inp); - INP_INFO_WUNLOCK(&udbinfo); + INP_INFO_WUNLOCK(&V_udbinfo); } static int @@ -733,14 +734,14 @@ udp6_attach(struct socket *so, int proto, struct thread *td) if (error) return (error); } - INP_INFO_WLOCK(&udbinfo); - error = in_pcballoc(so, &udbinfo); + INP_INFO_WLOCK(&V_udbinfo); + error = in_pcballoc(so, &V_udbinfo); if (error) { - INP_INFO_WUNLOCK(&udbinfo); + INP_INFO_WUNLOCK(&V_udbinfo); return (error); } inp = (struct inpcb *)so->so_pcb; - INP_INFO_WUNLOCK(&udbinfo); + INP_INFO_WUNLOCK(&V_udbinfo); inp->inp_vflag |= INP_IPV6; if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) inp->inp_vflag |= INP_IPV4; @@ -752,7 +753,7 @@ udp6_attach(struct socket *so, int proto, struct thread *td) * because the socket may be bound to an IPv6 wildcard address, * which may match an IPv4-mapped IPv6 address. */ - inp->inp_ip_ttl = ip_defttl; + inp->inp_ip_ttl = V_ip_defttl; INP_WUNLOCK(inp); return (0); } @@ -766,7 +767,7 @@ udp6_bind(struct socket *so, struct sockaddr *nam, struct thread *td) inp = sotoinpcb(so); KASSERT(inp != NULL, ("udp6_bind: inp == NULL")); - INP_INFO_WLOCK(&udbinfo); + INP_INFO_WLOCK(&V_udbinfo); INP_WLOCK(inp); inp->inp_vflag &= ~INP_IPV4; inp->inp_vflag |= INP_IPV6; @@ -792,7 +793,7 @@ udp6_bind(struct socket *so, struct sockaddr *nam, struct thread *td) error = in6_pcbbind(inp, nam, td->td_ucred); out: INP_WUNLOCK(inp); - INP_INFO_WUNLOCK(&udbinfo); + INP_INFO_WUNLOCK(&V_udbinfo); return (error); } @@ -813,7 +814,7 @@ udp6_close(struct socket *so) return; } #endif - INP_INFO_WLOCK(&udbinfo); + INP_INFO_WLOCK(&V_udbinfo); INP_WLOCK(inp); if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) { in6_pcbdisconnect(inp); @@ -821,7 +822,7 @@ udp6_close(struct socket *so) soisdisconnected(so); } INP_WUNLOCK(inp); - INP_INFO_WUNLOCK(&udbinfo); + INP_INFO_WUNLOCK(&V_udbinfo); } static int @@ -833,7 +834,7 @@ udp6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) inp = sotoinpcb(so); KASSERT(inp != NULL, ("udp6_connect: inp == NULL")); - INP_INFO_WLOCK(&udbinfo); + INP_INFO_WLOCK(&V_udbinfo); INP_WLOCK(inp); if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) { struct sockaddr_in6 *sin6_p; @@ -872,7 +873,7 @@ udp6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) } out: INP_WUNLOCK(inp); - INP_INFO_WUNLOCK(&udbinfo); + INP_INFO_WUNLOCK(&V_udbinfo); return (error); } @@ -884,11 +885,11 @@ udp6_detach(struct socket *so) inp = sotoinpcb(so); KASSERT(inp != NULL, ("udp6_detach: inp == NULL")); - INP_INFO_WLOCK(&udbinfo); + INP_INFO_WLOCK(&V_udbinfo); INP_WLOCK(inp); in6_pcbdetach(inp); in6_pcbfree(inp); - INP_INFO_WUNLOCK(&udbinfo); + INP_INFO_WUNLOCK(&V_udbinfo); } static int @@ -900,7 +901,7 @@ udp6_disconnect(struct socket *so) inp = sotoinpcb(so); KASSERT(inp != NULL, ("udp6_disconnect: inp == NULL")); - INP_INFO_WLOCK(&udbinfo); + INP_INFO_WLOCK(&V_udbinfo); INP_WLOCK(inp); #ifdef INET @@ -924,7 +925,7 @@ udp6_disconnect(struct socket *so) so->so_state &= ~SS_ISCONNECTED; /* XXX */ out: INP_WUNLOCK(inp); - INP_INFO_WUNLOCK(&udbinfo); + INP_INFO_WUNLOCK(&V_udbinfo); return (0); } @@ -938,7 +939,7 @@ udp6_send(struct socket *so, int flags, struct mbuf *m, inp = sotoinpcb(so); KASSERT(inp != NULL, ("udp6_send: inp == NULL")); - INP_INFO_WLOCK(&udbinfo); + INP_INFO_WLOCK(&V_udbinfo); INP_WLOCK(inp); if (addr) { if (addr->sa_len != sizeof(struct sockaddr_in6)) { @@ -993,12 +994,12 @@ udp6_send(struct socket *so, int flags, struct mbuf *m, error = udp6_output(inp, m, addr, control, td); out: INP_WUNLOCK(inp); - INP_INFO_WUNLOCK(&udbinfo); + INP_INFO_WUNLOCK(&V_udbinfo); return (error); bad: INP_WUNLOCK(inp); - INP_INFO_WUNLOCK(&udbinfo); + INP_INFO_WUNLOCK(&V_udbinfo); m_freem(m); return (error); } |