]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/if_sysctl.c
Merge pull request #3503 from qlyoung/fix-bgpd-show-ip-neigh-json-double-free
[mirror_frr.git] / zebra / if_sysctl.c
index 39b7204e8e636ea2f7363e9cd3de6b0c520cc0cc..44afd266bc1e1bfc0b0d8354163cf79c8aaa4ac4 100644 (file)
@@ -37,6 +37,7 @@
 #include "zebra/rt.h"
 #include "zebra/kernel_socket.h"
 #include "zebra/rib.h"
+#include "zebra/zebra_errors.h"
 
 void ifstat_update_sysctl(void)
 {
@@ -52,16 +53,18 @@ void ifstat_update_sysctl(void)
 
        /* Query buffer size. */
        if (sysctl(mib, MIBSIZ, NULL, &bufsiz, NULL, 0) < 0) {
-               zlog_warn("sysctl() error by %s", safe_strerror(errno));
+               flog_warn(EC_ZEBRA_SYSCTL_FAILED, "sysctl() error by %s",
+                         safe_strerror(errno));
                return;
        }
 
        /* We free this memory at the end of this function. */
        ref = buf = XMALLOC(MTYPE_TMP, bufsiz);
 
-       /* Fetch interface informations into allocated buffer. */
+       /* Fetch interface information into allocated buffer. */
        if (sysctl(mib, MIBSIZ, buf, &bufsiz, NULL, 0) < 0) {
-               zlog_warn("sysctl error by %s", safe_strerror(errno));
+               flog_warn(EC_ZEBRA_SYSCTL_FAILED, "sysctl error by %s",
+                         safe_strerror(errno));
                XFREE(MTYPE_TMP, ref);
                return;
        }
@@ -95,22 +98,26 @@ void interface_list(struct zebra_ns *zns)
                NET_RT_IFLIST, 0};
 
        if (zns->ns_id != NS_DEFAULT) {
-               zlog_warn("interface_list: ignore NS %u", zns->ns_id);
+               zlog_debug("interface_list: ignore NS %u", zns->ns_id);
                return;
        }
 
        /* Query buffer size. */
        if (sysctl(mib, MIBSIZ, NULL, &bufsiz, NULL, 0) < 0) {
-               zlog_warn("sysctl() error by %s", safe_strerror(errno));
+               flog_err_sys(EC_ZEBRA_IFLIST_FAILED,
+                            "Could not enumerate interfaces: %s",
+                            safe_strerror(errno));
                return;
        }
 
        /* We free this memory at the end of this function. */
        ref = buf = XMALLOC(MTYPE_TMP, bufsiz);
 
-       /* Fetch interface informations into allocated buffer. */
+       /* Fetch interface information into allocated buffer. */
        if (sysctl(mib, MIBSIZ, buf, &bufsiz, NULL, 0) < 0) {
-               zlog_warn("sysctl error by %s", safe_strerror(errno));
+               flog_err_sys(EC_ZEBRA_IFLIST_FAILED,
+                            "Could not enumerate interfaces: %s",
+                            safe_strerror(errno));
                return;
        }