]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospfd/ospf_network.c
Merge pull request #10838 from ton31337/feature/bgpd_callbacks_for_start_end_configur...
[mirror_frr.git] / ospfd / ospf_network.c
index b8e2dac70e83f30a7a09680f3dff6bfe77814658..be06afe532620e162dbde3d4bc82809ce34df9ae 100644 (file)
@@ -53,16 +53,14 @@ int ospf_if_add_allspfrouters(struct ospf *top, struct prefix *p,
        if (ret < 0)
                flog_err(
                        EC_LIB_SOCKET,
-                       "can't setsockopt IP_ADD_MEMBERSHIP (fd %d, addr %s, "
-                       "ifindex %u, AllSPFRouters): %s; perhaps a kernel limit "
-                       "on # of multicast group memberships has been exceeded?",
-                       top->fd, inet_ntoa(p->u.prefix4), ifindex,
+                       "can't setsockopt IP_ADD_MEMBERSHIP (fd %d, addr %pI4, ifindex %u, AllSPFRouters): %s; perhaps a kernel limit on # of multicast group memberships has been exceeded?",
+                       top->fd, &p->u.prefix4, ifindex,
                        safe_strerror(errno));
        else {
                if (IS_DEBUG_OSPF_EVENT)
                        zlog_debug(
-                               "interface %s [%u] join AllSPFRouters Multicast group.",
-                               inet_ntoa(p->u.prefix4), ifindex);
+                               "interface %pI4 [%u] join AllSPFRouters Multicast group.",
+                               &p->u.prefix4, ifindex);
        }
 
        return ret;
@@ -78,15 +76,14 @@ int ospf_if_drop_allspfrouters(struct ospf *top, struct prefix *p,
                                        ifindex);
        if (ret < 0)
                flog_err(EC_LIB_SOCKET,
-                        "can't setsockopt IP_DROP_MEMBERSHIP (fd %d, addr %s, "
-                        "ifindex %u, AllSPFRouters): %s",
-                        top->fd, inet_ntoa(p->u.prefix4), ifindex,
+                        "can't setsockopt IP_DROP_MEMBERSHIP (fd %d, addr %pI4, ifindex %u, AllSPFRouters): %s",
+                        top->fd, &p->u.prefix4, ifindex,
                         safe_strerror(errno));
        else {
                if (IS_DEBUG_OSPF_EVENT)
                        zlog_debug(
-                               "interface %s [%u] leave AllSPFRouters Multicast group.",
-                               inet_ntoa(p->u.prefix4), ifindex);
+                               "interface %pI4 [%u] leave AllSPFRouters Multicast group.",
+                               &p->u.prefix4, ifindex);
        }
 
        return ret;
@@ -104,15 +101,13 @@ int ospf_if_add_alldrouters(struct ospf *top, struct prefix *p,
        if (ret < 0)
                flog_err(
                        EC_LIB_SOCKET,
-                       "can't setsockopt IP_ADD_MEMBERSHIP (fd %d, addr %s, "
-                       "ifindex %u, AllDRouters): %s; perhaps a kernel limit "
-                       "on # of multicast group memberships has been exceeded?",
-                       top->fd, inet_ntoa(p->u.prefix4), ifindex,
+                       "can't setsockopt IP_ADD_MEMBERSHIP (fd %d, addr %pI4, ifindex %u, AllDRouters): %s; perhaps a kernel limit on # of multicast group memberships has been exceeded?",
+                       top->fd, &p->u.prefix4, ifindex,
                        safe_strerror(errno));
        else
                zlog_debug(
-                       "interface %s [%u] join AllDRouters Multicast group.",
-                       inet_ntoa(p->u.prefix4), ifindex);
+                       "interface %pI4 [%u] join AllDRouters Multicast group.",
+                       &p->u.prefix4, ifindex);
 
        return ret;
 }
@@ -127,14 +122,13 @@ int ospf_if_drop_alldrouters(struct ospf *top, struct prefix *p,
                                        ifindex);
        if (ret < 0)
                flog_err(EC_LIB_SOCKET,
-                        "can't setsockopt IP_DROP_MEMBERSHIP (fd %d, addr %s, "
-                        "ifindex %u, AllDRouters): %s",
-                        top->fd, inet_ntoa(p->u.prefix4), ifindex,
+                        "can't setsockopt IP_DROP_MEMBERSHIP (fd %d, addr %pI4, ifindex %u, AllDRouters): %s",
+                        top->fd, &p->u.prefix4, ifindex,
                         safe_strerror(errno));
        else
                zlog_debug(
-                       "interface %s [%u] leave AllDRouters Multicast group.",
-                       inet_ntoa(p->u.prefix4), ifindex);
+                       "interface %pI4 [%u] leave AllDRouters Multicast group.",
+                       &p->u.prefix4, ifindex);
 
        return ret;
 }
@@ -167,9 +161,8 @@ int ospf_if_ipmulticast(struct ospf *top, struct prefix *p, ifindex_t ifindex)
        ret = setsockopt_ipv4_multicast_if(top->fd, p->u.prefix4, ifindex);
        if (ret < 0)
                flog_err(EC_LIB_SOCKET,
-                        "can't setsockopt IP_MULTICAST_IF(fd %d, addr %s, "
-                        "ifindex %u): %s",
-                        top->fd, inet_ntoa(p->u.prefix4), ifindex,
+                        "can't setsockopt IP_MULTICAST_IF(fd %d, addr %pI4, ifindex %u): %s",
+                        top->fd, &p->u.prefix4, ifindex,
                         safe_strerror(errno));
 #endif
 
@@ -197,7 +190,7 @@ int ospf_sock_init(struct ospf *ospf)
                        flog_err(EC_LIB_SOCKET,
                                 "ospf_read_sock_init: socket: %s",
                                 safe_strerror(errno));
-                       exit(1);
+                       return -1;
                }
 
 #ifdef IP_HDRINCL
@@ -208,7 +201,6 @@ int ospf_sock_init(struct ospf *ospf)
                        flog_err(EC_LIB_SOCKET,
                                 "Can't set IP_HDRINCL option for fd %d: %s",
                                 ospf_sock, safe_strerror(errno));
-                       close(ospf_sock);
                        break;
                }
 #elif defined(IPTOS_PREC_INTERNETCONTROL)
@@ -220,7 +212,6 @@ int ospf_sock_init(struct ospf *ospf)
                        flog_err(EC_LIB_SOCKET,
                                 "can't set sockopt IP_TOS %d to socket %d: %s",
                                 tos, ospf_sock, safe_strerror(errno));
-                       close(ospf_sock); /* Prevent sd leak. */
                        break;
                }
 #else /* !IPTOS_PREC_INTERNETCONTROL */