]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: fix wrong gateway for fpm debug
authoranlan_cs <vic.lan@pica8.com>
Sat, 17 Dec 2022 08:25:56 +0000 (16:25 +0800)
committeranlan_cs <vic.lan@pica8.com>
Sat, 17 Dec 2022 11:20:30 +0000 (19:20 +0800)
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>
zebra/zebra_fpm_netlink.c

index ca897251e2198e28385d155cdb7a9d6a1932b9e4..5cefa16cdd1f94b721e0f0e2ecf79bc0d3ba0458 100644 (file)
@@ -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",