]> git.proxmox.com Git - mirror_frr.git/blobdiff - pimd/pim_igmp.c
lib: enforce vrf_name_to_id by returning default_vrf when name is null
[mirror_frr.git] / pimd / pim_igmp.c
index b46f1b5e9dde1870297c7fcb633d64bcc2a3fa83..7a19d25a7b36f11eeed4dcd29fd691603b5ca218 100644 (file)
@@ -24,6 +24,7 @@
 #include "if.h"
 #include "hash.h"
 #include "jhash.h"
+#include "lib_errors.h"
 
 #include "pimd.h"
 #include "pim_igmp.h"
@@ -96,7 +97,8 @@ static int igmp_sock_open(struct in_addr ifaddr, struct interface *ifp,
        }
 
        if (!join) {
-               zlog_err(
+               flog_err_sys(
+                       EC_LIB_SOCKET,
                        "IGMP socket fd=%d could not join any group on interface address %s",
                        fd, inet_ntoa(ifaddr));
                close(fd);
@@ -697,7 +699,8 @@ static void sock_close(struct igmp_sock *igmp)
        THREAD_OFF(igmp->t_igmp_read);
 
        if (close(igmp->fd)) {
-               zlog_err(
+               flog_err(
+                       EC_LIB_SOCKET,
                        "Failure closing IGMP socket %s fd=%d on interface %s: errno=%d: %s",
                        inet_ntoa(igmp->ifaddr), igmp->fd,
                        igmp->interface->name, errno, safe_strerror(errno));
@@ -733,7 +736,7 @@ void igmp_startup_mode_on(struct igmp_sock *igmp)
 
 static void igmp_group_free(struct igmp_group *group)
 {
-       list_delete_and_null(&group->group_source_list);
+       list_delete(&group->group_source_list);
 
        XFREE(MTYPE_PIM_IGMP_GROUP, group);
 }
@@ -785,7 +788,7 @@ void igmp_sock_free(struct igmp_sock *igmp)
        zassert(igmp->igmp_group_list);
        zassert(!listcount(igmp->igmp_group_list));
 
-       list_delete_and_null(&igmp->igmp_group_list);
+       list_delete(&igmp->igmp_group_list);
        hash_free(igmp->igmp_group_hash);
 
        XFREE(MTYPE_PIM_IGMP_SOCKET, igmp);
@@ -833,15 +836,15 @@ static unsigned int igmp_group_hash_key(void *arg)
        return jhash_1word(group->group_addr.s_addr, 0);
 }
 
-static int igmp_group_hash_equal(const void *arg1, const void *arg2)
+static bool igmp_group_hash_equal(const void *arg1, const void *arg2)
 {
        const struct igmp_group *g1 = (const struct igmp_group *)arg1;
        const struct igmp_group *g2 = (const struct igmp_group *)arg2;
 
        if (g1->group_addr.s_addr == g2->group_addr.s_addr)
-               return 1;
+               return true;
 
-       return 0;
+       return false;
 }
 
 static struct igmp_sock *igmp_sock_new(int fd, struct in_addr ifaddr,
@@ -960,12 +963,6 @@ struct igmp_sock *pim_igmp_sock_add(struct list *igmp_sock_list,
        }
 
        igmp = igmp_sock_new(fd, ifaddr, ifp, mtrace_only);
-       if (!igmp) {
-               zlog_err("%s %s: igmp_sock_new() failure", __FILE__,
-                        __PRETTY_FUNCTION__);
-               close(fd);
-               return 0;
-       }
 
        igmp_read_on(igmp);