diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-11-04 13:26:40 -0500 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-12-08 14:12:10 -0500 |
commit | c1900e09a7fdd70437f3ba0329868f1eee3f5a1a (patch) | |
tree | 5f1032936f4413f7dc12935eabbdf62f940ffd12 | |
parent | 949b719eac0c8b51c73f144eb035fab27a16c2a6 (diff) | |
download | quagga-c1900e09a7fdd70437f3ba0329868f1eee3f5a1a.tar.bz2 quagga-c1900e09a7fdd70437f3ba0329868f1eee3f5a1a.tar.xz |
zebra: Fix change of distance on ipv6 route creating duplicate routes
If you enter:
ipv6 route 2002:44:44:44::44/128 swp1 4
ipv6 route 2002:44:44:44::44/128 swp1 99
You get:
host-111# show ipv6 route
Codes: K - kernel route, C - connected, S - static, R - RIPng,
O - OSPFv6, I - IS-IS, B - BGP, A - Babel, T - Table,
> - selected route, * - FIB route
S 2002:44:44:44::44/128 [99/0] is directly connected, swp1
S>* 2002:44:44:44::44/128 [4/0] is directly connected, swp1
This problem is fixed in the ipv4 code path. Copying the same
code from the ipv4 into the ipv6 code path fixes the issue.
With the fix:
host-111(config)# ipv6 route 2002:44:44:44::44/128 swp1 4
host-111(config)# do show ipv6 route
Codes: K - kernel route, C - connected, S - static, R - RIPng,
O - OSPFv6, I - IS-IS, B - BGP, A - Babel, T - Table,
> - selected route, * - FIB route
S>* 2002:44:44:44::44/128 [4/0] is directly connected, swp1
C * fe80::/64 is directly connected, swp1
C>* fe80::/64 is directly connected, eth0
host-111(config)# ipv6 route 2002:44:44:44::44/128 swp1 99
host-111(config)# do show ipv6 route
Codes: K - kernel route, C - connected, S - static, R - RIPng,
O - OSPFv6, I - IS-IS, B - BGP, A - Babel, T - Table,
> - selected route, * - FIB route
S>* 2002:44:44:44::44/128 [99/0] is directly connected, swp1
C * fe80::/64 is directly connected, swp1
C>* fe80::/64 is directly connected, eth0
host-111(config)#
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
-rw-r--r-- | zebra/zebra_rib.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 6a54f11b..0efa88d5 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -2866,6 +2866,7 @@ static_add_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate, struct static_route *si; struct static_route *pp; struct static_route *cp; + struct static_route *update = NULL; struct zebra_vrf *zvrf = vrf_info_get (vrf_id); struct route_table *stable = zvrf->stable[AFI_IP6][SAFI_UNICAST]; @@ -2886,16 +2887,23 @@ static_add_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate, /* Do nothing if there is a same static route. */ for (si = rn->info; si; si = si->next) { - if (distance == si->distance - && type == si->type + if (type == si->type && (! gate || IPV6_ADDR_SAME (gate, &si->addr.ipv6)) && (! ifname || strcmp (ifname, si->ifname) == 0)) { - route_unlock_node (rn); - return 0; + if (distance == si->distance) + { + route_unlock_node (rn); + return 0; + } + else + update = si; } } + if (update) + static_delete_ipv6(p, type, gate, ifname, si->distance, vrf_id); + /* Make new static route structure. */ si = XCALLOC (MTYPE_STATIC_ROUTE, sizeof (struct static_route)); |