-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
Before installing a new static route Zebra checks to see if an equivalent route already exists and deletes it before installing the new route.
zebra_static.c
394 /* Do nothing if there is a same static route. */
395 for (si = rn->info; si; si = si->next)
396 {
397 if (type == si->type
398 && (! gate ||
399 ((afi == AFI_IP && IPV4_ADDR_SAME (gate, &si->addr.ipv4)) ||
400 (afi == AFI_IP6 && IPV6_ADDR_SAME (gate, &si->addr.ipv6))))
401 && (! ifindex || ifindex == si->ifindex))
402 {
403 if ((distance == si->distance) && (tag == si->tag) &&
404 !memcmp (&si->snh_label, snh_label, sizeof (struct static_nh_label)))
405 {
406 route_unlock_node (rn);
407 return 0;
408 }
409 else
410 update = si;
411 }
412 }
This fails to check the route flags, which results in behavior like this:
cumulus# conf t
cumulus(config)# ip route 1.2.3.4/24 reject
cumulus(config)# do show ip route static
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, P - PIM, T - Table, v - VNC,
V - VPN,
> - selected route, * - FIB route
S>* 1.2.3.0/24 [1/0] is directly connected, Null0, rej
cumulus(config)# ip route 1.2.3.4/24 blackhole
cumulus(config)# do show ip route static
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, P - PIM, T - Table, v - VNC,
V - VPN,
> - selected route, * - FIB route
S>* 1.2.3.0/24 [1/0] is directly connected, Null0, rej
cumulus(config)#
The route flags are still set to reject. Correct behavior:
cumulus# conf t
cumulus(config)# ip route
A.B.C.D IP destination prefix
A.B.C.D/M IP destination prefix (e.g. 10.0.0.0/8)
cumulus(config)# ip route 1.2.3.4/24 reject
cumulus(config)# do show ip route static
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, P - PIM, T - Table, v - VNC,
V - VPN,
> - selected route, * - FIB route
S>* 1.2.3.0/24 [1/0] is directly connected, Null0, rej
cumulus(config)# ip route 1.2.3.4/24 blackhole
cumulus(config)# do show ip route static
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, P - PIM, T - Table, v - VNC,
V - VPN,
> - selected route, * - FIB route
S>* 1.2.3.0/24 [1/0] is directly connected, Null0, bh
cumulus(config)#
The route has been changed to a blackhole route.
Metadata
Metadata
Assignees
Labels
No labels