diff options
author | Tom Goff <thomas.goff@boeing.com> | 2010-01-27 00:30:22 +0000 |
---|---|---|
committer | David Lamparter <equinox@diac24.net> | 2010-02-05 06:05:14 +0100 |
commit | 659811a522cda0c95e83bfdde41b970442b1fbd3 (patch) | |
tree | a879329ee9f6eed8d47a4308257b0237860e8383 /zebra/zebra_rib.c | |
parent | 5f23da374fc5ca4a69fd3a3b9f4f2bc337d2b21e (diff) | |
download | quagga-659811a522cda0c95e83bfdde41b970442b1fbd3.tar.bz2 quagga-659811a522cda0c95e83bfdde41b970442b1fbd3.tar.xz |
zebra: consider all nexthops when looking for a gateway match
* zebra_rib.c: (rib_delete_ipv4 and rib_delete_ipv6) A route is not
deleted unless the given gateway is first in the nexthop list. This
can leave a route containing an invalid nexthop in the routing table
which might later be used. Instead look at all nexthops to find a
match.
forward-ported to apply on top of Joakim Tjernlund's "don't delete too
many routes" by David Lamparter.
Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'zebra/zebra_rib.c')
-rw-r--r-- | zebra/zebra_rib.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index f6f8980f..fc9c6aa2 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -1895,12 +1895,15 @@ rib_delete_ipv4 (int type, int flags, struct prefix_ipv4 *p, if (gate) { - if ((nexthop = rib->nexthop) && - (IPV4_ADDR_SAME (&nexthop->gate.ipv4, gate) || - IPV4_ADDR_SAME (&nexthop->rgate.ipv4, gate))) + for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next) + if (IPV4_ADDR_SAME (&nexthop->gate.ipv4, gate) || + IPV4_ADDR_SAME (&nexthop->rgate.ipv4, gate)) + /* make sure ifindex matches if specified */ + if (!ifindex || ifindex == nexthop->ifindex) + break; + + if (nexthop) { - if (ifindex && ifindex != nexthop->ifindex) - continue; /* ifindex doesn't match */ same = rib; break; } @@ -2455,12 +2458,15 @@ rib_delete_ipv6 (int type, int flags, struct prefix_ipv6 *p, if (gate) { - if ((nexthop = rib->nexthop) && - (IPV6_ADDR_SAME (&nexthop->gate.ipv6, gate) || - IPV6_ADDR_SAME (&nexthop->rgate.ipv6, gate))) + for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next) + if (IPV6_ADDR_SAME (&nexthop->gate.ipv6, gate) || + IPV6_ADDR_SAME (&nexthop->rgate.ipv6, gate)) + /* make sure ifindex matches if specified */ + if (!ifindex || ifindex == nexthop->ifindex) + break; + + if (nexthop) { - if (ifindex && ifindex != nexthop->ifindex) - continue; /* ifindex doesn't match */ same = rib; break; } |