summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-06-18 16:58:43 +0200
committerQuentin Young <qlyoung@cumulusnetworks.com>2018-08-14 22:02:05 +0200
commit6ae7ed45ff9a9a6c10b58c752ec8952e9e54c52e (patch)
tree629e7b0f8bac04199dc3a79e78e394cf5261a05f
parentlib: Update error ranges to include all daemons (diff)
downloadfrr-6ae7ed45ff9a9a6c10b58c752ec8952e9e54c52e.tar.xz
frr-6ae7ed45ff9a9a6c10b58c752ec8952e9e54c52e.zip
eigrpd: Convert to use LIB_ERR_XXX for zlog_err
Convert, where appropriate, to using LIB_ERR_XXX for zlog_ferr Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
-rw-r--r--eigrpd/eigrp_network.c33
-rw-r--r--eigrpd/eigrp_packet.c6
-rw-r--r--eigrpd/eigrp_topology.c4
-rw-r--r--eigrpd/eigrpd.c7
4 files changed, 27 insertions, 23 deletions
diff --git a/eigrpd/eigrp_network.c b/eigrpd/eigrp_network.c
index 629beddec..6b716c1c0 100644
--- a/eigrpd/eigrp_network.c
+++ b/eigrpd/eigrp_network.c
@@ -37,6 +37,7 @@
#include "privs.h"
#include "table.h"
#include "vty.h"
+#include "lib_errors.h"
#include "eigrpd/eigrp_structs.h"
#include "eigrpd/eigrpd.h"
@@ -61,8 +62,9 @@ int eigrp_sock_init(void)
#endif
if (eigrpd_privs.change(ZPRIVS_RAISE))
- zlog_err("eigrp_sock_init: could not raise privs, %s",
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_PRIVILEGES,
+ "eigrp_sock_init: could not raise privs, %s",
+ safe_strerror(errno));
eigrp_sock = socket(AF_INET, SOCK_RAW, IPPROTO_EIGRPIGP);
if (eigrp_sock < 0) {
@@ -70,8 +72,8 @@ int eigrp_sock_init(void)
if (eigrpd_privs.change(ZPRIVS_LOWER))
zlog_err("eigrp_sock_init: could not lower privs, %s",
safe_strerror(errno));
- zlog_err("eigrp_read_sock_init: socket: %s",
- safe_strerror(save_errno));
+ zlog_ferr(LIB_ERR_SOCKET, "eigrp_read_sock_init: socket: %s",
+ safe_strerror(save_errno));
exit(1);
}
@@ -82,8 +84,9 @@ int eigrp_sock_init(void)
if (ret < 0) {
int save_errno = errno;
if (eigrpd_privs.change(ZPRIVS_LOWER))
- zlog_err("eigrp_sock_init: could not lower privs, %s",
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_PRIVILEGES,
+ "eigrp_sock_init: could not lower privs, %s",
+ safe_strerror(errno));
zlog_warn("Can't set IP_HDRINCL option for fd %d: %s",
eigrp_sock, safe_strerror(save_errno));
}
@@ -94,8 +97,9 @@ int eigrp_sock_init(void)
if (ret < 0) {
int save_errno = errno;
if (eigrpd_privs.change(ZPRIVS_LOWER))
- zlog_err("eigrpd_sock_init: could not lower privs, %s",
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_PRIVILEGES,
+ "eigrpd_sock_init: could not lower privs, %s",
+ safe_strerror(errno));
zlog_warn("can't set sockopt IP_TOS %d to socket %d: %s", tos,
eigrp_sock, safe_strerror(save_errno));
close(eigrp_sock); /* Prevent sd leak. */
@@ -112,8 +116,9 @@ int eigrp_sock_init(void)
zlog_warn("Can't set pktinfo option for fd %d", eigrp_sock);
if (eigrpd_privs.change(ZPRIVS_LOWER)) {
- zlog_err("eigrp_sock_init: could not lower privs, %s",
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_PRIVILEGES,
+ "eigrp_sock_init: could not lower privs, %s",
+ safe_strerror(errno));
}
return eigrp_sock;
@@ -126,8 +131,8 @@ void eigrp_adjust_sndbuflen(struct eigrp *eigrp, unsigned int buflen)
if (eigrp->maxsndbuflen >= buflen)
return;
if (eigrpd_privs.change(ZPRIVS_RAISE))
- zlog_err("%s: could not raise privs, %s", __func__,
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not raise privs, %s",
+ __func__, safe_strerror(errno));
/* Now we try to set SO_SNDBUF to what our caller has requested
* (the MTU of a newly added interface). However, if the OS has
@@ -146,8 +151,8 @@ void eigrp_adjust_sndbuflen(struct eigrp *eigrp, unsigned int buflen)
else
zlog_warn("%s: failed to get SO_SNDBUF", __func__);
if (eigrpd_privs.change(ZPRIVS_LOWER))
- zlog_err("%s: could not lower privs, %s", __func__,
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not lower privs, %s",
+ __func__, safe_strerror(errno));
}
int eigrp_if_ipmulticast(struct eigrp *top, struct prefix *p,
diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c
index 027f30563..09a3ad8de 100644
--- a/eigrpd/eigrp_packet.c
+++ b/eigrpd/eigrp_packet.c
@@ -42,6 +42,7 @@
#include "checksum.h"
#include "md5.h"
#include "sha256.h"
+#include "lib_errors.h"
#include "eigrpd/eigrp_structs.h"
#include "eigrpd/eigrpd.h"
@@ -1210,8 +1211,9 @@ uint16_t eigrp_add_internalTLV_to_stream(struct stream *s,
stream_putw(s, length);
break;
default:
- zlog_err("%s: Unexpected prefix length: %d",
- __PRETTY_FUNCTION__, pe->destination->prefixlen);
+ zlog_ferr(LIB_ERR_DEVELOPMENT,
+ "%s: Unexpected prefix length: %d",
+ __PRETTY_FUNCTION__, pe->destination->prefixlen);
return 0;
}
stream_putl(s, 0x00000000);
diff --git a/eigrpd/eigrp_topology.c b/eigrpd/eigrp_topology.c
index 8ca0e282a..58aa23d48 100644
--- a/eigrpd/eigrp_topology.c
+++ b/eigrpd/eigrp_topology.c
@@ -37,6 +37,7 @@
#include "log.h"
#include "linklist.h"
#include "vty.h"
+#include "lib_errors.h"
#include "eigrpd/eigrp_structs.h"
#include "eigrpd/eigrpd.h"
@@ -411,7 +412,8 @@ eigrp_topology_update_distance(struct eigrp_fsm_action_message *msg)
}
break;
default:
- zlog_err("%s: Please implement handler", __PRETTY_FUNCTION__);
+ zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: Please implement handler",
+ __PRETTY_FUNCTION__);
break;
}
distance_done:
diff --git a/eigrpd/eigrpd.c b/eigrpd/eigrpd.c
index 24d1253cb..a60d1a1b8 100644
--- a/eigrpd/eigrpd.c
+++ b/eigrpd/eigrpd.c
@@ -170,12 +170,7 @@ static struct eigrp *eigrp_new(const char *AS)
eigrp->fd = eigrp_socket;
eigrp->maxsndbuflen = getsockopt_so_sendbuf(eigrp->fd);
- if ((eigrp->ibuf = stream_new(EIGRP_PACKET_MAX_LEN + 1)) == NULL) {
- zlog_err(
- "eigrp_new: fatal error: stream_new (%u) failed allocating ibuf",
- EIGRP_PACKET_MAX_LEN + 1);
- exit(1);
- }
+ eigrp->ibuf = stream_new(EIGRP_PACKET_MAX_LEN + 1);
eigrp->t_read = NULL;
thread_add_read(master, eigrp_read, eigrp, eigrp->fd, &eigrp->t_read);