]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Show why the prefix is inaccessible in show commands 12054/head
authorDonatas Abraitis <donatas@opensourcerouting.org>
Tue, 4 Oct 2022 08:32:39 +0000 (11:32 +0300)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Tue, 4 Oct 2022 08:32:39 +0000 (11:32 +0300)
```
donatas-pc# show ip bgp 100.100.100.0/24 longer-prefixes
BGP table version is 13, local router ID is 10.10.10.10, vrf id 0
Default local pref 100, local AS 65000
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

   Network          Next Hop            Metric LocPrf Weight Path
   100.100.100.0/24 0.0.0.0                  0         32768 i

Displayed  1 routes and 15 total paths
donatas-pc# show ip bgp 100.100.100.0/24
BGP routing table entry for 100.100.100.0/24, version 0
Paths: (1 available, no best path)
  Not advertised to any peer
  Local
    0.0.0.0 (inaccessible, import-check enabled) from 0.0.0.0 (10.10.10.10)
      Origin IGP, metric 0, weight 32768, invalid, sourced, local
      Last update: Tue Oct  4 11:31:44 2022
donatas-pc# show ip bgp 100.100.100.0/24 json
{
  "prefix":"100.100.100.0\/24",
  "version":0,
  "paths":[
    {
      "aspath":{
        "string":"Local",
        "segments":[
        ],
        "length":0
      },
      "origin":"IGP",
      "metric":0,
      "weight":32768,
      "valid":false,
      "version":0,
      "sourced":true,
      "local":true,
      "lastUpdate":{
        "epoch":1664872304,
        "string":"Tue Oct  4 11:31:44 2022\n"
      },
      "nexthops":[
        {
          "ip":"0.0.0.0",
          "hostname":"donatas-pc",
          "afi":"ipv4",
          "accessible":false,
          "importCheckEnabled":true,
          "used":true
        }
      ],
      "peer":{
        "peerId":"0.0.0.0",
        "routerId":"10.10.10.10"
      }
    }
  ]
}
donatas-pc#
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd/bgp_route.c

index a8e016a89081602c4737e11e9bff083137ae3de2..7d4110029ec22e52800a743e96c0a1910512b1a6 100644 (file)
@@ -10287,11 +10287,17 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
 
        /* Display the IGP cost or 'inaccessible' */
        if (!CHECK_FLAG(path->flags, BGP_PATH_VALID)) {
-               if (json_paths)
+               bool import = CHECK_FLAG(bgp->flags, BGP_FLAG_IMPORT_CHECK);
+
+               if (json_paths) {
                        json_object_boolean_false_add(json_nexthop_global,
                                                      "accessible");
-               else
-                       vty_out(vty, " (inaccessible)");
+                       json_object_boolean_add(json_nexthop_global,
+                                               "importCheckEnabled", import);
+               } else {
+                       vty_out(vty, " (inaccessible%s)",
+                               import ? ", import-check enabled" : "");
+               }
        } else {
                if (path->extra && path->extra->igpmetric) {
                        if (json_paths)