PERFORCE change 125321 for review
Marko Zec
zec at FreeBSD.org
Sat Aug 18 11:19:07 PDT 2007
http://perforce.freebsd.org/chv.cgi?CH=125321
Change 125321 by zec at zec_tpx32 on 2007/08/18 18:18:56
Allow ip6_auto_linklocal to be toggled on per vnet basis.
While here, virtualize in6_maxmtu as well.
Affected files ...
.. //depot/projects/vimage/src/sys/netinet6/in6.c#10 edit
.. //depot/projects/vimage/src/sys/netinet6/in6_ifattach.c#11 edit
.. //depot/projects/vimage/src/sys/netinet6/in6_proto.c#10 edit
.. //depot/projects/vimage/src/sys/netinet6/ip6_input.c#19 edit
.. //depot/projects/vimage/src/sys/netinet6/nd6.c#16 edit
.. //depot/projects/vimage/src/sys/netinet6/vinet6.h#9 edit
Differences ...
==== //depot/projects/vimage/src/sys/netinet6/in6.c#10 (text+ko) ====
@@ -2199,6 +2199,7 @@
in6_setmaxmtu(void)
{
INIT_VNET_NET(curvnet);
+ INIT_VNET_INET6(curvnet);
unsigned long maxmtu = 0;
struct ifnet *ifp;
@@ -2214,7 +2215,7 @@
}
IFNET_RUNLOCK();
if (maxmtu) /* update only when maxmtu is positive */
- in6_maxmtu = maxmtu;
+ V_in6_maxmtu = maxmtu;
}
/*
==== //depot/projects/vimage/src/sys/netinet6/in6_ifattach.c#11 (text+ko) ====
@@ -64,15 +64,9 @@
#include <netinet6/nd6.h>
#include <netinet6/scope6_var.h>
-unsigned long in6_maxmtu = 0;
-
-#ifdef IP6_AUTO_LINKLOCAL
-int ip6_auto_linklocal = IP6_AUTO_LINKLOCAL;
-#else
-int ip6_auto_linklocal = 1; /* enable by default */
-#endif
-
#ifndef VIMAGE
+unsigned long in6_maxmtu;
+int ip6_auto_linklocal;
struct callout in6_tmpaddrtimer_ch;
extern struct inpcbinfo ripcbinfo;
extern struct inpcbinfo udbinfo;
@@ -652,6 +646,7 @@
void
in6_ifattach(struct ifnet *ifp, struct ifnet *altifp)
{
+ INIT_VNET_INET6(ifp->if_vnet);
struct in6_ifaddr *ia;
struct in6_addr in6;
@@ -706,7 +701,7 @@
/*
* 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) {
@@ -722,8 +717,8 @@
#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;
}
/*
==== //depot/projects/vimage/src/sys/netinet6/in6_proto.c#10 (text+ko) ====
@@ -534,9 +534,11 @@
sysctl_ip6_tempvltime, "I", "");
SYSCTL_INT(_net_inet6_ip6, IPV6CTL_V6ONLY,
v6only, CTLFLAG_RW, &ip6_v6only, 0, "");
+#ifndef VIMAGE
TUNABLE_INT("net.inet6.ip6.auto_linklocal", &ip6_auto_linklocal);
-SYSCTL_INT(_net_inet6_ip6, IPV6CTL_AUTO_LINKLOCAL,
- auto_linklocal, CTLFLAG_RW, &ip6_auto_linklocal, 0, "");
+#endif
+SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_AUTO_LINKLOCAL,
+ auto_linklocal, CTLFLAG_RW, ip6_auto_linklocal, 0, "");
SYSCTL_V_STRUCT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_RIP6STATS,
rip6stats, CTLFLAG_RD, rip6stat, rip6stat, "");
SYSCTL_INT(_net_inet6_ip6, IPV6CTL_PREFER_TEMPADDR,
==== //depot/projects/vimage/src/sys/netinet6/ip6_input.c#19 (text+ko) ====
@@ -165,9 +165,16 @@
void
ip6_init(void)
{
+ INIT_VNET_INET6(curvnet);
struct ip6protosw *pr;
int i;
+#ifdef IP6_AUTO_LINKLOCAL
+ V_ip6_auto_linklocal = IP6_AUTO_LINKLOCAL;
+#else
+ V_ip6_auto_linklocal = 1; /* enable by default */
+#endif
+
scope6_init();
addrsel_policy_init();
nd6_init();
==== //depot/projects/vimage/src/sys/netinet6/nd6.c#16 (text+ko) ====
@@ -210,6 +210,7 @@
void
nd6_setmtu0(struct ifnet *ifp, struct nd_ifinfo *ndi)
{
+ INIT_VNET_INET6(ifp->if_vnet);
u_int32_t omaxmtu;
omaxmtu = ndi->maxmtu;
@@ -241,7 +242,7 @@
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 */
}
==== //depot/projects/vimage/src/sys/netinet6/vinet6.h#9 (text+ko) ====
@@ -64,6 +64,8 @@
struct in6_addrpolicy _defaultaddrpolicy;
TAILQ_HEAD(, addrsel_policyent) _addrsel_policytab;
+ u_int _in6_maxmtu;
+ int _ip6_auto_linklocal;
struct ip6stat _ip6stat;
struct rip6stat _rip6stat;
@@ -105,6 +107,8 @@
#define V_defaultaddrpolicy VNET_INET6(defaultaddrpolicy)
#define V_addrsel_policytab VNET_INET6(addrsel_policytab)
+#define V_in6_maxmtu VNET_INET6(in6_maxmtu)
+#define V_ip6_auto_linklocal VNET_INET6(ip6_auto_linklocal)
#define V_ip6stat VNET_INET6(ip6stat)
#define V_rip6stat VNET_INET6(rip6stat)
More information about the p4-projects
mailing list