FRRouting / frr

The FRRouting Protocol Suite
https://frrouting.org/
Other
3.27k stars 1.24k forks source link

Static routes don't install if a blackhole route is present in the configuration before them #4046

Closed zdc closed 5 years ago

zdc commented 5 years ago

Things you may try first

(put "x" in "[ ]" if you already tried following)

Description

Static routes don't install if a blackhole route is present in the configuration before them. Example:

ip route 192.168.3.0/24 192.168.20.1
ip route 192.168.4.0/24 blackhole
ip route 192.168.5.0/24 192.168.20.1 <--- will not be installed
ip route 192.168.6.0/24 192.168.20.1 <--- will not be installed

Stable version 7.0-20190329-00-g9576568 is not affected.

Steps to Reproduce

  1. Run vtysh.
  2. Add static route to 192.168.5.0/24 via gateway IP.
  3. Add blackhole route to 192.168.4.0/24.
  4. Add static route to 192.168.3.0/24 via gateway IP.
  5. Add static route to 192.168.6.0/24 via gateway IP.

Expected behavior: In the routing table we must see four static routes:

S>* 192.168.3.0/24 [1/0] via 192.168.20.1, eth0, 00:00:33
S>* 192.168.4.0/24 [1/0] unreachable (blackhole), 00:00:08
S>* 192.168.5.0/24 [1/0] via 192.168.20.1, eth0, 00:00:37
S>* 192.168.6.0/24 [1/0] via 192.168.20.1, eth0, 00:00:28

Actual behavior: Only three static routes were installed:

S>* 192.168.3.0/24 [1/0] via 192.168.20.1, eth0, 00:00:07
S>* 192.168.4.0/24 [1/0] unreachable (blackhole), 00:00:11
S>* 192.168.5.0/24 [1/0] via 192.168.20.1, eth0, 00:00:16

The route to 192.168.6.0/24 network was ignored by FRRouting. But, if you add the blackhole route by the last configuration command, all previously added routes will be installed, no matter of their position in configuration.

Versions

EasyNetDev commented 5 years ago

Hi,

