Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Jul 2002 00:24:21 -0700
From:      "Qing Li" <Qing.Li@windriver.com>
To:        "FreeBSD-Hackers" <hackers@freebsd.org>
Subject:   questions about some code in route.c
Message-ID:  <DMEGKJAJNLKBGDDBEAIPEEGGFMAA.Qing.Li@windriver.com>

next in thread | raw e-mail | index | archive | help


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-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DMEGKJAJNLKBGDDBEAIPEEGGFMAA.Qing.Li>