[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-net
Subject:    questions about some code in route.c
From:       "Qing Li" <Qing.Li () windriver ! com>
Date:       2002-07-25 19:17:30
[Download RAW message or body]



Please help me try to understand some of the code in route.c.

1. In function "rtrequest1",

	=========================================
	case RTM_DELETE:

	<snip>

		/*
		 * 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 | RTF_PRCLONING)) &&
		    rt_mask(rt)) {
	<snip>
	=========================================

Question: under what situation would a route entry that is
          clone-able but having a (rt_mask(rt) == 0) ??

2. A related question is, in the same function,

	=========================================
	<snip>
		/*
		 * 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 (!(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);
		}
	<snip>
	=========================================

Question: wouldn't the 1st check for "not a host route" be
          sufficient ??

3. In function "rtredirect",

	==========================================
	<snip>
	/*
	 * Create a new entry if we just got back a wildcard entry
	 * or the the lookup failed.  This is necessary for hosts
	 * which use routing redirects generated by smart gateways
	 * to dynamically build the routing tables.
	 */
	if ((rt == 0) || (rt_mask(rt) && rt_mask(rt)->sa_len < 2))
		goto create;
	<snip>
	============================================

Question:
	I am guessing (sa_len < 2) is checking for a mask of 
	all 0's based on what in_socktrim does, is this correct ??

	Why is the magic number "2" ?


	Any help/pointer on these would be greatly appreciated.

	-- Qing


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic