]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/sockopt.c
zebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message
[mirror_frr.git] / lib / sockopt.c
index 3febcb714d5a57e406cce9921034fe5139b2141d..ea04f2a43ee93ac2c180021f63cfeb9eeae3ad8a 100644 (file)
@@ -38,8 +38,9 @@ void setsockopt_so_recvbuf(int sock, int size)
                size /= 2;
 
        if (size != orig_req)
-               zlog_warn("%s: fd %d: SO_RCVBUF set to %d (requested %d)",
-                         __func__, sock, size, orig_req);
+               flog_err(EC_LIB_SOCKET,
+                        "%s: fd %d: SO_RCVBUF set to %d (requested %d)",
+                        __func__, sock, size, orig_req);
 }
 
 void setsockopt_so_sendbuf(const int sock, int size)
@@ -51,8 +52,9 @@ void setsockopt_so_sendbuf(const int sock, int size)
                size /= 2;
 
        if (size != orig_req)
-               zlog_warn("%s: fd %d: SO_SNDBUF set to %d (requested %d)",
-                         __func__, sock, size, orig_req);
+               flog_err(EC_LIB_SOCKET,
+                        "%s: fd %d: SO_SNDBUF set to %d (requested %d)",
+                        __func__, sock, size, orig_req);
 }
 
 int getsockopt_so_sendbuf(const int sock)
@@ -62,7 +64,7 @@ int getsockopt_so_sendbuf(const int sock)
        int ret = getsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char *)&optval,
                             &optlen);
        if (ret < 0) {
-               flog_err_sys(LIB_ERR_SYSTEM_CALL,
+               flog_err_sys(EC_LIB_SYSTEM_CALL,
                             "fd %d: can't getsockopt SO_SNDBUF: %d (%s)", sock,
                             errno, safe_strerror(errno));
                return ret;
@@ -92,13 +94,14 @@ int setsockopt_ipv6_pktinfo(int sock, int val)
        ret = setsockopt(sock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &val,
                         sizeof(val));
        if (ret < 0)
-               zlog_warn("can't setsockopt IPV6_RECVPKTINFO : %s",
-                         safe_strerror(errno));
+               flog_err(EC_LIB_SOCKET,
+                        "can't setsockopt IPV6_RECVPKTINFO : %s",
+                        safe_strerror(errno));
 #else  /*RFC2292*/
        ret = setsockopt(sock, IPPROTO_IPV6, IPV6_PKTINFO, &val, sizeof(val));
        if (ret < 0)
-               zlog_warn("can't setsockopt IPV6_PKTINFO : %s",
-                         safe_strerror(errno));
+               flog_err(EC_LIB_SOCKET, "can't setsockopt IPV6_PKTINFO : %s",
+                        safe_strerror(errno));
 #endif /* INIA_IPV6 */
        return ret;
 }
@@ -114,7 +117,7 @@ int setsockopt_ipv6_checksum(int sock, int val)
        ret = setsockopt(sock, IPPROTO_IPV6, IPV6_CHECKSUM, &val, sizeof(val));
 #endif /* GNU_LINUX */
        if (ret < 0)
-               zlog_warn("can't setsockopt IPV6_CHECKSUM");
+               flog_err(EC_LIB_SOCKET, "can't setsockopt IPV6_CHECKSUM");
        return ret;
 }
 
@@ -126,7 +129,7 @@ int setsockopt_ipv6_multicast_hops(int sock, int val)
        ret = setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &val,
                         sizeof(val));
        if (ret < 0)
-               zlog_warn("can't setsockopt IPV6_MULTICAST_HOPS");
+               flog_err(EC_LIB_SOCKET, "can't setsockopt IPV6_MULTICAST_HOPS");
        return ret;
 }
 
@@ -138,7 +141,7 @@ int setsockopt_ipv6_unicast_hops(int sock, int val)
        ret = setsockopt(sock, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &val,
                         sizeof(val));
        if (ret < 0)
-               zlog_warn("can't setsockopt IPV6_UNICAST_HOPS");
+               flog_err(EC_LIB_SOCKET, "can't setsockopt IPV6_UNICAST_HOPS");
        return ret;
 }
 
@@ -150,11 +153,11 @@ int setsockopt_ipv6_hoplimit(int sock, int val)
        ret = setsockopt(sock, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &val,
                         sizeof(val));
        if (ret < 0)
-               zlog_warn("can't setsockopt IPV6_RECVHOPLIMIT");
+               flog_err(EC_LIB_SOCKET, "can't setsockopt IPV6_RECVHOPLIMIT");
 #else /*RFC2292*/
        ret = setsockopt(sock, IPPROTO_IPV6, IPV6_HOPLIMIT, &val, sizeof(val));
        if (ret < 0)
