Author: melifaro
Date: Sat Jan  9 11:41:37 2016
New Revision: 293471
URL: https://svnweb.freebsd.org/changeset/base/293471

Log:
  Remove prefix check from in6_addroute().
  
  This check was added in initial? netinet6/ import
    back in 1999 (r53541).
  It effectively became unnecessary after 'address/prefix clean-ups'
    KAME commit 90ff8792e676132096a440dd787f99a5a5860ee8 (github) in 2001
    (merged to FreeBSD in r78064) where prefix check was added to
    nd6_prefix_onlink(). Similar IPv4 check (in_addroute() was added
    in r137628).
  Additionally, the right plance for this (or similar) check is the prefix
    addition code (nd6_prefix_onlink(), nd6_prefix_onlink_rtrequest(),
    in_addprefix() or rtinit()), but not the generic radix insert routine.

Modified:
  head/sys/netinet6/in6_rmx.c

Modified: head/sys/netinet6/in6_rmx.c
==============================================================================
--- head/sys/netinet6/in6_rmx.c Sat Jan  9 09:34:39 2016        (r293470)
+++ head/sys/netinet6/in6_rmx.c Sat Jan  9 11:41:37 2016        (r293471)
@@ -107,7 +107,6 @@ in6_addroute(void *v_arg, void *n_arg, s
 {
        struct rtentry *rt = (struct rtentry *)treenodes;
        struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)rt_key(rt);
-       struct radix_node *ret;
 
        RADIX_NODE_HEAD_WLOCK_ASSERT(head);
        if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
@@ -148,34 +147,7 @@ in6_addroute(void *v_arg, void *n_arg, s
                        rt->rt_mtu = IN6_LINKMTU(rt->rt_ifp);
        }
 
-       ret = rn_addroute(v_arg, n_arg, head, treenodes);
-       if (ret == NULL) {
-               struct rtentry *rt2;
-               /*
-                * We are trying to add a net route, but can't.
-                * The following case should be allowed, so we'll make a
-                * special check for this:
-                *      Two IPv6 addresses with the same prefix is assigned
-                *      to a single interrface.
-                *      # ifconfig if0 inet6 3ffe:0501::1 prefix 64 alias (*1)
-                *      # ifconfig if0 inet6 3ffe:0501::2 prefix 64 alias (*2)
-                *      In this case, (*1) and (*2) want to add the same
-                *      net route entry, 3ffe:0501:: -> if0.
-                *      This case should not raise an error.
-                */
-               rt2 = in6_rtalloc1((struct sockaddr *)sin6, 0, RTF_RNH_LOCKED,
-                   rt->rt_fibnum);
-               if (rt2) {
-                       if (((rt2->rt_flags & (RTF_HOST|RTF_GATEWAY)) == 0)
-                        && rt2->rt_gateway
-                        && rt2->rt_gateway->sa_family == AF_LINK
-                        && rt2->rt_ifp == rt->rt_ifp) {
-                               ret = rt2->rt_nodes;
-                       }
-                       RTFREE_LOCKED(rt2);
-               }
-       }
-       return (ret);
+       return (rn_addroute(v_arg, n_arg, head, treenodes));
 }
 
 /*
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to