summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authoranlan_cs <vic.lan@pica8.com>2022-12-17 09:25:56 +0100
committeranlan_cs <vic.lan@pica8.com>2022-12-17 12:20:30 +0100
commit278749cad96931ac123947c88b6d12478b68bc41 (patch)
tree4769f96d94815e50502731b55e4e2926f8dc62c3 /zebra
parentMerge pull request #12533 from donaldsharp/returns_are_needed (diff)
downloadfrr-278749cad96931ac123947c88b6d12478b68bc41.tar.xz
frr-278749cad96931ac123947c88b6d12478b68bc41.zip
zebra: fix wrong gateway for fpm debug
The wrong parameter is passed in `inet_ntop()` of `zfpm_log_route_info()` in old fpm module, so the display of gateway is always wrong. Just remove that extra ampersand. Additionally, use "none" as gateway value for the case of no gateway. Signed-off-by: anlan_cs <vic.lan@pica8.com>
Diffstat (limited to 'zebra')
-rw-r--r--zebra/zebra_fpm_netlink.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c
index ca897251e..5cefa16cd 100644
--- a/zebra/zebra_fpm_netlink.c
+++ b/zebra/zebra_fpm_netlink.c
@@ -539,10 +539,15 @@ static void zfpm_log_route_info(struct netlink_route_info *ri,
for (i = 0; i < ri->num_nhs; i++) {
nhi = &ri->nhs[i];
- if (ri->af == AF_INET)
- inet_ntop(AF_INET, &nhi->gateway, buf, sizeof(buf));
- else
- inet_ntop(AF_INET6, &nhi->gateway, buf, sizeof(buf));
+ if (nhi->gateway) {
+ if (ri->af == AF_INET)
+ inet_ntop(AF_INET, nhi->gateway, buf,
+ sizeof(buf));
+ else
+ inet_ntop(AF_INET6, nhi->gateway, buf,
+ sizeof(buf));
+ } else
+ strlcpy(buf, "none", sizeof(buf));
zfpm_debug(" Intf: %u, Gateway: %s, Recursive: %s, Type: %s, Encap type: %s",
nhi->if_index, buf, nhi->recursive ? "yes" : "no",