]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: fix showing nexthop vrf for ipv6 blackhole
authorLouis Scalbert <louis.scalbert@6wind.com>
Fri, 18 Oct 2024 12:16:50 +0000 (14:16 +0200)
committerLouis Scalbert <louis.scalbert@6wind.com>
Fri, 18 Oct 2024 12:45:50 +0000 (14:45 +0200)
For some reasons the Linux kernel associates the ipv6 blackhole of non
default table the lo interface.

> root@r1# ip -6 route show table 100
> root@r1# ip -6 route add unreachable default metric 4278198272 table 100
> root@r1# ip -6 route show table 100
> unreachable default dev lo metric 4278198272 pref medium

As a consequence, the VRF default that owns the lo interface is shown as
the nexthop VRF:

> r1# show ipv6 route table 20
> Table 20:
> K>* ::/0 [255/8192] unreachable (ICMP unreachable) (vrf default), 00:18:12

Do not display the nexthop VRF of a blackhole. It does not make sense
for a blackhole and it was not displayed in the past.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
zebra/zebra_rnh.c
zebra/zebra_vty.c

index 35486a4cd0e89aaf562e573dd75941b8111bd799..640e6551a774d437c95ab3eb6bf49a6b9c0c3150 100644 (file)
@@ -1271,7 +1271,7 @@ void show_nexthop_json_helper(json_object *json_nexthop,
        bool display_vrfid = false;
        uint8_t rn_family;
 
-       if (re == NULL || nexthop->vrf_id != re->vrf_id)
+       if ((re == NULL || nexthop->vrf_id != re->vrf_id) && nexthop->type != NEXTHOP_TYPE_BLACKHOLE)
                display_vrfid = true;
 
        if (rn)
@@ -1292,7 +1292,7 @@ void show_route_nexthop_helper(struct vty *vty, const struct route_node *rn,
        bool display_vrfid = false;
        uint8_t rn_family;
 
-       if (re == NULL || nexthop->vrf_id != re->vrf_id)
+       if ((re == NULL || nexthop->vrf_id != re->vrf_id) && nexthop->type != NEXTHOP_TYPE_BLACKHOLE)
                display_vrfid = true;
 
        if (rn)
index 3bf20ff42e7c2a23135e9a6374543f6ad41e2d38..f3292fd85ae87bc7a7b9d192b83658eba6ef70c9 100644 (file)
@@ -370,7 +370,7 @@ static void show_nexthop_detail_helper(struct vty *vty,
                break;
        }
 
-       if (re->vrf_id != nexthop->vrf_id) {
+       if (re->vrf_id != nexthop->vrf_id && nexthop->type != NEXTHOP_TYPE_BLACKHOLE) {
                struct vrf *vrf = vrf_lookup_by_id(nexthop->vrf_id);
 
                vty_out(vty, "(vrf %s)", VRF_LOGNAME(vrf));