Today I've notice with git compiled sources. if I'm using the interface instead the gateway, is working! I had a big issue because I got a eBGP with 3 hops and I've got the static route pointed to the first next hop. Because of this issue I've received the subnet for this eBGP via the other ISP. When the BGP went up, a new route was installed and the destination routes went into an invalid next hop. Then again up, and then down, overloading my 2 boarder routers :(.

EasyNetDev commented 5 years ago

Hi,

It seems that is trying to DELETE the route instead inserting it.. Here is the ZEBRA debug:

FRR-1(config)# ip route 10.1.4.0/24 10.180.0.198
FRR-1(config)# no ip route 10.1.4.0/24 10.180.0.198
FRR-1(config)# ip route 10.1.4.0/24 10.180.0.198
FRR-1(config)# do sh ip route static 
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

S>* 10.1.2.0/24 [1/0] via 10.180.0.198, ens256, 00:06:26
S>* 10.1.3.0/24 [1/0] unreachable (blackhole), 00:06:08
FRR-1(config)# 

Logs:

Apr  2 15:28:39 FRR-1 zebra[30392]: zebra message[ZEBRA_ROUTE_DELETE:0:27] comes from socket [72]
Apr  2 15:28:39 FRR-1 zebra[30392]: Rx'd ZAPI message
Apr  2 15:28:39 FRR-1 zebra[30392]:  Length: 27
Apr  2 15:28:39 FRR-1 zebra[30392]: Command: ZEBRA_ROUTE_DELETE
Apr  2 15:28:39 FRR-1 zebra[30392]:     VRF: 0
Apr  2 15:28:39 FRR-1 zebra[30392]: #0120x00005580c24530b0: 00 1b fe 06 00 00 00 00 ........#0120x00005580c24530b8: 00 08 03 00 00 00 00 00 ........#0120x00005580c24530c0: 40                      @       
Apr  2 15:28:39 FRR-1 zebra[30392]: Read 1 packets from client: static
Apr  2 15:28:39 FRR-1 zebra[30392]: 0:10.1.4.0/24 doesn't exist in rib
Apr  2 15:28:52 FRR-1 zebra[30392]: zebra message[ZEBRA_ROUTE_DELETE:0:27] comes from socket [72]
Apr  2 15:28:52 FRR-1 zebra[30392]: Rx'd ZAPI message
Apr  2 15:28:52 FRR-1 zebra[30392]:  Length: 27
Apr  2 15:28:52 FRR-1 zebra[30392]: Command: ZEBRA_ROUTE_DELETE
Apr  2 15:28:52 FRR-1 zebra[30392]:     VRF: 0
Apr  2 15:28:52 FRR-1 zebra[30392]: #0120x00005580c24530b0: 00 1b fe 06 00 00 00 00 ........#0120x00005580c24530b8: 00 08 03 00 00 00 00 00 ........#0120x00005580c24530c0: 40                      @       
Apr  2 15:28:52 FRR-1 zebra[30392]: Read 1 packets from client: static
Apr  2 15:28:52 FRR-1 zebra[30392]: 0:10.1.4.0/24 doesn't exist in rib
Apr  2 15:29:37 FRR-1 zebra[30392]: zebra message[ZEBRA_ROUTE_DELETE:0:27] comes from socket [72]
Apr  2 15:29:37 FRR-1 zebra[30392]: Rx'd ZAPI message
Apr  2 15:29:37 FRR-1 zebra[30392]:  Length: 27
Apr  2 15:29:37 FRR-1 zebra[30392]: Command: ZEBRA_ROUTE_DELETE
Apr  2 15:29:37 FRR-1 zebra[30392]:     VRF: 0
Apr  2 15:29:37 FRR-1 zebra[30392]: #0120x00005580c24530b0: 00 1b fe 06 00 00 00 00 ........#0120x00005580c24530b8: 00 08 03 00 00 00 00 00 ........#0120x00005580c24530c0: 40                      @       
Apr  2 15:29:37 FRR-1 zebra[30392]: Read 1 packets from client: static
Apr  2 15:29:37 FRR-1 zebra[30392]: 0:10.1.4.0/24 doesn't exist in rib

Trying to delete the Null0 route:

FRR-1(config)# no ip route 10.1.3.0/24 Null0

Logs:

Apr  2 15:31:51 FRR-1 zebra[30392]: zebra message[ZEBRA_ROUTE_DELETE:0:27] comes from socket [72]
Apr  2 15:31:51 FRR-1 zebra[30392]: Rx'd ZAPI message
Apr  2 15:31:51 FRR-1 zebra[30392]:  Length: 27
Apr  2 15:31:51 FRR-1 zebra[30392]: Command: ZEBRA_ROUTE_DELETE
Apr  2 15:31:51 FRR-1 zebra[30392]:     VRF: 0
Apr  2 15:31:51 FRR-1 zebra[30392]: #0120x00005580c24530b0: 00 1b fe 06 00 00 00 00 ........#0120x00005580c24530b8: 00 08 03 00 00 00 00 00 ........#0120x00005580c24530c0: 40                      @       
Apr  2 15:31:51 FRR-1 zebra[30392]: Read 1 packets from client: static
Apr  2 15:31:51 FRR-1 zebra[30392]: rib_delnode: 0:10.1.3.0/24: rn 0x5580c2485bd0, re 0x5580c2484450, removing
Apr  2 15:31:51 FRR-1 zebra[30392]: 0:10.1.3.0/24: Deleting route rn 0x5580c2485bd0, re 0x5580c2484450 (static)
Apr  2 15:31:51 FRR-1 zebra[30392]: 0:10.1.3.0/24: Redist delete re 0x5580c2484450 (static)
Apr  2 15:31:51 FRR-1 zebra[30392]: rib_process: 0:10.1.3.0/24: rn 0x5580c2485bd0, removing re 0x5580c2484450
Apr  2 15:31:51 FRR-1 zebra[30392]: rib_unlink: 0:10.1.3.0/24: rn 0x5580c2485bd0, re 0x5580c2484450
Apr  2 15:31:51 FRR-1 zebra[30392]: rib_gc_dest: 0:10.1.3.0/24: removing dest from table
Apr  2 15:31:51 FRR-1 zebra[30392]: Notifying Owner: 3 about prefix 10.1.3.0/24(254) 3 vrf: 0

And adding the normal route:

FRR-1(config)# no ip route 10.1.4.0/24 10.180.0.198
FRR-1(config)# ip route 10.1.4.0/24 10.180.0.198
FRR-1(config)# do sh ip route static 
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

S>* 10.1.2.0/24 [1/0] via 10.180.0.198, ens256, 00:10:07
S>* 10.1.4.0/24 [1/0] via 10.180.0.198, ens256, 00:00:38
FRR-1(config)# 

Logs:

Apr  2 15:32:44 FRR-1 zebra[30392]: zebra message[ZEBRA_ROUTE_DELETE:0:27] comes from socket [72]
Apr  2 15:32:44 FRR-1 zebra[30392]: Rx'd ZAPI message
Apr  2 15:32:44 FRR-1 zebra[30392]:  Length: 27
Apr  2 15:32:44 FRR-1 zebra[30392]: Command: ZEBRA_ROUTE_DELETE
Apr  2 15:32:44 FRR-1 zebra[30392]:     VRF: 0
Apr  2 15:32:44 FRR-1 zebra[30392]: #0120x00005580c24530b0: 00 1b fe 06 00 00 00 00 ........#0120x00005580c24530b8: 00 08 03 00 00 00 00 00 ........#0120x00005580c24530c0: 40                      @       
Apr  2 15:32:44 FRR-1 zebra[30392]: Read 1 packets from client: static
Apr  2 15:32:44 FRR-1 zebra[30392]: 0:10.1.4.0/24 doesn't exist in rib
Apr  2 15:32:50 FRR-1 zebra[30392]: zebra message[ZEBRA_ROUTE_ADD:0:37] comes from socket [72]
Apr  2 15:32:50 FRR-1 zebra[30392]: Rx'd ZAPI message
Apr  2 15:32:50 FRR-1 zebra[30392]:  Length: 37
Apr  2 15:32:50 FRR-1 zebra[30392]: Command: ZEBRA_ROUTE_ADD
Apr  2 15:32:50 FRR-1 zebra[30392]:     VRF: 0
Apr  2 15:32:50 FRR-1 zebra[30392]: #0120x00005580c24530b0: 00 25 fe 06 00 00 00 00 .%......#0120x00005580c24530b8: 00 07 03 00 00 00 00 00 ........#0120x00005580c24530c0: 40 03 01 02 18 0a 01 04 @.......#0120x00005580c24530c8: 00 01 00                ...     
Apr  2 15:32:50 FRR-1 zebra[30392]: zebra message[ZEBRA_ROUTE_ADD:0:37] comes from socket [72]
Apr  2 15:32:50 FRR-1 zebra[30392]: Rx'd ZAPI message
Apr  2 15:32:50 FRR-1 zebra[30392]:  Length: 37
Apr  2 15:32:50 FRR-1 zebra[30392]: Command: ZEBRA_ROUTE_ADD
Apr  2 15:32:50 FRR-1 zebra[30392]:     VRF: 0
Apr  2 15:32:50 FRR-1 zebra[30392]: #0120x00005580c24530b0: 00 25 fe 06 00 00 00 00 .%......#0120x00005580c24530b8: 00 07 03 00 00 00 00 00 ........#0120x00005580c24530c0: 40 03 01 02 18 0a 01 04 @.......#0120x00005580c24530c8: 00 01 00                ...     
Apr  2 15:32:50 FRR-1 zebra[30392]: Read 2 packets from client: static
Apr  2 15:32:50 FRR-1 zebra[30392]: zread_route_add: p=10.1.4.0/24, ZAPI_MESSAGE_LABEL: unset, flags=0x40
Apr  2 15:32:50 FRR-1 zebra[30392]: nh type 2
Apr  2 15:32:50 FRR-1 zebra[30392]: zread_route_add: nh=10.180.0.198, vrf_id=0
Apr  2 15:32:50 FRR-1 zebra[30392]: rib_add_multipath: 0:10.1.4.0/24: Inserting route rn 0x5580c2346ff0, re 0x5580c23ff600 (static) existing (nil)
Apr  2 15:32:50 FRR-1 zebra[30392]: zread_route_add: p=10.1.4.0/24, ZAPI_MESSAGE_LABEL: unset, flags=0x40
Apr  2 15:32:50 FRR-1 zebra[30392]: nh type 2
Apr  2 15:32:50 FRR-1 zebra[30392]: zread_route_add: nh=10.180.0.198, vrf_id=0
Apr  2 15:32:50 FRR-1 zebra[30392]: rib_add_multipath: 0:10.1.4.0/24: Inserting route rn 0x5580c2346ff0, re 0x5580c23476f0 (static) existing 0x5580c23ff600
Apr  2 15:32:50 FRR-1 zebra[30392]: rib_delnode: 0:10.1.4.0/24: rn 0x5580c2346ff0, re 0x5580c23ff600, removing
Apr  2 15:32:50 FRR-1 zebra[30392]: 0:10.1.4.0/24: Adding route rn 0x5580c2346ff0, re 0x5580c23476f0 (static)
Apr  2 15:32:50 FRR-1 zebra[30392]: rib_process: 0:10.1.4.0/24: rn 0x5580c2346ff0, removing re 0x5580c23ff600
Apr  2 15:32:50 FRR-1 zebra[30392]: rib_unlink: 0:10.1.4.0/24: rn 0x5580c2346ff0, re 0x5580c23ff600
Apr  2 15:32:50 FRR-1 zebra[30392]: 0:10.1.4.0/24: Redist update re 0x5580c23476f0 (static), old (nil) (None)
Apr  2 15:32:50 FRR-1 zebra[30392]: redistribute_update: client ldp 10.1.4.0/24(0), type=3, distance=1, metric=0
Apr  2 15:32:50 FRR-1 zebra[30392]: Notifying Owner: 3 about prefix 10.1.4.0/24(254) 2 vrf: 0

Repeating the test with Null0 route and then adding the route with interface instead gateway:

FRR-1(config)# no ip route 10.1.4.0/24 10.180.0.198
FRR-1(config)# ip route 10.1.3.0/24 Null0
FRR-1(config)# ip route 10.1.4.0/24 ens256
FRR-1(config)# do sh ip route static 
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

S>* 10.1.2.0/24 [1/0] via 10.180.0.198, ens256, 00:11:18
S>* 10.1.3.0/24 [1/0] unreachable (blackhole), 00:00:16
S>* 10.1.4.0/24 [1/0] is directly connected, ens256, 00:00:03
FRR-1(config)# 

Logs:

Apr  2 15:34:11 FRR-1 zebra[30392]: zebra message[ZEBRA_ROUTE_DELETE:0:27] comes from socket [72]
Apr  2 15:34:11 FRR-1 zebra[30392]: Rx'd ZAPI message
Apr  2 15:34:11 FRR-1 zebra[30392]:  Length: 27
Apr  2 15:34:11 FRR-1 zebra[30392]: Command: ZEBRA_ROUTE_DELETE
Apr  2 15:34:11 FRR-1 zebra[30392]:     VRF: 0
Apr  2 15:34:11 FRR-1 zebra[30392]: #0120x00005580c24530b0: 00 1b fe 06 00 00 00 00 ........#0120x00005580c24530b8: 00 08 03 00 00 00 00 00 ........#0120x00005580c24530c0: 40                      @       
Apr  2 15:34:11 FRR-1 zebra[30392]: Read 1 packets from client: static
Apr  2 15:34:11 FRR-1 zebra[30392]: rib_delnode: 0:10.1.4.0/24: rn 0x5580c2346ff0, re 0x5580c23476f0, removing
Apr  2 15:34:11 FRR-1 zebra[30392]: 0:10.1.4.0/24: Deleting route rn 0x5580c2346ff0, re 0x5580c23476f0 (static)
Apr  2 15:34:11 FRR-1 zebra[30392]: 0:10.1.4.0/24: Redist delete re 0x5580c23476f0 (static)
Apr  2 15:34:11 FRR-1 zebra[30392]: rib_process: 0:10.1.4.0/24: rn 0x5580c2346ff0, removing re 0x5580c23476f0
Apr  2 15:34:11 FRR-1 zebra[30392]: rib_unlink: 0:10.1.4.0/24: rn 0x5580c2346ff0, re 0x5580c23476f0
Apr  2 15:34:11 FRR-1 zebra[30392]: rib_gc_dest: 0:10.1.4.0/24: removing dest from table
Apr  2 15:34:11 FRR-1 zebra[30392]: Notifying Owner: 3 about prefix 10.1.4.0/24(254) 3 vrf: 0
Apr  2 15:34:23 FRR-1 zebra[30392]: zebra message[ZEBRA_ROUTE_ADD:0:34] comes from socket [72]
Apr  2 15:34:23 FRR-1 zebra[30392]: Rx'd ZAPI message
Apr  2 15:34:23 FRR-1 zebra[30392]:  Length: 34
Apr  2 15:34:23 FRR-1 zebra[30392]: Command: ZEBRA_ROUTE_ADD
Apr  2 15:34:23 FRR-1 zebra[30392]:     VRF: 0
Apr  2 15:34:23 FRR-1 zebra[30392]: #0120x00005580c24530b0: 00 22 fe 06 00 00 00 00 ."......#0120x00005580c24530b8: 00 07 03 00 00 00 00 00 ........#0120x00005580c24530c0: 40 03 01 02 18 0a 01 03 @.......
Apr  2 15:34:23 FRR-1 zebra[30392]: Read 1 packets from client: static
Apr  2 15:34:23 FRR-1 zebra[30392]: zread_route_add: p=10.1.3.0/24, ZAPI_MESSAGE_LABEL: unset, flags=0x40
Apr  2 15:34:23 FRR-1 zebra[30392]: nh type 6
Apr  2 15:34:23 FRR-1 zebra[30392]: rib_add_multipath: 0:10.1.3.0/24: Inserting route rn 0x5580c24838e0, re 0x5580c23476f0 (static) existing (nil)
Apr  2 15:34:23 FRR-1 zebra[30392]: 0:10.1.3.0/24: Adding route rn 0x5580c24838e0, re 0x5580c23476f0 (static)
Apr  2 15:34:23 FRR-1 zebra[30392]: 0:10.1.3.0/24: Redist update re 0x5580c23476f0 (static), old (nil) (None)
Apr  2 15:34:23 FRR-1 zebra[30392]: redistribute_update: client ldp 10.1.3.0/24(0), type=3, distance=1, metric=0
Apr  2 15:34:23 FRR-1 zebra[30392]: Notifying Owner: 3 about prefix 10.1.3.0/24(254) 2 vrf: 0
Apr  2 15:34:36 FRR-1 zebra[30392]: zebra message[ZEBRA_ROUTE_ADD:0:37] comes from socket [72]
Apr  2 15:34:36 FRR-1 zebra[30392]: Rx'd ZAPI message
Apr  2 15:34:36 FRR-1 zebra[30392]:  Length: 37
Apr  2 15:34:36 FRR-1 zebra[30392]: Command: ZEBRA_ROUTE_ADD
Apr  2 15:34:36 FRR-1 zebra[30392]:     VRF: 0
Apr  2 15:34:36 FRR-1 zebra[30392]: #0120x00005580c24530b0: 00 25 fe 06 00 00 00 00 .%......#0120x00005580c24530b8: 00 07 03 00 00 00 00 00 ........#0120x00005580c24530c0: 40 03 01 02 18 0a 01 04 @.......#0120x00005580c24530c8: 00 01 00                ...     
Apr  2 15:34:36 FRR-1 zebra[30392]: Read 1 packets from client: static
Apr  2 15:34:36 FRR-1 zebra[30392]: zread_route_add: p=10.1.4.0/24, ZAPI_MESSAGE_LABEL: unset, flags=0x40
Apr  2 15:34:36 FRR-1 zebra[30392]: nh type 1
Apr  2 15:34:36 FRR-1 zebra[30392]: rib_add_multipath: 0:10.1.4.0/24: Inserting route rn 0x5580c2484860, re 0x5580c2347750 (static) existing (nil)
Apr  2 15:34:36 FRR-1 zebra[30392]: 0:10.1.4.0/24: Adding route rn 0x5580c2484860, re 0x5580c2347750 (static)
Apr  2 15:34:36 FRR-1 zebra[30392]: 0:10.1.4.0/24: Redist update re 0x5580c2347750 (static), old (nil) (None)
Apr  2 15:34:36 FRR-1 zebra[30392]: redistribute_update: client ldp 10.1.4.0/24(0), type=3, distance=1, metric=0
Apr  2 15:34:36 FRR-1 zebra[30392]: Notifying Owner: 3 about prefix 10.1.4.0/24(254) 2 vrf: 0

I see somewhere a regression, huge one :(.

EasyNetDev commented 5 years ago

Hi @qlyoung,

The regresion is in the staticd daemon.

Trying some debugging on the new sources and do a diff between current source and FRR 7.0, I've notice this:

static_nht_update_safi (p=0x55a3342004e0, nh_num=1, afi=AFI_IP, safi=SAFI_UNICAST, vrf=0x55a3341c6fa0, nh_vrf_id=0)
    at staticd/static_nht.c:52
52          reinstall = false;
(gdb) 
53          for (si = rn->info; si; si = si->next) {
(gdb) 
51      for (rn = route_top(stable); rn; rn = route_next(rn)) {
(gdb) 
52          reinstall = false;
(gdb) 
53          for (si = rn->info; si; si = si->next) {
(gdb) 
51      for (rn = route_top(stable); rn; rn = route_next(rn)) {
(gdb) 
52          reinstall = false;
(gdb) 
53          for (si = rn->info; si; si = si->next) {
(gdb) 
54              if (si->nh_vrf_id != nh_vrf_id)
(gdb) 
57              if (si->type != STATIC_IPV4_GATEWAY
(gdb) 
63              orig = si->nh_valid;
(gdb) 
64              if (p->family == AF_INET
(gdb) 
65                  && p->u.prefix4.s_addr == si->addr.ipv4.s_addr)
(gdb) 
66                  si->nh_valid = !!nh_num;
(gdb) 
68              if (p->family == AF_INET6
(gdb) 
72              if (orig != si->nh_valid)
(gdb) print *si
$26 = {prev = 0x0, next = 0x0, vrf_id = 0, nh_vrf_id = 0, nh_vrfname = "default", '\000' <repeats 29 times>, 
  distance = 1 '\001', tag = 0, type = STATIC_IPV4_GATEWAY, bh_type = STATIC_BLACKHOLE_DROP, addr = {ipv4 = {
      s_addr = 40154122}, ipv6 = {__in6_u = {__u6_addr8 = "\n\264d\002", '\000' <repeats 11 times>, __u6_addr16 = {46090, 
          612, 0, 0, 0, 0, 0, 0}, __u6_addr32 = {40154122, 0, 0, 0}}}}, ifindex = 0, nh_registered = true, 
  nh_valid = true, ifname = '\000' <repeats 20 times>, snh_label = {num_labels = 0 '\000', reserved = "\000\000", 
    label = {0 <repeats 16 times>}}, table_id = 0, onlink = false}
(gdb) next
75              if (reinstall) {
(gdb) 
53          for (si = rn->info; si; si = si->next) {
(gdb) 
51      for (rn = route_top(stable); rn; rn = route_next(rn)) {
(gdb) 
52          reinstall = false;
(gdb) 
53          for (si = rn->info; si; si = si->next) {
(gdb) 
54              if (si->nh_vrf_id != nh_vrf_id)
(gdb) 
57              if (si->type != STATIC_IPV4_GATEWAY
(gdb) 
58                  && si->type != STATIC_IPV4_GATEWAY_IFNAME
(gdb) 
59                  && si->type != STATIC_IPV6_GATEWAY
(gdb) 
60                  && si->type != STATIC_IPV6_GATEWAY_IFNAME)
(gdb) 
61                  return;
(gdb) 
82  }
(gdb) print *si
$27 = {prev = 0x0, next = 0x0, vrf_id = 0, nh_vrf_id = 0, nh_vrfname = "default", '\000' <repeats 29 times>, 
  distance = 1 '\001', tag = 0, type = STATIC_BLACKHOLE, bh_type = STATIC_BLACKHOLE_NULL, addr = {ipv4 = {s_addr = 0}, 
    ipv6 = {__in6_u = {__u6_addr8 = '\000' <repeats 15 times>, __u6_addr16 = {0, 0, 0, 0, 0, 0, 0, 0}, __u6_addr32 = {0, 
          0, 0, 0}}}}, ifindex = 0, nh_registered = false, nh_valid = false, ifname = '\000' <repeats 20 times>, 
  snh_label = {num_labels = 0 '\000', reserved = "\000\000", label = {0 <repeats 16 times>}}, table_id = 0, 
  onlink = false}
(gdb) step
static_nht_update (p=0x55a3342004e0, nh_num=1, afi=AFI_IP, nh_vrf_id=0) at staticd/static_nht.c:93
93          static_nht_update_safi(p, nh_num, afi, SAFI_MULTICAST,
(gdb) 
static_nht_update_safi (p=0x55a3342004e0, nh_num=1, afi=AFI_IP, safi=SAFI_MULTICAST, vrf=0x55a3341c6fa0, nh_vrf_id=0)
    at staticd/static_nht.c:43
43      svrf = vrf->info;
(gdb) 
44      if (!svrf)
(gdb) 
47      stable = static_vrf_static_table(afi, safi, svrf);
(gdb) 
static_vrf_static_table (afi=AFI_IP, safi=SAFI_MULTICAST, svrf=0x55a3341c7060) at staticd/static_vrf.c:117
117     if (!svrf)
(gdb) 
120     if (afi >= AFI_MAX || safi >= SAFI_MAX)
(gdb) 
123     return svrf->stable[afi][safi];
(gdb) 
124 }
(gdb) 
static_nht_update_safi (p=0x55a3342004e0, nh_num=1, afi=AFI_IP, safi=SAFI_MULTICAST, vrf=0x55a3341c6fa0, nh_vrf_id=0)
    at staticd/static_nht.c:48

And here is the difference:

frr-7.0-orig/staticd/static_nht.c :

<               if (si->type != STATIC_IPV4_GATEWAY
<                   && si->type != STATIC_IPV4_GATEWAY_IFNAME
<                   && si->type != STATIC_IPV6_GATEWAY
<                   && si->type != STATIC_IPV6_GATEWAY_IFNAME)
<                   continue;
< 

frr-7.1/staticd/static_nht.c

>           if (si->type != STATIC_IPV4_GATEWAY
>               && si->type != STATIC_IPV4_GATEWAY_IFNAME
>               && si->type != STATIC_IPV6_GATEWAY
>               && si->type != STATIC_IPV6_GATEWAY_IFNAME)
>               return;
> 

Instead of continue in the new sources there is a return, which I is causing to stop the function and return to previous function.

After changing the return to continue and recompiling the sources this is the result:

RouterFW(config)# no ip route 10.240.2.0/24 10.180.100.2
RouterFW(config)# sh ip route static 
% Unknown command: sh ip route static 
RouterFW(config)# do sh ip route static 
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

S>* 10.240.0.0/24 [1/0] via 10.180.100.2, eth1, 00:00:20
S>* 10.240.1.0/24 [1/0] unreachable (blackhole), 00:00:20
RouterFW(config)# ip route 10.240.2.0/24 10.180.100.2
RouterFW(config)# do sh ip route static 
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

S>* 10.240.0.0/24 [1/0] via 10.180.100.2, eth1, 00:00:28
S>* 10.240.1.0/24 [1/0] unreachable (blackhole), 00:00:28
S>* 10.240.2.0/24 [1/0] via 10.180.100.2, eth1, 00:00:02
RouterFW(config)# 

Voila! Is working! Is not causing the ignoring the routes after the Null0 route.

Can be pushed as an emergency patch?

EasyNetDev commented 5 years ago

Issue solved with pull request #4070. We can close the ticket.