Patch for route.c

Larry J. Blunk (ljb@merit.edu)
Thu, 03 Apr 1997 14:49:04 -0500


This patch was submitted by Dave Madden addressing a problem
with legitimate routes getting rejected.

-Larry Blunk
Merit Network, Inc.

----------------------------------------------------------------------------

* To: alan@manawatu.gen.nz
* Subject: Re: Problem with [gated] 3.5.4 under linux 2.0.27
* From: dave madden <dhm@paradigm.webvision.com>
* Date: Tue, 4 Mar 1997 10:15:26 -0800
* CC: lts@gic.de, gated-people@merit.edu, gw4pts@gw4pts.ampr.org
* In-reply-to:
<Pine.SUN.3.90.970305023625.5751Z-100000@papaioea.manawatu.gen.nz>
(message from Alan Brown on Wed, 5 Mar 1997 02:41:46 +1300 (NZDT))
* Sender: owner-gated-people@merit.edu

----------------------------------------------------------------------------

Here's the patch I mentioned, to make gated work on linux-2.0.27.
Without the patch, what appears to happen is that gated installs
host routes to other gateways on locally-connected nets, and then,
when attempting to install routes whose next hops are one of those
gateways, sometimes the route will be rejected because the route to
gateway matches (dst&mask), and the host route has the RTF_GATEWAY
flag set. I think the code was intended to prevent routes through a
non-local router from getting into the routing table, but it has the
effect of keeping legitimate routes out as well. It doesn't happen
all the time -- it depends on the order of entries in the hash table.

regards,
d.

*** /tmp/linux/net/ipv4/route.c Mon May 27 03:09:06 1996
--- linux/net/ipv4/route.c Sun Jan 26 21:41:25 1997
***************
*** 222,234 ****
f = fz->fz_hash_table[fz_hash_code(dst, fz->fz_logmask)];
else
f = fz->fz_list;
-
for ( ; f; f = f->fib_next)
{
! if ((dst ^ f->fib_dst) & fz->fz_mask)
continue;
- if (f->fib_info->fib_flags & RTF_GATEWAY)
- return NULL;
return f;
}
}
--- 222,232 ----
f = fz->fz_hash_table[fz_hash_code(dst, fz->fz_logmask)];
else
f = fz->fz_list;
for ( ; f; f = f->fib_next)
{
! if (((dst ^ f->fib_dst) & fz->fz_mask) ||
! (f->fib_info->fib_flags & RTF_GATEWAY))
continue;
return f;
}
}

------
Larry J. Blunk
Merit Network, Inc. Ann Arbor, Michigan