-               zlog_warn("can't setsockopt IPV6_HOPLIMIT");
+               flog_err(EC_LIB_SOCKET, "can't setsockopt IPV6_HOPLIMIT");
 #endif
        return ret;
 }
@@ -167,7 +170,7 @@ int setsockopt_ipv6_multicast_loop(int sock, int val)
        ret = setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &val,
                         sizeof(val));
        if (ret < 0)
-               zlog_warn("can't setsockopt IPV6_MULTICAST_LOOP");
+               flog_err(EC_LIB_SOCKET, "can't setsockopt IPV6_MULTICAST_LOOP");
        return ret;
 }
 
@@ -188,8 +191,9 @@ int setsockopt_ipv6_tclass(int sock, int tclass)
        ret = setsockopt(sock, IPPROTO_IPV6, IPV6_TCLASS, &tclass,
                         sizeof(tclass));
        if (ret < 0)
-               zlog_warn("Can't set IPV6_TCLASS option for fd %d to %#x: %s",
-                         sock, tclass, safe_strerror(errno));
+               flog_err(EC_LIB_SOCKET,
+                        "Can't set IPV6_TCLASS option for fd %d to %#x: %s",
+                        sock, tclass, safe_strerror(errno));
 #endif
        return ret;
 }
@@ -391,7 +395,7 @@ int setsockopt_ipv4_multicast_loop(int sock, uint8_t val)
        ret = setsockopt(sock, IPPROTO_IP, IP_MULTICAST_LOOP, (void *)&val,
                         sizeof(val));
        if (ret < 0)
-               zlog_warn("can't setsockopt IP_MULTICAST_LOOP");
+               flog_err(EC_LIB_SOCKET, "can't setsockopt IP_MULTICAST_LOOP");
 
        return ret;
 }
@@ -403,13 +407,15 @@ static int setsockopt_ipv4_ifindex(int sock, ifindex_t val)
 #if defined(IP_PKTINFO)
        if ((ret = setsockopt(sock, IPPROTO_IP, IP_PKTINFO, &val, sizeof(val)))
            < 0)
-               zlog_warn("Can't set IP_PKTINFO option for fd %d to %d: %s",
-                         sock, val, safe_strerror(errno));
+               flog_err(EC_LIB_SOCKET,
+                        "Can't set IP_PKTINFO option for fd %d to %d: %s",
+                        sock, val, safe_strerror(errno));
 #elif defined(IP_RECVIF)
        if ((ret = setsockopt(sock, IPPROTO_IP, IP_RECVIF, &val, sizeof(val)))
            < 0)
-               zlog_warn("Can't set IP_RECVIF option for fd %d to %d: %s",
-                         sock, val, safe_strerror(errno));
+               flog_err(EC_LIB_SOCKET,
+                        "Can't set IP_RECVIF option for fd %d to %d: %s", sock,
+                        val, safe_strerror(errno));
 #else
 #warning "Neither IP_PKTINFO nor IP_RECVIF is available."
 #warning "Will not be able to receive link info."
@@ -427,8 +433,9 @@ int setsockopt_ipv4_tos(int sock, int tos)
 
        ret = setsockopt(sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos));
        if (ret < 0)
-               zlog_warn("Can't set IP_TOS option for fd %d to %#x: %s", sock,
-                         tos, safe_strerror(errno));
+               flog_err(EC_LIB_SOCKET,
+                        "Can't set IP_TOS option for fd %d to %#x: %s", sock,
+                        tos, safe_strerror(errno));
        return ret;
 }
 
@@ -445,7 +452,8 @@ int setsockopt_ifindex(int af, int sock, ifindex_t val)
                ret = setsockopt_ipv6_pktinfo(sock, val);
                break;
        default:
-               zlog_warn("setsockopt_ifindex: unknown address family %d", af);
+               flog_err(EC_LIB_DEVELOPMENT,
+                        "setsockopt_ifindex: unknown address family %d", af);
        }
        return ret;
 }
@@ -534,7 +542,8 @@ ifindex_t getsockopt_ifindex(int af, struct msghdr *msgh)
                return (getsockopt_ipv6_ifindex(msgh));
                break;
        default:
-               zlog_warn("getsockopt_ifindex: unknown address family %d", af);
+               flog_err(EC_LIB_DEVELOPMENT,
+                        "getsockopt_ifindex: unknown address family %d", af);
                return 0;
        }
 }
@@ -649,7 +658,7 @@ int sockopt_tcp_signature(int sock, union sockunion *su, const char *password)
                        ret = 0;
                else
                        flog_err_sys(
-                               LIB_ERR_SYSTEM_CALL,
+                               EC_LIB_SYSTEM_CALL,
                                "sockopt_tcp_signature: setsockopt(%d): %s",
                                sock, safe_strerror(errno));
        }