]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: debug trace retrieve real peer origin of path info 12917/head
authorPhilippe Guibert <philippe.guibert@6wind.com>
Fri, 24 Feb 2023 13:26:59 +0000 (14:26 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 28 Feb 2023 21:00:25 +0000 (22:00 +0100)
The BGP path info debugging information should dump the
real peer information for imported prefixes.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
bgpd/bgp_route.c

index f9028422eb10b0f43196cd54ca5910132abda59f..1e9f9429c5e8dd7fd1fc6b7a3b3f09dbfefe38a4 100644 (file)
@@ -515,11 +515,19 @@ static uint32_t bgp_med_value(struct attr *attr, struct bgp *bgp)
 void bgp_path_info_path_with_addpath_rx_str(struct bgp_path_info *pi, char *buf,
                                            size_t buf_len)
 {
+       struct peer *peer;
+
+       if (pi->sub_type == BGP_ROUTE_IMPORTED &&
+           bgp_get_imported_bpi_ultimate(pi))
+               peer = bgp_get_imported_bpi_ultimate(pi)->peer;
+       else
+               peer = pi->peer;
+
        if (pi->addpath_rx_id)
-               snprintf(buf, buf_len, "path %s (addpath rxid %d)",
-                        pi->peer->host, pi->addpath_rx_id);
+               snprintf(buf, buf_len, "path %s (addpath rxid %d)", peer->host,
+                        pi->addpath_rx_id);
        else
-               snprintf(buf, buf_len, "path %s", pi->peer->host);
+               snprintf(buf, buf_len, "path %s", peer->host);
 }