diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-08-20 15:22:02 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-09-06 22:50:58 +0200 |
commit | 4496fbb36ca71fef34d40f679c21690cdf0a0e24 (patch) | |
tree | ff659b68d7b97bcca0720a4622e3dcd8b6482092 /lib | |
parent | lib: Convert sockunion.c to use flog_err (diff) | |
download | frr-4496fbb36ca71fef34d40f679c21690cdf0a0e24.tar.xz frr-4496fbb36ca71fef34d40f679c21690cdf0a0e24.zip |
lib: Convert sockopt.c to flog_err
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sockopt.c | 61 |
1 files changed, 36 insertions, 25 deletions
diff --git a/lib/sockopt.c b/lib/sockopt.c index 3febcb714..25e9973e5 100644 --- a/lib/sockopt.c +++ b/lib/sockopt.c @@ -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(LIB_ERR_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(LIB_ERR_SOCKET, + "%s: fd %d: SO_SNDBUF set to %d (requested %d)", + __func__, sock, size, orig_req); } int getsockopt_so_sendbuf(const int sock) @@ -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(LIB_ERR_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(LIB_ERR_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(LIB_ERR_SOCKET, "can't setsockopt IPV6_CHECKSUM"); return ret; } @@ -126,7 +129,8 @@ 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(LIB_ERR_SOCKET, + "can't setsockopt IPV6_MULTICAST_HOPS"); return ret; } @@ -138,7 +142,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(LIB_ERR_SOCKET, "can't setsockopt IPV6_UNICAST_HOPS"); return ret; } @@ -150,11 +154,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(LIB_ERR_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(LIB_ERR_SOCKET, "can't setsockopt IPV6_HOPLIMIT"); #endif return ret; } @@ -167,7 +171,8 @@ 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(LIB_ERR_SOCKET, + "can't setsockopt IPV6_MULTICAST_LOOP"); return ret; } @@ -188,8 +193,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(LIB_ERR_SOCKET, + "Can't set IPV6_TCLASS option for fd %d to %#x: %s", + sock, tclass, safe_strerror(errno)); #endif return ret; } @@ -391,7 +397,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(LIB_ERR_SOCKET, "can't setsockopt IP_MULTICAST_LOOP"); return ret; } @@ -403,13 +409,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(LIB_ERR_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(LIB_ERR_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 +435,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(LIB_ERR_SOCKET, + "Can't set IP_TOS option for fd %d to %#x: %s", sock, + tos, safe_strerror(errno)); return ret; } @@ -445,7 +454,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(LIB_ERR_DEVELOPMENT, + "setsockopt_ifindex: unknown address family %d", af); } return ret; } @@ -534,7 +544,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(LIB_ERR_DEVELOPMENT, + "getsockopt_ifindex: unknown address family %d", af); return 0; } } |