Mailing List Archive

Zebra incorrectly ignoring some BGP routes
Hello,

For some time now we've had problems with the zebra daemon making some
valid iBGP routes inactive. This is a problem in Zebra 0.93b (which
we're currently running), but I have just verified, that this problem
still exists in Quagga 0.96.5 (which we're in the process of upgrading
to). To illustrate it, I have some real data from our routers:

One of our BGP routers (212.97.129.4) has an eBGP peering with
192.38.7.1, and this router announces the 192.38.0.0/17 prefix to us
(and several others, but this is the only the prefix from this peer with
the problem), and this is properly added to the kernel routing table on
212.97.129.4. But on our other BGP routers, the following happens:

bgpd# show ip bgp 192.38.0.0/17
BGP routing table entry for 192.38.0.0/17
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Not advertised to any peer
1835
192.38.7.1 (metric 1) from 212.97.129.4 (212.97.129.4)
Origin IGP, metric 0, localpref 200, valid, internal, best
Last update: Mon Apr 26 10:21:22 2004

zebra# show ip route 192.38.0.0/17
Routing entry for 192.38.0.0/17
Known via "bgp", distance 200, metric 0
Last update 03w5d12h ago
192.38.7.1 inactive

All other prefixes from the peer are fine, but this particular one is
marked as inactive by the zebra daemon. As far as I can tell, this
happens, because 192.38.7.1 (the peer address) is inside 192.38.0.0/17
(the prefix). This also happens for all other prefixes received through
peers, whose address is inside the prefix.

I did some digging in the source code and traced this behaviour to the
nexthop_active_ipv4 function in zebra/zebra_rib.c. The BGP routes were
made inactive because of the following lines in this function:

/* If lookup self prefix return immidiately. */
if (rn == top)
return 0;

As far as I can tell, this check is only done to speed things up and
avoid running through all the other tests, so I tried to disable it,
which made the problematic routes inactive, while other routes that were
previously (correctly) filtered by this check now fell through to the
final "return 0" in the function after one more iteration of the while loop.

I'm a bit surprised, that others apparently haven't hit (or at least
noticed) this bug, so I'm wondering if this could be caused by some
wierd configuration on our routers, or this is in fact a bug in the
zebra daemon?

Also, if it is a bug, is disabling the code above the proper fix, or
does it have a purpose, that I'm missing?

Finally, if this is the proper fix, the code should probably be removed
from nexthop_active_ipv6 too.

Regards,
Anders K. Pedersen

--
The From: and Reply-To: addresses are internal news2mail gateway addresses.
Reply to the list or to "Anders K. Pedersen" <akp@cohaesio.com>
Re: Zebra incorrectly ignoring some BGP routes [ In reply to ]
On Sat, 22 May 2004, "Anders K. Pedersen" < wrote:

> All other prefixes from the peer are fine, but this particular one
> is marked as inactive by the zebra daemon. As far as I can tell,
> this happens, because 192.38.7.1 (the peer address) is inside
> 192.38.0.0/17 (the prefix). This also happens for all other
> prefixes received through peers, whose address is inside the
> prefix.

How are you distributing the route to the next-hop address?

regards,
--
Paul Jakma paul@clubi.ie paul@jakma.org Key ID: 64A2FF6A
warning: do not ever send email to spam@dishone.st
Fortune:
Aphasia:
Loss of speech in social scientists when asked
at parties, "But of what use is your research?"
Re: Zebra incorrectly ignoring some BGP routes [ In reply to ]
Paul Jakma wrote:
> On Sat, 22 May 2004, "Anders K. Pedersen" < wrote:

>>All other prefixes from the peer are fine, but this particular one
>>is marked as inactive by the zebra daemon. As far as I can tell,
>>this happens, because 192.38.7.1 (the peer address) is inside
>>192.38.0.0/17 (the prefix). This also happens for all other
>>prefixes received through peers, whose address is inside the
>>prefix.
>
>
> How are you distributing the route to the next-hop address?

The peering with 192.38.7.1 has the next-hop-self option enabled, which
(as I understand it) means, that I don't need a route for 192.38.7.1 on
the other iBGP routers. Just to make sure though, we also have
"redistribute connected" in the BGP configuration, so the other iBGP
routers have the following:

bgpd# show ip bgp 192.38.7.1
BGP routing table entry for 192.38.7.0/24
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Not advertised to any peer
Local
212.97.128.4 (metric 20) from 212.97.129.4 (212.97.129.4)
Origin incomplete, metric 0, localpref 100, valid, internal, best
Last update: Sat May 22 22:43:05 2004

zebra# show ip route 192.38.7.1
Routing entry for 192.38.7.0/24
Known via "bgp", distance 200, metric 0, best
Last update 17:31:40 ago
* 212.97.128.4 (recursive via 212.97.129.4)

And as I mentioned, all other prefixes from 192.38.7.1 are handled
correctly on the iBGP peers - one of them are:

bgpd# show ip bgp 130.225.0.0
BGP routing table entry for 130.225.0.0/16
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Not advertised to any peer
1835
192.38.7.1 (metric 1) from 212.97.129.4 (212.97.129.4)
Origin IGP, metric 0, localpref 200, valid, internal, best
Last update: Sat May 22 22:42:44 2004

zebra# show ip route 130.225.0.0
Routing entry for 130.225.0.0/16
Known via "bgp", distance 200, metric 0, best
Last update 17:35:23 ago
* 192.38.7.1 (recursive via 212.97.129.4)

Regards,
Anders K. Pedersen

--
The From: and Reply-To: addresses are internal news2mail gateway addresses.
Reply to the list or to "Anders K. Pedersen" <akp@cohaesio.com>
Re: Zebra incorrectly ignoring some BGP routes [ In reply to ]
> On Sat, 22 May 2004, "Anders K. Pedersen" < wrote:
>>All other prefixes from the peer are fine, but this particular one
>>is marked as inactive by the zebra daemon. As far as I can tell,
>>this happens, because 192.38.7.1 (the peer address) is inside
>>192.38.0.0/17 (the prefix). This also happens for all other
>>prefixes received through peers, whose address is inside the
>>prefix.

I just realised, that the last sentence above could easily be
misinterpreted - "the prefix" (last two words) was meant to refer to the
prefix received and *not* the specific prefix mentioned earlier
(192.38.0.0/7). I.e. the problematic prefix from peer A.B.C.D is
A.B.0.0/16 or similar for all our various peers, where such a prefix exists.

Regards,
Anders K. Pedersen

--
The From: and Reply-To: addresses are internal news2mail gateway addresses.
Reply to the list or to "Anders K. Pedersen" <akp@cohaesio.com>
Re: Zebra incorrectly ignoring some BGP routes [ In reply to ]
On Sun, 23 May 2004, Anders K. Pedersen wrote:

> The peering with 192.38.7.1 has the next-hop-self option enabled, which (as I
> understand it) means, that I don't need a route for 192.38.7.1 on the other
> iBGP routers.

Ok, yes. So what is the route for 192.38.7.1? Eg, your firs post had:

zebra# show ip route 192.38.0.0/17
Routing entry for 192.38.0.0/17
Known via "bgp", distance 200, metric 0
Last update 03w5d12h ago
192.38.7.1 inactive

Why is it inactive? Do you not have any route for 192.38.7.1? But
then how does the BGP peering manage to work?

Ie how does your router know how to get to the peer?

regards,
--
Paul Jakma paul@clubi.ie paul@jakma.org Key ID: 64A2FF6A
warning: do not ever send email to spam@dishone.st
Fortune:
Let a fool hold his tongue and he will pass for a sage.
-- Publilius Syrus