]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/irdp_interface.c
isisd: retrofit the 'isis [c|p]snp-interval' commands
[mirror_frr.git] / zebra / irdp_interface.c
index f02ba1fa2f84ca29360167cfb9a91b9ca9ca5b7b..3e50550dd2f8dcd9a541bff34baee9c147f0f9e6 100644 (file)
 #include "log.h"
 #include "zclient.h"
 #include "thread.h"
+#include "lib_errors.h"
 #include "zebra/interface.h"
 #include "zebra/rtadv.h"
 #include "zebra/rib.h"
 #include "zebra/zserv.h"
 #include "zebra/redistribute.h"
 #include "zebra/irdp.h"
+#include "zebra/zebra_errors.h"
 #include <netinet/ip_icmp.h>
 #include "if.h"
 #include "sockunion.h"
@@ -124,7 +126,8 @@ static int if_group(struct interface *ifp, int sock, uint32_t group,
        p = irdp_get_prefix(ifp);
 
        if (!p) {
-               zlog_warn("IRDP: can't get address for %s", ifp->name);
+               flog_warn(EC_ZEBRA_NO_IFACE_ADDR,
+                         "IRDP: can't get address for %s", ifp->name);
                return 1;
        }
 
@@ -133,10 +136,10 @@ static int if_group(struct interface *ifp, int sock, uint32_t group,
        ret = setsockopt(sock, IPPROTO_IP, add_leave, (char *)&m,
                         sizeof(struct ip_mreq));
        if (ret < 0)
-               zlog_warn("IRDP: %s can't setsockopt %s: %s",
-                         add_leave == IP_ADD_MEMBERSHIP ? "join group"
-                                                        : "leave group",
-                         inet_2a(group, b1), safe_strerror(errno));
+               flog_err_sys(EC_LIB_SOCKET, "IRDP: %s can't setsockopt %s: %s",
+                            add_leave == IP_ADD_MEMBERSHIP ? "join group"
+                                                           : "leave group",
+                            inet_2a(group, b1), safe_strerror(errno));
 
        return ret;
 }
@@ -215,14 +218,14 @@ static void irdp_if_start(struct interface *ifp, int multicast,
 
        irdp->started = true;
        if (irdp->flags & IF_ACTIVE) {
-               zlog_warn("IRDP: Interface is already active %s", ifp->name);
+               zlog_debug("IRDP: Interface is already active %s", ifp->name);
                return;
        }
        if ((irdp_sock < 0) && ((irdp_sock = irdp_sock_init()) < 0)) {
-               zlog_warn(
-                       "IRDP: Cannot activate interface %s (cannot create "
-                       "IRDP socket)",
-                       ifp->name);
+               flog_warn(EC_ZEBRA_IRDP_CANNOT_ACTIVATE_IFACE,
+                         "IRDP: Cannot activate interface %s (cannot create "
+                         "IRDP socket)",
+                         ifp->name);
                return;
        }
        irdp->flags |= IF_ACTIVE;
@@ -233,7 +236,8 @@ static void irdp_if_start(struct interface *ifp, int multicast,
        if_add_update(ifp);
 
        if (!(ifp->flags & IFF_UP)) {
-               zlog_warn("IRDP: Interface is down %s", ifp->name);
+               flog_warn(EC_ZEBRA_IRDP_IFACE_DOWN,
+                         "IRDP: Interface is down %s", ifp->name);
        }
 
        /* Shall we cancel if_start if if_add_group fails? */
@@ -242,7 +246,8 @@ static void irdp_if_start(struct interface *ifp, int multicast,
                if_add_group(ifp);
 
                if (!(ifp->flags & (IFF_MULTICAST | IFF_ALLMULTI))) {
-                       zlog_warn("IRDP: Interface not multicast enabled %s",
+                       flog_warn(EC_ZEBRA_IRDP_IFACE_MCAST_DISABLED,
+                                 "IRDP: Interface not multicast enabled %s",
                                  ifp->name);
                }
        }
@@ -290,12 +295,12 @@ static void irdp_if_stop(struct interface *ifp)
        struct irdp_interface *irdp = zi->irdp;
 
        if (irdp == NULL) {
-               zlog_warn("Interface %s structure is NULL", ifp->name);
+               zlog_debug("Interface %s structure is NULL", ifp->name);
                return;
        }
 
        if (!(irdp->flags & IF_ACTIVE)) {
-               zlog_warn("Interface is not active %s", ifp->name);
+               zlog_debug("Interface is not active %s", ifp->name);
                return;
        }
 
@@ -304,7 +309,7 @@ static void irdp_if_stop(struct interface *ifp)
 
        irdp_advert_off(ifp);
 
-       list_delete_and_null(&irdp->AdvPrefList);
+       list_delete(&irdp->AdvPrefList);
 
        irdp->flags = 0;
 }
@@ -319,7 +324,7 @@ static void irdp_if_shutdown(struct interface *ifp)
                return;
 
        if (irdp->flags & IF_SHUTDOWN) {
-               zlog_warn("IRDP: Interface is already shutdown %s", ifp->name);
+               zlog_debug("IRDP: Interface is already shutdown %s", ifp->name);
                return;
        }
 
@@ -341,7 +346,7 @@ static void irdp_if_no_shutdown(struct interface *ifp)
                return;
 
        if (!(irdp->flags & IF_SHUTDOWN)) {
-               zlog_warn("IRDP: Interface is not shutdown %s", ifp->name);
+               zlog_debug("IRDP: Interface is not shutdown %s", ifp->name);
                return;
        }