summaryrefslogtreecommitdiffstats
path: root/pimd/pim_sock.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-06-18 16:17:36 +0200
committerQuentin Young <qlyoung@cumulusnetworks.com>2018-08-14 22:02:05 +0200
commit3613d8984440c5193a1d41dd5ccfd1ba50b73d8e (patch)
tree60bbfab91d34892c1b2b59b4281e0b3fac9a81a5 /pimd/pim_sock.c
parentripngd: Convert over to using LIB_ERR_XXXX for zlog_ferr (diff)
downloadfrr-3613d8984440c5193a1d41dd5ccfd1ba50b73d8e.tar.xz
frr-3613d8984440c5193a1d41dd5ccfd1ba50b73d8e.zip
pimd: Convert over to use LIB_ERR_XXX for zlog_err
Convert, where appropriate, the zlog_err functions to zlog_ferr for the LIB_ERR_XXX enums Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_sock.c')
-rw-r--r--pimd/pim_sock.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/pimd/pim_sock.c b/pimd/pim_sock.c
index fb0d6b506..44e051804 100644
--- a/pimd/pim_sock.c
+++ b/pimd/pim_sock.c
@@ -33,6 +33,7 @@
#include "if.h"
#include "vrf.h"
#include "sockopt.h"
+#include "lib_errors.h"
#include "pimd.h"
#include "pim_mroute.h"
@@ -46,14 +47,16 @@ int pim_socket_raw(int protocol)
int fd;
if (pimd_privs.change(ZPRIVS_RAISE))
- zlog_err("pim_sockek_raw: could not raise privs, %s",
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_PRIVILEGES,
+ "pim_sockek_raw: could not raise privs, %s",
+ safe_strerror(errno));
fd = socket(AF_INET, SOCK_RAW, protocol);
if (pimd_privs.change(ZPRIVS_LOWER))
- zlog_err("pim_socket_raw: could not lower privs, %s",
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_PRIVILEGES,
+ "pim_socket_raw: could not lower privs, %s",
+ safe_strerror(errno));
if (fd < 0) {
zlog_warn("Could not create raw socket: errno=%d: %s", errno,
@@ -69,16 +72,17 @@ void pim_socket_ip_hdr(int fd)
const int on = 1;
if (pimd_privs.change(ZPRIVS_RAISE))
- zlog_err("%s: could not raise privs, %s", __PRETTY_FUNCTION__,
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not raise privs, %s",
+ __PRETTY_FUNCTION__, safe_strerror(errno));
if (setsockopt(fd, IPPROTO_IP, IP_HDRINCL, &on, sizeof(on)))
- zlog_err("%s: Could not turn on IP_HDRINCL option: %s",
- __PRETTY_FUNCTION__, safe_strerror(errno));
+ zlog_ferr(LIB_ERR_SOCKET,
+ "%s: Could not turn on IP_HDRINCL option: %s",
+ __PRETTY_FUNCTION__, safe_strerror(errno));
if (pimd_privs.change(ZPRIVS_LOWER))
- zlog_err("%s: could not lower privs, %s", __PRETTY_FUNCTION__,
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not lower privs, %s",
+ __PRETTY_FUNCTION__, safe_strerror(errno));
}
/*
@@ -91,15 +95,15 @@ int pim_socket_bind(int fd, struct interface *ifp)
#ifdef SO_BINDTODEVICE
if (pimd_privs.change(ZPRIVS_RAISE))
- zlog_err("%s: could not raise privs, %s", __PRETTY_FUNCTION__,
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not raise privs, %s",
+ __PRETTY_FUNCTION__, safe_strerror(errno));
ret = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, ifp->name,
strlen(ifp->name));
if (pimd_privs.change(ZPRIVS_LOWER))
- zlog_err("%s: could not lower privs, %s", __PRETTY_FUNCTION__,
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not lower privs, %s",
+ __PRETTY_FUNCTION__, safe_strerror(errno));
#endif
return ret;
@@ -161,7 +165,8 @@ int pim_socket_mcast(int protocol, struct in_addr ifaddr, struct interface *ifp,
fd, errno, safe_strerror(errno));
}
#else
- zlog_err(
+ zlog_ferr(
+ LIB_ERR_DEVELOPMENT,
"%s %s: Missing IP_PKTINFO and IP_RECVDSTADDR: unable to get dst addr from recvmsg()",
__FILE__, __PRETTY_FUNCTION__);
close(fd);
@@ -298,7 +303,8 @@ int pim_socket_join(int fd, struct in_addr group, struct in_addr ifaddr,
sizeof(ifaddr_str)))
sprintf(ifaddr_str, "<ifaddr?>");
- zlog_err(
+ zlog_ferr(
+ LIB_ERR_SOCKET,
"Failure socket joining fd=%d group %s on interface address %s: errno=%d: %s",
fd, group_str, ifaddr_str, errno, safe_strerror(errno));
return ret;