From owner-p4-projects@FreeBSD.ORG Sat Aug 18 18:19:07 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 411F916A420; Sat, 18 Aug 2007 18:19:07 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB36816A41B for ; Sat, 18 Aug 2007 18:19:06 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id C9F5F13C474 for ; Sat, 18 Aug 2007 18:19:06 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l7IIJ628064687 for ; Sat, 18 Aug 2007 18:19:06 GMT (envelope-from zec@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l7IIJ660064684 for perforce@freebsd.org; Sat, 18 Aug 2007 18:19:06 GMT (envelope-from zec@FreeBSD.org) Date: Sat, 18 Aug 2007 18:19:06 GMT Message-Id: <200708181819.l7IIJ660064684@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to zec@FreeBSD.org using -f From: Marko Zec To: Perforce Change Reviews Cc: Subject: PERFORCE change 125321 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Aug 2007 18:19:07 -0000 http://perforce.freebsd.org/chv.cgi?CH=125321 Change 125321 by zec@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 #include -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)