]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Do not allow instance redistribution to happen no matter what
authorDonald Sharp <sharpd@nvidia.com>
Tue, 4 Jan 2022 11:57:53 +0000 (06:57 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Tue, 18 Jan 2022 13:39:40 +0000 (08:39 -0500)
If you have this setup:

router ospf 3
  redistribute sharp
!

and then install:
sharp install route 4.5.6.7 nexthop 192.168.100.1 1
sharp install route 4.5.6.8 nexthop 192.168.100.1 1 instance 3
sharp install route 4.5.6.9 nexthop 192.168.100.1 1 instance 4

The .8 and .9 routes are auto redistributed into ospf instance 3:

eva# show ip ospf data

OSPF Instance: 3

       OSPF Router with ID (192.168.122.1)

                AS External Link States

Link ID         ADV Router      Age  Seq#       CkSum  Route
4.5.6.7        192.168.122.1     13 0x80000001 0x477c E2 4.5.6.7/32 [0x0]
4.5.6.8        192.168.122.1      5 0x80000001 0x3d85 E2 4.5.6.8/32 [0x0]
4.5.6.9        192.168.122.1      5 0x80000001 0x338e E2 4.5.6.9/32 [0x0]

This cannot be correct behavior.  When redistributing in the absense
of an instance number the default instance of 0 should be used and should
be the only route redistributed.  Here is the correct behavior:

eva# show ip route
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, r - rejected, b - backup
       t - trapped, o - offload failure

K>* 0.0.0.0/0 [0/100] via 192.168.119.1, enp39s0, 00:00:28
D>* 4.5.6.7/32 [150/0] via 192.168.100.1, virbr1, weight 1, 00:00:02
D[3]>* 4.5.6.8/32 [150/0] via 192.168.100.1, virbr1, weight 1, 00:00:02
D[4]>* 4.5.6.9/32 [150/0] via 192.168.100.1, virbr1, weight 1, 00:00:02
C>* 192.168.100.0/24 is directly connected, virbr1, 00:00:28
C>* 192.168.110.0/24 is directly connected, virbr2, 00:00:28
C>* 192.168.119.0/24 is directly connected, enp39s0, 00:00:28
C>* 192.168.122.0/24 is directly connected, virbr0, 00:00:28
eva# show ip ospf data

OSPF Instance: 3

       OSPF Router with ID (192.168.122.1)

                AS External Link States

Link ID         ADV Router      Age  Seq#       CkSum  Route
4.5.6.7        192.168.122.1      6 0x80000001 0x477c E2 4.5.6.7/32 [0x0]

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
zebra/redistribute.c

index e7044bc67f6274c66872f18a6e0b09fa98cb802a..b1e8815ce5a425eb3e26dc92e09489f8d02a1292 100644 (file)
@@ -176,10 +176,13 @@ static bool zebra_redistribute_check(const struct route_entry *re,
         * If multi-instance then check for route
         * redistribution for given instance.
         */
-       if (re->instance
-           && redist_check_instance(&client->mi_redist[afi][re->type],
-                                    re->instance))
-               return true;
+       if (re->instance) {
+               if (redist_check_instance(&client->mi_redist[afi][re->type],
+                                         re->instance))
+                       return true;
+               else
+                       return false;
+       }
 
        /* If redistribution is enabled for give route type. */
        if (vrf_bitmap_check(client->redist[afi][re->type], re->vrf_id))