Date: Mon, 28 Nov 2011 19:53:16 +0000 (UTC) From: Qing Li <qingli@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r228092 - stable/8/sys/netinet6 Message-ID: <201111281953.pASJrG1Y006350@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: qingli Date: Mon Nov 28 19:53:16 2011 New Revision: 228092 URL: http://svn.freebsd.org/changeset/base/228092 Log: MFC 227460 A default route learned from the RAs could be deleted manually after its installation. This removal may be accidental and can prevent the default route from being installed in the future if the associated default router has the best preference. The cause is the lack of status update in the default router on the state of its route installation in the kernel FIB. This patch fixes the described problem. Reviewed by: hrs, discussed with hrs Modified: stable/8/sys/netinet6/in6.c stable/8/sys/netinet6/nd6.c stable/8/sys/netinet6/nd6.h stable/8/sys/netinet6/nd6_rtr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/netinet6/in6.c ============================================================================== --- stable/8/sys/netinet6/in6.c Mon Nov 28 19:48:04 2011 (r228091) +++ stable/8/sys/netinet6/in6.c Mon Nov 28 19:53:16 2011 (r228092) @@ -1802,7 +1802,7 @@ in6_ifinit(struct ifnet *ifp, struct in6 struct sockaddr_in6 mask, addr; IF_AFDATA_LOCK(ifp); - ia->ia_ifa.ifa_rtrequest = NULL; + ia->ia_ifa.ifa_rtrequest = nd6_rtrequest; /* XXX QL * we need to report rt_newaddrmsg Modified: stable/8/sys/netinet6/nd6.c ============================================================================== --- stable/8/sys/netinet6/nd6.c Mon Nov 28 19:48:04 2011 (r228091) +++ stable/8/sys/netinet6/nd6.c Mon Nov 28 19:53:16 2011 (r228092) @@ -1170,6 +1170,46 @@ done: } +/* + * Rejuvenate this function for routing operations related + * processing. + */ +void +nd6_rtrequest(int req, struct rtentry *rt, struct rt_addrinfo *info) +{ + struct sockaddr_in6 *gateway = (struct sockaddr_in6 *)rt->rt_gateway; + struct nd_defrouter *dr; + struct ifnet *ifp = rt->rt_ifp; + + RT_LOCK_ASSERT(rt); + + switch (req) { + case RTM_ADD: + break; + + case RTM_DELETE: + if (!ifp) + return; + /* + * Only indirect routes are interesting. + */ + if ((rt->rt_flags & RTF_GATEWAY) == 0) + return; + /* + * check for default route + */ + if (IN6_ARE_ADDR_EQUAL(&in6addr_any, + &SIN6(rt_key(rt))->sin6_addr)) { + + dr = defrouter_lookup(&gateway->sin6_addr, ifp); + if (dr != NULL) + dr->installed = 0; + } + break; + } +} + + int nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) { Modified: stable/8/sys/netinet6/nd6.h ============================================================================== --- stable/8/sys/netinet6/nd6.h Mon Nov 28 19:48:04 2011 (r228091) +++ stable/8/sys/netinet6/nd6.h Mon Nov 28 19:53:16 2011 (r228092) @@ -404,6 +404,7 @@ void nd6_purge __P((struct ifnet *)); void nd6_nud_hint __P((struct rtentry *, struct in6_addr *, int)); int nd6_resolve __P((struct ifnet *, struct rtentry *, struct mbuf *, struct sockaddr *, u_char *)); +void nd6_rtrequest __P((int, struct rtentry *, struct rt_addrinfo *)); int nd6_ioctl __P((u_long, caddr_t, struct ifnet *)); struct llentry *nd6_cache_lladdr __P((struct ifnet *, struct in6_addr *, char *, int, int, int)); Modified: stable/8/sys/netinet6/nd6_rtr.c ============================================================================== --- stable/8/sys/netinet6/nd6_rtr.c Mon Nov 28 19:48:04 2011 (r228091) +++ stable/8/sys/netinet6/nd6_rtr.c Mon Nov 28 19:53:16 2011 (r228092) @@ -755,9 +755,10 @@ defrtrlist_update(struct nd_defrouter *n /* * If the preference does not change, there's no need - * to sort the entries. + * to sort the entries. Also make sure the selected + * router is still installed in the kernel. */ - if (rtpref(new) == oldpref) { + if (dr->installed && rtpref(new) == oldpref) { splx(s); return (dr); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201111281953.pASJrG1Y006350>