Date: Thu, 11 Dec 2008 02:47:42 +0000 (UTC) From: Kip Macy <kmacy@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r185905 - in projects/arpv2_merge_1/sys: net netinet netinet6 Message-ID: <200812110247.mBB2lgJP051204@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kmacy Date: Thu Dec 11 02:47:41 2008 New Revision: 185905 URL: http://svn.freebsd.org/changeset/base/185905 Log: Remove all vestiges of cloning: - the flags: RTF_CLONING, RTF_LLINFO, RTF_WASCLONED - routines only used to cleanup children of a cloning route Modified: projects/arpv2_merge_1/sys/net/radix_mpath.c projects/arpv2_merge_1/sys/net/route.c projects/arpv2_merge_1/sys/net/route.h projects/arpv2_merge_1/sys/net/rtsock.c projects/arpv2_merge_1/sys/netinet/in.c projects/arpv2_merge_1/sys/netinet/in_mcast.c projects/arpv2_merge_1/sys/netinet/in_pcb.c projects/arpv2_merge_1/sys/netinet/in_rmx.c projects/arpv2_merge_1/sys/netinet/ip_fastfwd.c projects/arpv2_merge_1/sys/netinet/ip_input.c projects/arpv2_merge_1/sys/netinet/tcp_subr.c projects/arpv2_merge_1/sys/netinet6/in6.c projects/arpv2_merge_1/sys/netinet6/in6_rmx.c projects/arpv2_merge_1/sys/netinet6/in6_src.c projects/arpv2_merge_1/sys/netinet6/ip6_output.c projects/arpv2_merge_1/sys/netinet6/ip6_var.h projects/arpv2_merge_1/sys/netinet6/nd6_rtr.c Modified: projects/arpv2_merge_1/sys/net/radix_mpath.c ============================================================================== --- projects/arpv2_merge_1/sys/net/radix_mpath.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/net/radix_mpath.c Thu Dec 11 02:47:41 2008 (r185905) @@ -266,8 +266,8 @@ rtalloc_mpath_fib(struct route *ro, u_in * be done for sendto(3) case? */ if (ro->ro_rt && ro->ro_rt->rt_ifp && (ro->ro_rt->rt_flags & RTF_UP)) - return; /* XXX */ - ro->ro_rt = rtalloc1_fib(&ro->ro_dst, 1, RTF_CLONING, fibnum); + return; + ro->ro_rt = rtalloc1_fib(&ro->ro_dst, 1, 0, fibnum); /* if the route does not exist or it is not multipath, don't care */ if (ro->ro_rt == NULL) Modified: projects/arpv2_merge_1/sys/net/route.c ============================================================================== --- projects/arpv2_merge_1/sys/net/route.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/net/route.c Thu Dec 11 02:47:41 2008 (r185905) @@ -271,8 +271,7 @@ rtalloc1_fib(struct sockaddr *dst, int r struct radix_node *rn; struct rtentry *newrt; struct rt_addrinfo info; - u_long nflags; - int needresolve = 0, err = 0, msgtype = RTM_MISS; + int err = 0, msgtype = RTM_MISS; int needlock; KASSERT((fibnum < rt_numfibs), ("rtalloc1_fib: bad fibnum")); @@ -285,10 +284,9 @@ rtalloc1_fib(struct sockaddr *dst, int r */ if (rnh == NULL) { V_rtstat.rts_unreach++; - goto miss2; + goto miss; } needlock = !(ignflags & RTF_RNH_LOCKED); -retry: if (needlock) RADIX_NODE_HEAD_RLOCK(rnh); #ifdef INVARIANTS @@ -297,103 +295,33 @@ retry: #endif rn = rnh->rnh_matchaddr(dst, rnh); if (rn && ((rn->rn_flags & RNF_ROOT) == 0)) { - newrt = rt = RNTORT(rn); - nflags = rt->rt_flags & ~ignflags; - if (report && (nflags & RTF_CLONING)) { - if (needlock && !RADIX_NODE_HEAD_LOCK_TRY_UPGRADE(rnh)) { - RADIX_NODE_HEAD_RUNLOCK(rnh); - RADIX_NODE_HEAD_LOCK(rnh); - /* - * lookup again to make sure it wasn't changed - */ - rn = rnh->rnh_matchaddr(dst, rnh); - if (!(rn && ((rn->rn_flags & RNF_ROOT) == 0))) { - RADIX_NODE_HEAD_UNLOCK(rnh); - needresolve = 0; - log(LOG_INFO, "retrying route lookup ...\n"); - goto retry; - } - } - needresolve = 1; - } else { - RT_LOCK(newrt); - RT_ADDREF(newrt); - if (needlock) - RADIX_NODE_HEAD_RUNLOCK(rnh); - goto done; - } - } - /* - * if needresolve is set then we have the exclusive lock - * and we need to keep it held for the benefit of rtrequest_fib - */ - if (!needresolve && needlock) - RADIX_NODE_HEAD_RUNLOCK(rnh); - - if (needresolve) { - RADIX_NODE_HEAD_WLOCK_ASSERT(rnh); - /* - * We are apparently adding (report = 0 in delete). - * If it requires that it be cloned, do so. - * (This implies it wasn't a HOST route.) - */ - err = rtrequest_fib(RTM_RESOLVE, dst, NULL, - NULL, RTF_RNH_LOCKED, &newrt, fibnum); - if (err) { - /* - * If the cloning didn't succeed, maybe - * what we have will do. Return that. - */ - newrt = rt; /* existing route */ - RT_LOCK(newrt); - RT_ADDREF(newrt); - goto miss; - } - KASSERT(newrt, ("no route and no error")); RT_LOCK(newrt); - if (newrt->rt_flags & RTF_XRESOLVE) { - /* - * If the new route specifies it be - * externally resolved, then go do that. - */ - msgtype = RTM_RESOLVE; - goto miss; - } - /* Inform listeners of the new route. */ - bzero(&info, sizeof(info)); - info.rti_info[RTAX_DST] = rt_key(newrt); - info.rti_info[RTAX_NETMASK] = rt_mask(newrt); - info.rti_info[RTAX_GATEWAY] = newrt->rt_gateway; - if (newrt->rt_ifp != NULL) { - info.rti_info[RTAX_IFP] = - newrt->rt_ifp->if_addr->ifa_addr; - info.rti_info[RTAX_IFA] = newrt->rt_ifa->ifa_addr; - } - rt_missmsg(RTM_ADD, &info, newrt->rt_flags, 0); + RT_ADDREF(newrt); if (needlock) - RADIX_NODE_HEAD_UNLOCK(rnh); - } else { - /* - * Either we hit the root or couldn't find any match, - * Which basically means - * "caint get there frm here" + RADIX_NODE_HEAD_RUNLOCK(rnh); + goto done; + + } else if (needlock) + RADIX_NODE_HEAD_RUNLOCK(rnh); + + /* + * Either we hit the root or couldn't find any match, + * Which basically means + * "caint get there frm here" + */ + V_rtstat.rts_unreach++; +miss: + if (report) { + /* + * If required, report the failure to the supervising + * Authorities. + * For a delete, this is not an error. (report == 0) */ - V_rtstat.rts_unreach++; - miss: - if (needlock && needresolve) - RADIX_NODE_HEAD_UNLOCK(rnh); - miss2: if (report) { - /* - * If required, report the failure to the supervising - * Authorities. - * For a delete, this is not an error. (report == 0) - */ - bzero(&info, sizeof(info)); - info.rti_info[RTAX_DST] = dst; - rt_missmsg(msgtype, &info, 0, err); - } - } + bzero(&info, sizeof(info)); + info.rti_info[RTAX_DST] = dst; + rt_missmsg(msgtype, &info, 0, err); + } done: if (newrt) RT_LOCK_ASSERT(newrt); @@ -717,14 +645,6 @@ ifa_ifwithroute_fib(int flags, struct so return (ifa); } -static walktree_f_t rt_fixdelete; -static walktree_f_t rt_fixchange; - -struct rtfc_arg { - struct rtentry *rt0; - struct radix_node_head *rnh; -}; - /* * Do appropriate manipulations of a routing tree given * all the bits of info needed @@ -865,14 +785,6 @@ rtexpunge(struct rtentry *rt) rt->rt_flags &= ~RTF_UP; /* - * Now search what's left of the subtree for any cloned - * routes which might have been formed from this node. - */ - if ((rt->rt_flags & RTF_CLONING) && rt_mask(rt)) - rnh->rnh_walktree_from(rnh, rt_key(rt), rt_mask(rt), - rt_fixdelete, rt); - - /* * Remove any external references we may have. * This might result in another rtentry being freed if * we held its last reference. @@ -943,10 +855,9 @@ rtrequest1_fib(int req, struct rt_addrin * If we are adding a host route then we don't want to put * a netmask in the tree, nor do we want to clone it. */ - if (flags & RTF_HOST) { + if (flags & RTF_HOST) netmask = NULL; - flags &= ~RTF_CLONING; - } + switch (req) { case RTM_DELETE: #ifdef RADIX_MPATH @@ -1025,16 +936,6 @@ normal_rtdel: rt->rt_flags &= ~RTF_UP; /* - * Now search what's left of the subtree for any cloned - * routes which might have been formed from this node. - */ - if ((rt->rt_flags & RTF_CLONING) && - rt_mask(rt)) { - rnh->rnh_walktree_from(rnh, dst, rt_mask(rt), - rt_fixdelete, rt); - } - - /* * Remove any external references we may have. * This might result in another rtentry being freed if * we held its last reference. @@ -1071,20 +972,12 @@ deldone: } else RTFREE_LOCKED(rt); break; - case RTM_RESOLVE: - if (ret_nrt == NULL || (rt = *ret_nrt) == NULL) - senderr(EINVAL); - ifa = rt->rt_ifa; - /* XXX locking? */ - flags = rt->rt_flags & - ~(RTF_CLONING | RTF_STATIC); - flags |= RTF_WASCLONED; - gateway = rt->rt_gateway; - if ((netmask = rt->rt_genmask) == NULL) - flags |= RTF_HOST; - goto makeroute; - + /* + * resolve is only used for route cloning + * + */ + senderr(EINVAL); case RTM_ADD: if ((flags & RTF_GATEWAY) && !gateway) senderr(EINVAL); @@ -1095,8 +988,6 @@ deldone: if (info->rti_ifa == NULL && (error = rt_getifa_fib(info, fibnum))) senderr(error); ifa = info->rti_ifa; - - makeroute: rt = uma_zalloc(rtzone, M_NOWAIT | M_ZERO); if (rt == NULL) senderr(ENOBUFS); @@ -1154,26 +1045,6 @@ deldone: /* XXX mtu manipulation will be done in rnh_addaddr -- itojun */ rn = rnh->rnh_addaddr(ndst, netmask, rnh, rt->rt_nodes); - if (rn == NULL) { - struct rtentry *rt2; - /* - * Uh-oh, we already have one of these in the tree. - * We do a special hack: if the route that's already - * there was generated by the cloning mechanism - * then we just blow it away and retry the insertion - * of the new one. - */ - rt2 = rtalloc1_fib(dst, 0, 0, fibnum); - if (rt2 && rt2->rt_parent) { - rtexpunge(rt2); - RT_UNLOCK(rt2); - rn = rnh->rnh_addaddr(ndst, netmask, - rnh, rt->rt_nodes); - } else if (rt2) { - /* undo the extra ref we got */ - RTFREE_LOCKED(rt2); - } - } /* * If it still failed to go into the tree, @@ -1191,32 +1062,6 @@ deldone: } rt->rt_parent = NULL; - - /* - * If we got here from RESOLVE, then we are cloning - * so clone the rest, and note that we - * are a clone (and increment the parent's references) - */ - if (req == RTM_RESOLVE) { - KASSERT(ret_nrt && *ret_nrt, - ("no route to clone from")); - rt->rt_rmx = (*ret_nrt)->rt_rmx; /* copy metrics */ - rt->rt_rmx.rmx_pksent = 0; /* reset packet counter */ - if ((*ret_nrt)->rt_flags & RTF_CLONING) { - /* - * NB: We do not bump the refcnt on the parent - * entry under the assumption that it will - * remain so long as we do. This is - * important when deleting the parent route - * as this operation requires traversing - * the tree to delete all clones and futzing - * with refcnts requires us to double-lock - * parent through this back reference. - */ - rt->rt_parent = *ret_nrt; - } - } - /* * If this protocol has something to add to this then * allow it to do that as well. @@ -1225,20 +1070,6 @@ deldone: ifa->ifa_rtrequest(req, rt, info); /* - * We repeat the same procedure from rt_setgate() here because - * it doesn't fire when we call it there because the node - * hasn't been added to the tree yet. - */ - if (req == RTM_ADD && - !(rt->rt_flags & RTF_HOST) && rt_mask(rt) != NULL) { - struct rtfc_arg arg; - arg.rnh = rnh; - arg.rt0 = rt; - rnh->rnh_walktree_from(rnh, rt_key(rt), rt_mask(rt), - rt_fixchange, &arg); - } - - /* * actually return a resultant rtentry and * give the caller a single reference. */ @@ -1265,90 +1096,6 @@ bad: #undef ifpaddr #undef flags -/* - * Called from rtrequest(RTM_DELETE, ...) to fix up the route's ``family'' - * (i.e., the routes related to it by the operation of cloning). This - * routine is iterated over all potential former-child-routes by way of - * rnh->rnh_walktree_from() above, and those that actually are children of - * the late parent (passed in as VP here) are themselves deleted. - */ -static int -rt_fixdelete(struct radix_node *rn, void *vp) -{ - struct rtentry *rt = RNTORT(rn); - struct rtentry *rt0 = vp; - - if (rt->rt_parent == rt0 && - !(rt->rt_flags & (RTF_PINNED | RTF_CLONING))) { - return rtrequest_fib(RTM_DELETE, rt_key(rt), NULL, rt_mask(rt), - rt->rt_flags|RTF_RNH_LOCKED, NULL, rt->rt_fibnum); - } - return 0; -} - -/* - * This routine is called from rt_setgate() to do the analogous thing for - * adds and changes. There is the added complication in this case of a - * middle insert; i.e., insertion of a new network route between an older - * network route and (cloned) host routes. For this reason, a simple check - * of rt->rt_parent is insufficient; each candidate route must be tested - * against the (mask, value) of the new route (passed as before in vp) - * to see if the new route matches it. - * - * XXX - it may be possible to do fixdelete() for changes and reserve this - * routine just for adds. I'm not sure why I thought it was necessary to do - * changes this way. - */ - -static int -rt_fixchange(struct radix_node *rn, void *vp) -{ - struct rtentry *rt = RNTORT(rn); - struct rtfc_arg *ap = vp; - struct rtentry *rt0 = ap->rt0; - struct radix_node_head *rnh = ap->rnh; - u_char *xk1, *xm1, *xk2, *xmp; - int i, len, mlen; - - /* make sure we have a parent, and route is not pinned or cloning */ - if (!rt->rt_parent || - (rt->rt_flags & (RTF_PINNED | RTF_CLONING))) - return 0; - - if (rt->rt_parent == rt0) /* parent match */ - goto delete_rt; - /* - * There probably is a function somewhere which does this... - * if not, there should be. - */ - len = imin(rt_key(rt0)->sa_len, rt_key(rt)->sa_len); - - xk1 = (u_char *)rt_key(rt0); - xm1 = (u_char *)rt_mask(rt0); - xk2 = (u_char *)rt_key(rt); - - /* avoid applying a less specific route */ - xmp = (u_char *)rt_mask(rt->rt_parent); - mlen = rt_key(rt->rt_parent)->sa_len; - if (mlen > rt_key(rt0)->sa_len) /* less specific route */ - return 0; - for (i = rnh->rnh_treetop->rn_offset; i < mlen; i++) - if ((xmp[i] & ~(xmp[i] ^ xm1[i])) != xmp[i]) - return 0; /* less specific route */ - - for (i = rnh->rnh_treetop->rn_offset; i < len; i++) - if ((xk2[i] & xm1[i]) != xk1[i]) - return 0; /* no match */ - - /* - * OK, this node is a clone, and matches the node currently being - * changed/added under the node's mask. So, get rid of it. - */ -delete_rt: - return rtrequest_fib(RTM_DELETE, rt_key(rt), NULL, - rt_mask(rt), rt->rt_flags, NULL, rt->rt_fibnum); -} - int rt_setgate(struct rtentry *rt, struct sockaddr *dst, struct sockaddr *gate) { @@ -1363,24 +1110,6 @@ again: RADIX_NODE_HEAD_LOCK_ASSERT(rnh); /* - * A host route with the destination equal to the gateway - * will interfere with keeping LLINFO in the routing - * table, so disallow it. - */ - if (((rt->rt_flags & (RTF_HOST|RTF_GATEWAY|RTF_LLINFO)) == - (RTF_HOST|RTF_GATEWAY)) && - dst->sa_len == gate->sa_len && - bcmp(dst, gate, dst->sa_len) == 0) { - /* - * The route might already exist if this is an RTM_CHANGE - * or a routing redirect, so try to delete it. - */ - if (rt_key(rt)) - rtexpunge(rt); - return EADDRNOTAVAIL; - } - - /* * Cloning loop avoidance in case of bad configuration. */ if (rt->rt_flags & RTF_GATEWAY) { @@ -1448,21 +1177,7 @@ again: */ bcopy(gate, rt->rt_gateway, glen); - /* - * This isn't going to do anything useful for host routes, so - * don't bother. Also make sure we have a reasonable mask - * (we don't yet have one during adds). - */ - if (!(rt->rt_flags & RTF_HOST) && rt_mask(rt) != 0) { - struct rtfc_arg arg; - - arg.rnh = rnh; - arg.rt0 = rt; - rnh->rnh_walktree_from(rnh, rt_key(rt), rt_mask(rt), - rt_fixchange, &arg); - } - - return 0; + return (0); } static void Modified: projects/arpv2_merge_1/sys/net/route.h ============================================================================== --- projects/arpv2_merge_1/sys/net/route.h Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/net/route.h Thu Dec 11 02:47:41 2008 (r185905) @@ -143,7 +143,7 @@ struct rtentry { struct sockaddr *rt_genmask; /* for generation of cloned routes */ caddr_t rt_llinfo; /* pointer to link level info cache */ struct rtentry *rt_gwroute; /* implied entry for gatewayed routes */ - struct rtentry *rt_parent; /* cloning parent of this route */ + struct rtentry *rt_parent; /* cloning parent - UNUSED */ u_int rt_fibnum; /* which FIB */ #ifdef _KERNEL /* XXX ugly, user apps use this definition but don't have a mtx def */ @@ -175,9 +175,9 @@ struct ortentry { #define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */ #define RTF_DONE 0x40 /* message confirmed */ /* 0x80 unused, was RTF_DELCLONE */ -#define RTF_CLONING 0x100 /* generate new routes on use */ +/* 0x100 unused, was RTF_CLONING */ #define RTF_XRESOLVE 0x200 /* external daemon resolves name */ -#define RTF_LLINFO 0x400 /* generated by link layer (e.g. ARP) */ +/* 0x400 unused, was RTF_LLINFO */ #define RTF_STATIC 0x800 /* manually added */ #define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */ #define RTF_PROTO2 0x4000 /* protocol specific routing flag */ @@ -188,7 +188,7 @@ struct ortentry { #define RTF_PRCLONING 0x10000 /* unused, for compatibility */ #endif -#define RTF_WASCLONED 0x20000 /* route generated through cloning */ +/* 0x20000 unused, was RTF_WASCLONED */ #define RTF_PROTO3 0x40000 /* protocol specific routing flag */ /* 0x80000 unused */ #define RTF_PINNED 0x100000 /* future use */ Modified: projects/arpv2_merge_1/sys/net/rtsock.c ============================================================================== --- projects/arpv2_merge_1/sys/net/rtsock.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/net/rtsock.c Thu Dec 11 02:47:41 2008 (r185905) @@ -703,8 +703,7 @@ route_output(struct mbuf *m, struct sock RT_UNLOCK(rt); senderr(error); } - if (!(rt->rt_flags & RTF_LLINFO)) - rt->rt_flags |= RTF_GATEWAY; + rt->rt_flags |= RTF_GATEWAY; } if (info.rti_ifa != NULL && info.rti_ifa != rt->rt_ifa) { @@ -1447,7 +1446,7 @@ sysctl_rtsock(SYSCTL_HANDLER_ARGS) /* * take care of llinfo entries */ - if (w.w_op == NET_RT_FLAGS && (RTF_LLINFO & w.w_arg)) + if (w.w_op == NET_RT_FLAGS) error = lltable_sysctl_dumparp(af, w.w_req); break; Modified: projects/arpv2_merge_1/sys/netinet/in.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/in.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet/in.c Thu Dec 11 02:47:41 2008 (r185905) @@ -1218,7 +1218,7 @@ in_lltable_dump(struct lltable *llt, str } arpc.rtm.rtm_rmx.rmx_expire = lle->la_flags & LLE_STATIC ? 0 : lle->la_expire; - arpc.rtm.rtm_flags |= RTF_LLINFO | RTF_HOST; + arpc.rtm.rtm_flags |= RTF_HOST; if (lle->la_flags & LLE_STATIC) arpc.rtm.rtm_flags |= RTF_STATIC; arpc.rtm.rtm_index = ifp->if_index; Modified: projects/arpv2_merge_1/sys/netinet/in_mcast.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/in_mcast.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet/in_mcast.c Thu Dec 11 02:47:41 2008 (r185905) @@ -1036,7 +1036,7 @@ inp_join_group(struct inpcb *inp, struct ro.ro_rt = NULL; *(struct sockaddr_in *)&ro.ro_dst = gsa->sin; - in_rtalloc_ign(&ro, RTF_CLONING, + in_rtalloc_ign(&ro, 0, inp->inp_inc.inc_fibnum); if (ro.ro_rt != NULL) { ifp = ro.ro_rt->rt_ifp; Modified: projects/arpv2_merge_1/sys/netinet/in_pcb.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/in_pcb.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet/in_pcb.c Thu Dec 11 02:47:41 2008 (r185905) @@ -572,7 +572,7 @@ in_pcbladdr(struct inpcb *inp, struct in * Find out route to destination. */ if ((inp->inp_socket->so_options & SO_DONTROUTE) == 0) - in_rtalloc_ign(&sro, RTF_CLONING, inp->inp_inc.inc_fibnum); + in_rtalloc_ign(&sro, 0, inp->inp_inc.inc_fibnum); /* * If we found a route, use the address corresponding to Modified: projects/arpv2_merge_1/sys/netinet/in_rmx.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/in_rmx.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet/in_rmx.c Thu Dec 11 02:47:41 2008 (r185905) @@ -75,7 +75,6 @@ in_addroute(void *v_arg, void *n_arg, st { struct rtentry *rt = (struct rtentry *)treenodes; struct sockaddr_in *sin = (struct sockaddr_in *)rt_key(rt); - struct radix_node *ret; /* * A little bit of help for both IP output and input: @@ -106,31 +105,7 @@ in_addroute(void *v_arg, void *n_arg, st if (!rt->rt_rmx.rmx_mtu && rt->rt_ifp) rt->rt_rmx.rmx_mtu = rt->rt_ifp->if_mtu; - ret = rn_addroute(v_arg, n_arg, head, treenodes); - if (ret == NULL && rt->rt_flags & RTF_HOST) { - struct rtentry *rt2; - /* - * We are trying to add a host route, but can't. - * Find out if it is because of an - * ARP entry and delete it if so. - */ - rt2 = in_rtalloc1((struct sockaddr *)sin, 0, - RTF_CLONING, rt->rt_fibnum); - if (rt2) { - if (rt2->rt_flags & RTF_LLINFO && - rt2->rt_flags & RTF_HOST && - rt2->rt_gateway && - rt2->rt_gateway->sa_family == AF_LINK) { - rtexpunge(rt2); - RTFREE_LOCKED(rt2); - ret = rn_addroute(v_arg, n_arg, head, - treenodes); - } else - RTFREE_LOCKED(rt2); - } - } - - return ret; + return (rn_addroute(v_arg, n_arg, head, treenodes)); } /* @@ -187,13 +162,10 @@ in_clsroute(struct radix_node *rn, struc if (!(rt->rt_flags & RTF_UP)) return; /* prophylactic measures */ - if ((rt->rt_flags & (RTF_LLINFO | RTF_HOST)) != RTF_HOST) - return; - if (rt->rt_flags & RTPRF_OURS) return; - if (!(rt->rt_flags & (RTF_WASCLONED | RTF_DYNAMIC))) + if (!(rt->rt_flags & RTF_DYNAMIC)) return; /* @@ -434,7 +406,6 @@ in_ifadownkill(struct radix_node *rn, vo * the routes that rtrequest() would have in any case, * so that behavior is not needed there. */ - rt->rt_flags &= ~RTF_CLONING; rtexpunge(rt); } RT_UNLOCK(rt); Modified: projects/arpv2_merge_1/sys/netinet/ip_fastfwd.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/ip_fastfwd.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet/ip_fastfwd.c Thu Dec 11 02:47:41 2008 (r185905) @@ -128,7 +128,7 @@ ip_findroute(struct route *ro, struct in dst->sin_family = AF_INET; dst->sin_len = sizeof(*dst); dst->sin_addr.s_addr = dest.s_addr; - in_rtalloc_ign(ro, RTF_CLONING, M_GETFIB(m)); + in_rtalloc_ign(ro, 0, M_GETFIB(m)); /* * Route there and interface still up? Modified: projects/arpv2_merge_1/sys/netinet/ip_input.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/ip_input.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet/ip_input.c Thu Dec 11 02:47:41 2008 (r185905) @@ -1272,7 +1272,7 @@ ip_rtaddr(struct in_addr dst, u_int fibn sin->sin_family = AF_INET; sin->sin_len = sizeof(*sin); sin->sin_addr = dst; - in_rtalloc_ign(&sro, RTF_CLONING, fibnum); + in_rtalloc_ign(&sro, 0, fibnum); if (sro.ro_rt == NULL) return (NULL); @@ -1398,7 +1398,7 @@ ip_forward(struct mbuf *m, int srcrt) sin->sin_family = AF_INET; sin->sin_len = sizeof(*sin); sin->sin_addr = ip->ip_dst; - in_rtalloc_ign(&ro, RTF_CLONING, M_GETFIB(m)); + in_rtalloc_ign(&ro, 0, M_GETFIB(m)); rt = ro.ro_rt; Modified: projects/arpv2_merge_1/sys/netinet/tcp_subr.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/tcp_subr.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet/tcp_subr.c Thu Dec 11 02:47:41 2008 (r185905) @@ -1657,7 +1657,7 @@ tcp_maxmtu(struct in_conninfo *inc, int dst->sin_family = AF_INET; dst->sin_len = sizeof(*dst); dst->sin_addr = inc->inc_faddr; - in_rtalloc_ign(&sro, RTF_CLONING, inc->inc_fibnum); + in_rtalloc_ign(&sro, 0, inc->inc_fibnum); } if (sro.ro_rt != NULL) { ifp = sro.ro_rt->rt_ifp; @@ -1692,7 +1692,7 @@ tcp_maxmtu6(struct in_conninfo *inc, int sro6.ro_dst.sin6_family = AF_INET6; sro6.ro_dst.sin6_len = sizeof(struct sockaddr_in6); sro6.ro_dst.sin6_addr = inc->inc6_faddr; - rtalloc_ign((struct route *)&sro6, RTF_CLONING); + rtalloc_ign((struct route *)&sro6, 0); } if (sro6.ro_rt != NULL) { ifp = sro6.ro_rt->rt_ifp; Modified: projects/arpv2_merge_1/sys/netinet6/in6.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/in6.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet6/in6.c Thu Dec 11 02:47:41 2008 (r185905) @@ -987,10 +987,9 @@ in6_update_ifa(struct ifnet *ifp, struct } } if (!rt) { - /* XXX: we need RTF_CLONING to fake nd6_rtrequest */ error = rtrequest(RTM_ADD, (struct sockaddr *)&mltaddr, (struct sockaddr *)&ia->ia_addr, - (struct sockaddr *)&mltmask, RTF_UP | RTF_CLONING, + (struct sockaddr *)&mltmask, RTF_UP, (struct rtentry **)0); if (error) goto cleanup; @@ -1064,7 +1063,7 @@ in6_update_ifa(struct ifnet *ifp, struct if (!rt) { error = rtrequest(RTM_ADD, (struct sockaddr *)&mltaddr, (struct sockaddr *)&ia->ia_addr, - (struct sockaddr *)&mltmask, RTF_UP | RTF_CLONING, + (struct sockaddr *)&mltmask, RTF_UP, (struct rtentry **)0); if (error) goto cleanup; @@ -1542,7 +1541,6 @@ in6_ifinit(struct ifnet *ifp, struct in6 struct rtentry *rt = NULL, **rtp = NULL; if (nd6_need_cache(ifp) != 0) { - rtflags |= RTF_LLINFO; rtp = &rt; } @@ -1571,12 +1569,6 @@ in6_ifinit(struct ifnet *ifp, struct in6 } ia->ia_flags |= IFA_ROUTE; } - if (plen < 128) { - /* - * The RTF_CLONING flag is necessary for in6_is_ifloop_auto(). - */ - ia->ia_ifa.ifa_flags |= RTF_CLONING; - } #else plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */ if (!(ia->ia_flags & IFA_ROUTE) && plen == 128 && @@ -1586,12 +1578,6 @@ in6_ifinit(struct ifnet *ifp, struct in6 return (error); ia->ia_flags |= IFA_ROUTE; } - if (plen < 128) { - /* - * The RTF_CLONING flag is necessary for in6_is_ifloop_auto(). - */ - ia->ia_ifa.ifa_flags |= RTF_CLONING; - } #endif /* Add ownaddr as loopback rtentry, if necessary (ex. on p2p link). */ @@ -2287,7 +2273,7 @@ in6_lltable_dump(struct lltable *llt, st } ndpc.rtm.rtm_rmx.rmx_expire = lle->la_flags & LLE_STATIC ? 0 : lle->la_expire; - ndpc.rtm.rtm_flags |= RTF_LLINFO | RTF_HOST; + ndpc.rtm.rtm_flags |= RTF_HOST; if (lle->la_flags & LLE_STATIC) ndpc.rtm.rtm_flags |= RTF_STATIC; ndpc.rtm.rtm_index = ifp->if_index; Modified: projects/arpv2_merge_1/sys/netinet6/in6_rmx.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/in6_rmx.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet6/in6_rmx.c Thu Dec 11 02:47:41 2008 (r185905) @@ -153,27 +153,7 @@ in6_addroute(void *v_arg, void *n_arg, s rt->rt_rmx.rmx_mtu = IN6_LINKMTU(rt->rt_ifp); ret = rn_addroute(v_arg, n_arg, head, treenodes); - if (ret == NULL && rt->rt_flags & RTF_HOST) { - struct rtentry *rt2; - /* - * We are trying to add a host route, but can't. - * Find out if it is because of an - * ARP entry and delete it if so. - */ - rt2 = rtalloc1((struct sockaddr *)sin6, 0, RTF_CLONING); - if (rt2) { - if (rt2->rt_flags & RTF_LLINFO && - rt2->rt_flags & RTF_HOST && - rt2->rt_gateway && - rt2->rt_gateway->sa_family == AF_LINK) { - rtexpunge(rt2); - RTFREE_LOCKED(rt2); - ret = rn_addroute(v_arg, n_arg, head, - treenodes); - } else - RTFREE_LOCKED(rt2); - } - } else if (ret == NULL && rt->rt_flags & RTF_CLONING) { + if (ret == NULL) { struct rtentry *rt2; /* * We are trying to add a net route, but can't. @@ -187,10 +167,9 @@ in6_addroute(void *v_arg, void *n_arg, s * net route entry, 3ffe:0501:: -> if0. * This case should not raise an error. */ - rt2 = rtalloc1((struct sockaddr *)sin6, 0, RTF_CLONING); + rt2 = rtalloc1((struct sockaddr *)sin6, 0, 0); if (rt2) { - if ((rt2->rt_flags & (RTF_CLONING|RTF_HOST|RTF_GATEWAY)) - == RTF_CLONING + 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) { @@ -199,7 +178,7 @@ in6_addroute(void *v_arg, void *n_arg, s RTFREE_LOCKED(rt2); } } - return ret; + return (ret); } /* @@ -255,12 +234,6 @@ in6_clsroute(struct radix_node *rn, stru if (!(rt->rt_flags & RTF_UP)) return; /* prophylactic measures */ - if ((rt->rt_flags & (RTF_LLINFO | RTF_HOST)) != RTF_HOST) - return; - - if ((rt->rt_flags & (RTF_WASCLONED | RTPRF_OURS)) != RTF_WASCLONED) - return; - /* * As requested by David Greenman: * If rtq_reallyold6 is 0, just delete the route without Modified: projects/arpv2_merge_1/sys/netinet6/in6_src.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/in6_src.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet6/in6_src.c Thu Dec 11 02:47:41 2008 (r185905) @@ -87,6 +87,7 @@ __FBSDID("$FreeBSD$"); #include <net/if.h> #include <net/route.h> +#include <net/if_llatbl.h> #ifdef RADIX_MPATH #include <net/radix_mpath.h> #endif @@ -131,7 +132,7 @@ int ip6_prefer_tempaddr; static int selectroute __P((struct sockaddr_in6 *, struct ip6_pktopts *, struct ip6_moptions *, struct route_in6 *, struct ifnet **, - struct rtentry **, int, int)); + struct rtentry **, int)); static int in6_selectif __P((struct sockaddr_in6 *, struct ip6_pktopts *, struct ip6_moptions *, struct route_in6 *ro, struct ifnet **)); @@ -479,8 +480,7 @@ in6_selectsrc(struct sockaddr_in6 *dstso static int selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, struct ip6_moptions *mopts, struct route_in6 *ro, - struct ifnet **retifp, struct rtentry **retrt, int clone, - int norouteok) + struct ifnet **retifp, struct rtentry **retrt, int norouteok) { INIT_VNET_INET6(curvnet); int error = 0; @@ -536,9 +536,10 @@ selectroute(struct sockaddr_in6 *dstsock */ if (opts && opts->ip6po_nexthop) { struct route_in6 *ron; - + struct llentry *la; + sin6_next = satosin6(opts->ip6po_nexthop); - + /* at this moment, we only support AF_INET6 next hops */ if (sin6_next->sin6_family != AF_INET6) { error = EAFNOSUPPORT; /* or should we proceed? */ @@ -550,6 +551,36 @@ selectroute(struct sockaddr_in6 *dstsock * by that address must be a neighbor of the sending host. */ ron = &opts->ip6po_nextroute; + /* + * XXX what do we do here? + * PLZ to be fixing + */ + + + if (ron->ro_rt == NULL) { + rtalloc((struct route *)ron); /* multi path case? */ + if (ron->ro_rt == NULL) { + if (ron->ro_rt) { + RTFREE(ron->ro_rt); + ron->ro_rt = NULL; + } + error = EHOSTUNREACH; + goto done; + } + } + + rt = ron->ro_rt; + ifp = rt->rt_ifp; + IF_AFDATA_LOCK(ifp); + la = lla_lookup(LLTABLE6(ifp), 0, (struct sockaddr *)&sin6_next->sin6_addr); + IF_AFDATA_UNLOCK(ifp); + if (la) + LLE_RUNLOCK(la); + else { + error = EHOSTUNREACH; + goto done; + } +#if 0 if ((ron->ro_rt && (ron->ro_rt->rt_flags & (RTF_UP | RTF_LLINFO)) != (RTF_UP | RTF_LLINFO)) || @@ -573,16 +604,14 @@ selectroute(struct sockaddr_in6 *dstsock goto done; } } - rt = ron->ro_rt; - ifp = rt->rt_ifp; +#endif /* * When cloning is required, try to allocate a route to the * destination so that the caller can store path MTU * information. */ - if (!clone) - goto done; + goto done; } /* @@ -608,21 +637,17 @@ selectroute(struct sockaddr_in6 *dstsock *sa6 = *dstsock; sa6->sin6_scope_id = 0; - if (clone) { #ifdef RADIX_MPATH rtalloc_mpath((struct route *)ro, ntohl(sa6->sin6_addr.s6_addr32[3])); -#else - rtalloc((struct route *)ro); -#endif - } else { +#else ro->ro_rt = rtalloc1(&((struct route *)ro) - ->ro_dst, 0, 0UL); + ->ro_dst, 0, 0UL); if (ro->ro_rt) RT_UNLOCK(ro->ro_rt); - } +#endif } - + /* * do not care about the result if we have the nexthop * explicitly specified. @@ -693,7 +718,7 @@ in6_selectif(struct sockaddr_in6 *dstsoc } if ((error = selectroute(dstsock, opts, mopts, ro, retifp, - &rt, 0, 1)) != 0) { + &rt, 1)) != 0) { if (ro == &sro && rt && rt == sro.ro_rt) RTFREE(rt); return (error); @@ -745,11 +770,11 @@ in6_selectif(struct sockaddr_in6 *dstsoc int in6_selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, struct ip6_moptions *mopts, struct route_in6 *ro, - struct ifnet **retifp, struct rtentry **retrt, int clone) + struct ifnet **retifp, struct rtentry **retrt) { return (selectroute(dstsock, opts, mopts, ro, retifp, - retrt, clone, 0)); + retrt, 0)); } /* Modified: projects/arpv2_merge_1/sys/netinet6/ip6_output.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/ip6_output.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet6/ip6_output.c Thu Dec 11 02:47:41 2008 (r185905) @@ -615,7 +615,7 @@ again: dst_sa.sin6_len = sizeof(dst_sa); dst_sa.sin6_addr = ip6->ip6_dst; if ((error = in6_selectroute(&dst_sa, opt, im6o, ro, - &ifp, &rt, 0)) != 0) { + &ifp, &rt)) != 0) { switch (error) { case EHOSTUNREACH: V_ip6stat.ip6s_noroute++; Modified: projects/arpv2_merge_1/sys/netinet6/ip6_var.h ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/ip6_var.h Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet6/ip6_var.h Thu Dec 11 02:47:41 2008 (r185905) @@ -398,7 +398,7 @@ struct in6_addr *in6_selectsrc __P((stru struct ifnet **, int *)); int in6_selectroute __P((struct sockaddr_in6 *, struct ip6_pktopts *, struct ip6_moptions *, struct route_in6 *, struct ifnet **, - struct rtentry **, int)); + struct rtentry **)); u_int32_t ip6_randomid __P((void)); u_int32_t ip6_randomflowlabel __P((void)); #endif /* _KERNEL */ Modified: projects/arpv2_merge_1/sys/netinet6/nd6_rtr.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/nd6_rtr.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet6/nd6_rtr.c Thu Dec 11 02:47:41 2008 (r185905) @@ -1613,16 +1613,7 @@ nd6_prefix_onlink(struct nd_prefix *pr) bzero(&mask6, sizeof(mask6)); mask6.sin6_len = sizeof(mask6); mask6.sin6_addr = pr->ndpr_mask; - rtflags = ifa->ifa_flags | RTF_CLONING | RTF_UP; - if (nd6_need_cache(ifp)) { - /* explicitly set in case ifa_flags does not set the flag. */ - rtflags |= RTF_CLONING; - } else { - /* - * explicitly clear the cloning bit in case ifa_flags sets it. - */ - rtflags &= ~RTF_CLONING; - } + rtflags = ifa->ifa_flags | RTF_UP; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812110247.mBB2lgJP051204>