summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2018-09-14 17:35:58 +0200
committerGitHub <noreply@github.com>2018-09-14 17:35:58 +0200
commit2fa3198399df58b1b039f094ad03d7c1329a2a3d (patch)
tree8bfb9ce491addede73950d9320bb075df0969339
parentMerge pull request #3019 from pacovn/static_analysis__shadow_variables4 (diff)
parent*: style for EC replacements (diff)
downloadfrr-2fa3198399df58b1b039f094ad03d7c1329a2a3d.tar.xz
frr-2fa3198399df58b1b039f094ad03d7c1329a2a3d.zip
Merge pull request #3023 from qlyoung/ultimate-warning-reference-cards-rename
warning reference cards rename
-rw-r--r--babeld/babel_errors.c8
-rw-r--r--babeld/babel_errors.h8
-rw-r--r--babeld/babel_interface.c24
-rw-r--r--babeld/babel_main.c24
-rw-r--r--babeld/babeld.c12
-rw-r--r--babeld/message.c52
-rw-r--r--babeld/neighbour.c2
-rw-r--r--babeld/route.c18
-rw-r--r--babeld/source.c2
-rw-r--r--bgpd/bgp_aspath.c2
-rw-r--r--bgpd/bgp_attr.c148
-rw-r--r--bgpd/bgp_dump.c4
-rw-r--r--bgpd/bgp_errors.c144
-rw-r--r--bgpd/bgp_errors.h148
-rw-r--r--bgpd/bgp_evpn.c173
-rw-r--r--bgpd/bgp_evpn_vty.c9
-rw-r--r--bgpd/bgp_flowspec.c27
-rw-r--r--bgpd/bgp_flowspec_util.c29
-rw-r--r--bgpd/bgp_fsm.c43
-rw-r--r--bgpd/bgp_io.c6
-rw-r--r--bgpd/bgp_label.c20
-rw-r--r--bgpd/bgp_labelpool.c16
-rw-r--r--bgpd/bgp_main.c2
-rw-r--r--bgpd/bgp_mplsvpn.c21
-rw-r--r--bgpd/bgp_network.c36
-rw-r--r--bgpd/bgp_nht.c4
-rw-r--r--bgpd/bgp_open.c36
-rw-r--r--bgpd/bgp_packet.c80
-rw-r--r--bgpd/bgp_pbr.c18
-rw-r--r--bgpd/bgp_route.c26
-rw-r--r--bgpd/bgp_updgrp.c6
-rw-r--r--bgpd/bgp_updgrp_packet.c6
-rw-r--r--bgpd/bgp_vty.c2
-rw-r--r--bgpd/bgp_zebra.c24
-rw-r--r--bgpd/bgpd.c20
-rw-r--r--bgpd/rfapi/rfapi.c8
-rw-r--r--bgpd/rfapi/rfapi_import.c7
-rw-r--r--bgpd/rfapi/vnc_export_bgp.c40
-rw-r--r--bgpd/rfapi/vnc_import_bgp.c16
-rw-r--r--bgpd/rfapi/vnc_zebra.c14
-rw-r--r--eigrpd/eigrp_errors.c4
-rw-r--r--eigrpd/eigrp_errors.h4
-rw-r--r--eigrpd/eigrp_hello.c6
-rw-r--r--eigrpd/eigrp_neighbor.c4
-rw-r--r--eigrpd/eigrp_packet.c15
-rw-r--r--eigrpd/eigrp_reply.c9
-rw-r--r--eigrpd/eigrp_topology.c4
-rw-r--r--eigrpd/eigrpd.c2
-rw-r--r--isisd/isis_circuit.c4
-rw-r--r--isisd/isis_csm.c4
-rw-r--r--isisd/isis_errors.c4
-rw-r--r--isisd/isis_errors.h4
-rw-r--r--isisd/isis_events.c2
-rw-r--r--isisd/isis_lsp.c14
-rw-r--r--isisd/isis_pdu.c76
-rw-r--r--isisd/isis_spf_private.h2
-rw-r--r--ldpd/ldpd.c2
-rw-r--r--lib/agentx.c14
-rw-r--r--lib/buffer.c12
-rw-r--r--lib/command.c2
-rw-r--r--lib/frr_zmq.c8
-rw-r--r--lib/if.c2
-rw-r--r--lib/if.h36
-rw-r--r--lib/lib_errors.c46
-rw-r--r--lib/lib_errors.h41
-rw-r--r--lib/libfrr.c18
-rw-r--r--lib/log.c21
-rw-r--r--lib/netns_linux.c20
-rw-r--r--lib/network.c4
-rw-r--r--lib/pid_output.c8
-rw-r--r--lib/prefix.c6
-rw-r--r--lib/privs.c2
-rw-r--r--lib/routemap.c2
-rw-r--r--lib/sigevent.c4
-rw-r--r--lib/skiplist.c4
-rw-r--r--lib/sockopt.c40
-rw-r--r--lib/sockunion.c25
-rw-r--r--lib/stream.c12
-rw-r--r--lib/thread.c4
-rw-r--r--lib/vrf.c26
-rw-r--r--lib/vty.c61
-rw-r--r--lib/zclient.c152
-rw-r--r--nhrpd/nhrp_errors.c4
-rw-r--r--nhrpd/nhrp_errors.h4
-rw-r--r--nhrpd/resolver.c7
-rw-r--r--nhrpd/vici.c19
-rw-r--r--ospf6d/ospf6_message.c5
-rw-r--r--ospf6d/ospf6_network.c2
-rw-r--r--ospf6d/ospf6_route.c5
-rw-r--r--ospf6d/ospf6_spf.c4
-rw-r--r--ospf6d/ospf6_zebra.c8
-rw-r--r--ospfd/ospf_abr.c6
-rw-r--r--ospfd/ospf_apiserver.c8
-rw-r--r--ospfd/ospf_errors.c46
-rw-r--r--ospfd/ospf_errors.h46
-rw-r--r--ospfd/ospf_ext.c50
-rw-r--r--ospfd/ospf_lsa.c10
-rw-r--r--ospfd/ospf_main.c4
-rw-r--r--ospfd/ospf_network.c25
-rw-r--r--ospfd/ospf_nsm.c2
-rw-r--r--ospfd/ospf_opaque.c78
-rw-r--r--ospfd/ospf_packet.c146
-rw-r--r--ospfd/ospf_ri.c16
-rw-r--r--ospfd/ospf_routemap.c2
-rw-r--r--ospfd/ospf_spf.c2
-rw-r--r--ospfd/ospf_sr.c63
-rw-r--r--ospfd/ospf_te.c40
-rw-r--r--ospfd/ospfd.c2
-rw-r--r--pimd/pim_errors.c4
-rw-r--r--pimd/pim_errors.h4
-rw-r--r--pimd/pim_igmp.c4
-rw-r--r--pimd/pim_igmpv3.c2
-rw-r--r--pimd/pim_msdp.c2
-rw-r--r--pimd/pim_msdp_packet.c8
-rw-r--r--pimd/pim_msdp_socket.c43
-rw-r--r--pimd/pim_neighbor.c2
-rw-r--r--pimd/pim_pim.c6
-rw-r--r--pimd/pim_rp.c8
-rw-r--r--pimd/pim_sock.c4
-rw-r--r--pimd/pim_ssm.c6
-rw-r--r--pimd/pim_ssmpingd.c4
-rw-r--r--pimd/pim_time.c8
-rw-r--r--pimd/pim_zlookup.c30
-rw-r--r--pimd/pimd.c2
-rw-r--r--ripd/rip_errors.c13
-rw-r--r--ripd/rip_errors.h2
-rw-r--r--ripd/rip_interface.c2
-rw-r--r--ripd/ripd.c9
-rw-r--r--ripngd/ripng_interface.c2
-rw-r--r--ripngd/ripngd.c9
-rw-r--r--watchfrr/watchfrr.c50
-rw-r--r--watchfrr/watchfrr_errors.c2
-rw-r--r--watchfrr/watchfrr_errors.h2
-rw-r--r--zebra/connected.c6
-rw-r--r--zebra/if_ioctl.c14
-rw-r--r--zebra/if_ioctl_solaris.c12
-rw-r--r--zebra/if_netlink.c22
-rw-r--r--zebra/if_sysctl.c8
-rw-r--r--zebra/interface.c12
-rw-r--r--zebra/ioctl.c4
-rw-r--r--zebra/ioctl_solaris.c4
-rw-r--r--zebra/ipforward_solaris.c6
-rw-r--r--zebra/ipforward_sysctl.c13
-rw-r--r--zebra/irdp_interface.c10
-rw-r--r--zebra/irdp_main.c7
-rw-r--r--zebra/irdp_packet.c32
-rw-r--r--zebra/kernel_netlink.c60
-rw-r--r--zebra/kernel_socket.c19
-rw-r--r--zebra/label_manager.c50
-rw-r--r--zebra/main.c2
-rw-r--r--zebra/redistribute.c10
-rw-r--r--zebra/rt_netlink.c8
-rw-r--r--zebra/rt_socket.c8
-rw-r--r--zebra/rtadv.c22
-rw-r--r--zebra/rtread_getmsg.c8
-rw-r--r--zebra/rtread_sysctl.c4
-rw-r--r--zebra/rule_netlink.c2
-rw-r--r--zebra/rule_socket.c8
-rw-r--r--zebra/table_manager.c13
-rw-r--r--zebra/zapi_msg.c58
-rw-r--r--zebra/zebra_errors.c178
-rw-r--r--zebra/zebra_errors.h190
-rw-r--r--zebra/zebra_fpm.c9
-rw-r--r--zebra/zebra_mpls.c36
-rw-r--r--zebra/zebra_mpls_openbsd.c16
-rw-r--r--zebra/zebra_netns_id.c18
-rw-r--r--zebra/zebra_netns_notify.c20
-rw-r--r--zebra/zebra_ptm.c22
-rw-r--r--zebra/zebra_rib.c36
-rw-r--r--zebra/zebra_rnh.c8
-rw-r--r--zebra/zebra_vxlan.c42
-rw-r--r--zebra/zserv.c15
172 files changed, 1914 insertions, 1945 deletions
diff --git a/babeld/babel_errors.c b/babeld/babel_errors.c
index e03cace37..b22b1d5cb 100644
--- a/babeld/babel_errors.c
+++ b/babeld/babel_errors.c
@@ -26,25 +26,25 @@
/* clang-format off */
static struct log_ref ferr_babel_err[] = {
{
- .code = BABEL_ERR_MEMORY,
+ .code = EC_BABEL_MEMORY,
.title = "BABEL Memory Errors",
.description = "Babel has failed to allocate memory, the system is about to run out of memory",
.suggestion = "Find the process that is causing memory shortages, remediate that process and restart FRR"
},
{
- .code = BABEL_ERR_PACKET,
+ .code = EC_BABEL_PACKET,
.title = "BABEL Packet Error",
.description = "Babel has detected a packet encode/decode problem",
.suggestion = "Collect relevant log files and file an Issue"
},
{
- .code = BABEL_ERR_CONFIG,
+ .code = EC_BABEL_CONFIG,
.title = "BABEL Configuration Error",
.description = "Babel has detected a configuration error of some sort",
.suggestion = "Ensure that the configuration is correct"
},
{
- .code = BABEL_ERR_ROUTE,
+ .code = EC_BABEL_ROUTE,
.title = "BABEL Route Error",
.description = "Babel has detected a routing error and has an inconsistent state",
.suggestion = "Gather data for filing an Issue and then restart FRR"
diff --git a/babeld/babel_errors.h b/babeld/babel_errors.h
index 19adc63f0..629b6604b 100644
--- a/babeld/babel_errors.h
+++ b/babeld/babel_errors.h
@@ -24,10 +24,10 @@
#include "lib/ferr.h"
enum babel_log_refs {
- BABEL_ERR_MEMORY = BABEL_FERR_START,
- BABEL_ERR_PACKET,
- BABEL_ERR_CONFIG,
- BABEL_ERR_ROUTE,
+ EC_BABEL_MEMORY = BABEL_FERR_START,
+ EC_BABEL_PACKET,
+ EC_BABEL_CONFIG,
+ EC_BABEL_ROUTE,
};
extern void babel_error_init(void);
diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c
index b7c01e73d..7121ca28d 100644
--- a/babeld/babel_interface.c
+++ b/babeld/babel_interface.c
@@ -169,7 +169,7 @@ babel_interface_address_add (int cmd, struct zclient *client,
if (babel_ifp->ipv4 == NULL) {
babel_ifp->ipv4 = malloc(4);
if (babel_ifp->ipv4 == NULL) {
- flog_err(BABEL_ERR_MEMORY, "not enough memory");
+ flog_err(EC_BABEL_MEMORY, "not enough memory");
} else {
memcpy(babel_ifp->ipv4, &prefix->u.prefix4, 4);
}
@@ -709,7 +709,7 @@ interface_recalculate(struct interface *ifp)
tmp = babel_ifp->sendbuf;
babel_ifp->sendbuf = realloc(babel_ifp->sendbuf, babel_ifp->bufsize);
if(babel_ifp->sendbuf == NULL) {
- flog_err(BABEL_ERR_MEMORY, "Couldn't reallocate sendbuf.");
+ flog_err(EC_BABEL_MEMORY, "Couldn't reallocate sendbuf.");
free(tmp);
babel_ifp->bufsize = 0;
return -1;
@@ -729,7 +729,7 @@ interface_recalculate(struct interface *ifp)
rc = setsockopt(protocol_socket, IPPROTO_IPV6, IPV6_JOIN_GROUP,
(char*)&mreq, sizeof(mreq));
if(rc < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"setsockopt(IPV6_JOIN_GROUP) on interface '%s': %s",
ifp->name, safe_strerror(errno));
/* This is probably due to a missing link-local address,
@@ -793,7 +793,7 @@ interface_reset(struct interface *ifp)
rc = setsockopt(protocol_socket, IPPROTO_IPV6, IPV6_LEAVE_GROUP,
(char*)&mreq, sizeof(mreq));
if(rc < 0)
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"setsockopt(IPV6_LEAVE_GROUP) on interface '%s': %s",
ifp->name, safe_strerror(errno));
}
@@ -1060,7 +1060,7 @@ DEFUN (show_babel_route,
}
route_stream_done(routes);
} else {
- flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream.");
+ flog_err(EC_BABEL_MEMORY, "Couldn't allocate route stream.");
}
xroutes = xroute_stream();
if(xroutes) {
@@ -1072,7 +1072,7 @@ DEFUN (show_babel_route,
}
xroute_stream_done(xroutes);
} else {
- flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream.");
+ flog_err(EC_BABEL_MEMORY, "Couldn't allocate route stream.");
}
return CMD_SUCCESS;
}
@@ -1107,7 +1107,7 @@ DEFUN (show_babel_route_prefix,
}
route_stream_done(routes);
} else {
- flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream.");
+ flog_err(EC_BABEL_MEMORY, "Couldn't allocate route stream.");
}
xroutes = xroute_stream();
if(xroutes) {
@@ -1119,7 +1119,7 @@ DEFUN (show_babel_route_prefix,
}
xroute_stream_done(xroutes);
} else {
- flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream.");
+ flog_err(EC_BABEL_MEMORY, "Couldn't allocate route stream.");
}
return CMD_SUCCESS;
}
@@ -1165,7 +1165,7 @@ DEFUN (show_babel_route_addr,
}
route_stream_done(routes);
} else {
- flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream.");
+ flog_err(EC_BABEL_MEMORY, "Couldn't allocate route stream.");
}
xroutes = xroute_stream();
if(xroutes) {
@@ -1177,7 +1177,7 @@ DEFUN (show_babel_route_addr,
}
xroute_stream_done(xroutes);
} else {
- flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream.");
+ flog_err(EC_BABEL_MEMORY, "Couldn't allocate route stream.");
}
return CMD_SUCCESS;
}
@@ -1224,7 +1224,7 @@ DEFUN (show_babel_route_addr6,
}
route_stream_done(routes);
} else {
- flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream.");
+ flog_err(EC_BABEL_MEMORY, "Couldn't allocate route stream.");
}
xroutes = xroute_stream();
if(xroutes) {
@@ -1236,7 +1236,7 @@ DEFUN (show_babel_route_addr6,
}
xroute_stream_done(xroutes);
} else {
- flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream.");
+ flog_err(EC_BABEL_MEMORY, "Couldn't allocate route stream.");
}
return CMD_SUCCESS;
}
diff --git a/babeld/babel_main.c b/babeld/babel_main.c
index 31a3fb5b4..d02d86f77 100644
--- a/babeld/babel_main.c
+++ b/babeld/babel_main.c
@@ -225,7 +225,7 @@ babel_init_random(void)
rc = read_random_bytes(&seed, sizeof(seed));
if(rc < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "read(random): %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "read(random): %s",
safe_strerror(errno));
seed = 42;
}
@@ -246,13 +246,13 @@ babel_replace_by_null(int fd)
fd_null = open("/dev/null", O_RDONLY);
if(fd_null < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "open(null): %s", safe_strerror(errno));
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "open(null): %s", safe_strerror(errno));
exit(1);
}
rc = dup2(fd_null, fd);
if(rc < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "dup2(null, 0): %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "dup2(null, 0): %s",
safe_strerror(errno));
exit(1);
}
@@ -272,11 +272,11 @@ babel_load_state_file(void)
fd = open(state_file, O_RDONLY);
if(fd < 0 && errno != ENOENT)
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "open(babel-state: %s)",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "open(babel-state: %s)",
safe_strerror(errno));
rc = unlink(state_file);
if(fd >= 0 && rc < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "unlink(babel-state): %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "unlink(babel-state): %s",
safe_strerror(errno));
/* If we couldn't unlink it, it's probably stale. */
goto fini;
@@ -288,7 +288,7 @@ babel_load_state_file(void)
long t;
rc = read(fd, buf, 99);
if(rc < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "read(babel-state): %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "read(babel-state): %s",
safe_strerror(errno));
} else {
buf[rc] = '\0';
@@ -297,7 +297,7 @@ babel_load_state_file(void)
unsigned char sid[8];
rc = parse_eui64(buf2, sid);
if(rc < 0) {
- flog_err(BABEL_ERR_CONFIG, "Couldn't parse babel-state.");
+ flog_err(EC_BABEL_CONFIG, "Couldn't parse babel-state.");
} else {
struct timeval realnow;
debugf(BABEL_DEBUG_COMMON,
@@ -307,13 +307,13 @@ babel_load_state_file(void)
if(memcmp(sid, myid, 8) == 0)
myseqno = seqno_plus(s, 1);
else
- flog_err(BABEL_ERR_CONFIG,
+ flog_err(EC_BABEL_CONFIG,
"ID mismatch in babel-state. id=%s; old=%s",
format_eui64(myid),
format_eui64(sid));
}
} else {
- flog_err(BABEL_ERR_CONFIG, "Couldn't parse babel-state.");
+ flog_err(EC_BABEL_CONFIG, "Couldn't parse babel-state.");
}
}
goto fini;
@@ -353,7 +353,7 @@ babel_save_state_file(void)
debugf(BABEL_DEBUG_COMMON, "Save state file.");
fd = open(state_file, O_WRONLY | O_TRUNC | O_CREAT, 0644);
if(fd < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "creat(babel-state): %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "creat(babel-state): %s",
safe_strerror(errno));
unlink(state_file);
} else {
@@ -364,12 +364,12 @@ babel_save_state_file(void)
format_eui64(myid), (int)myseqno,
(long)realnow.tv_sec);
if(rc < 0 || rc >= 100) {
- flog_err(BABEL_ERR_CONFIG, "write(babel-state): overflow.");
+ flog_err(EC_BABEL_CONFIG, "write(babel-state): overflow.");
unlink(state_file);
} else {
rc = write(fd, buf, rc);
if(rc < 0) {
- flog_err(BABEL_ERR_CONFIG, "write(babel-state): %s",
+ flog_err(EC_BABEL_CONFIG, "write(babel-state): %s",
safe_strerror(errno));
unlink(state_file);
}
diff --git a/babeld/babeld.c b/babeld/babeld.c
index 54692cdf2..0517cbea6 100644
--- a/babeld/babeld.c
+++ b/babeld/babeld.c
@@ -145,7 +145,7 @@ babel_create_routing_process (void)
/* Make socket for Babel protocol. */
protocol_socket = babel_socket(protocol_port);
if (protocol_socket < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "Couldn't create link local socket: %s",
+ flog_err_sys(EC_LIB_SOCKET, "Couldn't create link local socket: %s",
safe_strerror(errno));
goto fail;
}
@@ -179,7 +179,7 @@ babel_read_protocol (struct thread *thread)
(struct sockaddr*)&sin6, sizeof(sin6));
if(rc < 0) {
if(errno != EAGAIN && errno != EINTR) {
- flog_err_sys(LIB_ERR_SOCKET, "recv: %s", safe_strerror(errno));
+ flog_err_sys(EC_LIB_SOCKET, "recv: %s", safe_strerror(errno));
}
} else {
FOR_ALL_INTERFACES(vrf, ifp) {
@@ -255,12 +255,12 @@ babel_get_myid(void)
return;
}
- flog_err(BABEL_ERR_CONFIG,
+ flog_err(EC_BABEL_CONFIG,
"Warning: couldn't find router id -- using random value.");
rc = read_random_bytes(myid, 8);
if(rc < 0) {
- flog_err(BABEL_ERR_CONFIG, "read(random): %s (cannot assign an ID)",
+ flog_err(EC_BABEL_CONFIG, "read(random): %s (cannot assign an ID)",
safe_strerror(errno));
exit(1);
}
@@ -519,7 +519,7 @@ resize_receive_buffer(int size)
if(receive_buffer == NULL) {
receive_buffer = malloc(size);
if(receive_buffer == NULL) {
- flog_err(BABEL_ERR_MEMORY, "malloc(receive_buffer): %s",
+ flog_err(EC_BABEL_MEMORY, "malloc(receive_buffer): %s",
safe_strerror(errno));
return -1;
}
@@ -528,7 +528,7 @@ resize_receive_buffer(int size)
unsigned char *new;
new = realloc(receive_buffer, size);
if(new == NULL) {
- flog_err(BABEL_ERR_MEMORY, "realloc(receive_buffer): %s",
+ flog_err(EC_BABEL_MEMORY, "realloc(receive_buffer): %s",
safe_strerror(errno));
return -1;
}
diff --git a/babeld/message.c b/babeld/message.c
index 09eaca7a4..f85a08ac3 100644
--- a/babeld/message.c
+++ b/babeld/message.c
@@ -141,12 +141,12 @@ parse_update_subtlv(const unsigned char *a, int alen,
}
if(i + 1 > alen) {
- flog_err(BABEL_ERR_PACKET, "Received truncated attributes.");
+ flog_err(EC_BABEL_PACKET, "Received truncated attributes.");
return;
}
len = a[i + 1];
if(i + len > alen) {
- flog_err(BABEL_ERR_PACKET, "Received truncated attributes.");
+ flog_err(EC_BABEL_PACKET, "Received truncated attributes.");
return;
}
@@ -154,14 +154,14 @@ parse_update_subtlv(const unsigned char *a, int alen,
/* Nothing. */
} else if(type == SUBTLV_DIVERSITY) {
if(len > DIVERSITY_HOPS) {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Received overlong channel information (%d > %d).n",
len, DIVERSITY_HOPS);
len = DIVERSITY_HOPS;
}
if(memchr(a + i + 2, 0, len) != NULL) {
/* 0 is reserved. */
- flog_err(BABEL_ERR_PACKET, "Channel information contains 0!");
+ flog_err(EC_BABEL_PACKET, "Channel information contains 0!");
return;
}
memset(channels, 0, DIVERSITY_HOPS);
@@ -189,13 +189,13 @@ parse_hello_subtlv(const unsigned char *a, int alen,
}
if(i + 1 > alen) {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Received truncated sub-TLV on Hello message.");
return -1;
}
len = a[i + 1];
if(i + len > alen) {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Received truncated sub-TLV on Hello message.");
return -1;
}
@@ -207,7 +207,7 @@ parse_hello_subtlv(const unsigned char *a, int alen,
DO_NTOHL(*hello_send_us, a + i + 2);
ret = 1;
} else {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Received incorrect RTT sub-TLV on Hello message.");
}
} else {
@@ -235,13 +235,13 @@ parse_ihu_subtlv(const unsigned char *a, int alen,
}
if(i + 1 > alen) {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Received truncated sub-TLV on IHU message.");
return -1;
}
len = a[i + 1];
if(i + len > alen) {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Received truncated sub-TLV on IHU message.");
return -1;
}
@@ -255,7 +255,7 @@ parse_ihu_subtlv(const unsigned char *a, int alen,
ret = 1;
}
else {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Received incorrect RTT sub-TLV on IHU message.");
}
} else {
@@ -345,14 +345,14 @@ parse_packet(const unsigned char *from, struct interface *ifp,
}
if(!linklocal(from)) {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Received packet from non-local address %s.",
format_address(from));
return;
}
if (babel_packet_examin (packet, packetlen)) {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Received malformed packet on %s from %s.",
ifp->name, format_address(from));
return;
@@ -360,14 +360,14 @@ parse_packet(const unsigned char *from, struct interface *ifp,
neigh = find_neighbour(from, ifp);
if(neigh == NULL) {
- flog_err(BABEL_ERR_PACKET, "Couldn't allocate neighbour.");
+ flog_err(EC_BABEL_PACKET, "Couldn't allocate neighbour.");
return;
}
DO_NTOHS(bodylen, packet + 2);
if(bodylen + 4 > packetlen) {
- flog_err(BABEL_ERR_PACKET, "Received truncated packet (%d + 4 > %d).",
+ flog_err(EC_BABEL_PACKET, "Received truncated packet (%d + 4 > %d).",
bodylen, packetlen);
bodylen = packetlen - 4;
}
@@ -516,7 +516,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,
have_router_id = 1;
}
if(!have_router_id && message[2] != 0) {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Received prefix with no router id.");
goto fail;
}
@@ -528,7 +528,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,
if(message[2] == 0) {
if(metric < 0xFFFF) {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Received wildcard update with finite metric.");
goto done;
}
@@ -621,7 +621,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,
continue;
fail:
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Couldn't parse packet (%d, %d) from %s on %s.",
message[0], message[1], format_address(from), ifp->name);
goto done;
@@ -710,7 +710,7 @@ fill_rtt_message(struct interface *ifp)
DO_HTONL(babel_ifp->sendbuf + babel_ifp->buffered_hello + 10, time);
return 1;
} else {
- flog_err(BABEL_ERR_PACKET, "No space left for timestamp sub-TLV "
+ flog_err(EC_BABEL_PACKET, "No space left for timestamp sub-TLV "
"(this shouldn't happen)");
return -1;
}
@@ -745,9 +745,9 @@ flushbuf(struct interface *ifp)
babel_ifp->sendbuf, babel_ifp->buffered,
(struct sockaddr*)&sin6, sizeof(sin6));
if(rc < 0)
- flog_err(BABEL_ERR_PACKET, "send: %s", safe_strerror(errno));
+ flog_err(EC_BABEL_PACKET, "send: %s", safe_strerror(errno));
} else {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Warning: bucket full, dropping packet to %s.",
ifp->name);
}
@@ -870,7 +870,7 @@ start_unicast_message(struct neighbour *neigh, int type, int len)
if(!unicast_buffer)
unicast_buffer = malloc(UNICAST_BUFSIZE);
if(!unicast_buffer) {
- flog_err(BABEL_ERR_MEMORY, "malloc(unicast_buffer): %s",
+ flog_err(EC_BABEL_MEMORY, "malloc(unicast_buffer): %s",
safe_strerror(errno));
return -1;
}
@@ -1007,10 +1007,10 @@ flush_unicast(int dofree)
unicast_buffer, unicast_buffered,
(struct sockaddr*)&sin6, sizeof(sin6));
if(rc < 0)
- flog_err(BABEL_ERR_PACKET, "send(unicast): %s",
+ flog_err(EC_BABEL_PACKET, "send(unicast): %s",
safe_strerror(errno));
} else {
- flog_err(BABEL_ERR_PACKET,
+ flog_err(EC_BABEL_PACKET,
"Warning: bucket full, dropping unicast packet to %s if %s.",
format_address(unicast_neighbour->address),
unicast_neighbour->ifp->name);
@@ -1318,7 +1318,7 @@ buffer_update(struct interface *ifp,
again:
babel_ifp->buffered_updates = malloc(n *sizeof(struct buffered_update));
if(babel_ifp->buffered_updates == NULL) {
- flog_err(BABEL_ERR_MEMORY, "malloc(buffered_updates): %s",
+ flog_err(EC_BABEL_MEMORY, "malloc(buffered_updates): %s",
safe_strerror(errno));
if(n > 4) {
/* Try again with a tiny buffer. */
@@ -1382,7 +1382,7 @@ send_update(struct interface *ifp, int urgent,
}
route_stream_done(routes);
} else {
- flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream.");
+ flog_err(EC_BABEL_MEMORY, "Couldn't allocate route stream.");
}
set_timeout(&babel_ifp->update_timeout, babel_ifp->update_interval);
babel_ifp->last_update_time = babel_now.tv_sec;
@@ -1460,7 +1460,7 @@ send_self_update(struct interface *ifp)
}
xroute_stream_done(xroutes);
} else {
- flog_err(BABEL_ERR_MEMORY, "Couldn't allocate xroute stream.");
+ flog_err(EC_BABEL_MEMORY, "Couldn't allocate xroute stream.");
}
}
diff --git a/babeld/neighbour.c b/babeld/neighbour.c
index 512b60e29..83f05bb5c 100644
--- a/babeld/neighbour.c
+++ b/babeld/neighbour.c
@@ -94,7 +94,7 @@ find_neighbour(const unsigned char *address, struct interface *ifp)
neigh = malloc(sizeof(struct neighbour));
if(neigh == NULL) {
- flog_err(BABEL_ERR_MEMORY, "malloc(neighbour): %s",
+ flog_err(EC_BABEL_MEMORY, "malloc(neighbour): %s",
safe_strerror(errno));
return NULL;
}
diff --git a/babeld/route.c b/babeld/route.c
index ceeaa1057..76f038cda 100644
--- a/babeld/route.c
+++ b/babeld/route.c
@@ -399,14 +399,14 @@ install_route(struct babel_route *route)
return;
if(!route_feasible(route))
- flog_err(BABEL_ERR_ROUTE, "WARNING: installing unfeasible route "
+ flog_err(EC_BABEL_ROUTE, "WARNING: installing unfeasible route "
"(this shouldn't happen).");
i = find_route_slot(route->src->prefix, route->src->plen, NULL);
assert(i >= 0 && i < route_slots);
if(routes[i] != route && routes[i]->installed) {
- flog_err(BABEL_ERR_ROUTE,
+ flog_err(EC_BABEL_ROUTE,
"WARNING: attempting to install duplicate route "
"(this shouldn't happen).");
return;
@@ -418,7 +418,7 @@ install_route(struct babel_route *route)
metric_to_kernel(route_metric(route)), NULL, 0, 0);
if(rc < 0) {
int save = errno;
- flog_err(BABEL_ERR_ROUTE, "kernel_route(ADD): %s",
+ flog_err(EC_BABEL_ROUTE, "kernel_route(ADD): %s",
safe_strerror(errno));
if(save != EEXIST)
return;
@@ -441,7 +441,7 @@ uninstall_route(struct babel_route *route)
route->neigh->ifp->ifindex,
metric_to_kernel(route_metric(route)), NULL, 0, 0);
if(rc < 0)
- flog_err(BABEL_ERR_ROUTE, "kernel_route(FLUSH): %s",
+ flog_err(EC_BABEL_ROUTE, "kernel_route(FLUSH): %s",
safe_strerror(errno));
route->installed = 0;
@@ -465,7 +465,7 @@ switch_routes(struct babel_route *old, struct babel_route *new)
return;
if(!route_feasible(new))
- flog_err(BABEL_ERR_ROUTE, "WARNING: switching to unfeasible route "
+ flog_err(EC_BABEL_ROUTE, "WARNING: switching to unfeasible route "
"(this shouldn't happen).");
rc = kernel_route(ROUTE_MODIFY, old->src->prefix, old->src->plen,
@@ -474,7 +474,7 @@ switch_routes(struct babel_route *old, struct babel_route *new)
new->nexthop, new->neigh->ifp->ifindex,
metric_to_kernel(route_metric(new)));
if(rc < 0) {
- flog_err(BABEL_ERR_ROUTE, "kernel_route(MODIFY): %s",
+ flog_err(EC_BABEL_ROUTE, "kernel_route(MODIFY): %s",
safe_strerror(errno));
return;
}
@@ -503,7 +503,7 @@ change_route_metric(struct babel_route *route,
route->nexthop, route->neigh->ifp->ifindex,
new);
if(rc < 0) {
- flog_err(BABEL_ERR_ROUTE, "kernel_route(MODIFY metric): %s",
+ flog_err(EC_BABEL_ROUTE, "kernel_route(MODIFY metric): %s",
safe_strerror(errno));
return;
}
@@ -798,7 +798,7 @@ update_route(const unsigned char *router_id,
return NULL;
if(martian_prefix(prefix, plen)) {
- flog_err(BABEL_ERR_ROUTE, "Rejecting martian route to %s through %s.",
+ flog_err(EC_BABEL_ROUTE, "Rejecting martian route to %s through %s.",
format_prefix(prefix, plen), format_address(nexthop));
return NULL;
}
@@ -906,7 +906,7 @@ update_route(const unsigned char *router_id,
route->next = NULL;
new_route = insert_route(route);
if(new_route == NULL) {
- flog_err(BABEL_ERR_ROUTE, "Couldn't insert route.");
+ flog_err(EC_BABEL_ROUTE, "Couldn't insert route.");
free(route);
return NULL;
}
diff --git a/babeld/source.c b/babeld/source.c
index 75bca0620..ed165b41b 100644
--- a/babeld/source.c
+++ b/babeld/source.c
@@ -63,7 +63,7 @@ find_source(const unsigned char *id, const unsigned char *p, unsigned char plen,
src = malloc(sizeof(struct source));
if(src == NULL) {
- flog_err(BABEL_ERR_MEMORY, "malloc(source): %s", safe_strerror(errno));
+ flog_err(EC_BABEL_MEMORY, "malloc(source): %s", safe_strerror(errno));
return NULL;
}
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c
index b156cda86..1f8a910f2 100644
--- a/bgpd/bgp_aspath.c
+++ b/bgpd/bgp_aspath.c
@@ -1640,7 +1640,7 @@ struct aspath *aspath_reconcile_as4(struct aspath *aspath,
if (hops < 0) {
if (BGP_DEBUG(as4, AS4))
flog_warn(
- BGP_WARN_ASPATH_FEWER_HOPS,
+ EC_BGP_ASPATH_FEWER_HOPS,
"[AS4] Fewer hops in AS_PATH than NEW_AS_PATH");
/* Something's gone wrong. The RFC says we should now ignore
* AS4_PATH,
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index a603bbcd8..b853b2b08 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -997,14 +997,13 @@ bgp_attr_flags_diagnose(struct bgp_attr_parser_args *args,
for (i = 0; i <= 2; i++) /* O,T,P, but not E */
if (CHECK_FLAG(desired_flags, attr_flag_str[i].key)
!= CHECK_FLAG(real_flags, attr_flag_str[i].key)) {
- flog_err(
- BGP_ERR_ATTR_FLAG,
- "%s attribute must%s be flagged as \"%s\"",
- lookup_msg(attr_str, attr_code, NULL),
- CHECK_FLAG(desired_flags, attr_flag_str[i].key)
- ? ""
- : " not",
- attr_flag_str[i].str);
+ flog_err(EC_BGP_ATTR_FLAG,
+ "%s attribute must%s be flagged as \"%s\"",
+ lookup_msg(attr_str, attr_code, NULL),
+ CHECK_FLAG(desired_flags, attr_flag_str[i].key)
+ ? ""
+ : " not",
+ attr_flag_str[i].str);
seen = 1;
}
if (!seen) {
@@ -1063,7 +1062,7 @@ static int bgp_attr_flag_invalid(struct bgp_attr_parser_args *args)
if (!CHECK_FLAG(BGP_ATTR_FLAG_OPTIONAL, flags)
&& !CHECK_FLAG(BGP_ATTR_FLAG_TRANS, flags)) {
flog_err(
- BGP_ERR_ATTR_FLAG,
+ EC_BGP_ATTR_FLAG,
"%s well-known attributes must have transitive flag set (%x)",
lookup_msg(attr_str, attr_code, NULL), flags);
return 1;
@@ -1075,18 +1074,18 @@ static int bgp_attr_flag_invalid(struct bgp_attr_parser_args *args)
*/
if (CHECK_FLAG(flags, BGP_ATTR_FLAG_PARTIAL)) {
if (!CHECK_FLAG(flags, BGP_ATTR_FLAG_OPTIONAL)) {
- flog_err(BGP_ERR_ATTR_FLAG,
- "%s well-known attribute "
- "must NOT have the partial flag set (%x)",
- lookup_msg(attr_str, attr_code, NULL), flags);
+ flog_err(EC_BGP_ATTR_FLAG,
+ "%s well-known attribute "
+ "must NOT have the partial flag set (%x)",
+ lookup_msg(attr_str, attr_code, NULL), flags);
return 1;
}
if (CHECK_FLAG(flags, BGP_ATTR_FLAG_OPTIONAL)
&& !CHECK_FLAG(flags, BGP_ATTR_FLAG_TRANS)) {
- flog_err(BGP_ERR_ATTR_FLAG,
- "%s optional + transitive attribute "
- "must NOT have the partial flag set (%x)",
- lookup_msg(attr_str, attr_code, NULL), flags);
+ flog_err(EC_BGP_ATTR_FLAG,
+ "%s optional + transitive attribute "
+ "must NOT have the partial flag set (%x)",
+ lookup_msg(attr_str, attr_code, NULL), flags);
return 1;
}
}
@@ -1118,8 +1117,8 @@ static bgp_attr_parse_ret_t bgp_attr_origin(struct bgp_attr_parser_args *args)
field contains the erroneous attribute (type, length and
value). */
if (length != 1) {
- flog_err(BGP_ERR_ATTR_LEN,
- "Origin attribute length is not one %d", length);
+ flog_err(EC_BGP_ATTR_LEN,
+ "Origin attribute length is not one %d", length);
return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR,
args->total);
}
@@ -1132,8 +1131,8 @@ static bgp_attr_parse_ret_t bgp_attr_origin(struct bgp_attr_parser_args *args)
contains the unrecognized attribute (type, length and value). */
if ((attr->origin != BGP_ORIGIN_IGP) && (attr->origin != BGP_ORIGIN_EGP)
&& (attr->origin != BGP_ORIGIN_INCOMPLETE)) {
- flog_err(BGP_ERR_ATTR_ORIGIN,
- "Origin attribute value is invalid %d", attr->origin);
+ flog_err(EC_BGP_ATTR_ORIGIN,
+ "Origin attribute value is invalid %d", attr->origin);
return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_INVAL_ORIGIN,
args->total);
}
@@ -1161,9 +1160,9 @@ static int bgp_attr_aspath(struct bgp_attr_parser_args *args)
/* In case of IBGP, length will be zero. */
if (!attr->aspath) {
- flog_err(BGP_ERR_ATTR_MAL_AS_PATH,
- "Malformed AS path from %s, length is %d", peer->host,
- length);
+ flog_err(EC_BGP_ATTR_MAL_AS_PATH,
+ "Malformed AS path from %s, length is %d", peer->host,
+ length);
return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_MAL_AS_PATH,
0);
}
@@ -1191,8 +1190,8 @@ static bgp_attr_parse_ret_t bgp_attr_aspath_check(struct peer *const peer,
&& !aspath_left_confed_check(attr->aspath))
|| (peer->sort == BGP_PEER_EBGP
&& aspath_confed_check(attr->aspath))) {
- flog_err(BGP_ERR_ATTR_MAL_AS_PATH, "Malformed AS path from %s",
- peer->host);
+ flog_err(EC_BGP_ATTR_MAL_AS_PATH, "Malformed AS path from %s",
+ peer->host);
bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_MAL_AS_PATH);
return BGP_ATTR_PARSE_ERROR;
@@ -1202,9 +1201,9 @@ static bgp_attr_parse_ret_t bgp_attr_aspath_check(struct peer *const peer,
if (CHECK_FLAG(peer->flags, PEER_FLAG_ENFORCE_FIRST_AS)) {
if (peer->sort == BGP_PEER_EBGP
&& !aspath_firstas_check(attr->aspath, peer->as)) {
- flog_err(BGP_ERR_ATTR_FIRST_AS,
- "%s incorrect first AS (must be %u)",
- peer->host, peer->as);
+ flog_err(EC_BGP_ATTR_FIRST_AS,
+ "%s incorrect first AS (must be %u)",
+ peer->host, peer->as);
bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_MAL_AS_PATH);
return BGP_ATTR_PARSE_ERROR;
@@ -1236,9 +1235,9 @@ static int bgp_attr_as4_path(struct bgp_attr_parser_args *args,
/* In case of IBGP, length will be zero. */
if (!*as4_path) {
- flog_err(BGP_ERR_ATTR_MAL_AS_PATH,
- "Malformed AS4 path from %s, length is %d",
- peer->host, length);
+ flog_err(EC_BGP_ATTR_MAL_AS_PATH,
+ "Malformed AS4 path from %s, length is %d", peer->host,
+ length);
return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_MAL_AS_PATH,
0);
}
@@ -1260,8 +1259,8 @@ static bgp_attr_parse_ret_t bgp_attr_nexthop(struct bgp_attr_parser_args *args)
/* Check nexthop attribute length. */
if (length != 4) {
- flog_err(BGP_ERR_ATTR_LEN,
- "Nexthop attribute length isn't four [%d]", length);
+ flog_err(EC_BGP_ATTR_LEN,
+ "Nexthop attribute length isn't four [%d]", length);
return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR,
args->total);
@@ -1285,7 +1284,7 @@ static bgp_attr_parse_ret_t bgp_attr_nexthop(struct bgp_attr_parser_args *args)
{
char buf[INET_ADDRSTRLEN];
inet_ntop(AF_INET, &nexthop_n, buf, INET_ADDRSTRLEN);
- flog_err(BGP_ERR_ATTR_MARTIAN_NH, "Martian nexthop %s", buf);
+ flog_err(EC_BGP_ATTR_MARTIAN_NH, "Martian nexthop %s", buf);
return bgp_attr_malformed(
args, BGP_NOTIFY_UPDATE_INVAL_NEXT_HOP, args->total);
}
@@ -1305,8 +1304,8 @@ static bgp_attr_parse_ret_t bgp_attr_med(struct bgp_attr_parser_args *args)
/* Length check. */
if (length != 4) {
- flog_err(BGP_ERR_ATTR_LEN,
- "MED attribute length isn't four [%d]", length);
+ flog_err(EC_BGP_ATTR_LEN,
+ "MED attribute length isn't four [%d]", length);
return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR,
args->total);
@@ -1329,8 +1328,8 @@ bgp_attr_local_pref(struct bgp_attr_parser_args *args)
/* Length check. */
if (length != 4) {
- flog_err(BGP_ERR_ATTR_LEN,
- "LOCAL_PREF attribute length isn't 4 [%u]", length);
+ flog_err(EC_BGP_ATTR_LEN,
+ "LOCAL_PREF attribute length isn't 4 [%u]", length);
return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR,
args->total);
}
@@ -1359,9 +1358,9 @@ static int bgp_attr_atomic(struct bgp_attr_parser_args *args)
/* Length check. */
if (length != 0) {
- flog_err(BGP_ERR_ATTR_LEN,
- "ATOMIC_AGGREGATE attribute length isn't 0 [%u]",
- length);
+ flog_err(EC_BGP_ATTR_LEN,
+ "ATOMIC_AGGREGATE attribute length isn't 0 [%u]",
+ length);
return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR,
args->total);
}
@@ -1386,9 +1385,9 @@ static int bgp_attr_aggregator(struct bgp_attr_parser_args *args)
wantedlen = 8;
if (length != wantedlen) {
- flog_err(BGP_ERR_ATTR_LEN,
- "AGGREGATOR attribute length isn't %u [%u]",
- wantedlen, length);
+ flog_err(EC_BGP_ATTR_LEN,
+ "AGGREGATOR attribute length isn't %u [%u]", wantedlen,
+ length);
return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR,
args->total);
}
@@ -1416,8 +1415,8 @@ bgp_attr_as4_aggregator(struct bgp_attr_parser_args *args,
const bgp_size_t length = args->length;
if (length != 8) {
- flog_err(BGP_ERR_ATTR_LEN,
- "New Aggregator length is not 8 [%d]", length);
+ flog_err(EC_BGP_ATTR_LEN, "New Aggregator length is not 8 [%d]",
+ length);
return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR,
0);
}
@@ -1576,8 +1575,8 @@ bgp_attr_originator_id(struct bgp_attr_parser_args *args)
/* Length check. */
if (length != 4) {
- flog_err(BGP_ERR_ATTR_LEN, "Bad originator ID length %d",
- length);
+ flog_err(EC_BGP_ATTR_LEN, "Bad originator ID length %d",
+ length);
return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR,
args->total);
@@ -1600,8 +1599,7 @@ bgp_attr_cluster_list(struct bgp_attr_parser_args *args)
/* Check length. */
if (length % 4) {
- flog_err(BGP_ERR_ATTR_LEN, "Bad cluster list length %d",
- length);
+ flog_err(EC_BGP_ATTR_LEN, "Bad cluster list length %d", length);
return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR,
args->total);
@@ -1761,7 +1759,7 @@ int bgp_mp_reach_parse(struct bgp_attr_parser_args *args,
uint8_t val;
if ((val = stream_getc(s)))
flog_warn(
- BGP_WARN_DEFUNCT_SNPA_LEN,
+ EC_BGP_DEFUNCT_SNPA_LEN,
"%s sent non-zero value, %u, for defunct SNPA-length field",
peer->host, val);
}
@@ -2072,7 +2070,7 @@ static bgp_attr_parse_ret_t bgp_attr_psid_sub(int32_t type,
if (type == BGP_PREFIX_SID_LABEL_INDEX) {
if (length != BGP_PREFIX_SID_LABEL_INDEX_LENGTH) {
flog_err(
- BGP_ERR_ATTR_LEN,
+ EC_BGP_ATTR_LEN,
"Prefix SID label index length is %d instead of %d",
length, BGP_PREFIX_SID_LABEL_INDEX_LENGTH);
return bgp_attr_malformed(args,
@@ -2107,9 +2105,9 @@ static bgp_attr_parse_ret_t bgp_attr_psid_sub(int32_t type,
/* Placeholder code for the IPv6 SID type */
else if (type == BGP_PREFIX_SID_IPV6) {
if (length != BGP_PREFIX_SID_IPV6_LENGTH) {
- flog_err(BGP_ERR_ATTR_LEN,
- "Prefix SID IPv6 length is %d instead of %d",
- length, BGP_PREFIX_SID_IPV6_LENGTH);
+ flog_err(EC_BGP_ATTR_LEN,
+ "Prefix SID IPv6 length is %d instead of %d",
+ length, BGP_PREFIX_SID_IPV6_LENGTH);
return bgp_attr_malformed(args,
BGP_NOTIFY_UPDATE_ATTR_LENG_ERR,
args->total);
@@ -2131,7 +2129,7 @@ static bgp_attr_parse_ret_t bgp_attr_psid_sub(int32_t type,
if (length % BGP_PREFIX_SID_ORIGINATOR_SRGB_LENGTH) {
flog_err(
- BGP_ERR_ATTR_LEN,
+ EC_BGP_ATTR_LEN,
"Prefix SID Originator SRGB length is %d, it must be a multiple of %d ",
length, BGP_PREFIX_SID_ORIGINATOR_SRGB_LENGTH);
return bgp_attr_malformed(
@@ -2181,7 +2179,7 @@ bgp_attr_prefix_sid(int32_t tlength, struct bgp_attr_parser_args *args,
if (tlength < 0) {
flog_err(
- BGP_ERR_ATTR_LEN,
+ EC_BGP_ATTR_LEN,
"Prefix SID internal length %d causes us to read beyond the total Prefix SID length",
length);
return bgp_attr_malformed(args,
@@ -2208,24 +2206,24 @@ bgp_attr_pmsi_tunnel(struct bgp_attr_parser_args *args)
* can only support that.
*/
if (length < 2) {
- flog_err(BGP_ERR_ATTR_LEN,
- "Bad PMSI tunnel attribute length %d", length);
+ flog_err(EC_BGP_ATTR_LEN, "Bad PMSI tunnel attribute length %d",
+ length);
return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR,
args->total);
}
stream_getc(peer->curr); /* Flags */
tnl_type = stream_getc(peer->curr);
if (tnl_type > PMSI_TNLTYPE_MAX) {
- flog_err(BGP_ERR_ATTR_PMSI_TYPE,
- "Invalid PMSI tunnel attribute type %d", tnl_type);
+ flog_err(EC_BGP_ATTR_PMSI_TYPE,
+ "Invalid PMSI tunnel attribute type %d", tnl_type);
return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_OPT_ATTR_ERR,
args->total);
}
if (tnl_type == PMSI_TNLTYPE_INGR_REPL) {
if (length != 9) {
- flog_err(BGP_ERR_ATTR_PMSI_LEN,
- "Bad PMSI tunnel attribute length %d for IR",
- length);
+ flog_err(EC_BGP_ATTR_PMSI_LEN,
+ "Bad PMSI tunnel attribute length %d for IR",
+ length);
return bgp_attr_malformed(
args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR,
args->total);
@@ -2337,7 +2335,7 @@ static int bgp_attr_check(struct peer *peer, struct attr *attr)
type = BGP_ATTR_LOCAL_PREF;
if (type) {
- flog_warn(BGP_WARN_MISSING_ATTRIBUTE,
+ flog_warn(EC_BGP_MISSING_ATTRIBUTE,
"%s Missing well-known attribute %s.", peer->host,
lookup_msg(attr_str, type, NULL));
bgp_notify_send_with_data(peer, BGP_NOTIFY_UPDATE_ERR,
@@ -2380,7 +2378,7 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr,
if (endp - BGP_INPUT_PNT(peer) < BGP_ATTR_MIN_LEN) {
/* XXX warning: long int format, int arg (arg 5) */
flog_warn(
- BGP_WARN_ATTRIBUTE_TOO_SMALL,
+ EC_BGP_ATTRIBUTE_TOO_SMALL,
"%s: error BGP attribute length %lu is smaller than min len",
peer->host,
(unsigned long)(endp
@@ -2403,7 +2401,7 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr,
if (CHECK_FLAG(flag, BGP_ATTR_FLAG_EXTLEN)
&& ((endp - startp) < (BGP_ATTR_MIN_LEN + 1))) {
flog_warn(
- BGP_WARN_EXT_ATTRIBUTE_TOO_SMALL,
+ EC_BGP_EXT_ATTRIBUTE_TOO_SMALL,
"%s: Extended length set, but just %lu bytes of attr header",
peer->host,
(unsigned long)(endp
@@ -2426,7 +2424,7 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr,
if (CHECK_BITMAP(seen, type)) {
flog_warn(
- BGP_WARN_ATTRIBUTE_REPEATED,
+ EC_BGP_ATTRIBUTE_REPEATED,
"%s: error BGP attribute type %d appears twice in a message",
peer->host, type);
@@ -2445,7 +2443,7 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr,
if (attr_endp > endp) {
flog_warn(
- BGP_WARN_ATTRIBUTE_TOO_LARGE,
+ EC_BGP_ATTRIBUTE_TOO_LARGE,
"%s: BGP type %d length %d is too large, attribute total length is %d. attr_endp is %p. endp is %p",
peer->host, type, length, size, attr_endp,
endp);
@@ -2602,7 +2600,7 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr,
/* If hard error occured immediately return to the caller. */
if (ret == BGP_ATTR_PARSE_ERROR) {
- flog_warn(BGP_WARN_ATTRIBUTE_PARSE_ERROR,
+ flog_warn(EC_BGP_ATTRIBUTE_PARSE_ERROR,
"%s: Attribute %s, parse error", peer->host,
lookup_msg(attr_str, type, NULL));
if (as4_path)
@@ -2612,7 +2610,7 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr,
if (ret == BGP_ATTR_PARSE_WITHDRAW) {
flog_warn(
- BGP_WARN_ATTRIBUTE_PARSE_WITHDRAW,
+ EC_BGP_ATTRIBUTE_PARSE_WITHDRAW,
"%s: Attribute %s, parse error - treating as withdrawal",
peer->host, lookup_msg(attr_str, type, NULL));
if (as4_path)
@@ -2622,7 +2620,7 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr,
/* Check the fetched length. */
if (BGP_INPUT_PNT(peer) != attr_endp) {
- flog_warn(BGP_WARN_ATTRIBUTE_FETCH_ERROR,
+ flog_warn(EC_BGP_ATTRIBUTE_FETCH_ERROR,
"%s: BGP attribute %s, fetch error",
peer->host, lookup_msg(attr_str, type, NULL));
bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
@@ -2635,7 +2633,7 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr,
/* Check final read pointer is same as end pointer. */
if (BGP_INPUT_PNT(peer) != endp) {
- flog_warn(BGP_WARN_ATTRIBUTES_MISMATCH,
+ flog_warn(EC_BGP_ATTRIBUTES_MISMATCH,
"%s: BGP attribute %s, length mismatch", peer->host,
lookup_msg(attr_str, type, NULL));
bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
@@ -2831,7 +2829,7 @@ size_t bgp_packet_mpattr_start(struct stream *s, struct peer *peer, afi_t afi,
default:
if (safi != SAFI_FLOWSPEC)
flog_err(
- BGP_ERR_ATTR_NH_SEND_LEN,
+ EC_BGP_ATTR_NH_SEND_LEN,
"Bad nexthop when sending to %s, AFI %u SAFI %u nhlen %d",
peer->host, afi, safi, attr->mp_nexthop_len);
break;
diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c
index 49f27d298..ef746597a 100644
--- a/bgpd/bgp_dump.c
+++ b/bgpd/bgp_dump.c
@@ -120,7 +120,7 @@ static FILE *bgp_dump_open_file(struct bgp_dump *bgp_dump)
ret = strftime(realpath, MAXPATHLEN, bgp_dump->filename, tm);
if (ret == 0) {
- flog_warn(BGP_WARN_DUMP, "bgp_dump_open_file: strftime error");
+ flog_warn(EC_BGP_DUMP, "bgp_dump_open_file: strftime error");
return NULL;
}
@@ -132,7 +132,7 @@ static FILE *bgp_dump_open_file(struct bgp_dump *bgp_dump)
bgp_dump->fp = fopen(realpath, "w");
if (bgp_dump->fp == NULL) {
- flog_warn(BGP_WARN_DUMP, "bgp_dump_open_file: %s: %s", realpath,
+ flog_warn(EC_BGP_DUMP, "bgp_dump_open_file: %s: %s", realpath,
strerror(errno));
umask(oldumask);
return NULL;
diff --git a/bgpd/bgp_errors.c b/bgpd/bgp_errors.c
index 827927f1b..bd42901c2 100644
--- a/bgpd/bgp_errors.c
+++ b/bgpd/bgp_errors.c
@@ -26,163 +26,163 @@
/* clang-format off */
static struct log_ref ferr_bgp_warn[] = {
{
- .code = BGP_WARN_ASPATH_FEWER_HOPS,
+ .code = EC_BGP_ASPATH_FEWER_HOPS,
.title = "BGP AS-path conversion has failed",
.description = "BGP has attempted to convert a AS2 to AS4 path and has failed",
.suggestion = "Open an Issue with all relevant log files and restart FRR"
},
{
- .code = BGP_WARN_DEFUNCT_SNPA_LEN,
+ .code = EC_BGP_DEFUNCT_SNPA_LEN,
.title = "BGP has received a value in a reserved field",
.description = "BGP has received a non-zero value in a reserved field that was used for SNPA-length at one point in time",
.suggestion = "BGP has peered with either a router that is attempting to send SNPA data or it has received a corrupted packet. If we are peering with a SNPA aware router(unlikely) upgrade that router, else open an Issue after gathering relevant log files",
},
{
- .code = BGP_WARN_MISSING_ATTRIBUTE,
+ .code = EC_BGP_MISSING_ATTRIBUTE,
.title = "BGP has received an update with missing a missing attribute",
.description = "BGP received update packets must have some minimum attribute information within them",
.suggestion = "Gather log data from this and remote peer and open an Issue with this data",
},
{
- .code = BGP_WARN_ATTRIBUTE_TOO_SMALL,
+ .code = EC_BGP_ATTRIBUTE_TOO_SMALL,
.title = "BGP udate packet with attribute data that is too small",
.description = "BGP has received an update packet that is too small to parse a given attribute. This typically means that something has gone wrong between us and the remote peer",
.suggestion = "Gather log data from this and remote peer and open an Issue with this data",
},
{
- .code = BGP_WARN_EXT_ATTRIBUTE_TOO_SMALL,
+ .code = EC_BGP_EXT_ATTRIBUTE_TOO_SMALL,
.title = "BGP udate packet with extended attribute data that is too small",
.description = "BGP has received an update packet that is too small to parse a given extended attribute. This typically means that something has gone wrong between us and the remote peer",
.suggestion = "Gather log data from this and remote peer and open an Issue with this data",
},
{
- .code = BGP_WARN_ATTRIBUTE_REPEATED,
+ .code = EC_BGP_ATTRIBUTE_REPEATED,
.title = "BGP update packet received with a repeated attribute",
.description = "BGP has received an update packet with a attribute that is repeated more than one time for a particular route. This typically means that something has gone wrong between us and the remote peer",
.suggestion = "Gather log data from this and remote peer and open an Issue with this data",
},
{
- .code = BGP_WARN_ATTRIBUTE_TOO_LARGE,
+ .code = EC_BGP_ATTRIBUTE_TOO_LARGE,
.title = "BGP udate packet with attribute data that is too large",
.description = "BGP has received an update packet that has too much data in a particular attribute. This typically means that something has gone wrong between us and the remote peer",
.suggestion = "Gather log data from this and remote peer and open an Issue with this data",
},
{
- .code = BGP_WARN_ATTRIBUTE_PARSE_ERROR,
+ .code = EC_BGP_ATTRIBUTE_PARSE_ERROR,
.title = "BGP update packet with attribute data has a parse error, specific to the attribute",
.description = "BGP has received an update packet with an attribute that when parsed does not make sense in some manner",
.suggestion = "Gather log data from this and remote peer and open an Issue with this data",
},
{
- .code = BGP_WARN_ATTRIBUTE_PARSE_WITHDRAW,
+ .code = EC_BGP_ATTRIBUTE_PARSE_WITHDRAW,
.title = "BGP update packet with a broken optional attribute has caused a withdraw of associated routes",
.description = "BGP has received a update packet with optional attributes that did not parse correctly, instead of resetting the peer, withdraw associated routes and note that this has happened",
.suggestion = "Gather log data from this and remote peer and open an Issue with this data",
},
{
- .code = BGP_WARN_ATTRIBUTE_FETCH_ERROR,
+ .code = EC_BGP_ATTRIBUTE_FETCH_ERROR,
.title = "BGP update packet with a broken length",
.description = "BGP has received a update packet with an attribute that has an incorrect length",
.suggestion = "Gather log data from this and remote peer and open an Issue with this data",
},
{
- .code = BGP_WARN_ATTRIBUTES_MISMATCH,
+ .code = EC_BGP_ATTRIBUTES_MISMATCH,
.title = "BGP update packet with a length different than attribute data length",
.description = "BGP has received a update packet with attributes that when parsed do not correctly add up to packet data length",
.suggestion = "Gather log data from this and remote peer and open an Issue with this data",
},
{
- .code = BGP_WARN_DUMP,
+ .code = EC_BGP_DUMP,
.title = "BGP MRT dump subsystem has encountered an issue",
.description = "BGP has found that the attempted write of MRT data to a dump file has failed",
.suggestion = "Ensure BGP has permissions to write the specified file",
},
{
- .code = BGP_WARN_UPDATE_PACKET_SHORT,
+ .code = EC_BGP_UPDATE_PACKET_SHORT,
.title = "BGP Update Packet is to Small",
.description = "The update packet received from a peer is to small",
.suggestion = "Determine the source of the update packet and examine that peer for what has gone wrong",
},
{
- .code = BGP_WARN_UPDATE_PACKET_LONG,
+ .code = EC_BGP_UPDATE_PACKET_LONG,
.title = "BGP Update Packet is to large",
.description = "The update packet received from a peer is to large",
.suggestion = "Determine the source of the update packet and examine that peer for what has gone wrong",
},
{
- .code = BGP_WARN_UNRECOGNIZED_CAPABILITY,
+ .code = EC_BGP_UNRECOGNIZED_CAPABILITY,
.title = "Unknown BGP Capability Received",
.description = "The negotiation of capabilities has received a capability that we do not know what to do with",
.suggestion = "Determine the source of the capability and remove the capability from what is sent",
},
{
- .code = BGP_WARN_NO_TCP_MD5,
+ .code = EC_BGP_NO_TCP_MD5,
.title = "Unable to set TCP MD5 option on socket",
.description = "BGP attempted to setup TCP MD5 configuration on the socket as per configuration but was unable to",
.suggestion = "Please collect log files and open Issue",
},
{
- .code = BGP_WARN_NO_SOCKOPT_MARK,
+ .code = EC_BGP_NO_SOCKOPT_MARK,
.title = "Unable to set socket MARK option",
.description = "BGP attempted to set the SO_MARK option for a socket and was unable to do so",
.suggestion = "Please collect log files and open Issue",
},
{
- .code = BGP_WARN_EVPN_PMSI_PRESENT,
+ .code = EC_BGP_EVPN_PMSI_PRESENT,
.title = "BGP Received a EVPN NLRI with PMSI included",
.description = "BGP has received a type-3 NLRI with PMSI information. At this time FRR is not capable of properly handling this NLRI type",
.suggestion = "Setup peer to not send this type of data to FRR"
},
{
- .code = BGP_WARN_EVPN_VPN_VNI,
+ .code = EC_BGP_EVPN_VPN_VNI,
.title = "BGP has received a local macip and cannot properly handle it",
.description = "BGP has received a local macip from zebra and has no way to properly handle the macip because the vni is not setup properly",
.suggestion = "Ensure proper setup of BGP EVPN",
},
{
- .code = BGP_WARN_EVPN_ESI,
+ .code = EC_BGP_EVPN_ESI,
.title = "BGP has received a local ESI for deletion",
.description = "BGP has received a local ESI for deletion but when attempting to find the stored data internally was unable to find the information for deletion",
.suggestion = "Gather logging and open an Issue",
},
{
- .code = BGP_WARN_INVALID_LABEL_STACK,
+ .code = EC_BGP_INVALID_LABEL_STACK,
.title = "BGP has received a label stack in a NLRI that does not have the BOS marked",
.description = "BGP when it receives a NLRI with a label stack should have the BOS marked, this received packet does not have this",
.suggestion = "Gather log information from here and remote peer and open an Issue",
},
{
- .code = BGP_WARN_ZEBRA_SEND,
+ .code = EC_BGP_ZEBRA_SEND,
.title = "BGP has attempted to send data to zebra and has failed to do so",
.description = "BGP has attempted to send data to zebra but has been unable to do so",
.suggestion = "Gather log data, open an Issue and restart FRR"
},
{
- .code = BGP_WARN_CAPABILITY_INVALID_LENGTH,
+ .code = EC_BGP_CAPABILITY_INVALID_LENGTH,
.title = "BGP has received a capability with an invalid length",
.description = "BGP has received a capability from it's peer who's size is wrong",
.suggestion = "Gather log files from here and from peer and open an Issue",
},
{
- .code = BGP_WARN_CAPABILITY_INVALID_DATA,
+ .code = EC_BGP_CAPABILITY_INVALID_DATA,
.title = "BGP has received capability data with invalid information",
.description = "BGP has noticed that during processing of capability information that data was wrong",
.suggestion = "Gather log files from here and from peer and open an Issue",
},
{
- .code = BGP_WARN_CAPABILITY_VENDOR,
+ .code = EC_BGP_CAPABILITY_VENDOR,
.title = "BGP has recieved capability data specific to a particular vendor",
.description = "BGP has received a capability that is vendor specific and as such we have no knowledge of how to use this capability in FRR",
.suggestion = "On peer turn off this feature"
},
{
- .code = BGP_WARN_CAPABILITY_UNKNOWN,
+ .code = EC_BGP_CAPABILITY_UNKNOWN,
.title = "BGP has received capability data for a unknown capability",
.description = "BGP has received a capability that it does not know how to decode. This may be due to a new feature that has not been coded into FRR or it may be a bug in the remote peer",
.suggestion = "Gather log files from here and from peer and open an Issue",
},
{
- .code = BGP_WARN_INVALID_NEXTHOP_LENGTH,
+ .code = EC_BGP_INVALID_NEXTHOP_LENGTH,
.title = "BGP is attempting to write an invalid nexthop length value",
.description = "BGP is in the process of building NLRI information for a peer and has discovered an inconsistent internal state",
.suggestion = "Gather log files and open an Issue, restart FRR",
@@ -194,270 +194,270 @@ static struct log_ref ferr_bgp_warn[] = {
static struct log_ref ferr_bgp_err[] = {
{
- .code = BGP_ERR_ATTR_FLAG,
+ .code = EC_BGP_ATTR_FLAG,
.title = "BGP attribute flag is incorrect",
.description = "BGP attribute flag is set to the wrong value (Optional/Transitive/Partial)",
.suggestion = "Determine the soure of the attribute and determine why the attribute flag has been set incorrectly"
},
{
- .code = BGP_ERR_ATTR_LEN,
+ .code = EC_BGP_ATTR_LEN,
.title = "BGP attribute length is incorrect",
.description = "BGP attribute length is incorrect",
.suggestion = "Determine the soure of the attribute and determine why the attribute length has been set incorrectly"
},
{
- .code = BGP_ERR_ATTR_ORIGIN,
+ .code = EC_BGP_ATTR_ORIGIN,
.title = "BGP attribute origin value invalid",
.description = "BGP attribute origin value is invalid",
.suggestion = "Determine the soure of the attribute and determine why the origin attribute has been set incorrectly"
},
{
- .code = BGP_ERR_ATTR_MAL_AS_PATH,
+ .code = EC_BGP_ATTR_MAL_AS_PATH,
.title = "BGP as path is invalid",
.description = "BGP as path has been malformed",
.suggestion = "Determine the soure of the update and determine why the as path has been set incorrectly"
},
{
- .code = BGP_ERR_ATTR_FIRST_AS,
+ .code = EC_BGP_ATTR_FIRST_AS,
.title = "BGP as path first as is invalid",
.description = "BGP update has invalid first as in as path",
.suggestion = "Determine the soure of the update and determine why the as path first as value has been set incorrectly"
},
{
- .code = BGP_ERR_ATTR_PMSI_TYPE,
+ .code = EC_BGP_ATTR_PMSI_TYPE,
.title = "BGP PMSI tunnel attribute type is invalid",
.description = "BGP update has invalid type for PMSI tunnel",
.suggestion = "Determine the soure of the update and determine why the PMSI tunnel attribute type has been set incorrectly"
},
{
- .code = BGP_ERR_ATTR_PMSI_LEN,
+ .code = EC_BGP_ATTR_PMSI_LEN,
.title = "BGP PMSI tunnel attribute length is invalid",
.description = "BGP update has invalid length for PMSI tunnel",
.suggestion = "Determine the soure of the update and determine why the PMSI tunnel attribute length has been set incorrectly"
},
{
- .code = BGP_ERR_PEER_GROUP,
+ .code = EC_BGP_PEER_GROUP,
.title = "BGP peergroup operated on in error",
.description = "BGP operating on peer-group instead of peers included",
.suggestion = "Ensure the config doesn't contain peergroups contained within peergroups"
},
{
- .code = BGP_ERR_PEER_DELETE,
+ .code = EC_BGP_PEER_DELETE,
.title = "BGP failed to delete peer structure",
.description = "BGP was unable to delete peer structure when address-family removed",
.suggestion = "Determine if all expected peers are removed and restart FRR if not. Most likely a bug"
},
{
- .code = BGP_ERR_TABLE_CHUNK,
+ .code = EC_BGP_TABLE_CHUNK,
.title = "BGP failed to get table chunk memory",
.description = "BGP unable to get chunk memory for table manager",
.suggestion = "Ensure there is adequate memory on the device to support the table requirements"
},
{
- .code = BGP_ERR_MACIP_LEN,
+ .code = EC_BGP_MACIP_LEN,
.title = "BGP received MACIP with invalid IP addr len",
.description = "BGP received MACIP with invalid IP addr len from Zebra",
.suggestion = "Verify MACIP entries inserted in Zebra are correct. Most likely a bug"
},
{
- .code = BGP_ERR_LM_ERROR,
+ .code = EC_BGP_LM_ERROR,
.title = "BGP received invalid label manager message",
.description = "BGP received invalid label manager message from label manager",
.suggestion = "Label manager sent invalid essage to BGP for wrong protocol, instance, etc. Most likely a bug"
},
{
- .code = BGP_ERR_JSON_MEM_ERROR,
+ .code = EC_BGP_JSON_MEM_ERROR,
.title = "BGP unable to allocate memory for JSON output",
.description = "BGP attempted to generate JSON output and was unable to allocate the memory required",
.suggestion = "Ensure that the device has adequate memory to suport the required functions"
},
{
- .code = BGP_ERR_UPDGRP_ATTR_LEN,
+ .code = EC_BGP_UPDGRP_ATTR_LEN,
.title = "BGP update had attributes too long to send",
.description = "BGP attempted to send an update but the attributes were too long to fit",
.suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting"
},
{
- .code = BGP_ERR_UPDGRP_CREATE,
+ .code = EC_BGP_UPDGRP_CREATE,
.title = "BGP update group creation failed",
.description = "BGP attempted to create an update group but was unable to",
.suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting"
},
{
- .code = BGP_ERR_UPDATE_SND,
+ .code = EC_BGP_UPDATE_SND,
.title = "BGP error creating update packet",
.description = "BGP attempted to create an update packet but was unable to",
.suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting"
},
{
- .code = BGP_ERR_PKT_OPEN,
+ .code = EC_BGP_PKT_OPEN,
.title = "BGP error receiving open packet",
.description = "BGP received an open from a peer that was invalid",
.suggestion = "Determine the sending peer and correct his invalid open packet"
},
{
- .code = BGP_ERR_SND_FAIL,
+ .code = EC_BGP_SND_FAIL,
.title = "BGP error sending to peer",
.description = "BGP attempted to respond to open from a peer and failed",
.suggestion = "BGP attempted to respond to an open and could not sene the packet. Check local IP address for source"
},
{
- .code = BGP_ERR_INVALID_STATUS,
+ .code = EC_BGP_INVALID_STATUS,
.title = "BGP error receiving from peer",
.description = "BGP received an update from a peer but status was incorrect",
.suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting"
},
{
- .code = BGP_ERR_UPDATE_RCV,
+ .code = EC_BGP_UPDATE_RCV,
.title = "BGP error receiving update packet",
.description = "BGP received an invalid update packet",
.suggestion = "Determine the source of the update and resolve the invalid update being sent"
},
{
- .code = BGP_ERR_NO_CAP,
+ .code = EC_BGP_NO_CAP,
.title = "BGP error due to capability not enabled",
.description = "BGP attempted a function that did not have the capability enabled",
.suggestion = "Enable the capability if this functionality is desired"
},
{
- .code = BGP_ERR_NOTIFY_RCV,
+ .code = EC_BGP_NOTIFY_RCV,
.title = "BGP error receiving notify message",
.description = "BGP unable to process notification message",
.suggestion = "BGP notify received while in stopped state. If the problem persists, report for troubleshooting"
},
{
- .code = BGP_ERR_KEEP_RCV,
+ .code = EC_BGP_KEEP_RCV,
.title = "BGP error receiving keepalive packet",
.description = "BGP unable to process keepalive packet",
.suggestion = "BGP keepalive received while in stopped state. If the problem persists, report for troubleshooting"
},
{
- .code = BGP_ERR_RFSH_RCV,
+ .code = EC_BGP_RFSH_RCV,
.title = "BGP error receiving route refresh message",
.description = "BGP unable to process route refresh message",
.suggestion = "BGP route refresh received while in stopped state. If the problem persists, report for troubleshooting"},
{
- .code = BGP_ERR_CAP_RCV,
+ .code = EC_BGP_CAP_RCV,
.title = "BGP error capability message",
.description = "BGP unable to process received capability",
.suggestion = "BGP capability message received while in stopped state. If the problem persists, report for troubleshooting"
},
{
- .code = BGP_ERR_NH_UPD,
+ .code = EC_BGP_NH_UPD,
.title = "BGP error with nexthopo update",
.description = "BGP unable to process nexthop update",
.suggestion = "BGP received nexthop update but nexthop is not reachable in this bgp instance. Report for troubleshooting"
},
{
- .code = BGP_ERR_LABEL,
+ .code = EC_BGP_LABEL,
.title = "Failure to apply label",
.description = "BGP attempted to attempted to apply a label but could not",
.suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting"
},
{
- .code = BGP_ERR_MULTIPATH,
+ .code = EC_BGP_MULTIPATH,
.title = "Multipath specified is invalid",
.description = "BGP was started with an invalid ecmp/multipath value",
.suggestion = "Correct the ecmp/multipath value supplied when starting the BGP daemon"
},
{
- .code = BGP_ERR_PKT_PROCESS,
+ .code = EC_BGP_PKT_PROCESS,
.title = "Failure to process a packet",
.description = "BGP attempted to process a received packet but could not",
.suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting"
},
{
- .code = BGP_ERR_CONNECT,
+ .code = EC_BGP_CONNECT,
.title = "Failure to connect to peer",
.description = "BGP attempted to send open to peer but couldn't connect",
.suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting"
},
{
- .code = BGP_ERR_FSM,
+ .code = EC_BGP_FSM,
.title = "BGP FSM issue",
.description = "BGP neighbor transition problem",
.suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting"
},
{
- .code = BGP_ERR_VNI,
+ .code = EC_BGP_VNI,
.title = "BGP VNI creation issue",
.description = "BGP could not create a new VNI",
.suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting"
},
{
- .code = BGP_ERR_NO_DFLT,
+ .code = EC_BGP_NO_DFLT,
.title = "BGP default instance missing",
.description = "BGP could not find default instance",
.suggestion = "Define a default instance of BGP since some feature requires it's existence"
},
{
- .code = BGP_ERR_VTEP_INVALID,
+ .code = EC_BGP_VTEP_INVALID,
.title = "BGP remote VTEP invalid",
.description = "BGP remote VTEP is invalid and cannot be used",
.suggestion = "Correct remote VTEP configuration or resolve the source of the problem"
},
{
- .code = BGP_ERR_ES_INVALID,
+ .code = EC_BGP_ES_INVALID,
.title = "BGP ES route error",
.description = "BGP ES route incorrect, learned both local and remote",
.suggestion = "Correct configuration or addressing so that same not learned both local and remote"
},
{
- .code = BGP_ERR_EVPN_ROUTE_DELETE,
+ .code = EC_BGP_EVPN_ROUTE_DELETE,
.title = "BGP EVPN route delete error",
.description = "BGP attempted to delete an EVPN route and failed",
.suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting"
},
{
- .code = BGP_ERR_EVPN_FAIL,
+ .code = EC_BGP_EVPN_FAIL,
.title = "BGP EVPN install/uninstall error",
.description = "BGP attempted to install or uninstall an EVPN prefix and failed",
.suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting"
},
{
- .code = BGP_ERR_EVPN_ROUTE_INVALID,
+ .code = EC_BGP_EVPN_ROUTE_INVALID,
.title = "BGP EVPN route received with invalid contents",
.description = "BGP received an EVPN route with invalid contents",
.suggestion = "Determine the source of the EVPN route and resolve whatever is causing invalid contents"
},
{
- .code = BGP_ERR_EVPN_ROUTE_CREATE,
+ .code = EC_BGP_EVPN_ROUTE_CREATE,
.title = "BGP EVPN route create error",
.description = "BGP attempted to create an EVPN route and failed",
.suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting"
},
{
- .code = BGP_ERR_ES_CREATE,
+ .code = EC_BGP_ES_CREATE,
.title = "BGP EVPN ES entry create error",
.description = "BGP attempted to create an EVPN ES entry and failed",
.suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting"
},
{
- .code = BGP_ERR_MULTI_INSTANCE,
+ .code = EC_BGP_MULTI_INSTANCE,
.title = "BGP config multi-instance issue",
.description = "BGP configuration attempting multiple instances without enabling the feature",
.suggestion = "Correct the configuration so that bgp multiple-instance is enabled if desired"
},
{
- .code = BGP_ERR_EVPN_AS_MISMATCH,
+ .code = EC_BGP_EVPN_AS_MISMATCH,
.title = "BGP AS configuration issue",
.description = "BGP configuration attempted for a different AS than currently configured",
.suggestion = "Correct the configuration so that the correct BGP AS number is used"
},
{
- .code = BGP_ERR_EVPN_INSTANCE_MISMATCH,
+ .code = EC_BGP_EVPN_INSTANCE_MISMATCH,
.title = "BGP EVPN AS and process name mismatch",
.description = "BGP configuration has AS and process name mismatch",
.suggestion = "Correct the configuration so that the BGP AS number and instance name are consistent"
},
{
- .code = BGP_ERR_FLOWSPEC_PACKET,
+ .code = EC_BGP_FLOWSPEC_PACKET,
.title = "BGP Flowspec packet processing error",
.description = "The BGP flowspec subsystem has detected a error in the send or receive of a packet",
.suggestion = "Gather log files from both sides of the peering relationship and open an issue"
},
{
- .code = BGP_ERR_FLOWSPEC_INSTALLATION,
+ .code = EC_BGP_FLOWSPEC_INSTALLATION,
.title = "BGP Flowspec Installation/removal Error",
.description = "The BGP flowspec subsystem has detected that there was a failure for installation/removal/modification of Flowspec from the dataplane",
.suggestion = "Gather log files from the router and open an issue, Restart FRR"
diff --git a/bgpd/bgp_errors.h b/bgpd/bgp_errors.h
index f7db77ac3..853f2da22 100644
--- a/bgpd/bgp_errors.h
+++ b/bgpd/bgp_errors.h
@@ -25,80 +25,80 @@
enum bgp_log_refs {
- BGP_ERR_ATTR_FLAG = BGP_FERR_START,
- BGP_ERR_ATTR_LEN,
- BGP_ERR_ATTR_ORIGIN,
- BGP_ERR_ATTR_MAL_AS_PATH,
- BGP_ERR_ATTR_FIRST_AS,
- BGP_ERR_ATTR_MARTIAN_NH,
- BGP_ERR_ATTR_PMSI_TYPE,
- BGP_ERR_ATTR_PMSI_LEN,
- BGP_ERR_ATTR_NH_SEND_LEN,
- BGP_ERR_PEER_GROUP,
- BGP_ERR_PEER_DELETE,
- BGP_ERR_TABLE_CHUNK,
- BGP_ERR_MACIP_LEN,
- BGP_ERR_LM_ERROR,
- BGP_ERR_JSON_MEM_ERROR,
- BGP_ERR_UPDGRP_ATTR_LEN,
- BGP_ERR_UPDGRP_CREATE,
- BGP_ERR_UPDATE_SND,
- BGP_ERR_PKT_OPEN,
- BGP_ERR_SND_FAIL,
- BGP_ERR_INVALID_STATUS,
- BGP_ERR_UPDATE_RCV,
- BGP_ERR_NO_CAP,
- BGP_ERR_NOTIFY_RCV,
- BGP_ERR_KEEP_RCV,
- BGP_ERR_RFSH_RCV,
- BGP_ERR_CAP_RCV,
- BGP_ERR_NH_UPD,
- BGP_ERR_LABEL,
- BGP_ERR_MULTIPATH,
- BGP_ERR_PKT_PROCESS,
- BGP_ERR_CONNECT,
- BGP_ERR_FSM,
- BGP_ERR_VNI,
- BGP_ERR_NO_DFLT,
- BGP_ERR_VTEP_INVALID,
- BGP_ERR_ES_INVALID,
- BGP_ERR_EVPN_ROUTE_DELETE,
- BGP_ERR_EVPN_FAIL,
- BGP_ERR_EVPN_ROUTE_INVALID,
- BGP_ERR_EVPN_ROUTE_CREATE,
- BGP_ERR_ES_CREATE,
- BGP_ERR_MULTI_INSTANCE,
- BGP_ERR_EVPN_AS_MISMATCH,
- BGP_ERR_EVPN_INSTANCE_MISMATCH,
- BGP_ERR_FLOWSPEC_PACKET,
- BGP_ERR_FLOWSPEC_INSTALLATION,
- BGP_WARN_ASPATH_FEWER_HOPS,
- BGP_WARN_DEFUNCT_SNPA_LEN,
- BGP_WARN_MISSING_ATTRIBUTE,
- BGP_WARN_ATTRIBUTE_TOO_SMALL,
- BGP_WARN_EXT_ATTRIBUTE_TOO_SMALL,
- BGP_WARN_ATTRIBUTE_REPEATED,
- BGP_WARN_ATTRIBUTE_TOO_LARGE,
- BGP_WARN_ATTRIBUTE_PARSE_ERROR,
- BGP_WARN_ATTRIBUTE_PARSE_WITHDRAW,
- BGP_WARN_ATTRIBUTE_FETCH_ERROR,
- BGP_WARN_ATTRIBUTES_MISMATCH,
- BGP_WARN_DUMP,
- BGP_WARN_UPDATE_PACKET_SHORT,
- BGP_WARN_UPDATE_PACKET_LONG,
- BGP_WARN_UNRECOGNIZED_CAPABILITY,
- BGP_WARN_NO_TCP_MD5,
- BGP_WARN_NO_SOCKOPT_MARK,
- BGP_WARN_EVPN_PMSI_PRESENT,
- BGP_WARN_EVPN_VPN_VNI,
- BGP_WARN_EVPN_ESI,
- BGP_WARN_INVALID_LABEL_STACK,
- BGP_WARN_ZEBRA_SEND,
- BGP_WARN_CAPABILITY_INVALID_LENGTH,
- BGP_WARN_CAPABILITY_INVALID_DATA,
- BGP_WARN_CAPABILITY_VENDOR,
- BGP_WARN_CAPABILITY_UNKNOWN,
- BGP_WARN_INVALID_NEXTHOP_LENGTH,
+ EC_BGP_ATTR_FLAG = BGP_FERR_START,
+ EC_BGP_ATTR_LEN,
+ EC_BGP_ATTR_ORIGIN,
+ EC_BGP_ATTR_MAL_AS_PATH,
+ EC_BGP_ATTR_FIRST_AS,
+ EC_BGP_ATTR_MARTIAN_NH,
+ EC_BGP_ATTR_PMSI_TYPE,
+ EC_BGP_ATTR_PMSI_LEN,
+ EC_BGP_ATTR_NH_SEND_LEN,
+ EC_BGP_PEER_GROUP,
+ EC_BGP_PEER_DELETE,
+ EC_BGP_TABLE_CHUNK,
+ EC_BGP_MACIP_LEN,
+ EC_BGP_LM_ERROR,
+ EC_BGP_JSON_MEM_ERROR,
+ EC_BGP_UPDGRP_ATTR_LEN,
+ EC_BGP_UPDGRP_CREATE,
+ EC_BGP_UPDATE_SND,
+ EC_BGP_PKT_OPEN,
+ EC_BGP_SND_FAIL,
+ EC_BGP_INVALID_STATUS,
+ EC_BGP_UPDATE_RCV,
+ EC_BGP_NO_CAP,
+ EC_BGP_NOTIFY_RCV,
+ EC_BGP_KEEP_RCV,
+ EC_BGP_RFSH_RCV,
+ EC_BGP_CAP_RCV,
+ EC_BGP_NH_UPD,
+ EC_BGP_LABEL,
+ EC_BGP_MULTIPATH,
+ EC_BGP_PKT_PROCESS,
+ EC_BGP_CONNECT,
+ EC_BGP_FSM,
+ EC_BGP_VNI,
+ EC_BGP_NO_DFLT,
+ EC_BGP_VTEP_INVALID,
+ EC_BGP_ES_INVALID,
+ EC_BGP_EVPN_ROUTE_DELETE,
+ EC_BGP_EVPN_FAIL,
+ EC_BGP_EVPN_ROUTE_INVALID,
+ EC_BGP_EVPN_ROUTE_CREATE,
+ EC_BGP_ES_CREATE,
+ EC_BGP_MULTI_INSTANCE,
+ EC_BGP_EVPN_AS_MISMATCH,
+ EC_BGP_EVPN_INSTANCE_MISMATCH,
+ EC_BGP_FLOWSPEC_PACKET,
+ EC_BGP_FLOWSPEC_INSTALLATION,
+ EC_BGP_ASPATH_FEWER_HOPS,
+ EC_BGP_DEFUNCT_SNPA_LEN,
+ EC_BGP_MISSING_ATTRIBUTE,
+ EC_BGP_ATTRIBUTE_TOO_SMALL,
+ EC_BGP_EXT_ATTRIBUTE_TOO_SMALL,
+ EC_BGP_ATTRIBUTE_REPEATED,
+ EC_BGP_ATTRIBUTE_TOO_LARGE,
+ EC_BGP_ATTRIBUTE_PARSE_ERROR,
+ EC_BGP_ATTRIBUTE_PARSE_WITHDRAW,
+ EC_BGP_ATTRIBUTE_FETCH_ERROR,
+ EC_BGP_ATTRIBUTES_MISMATCH,
+ EC_BGP_DUMP,
+ EC_BGP_UPDATE_PACKET_SHORT,
+ EC_BGP_UPDATE_PACKET_LONG,
+ EC_BGP_UNRECOGNIZED_CAPABILITY,
+ EC_BGP_NO_TCP_MD5,
+ EC_BGP_NO_SOCKOPT_MARK,
+ EC_BGP_EVPN_PMSI_PRESENT,
+ EC_BGP_EVPN_VPN_VNI,
+ EC_BGP_EVPN_ESI,
+ EC_BGP_INVALID_LABEL_STACK,
+ EC_BGP_ZEBRA_SEND,
+ EC_BGP_CAPABILITY_INVALID_LENGTH,
+ EC_BGP_CAPABILITY_INVALID_DATA,
+ EC_BGP_CAPABILITY_VENDOR,
+ EC_BGP_CAPABILITY_UNKNOWN,
+ EC_BGP_INVALID_NEXTHOP_LENGTH,
};
extern void bgp_error_init(void);
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index 3bd566e07..41aceae9f 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -173,8 +173,8 @@ static struct vrf_irt_node *vrf_import_rt_new(struct ecommunity_val *rt)
bgp_def = bgp_get_default();
if (!bgp_def) {
- flog_err(BGP_ERR_NO_DFLT,
- "vrf import rt new - def instance not created yet");
+ flog_err(EC_BGP_NO_DFLT,
+ "vrf import rt new - def instance not created yet");
return NULL;
}
@@ -204,8 +204,8 @@ static void vrf_import_rt_free(struct vrf_irt_node *irt)
bgp_def = bgp_get_default();
if (!bgp_def) {
- flog_err(BGP_ERR_NO_DFLT,
- "vrf import rt free - def instance not created yet");
+ flog_err(EC_BGP_NO_DFLT,
+ "vrf import rt free - def instance not created yet");
return;
}
@@ -226,9 +226,8 @@ static struct vrf_irt_node *lookup_vrf_import_rt(struct ecommunity_val *rt)
bgp_def = bgp_get_default();
if (!bgp_def) {
- flog_err(
- BGP_ERR_NO_DFLT,
- "vrf import rt lookup - def instance not created yet");
+ flog_err(EC_BGP_NO_DFLT,
+ "vrf import rt lookup - def instance not created yet");
return NULL;
}
@@ -628,7 +627,7 @@ static int bgp_zebra_send_remote_vtep(struct bgp *bgp, struct bgpevpn *vpn,
stream_put_in_addr(s, &p->prefix.imet_addr.ip.ipaddr_v4);
else if (is_evpn_prefix_ipaddr_v6(p)) {
flog_err(
- BGP_ERR_VTEP_INVALID,
+ EC_BGP_VTEP_INVALID,
"Bad remote IP when trying to %s remote VTEP for VNI %u",
add ? "ADD" : "DEL", vpn->vni);
return -1;
@@ -1302,7 +1301,7 @@ static int update_evpn_type4_route_entry(struct bgp *bgp,
*/
if (remote_ri) {
flog_err(
- BGP_ERR_ES_INVALID,
+ EC_BGP_ES_INVALID,
"%u ERROR: local es route for ESI: %s Vtep %s also learnt from remote",
bgp->vrf_id,
esi_to_str(&evp->prefix.es_addr.esi, buf, sizeof(buf)),
@@ -1389,12 +1388,11 @@ static int update_evpn_type4_route(struct bgp *bgp,
&attr, 1, &ri,
&route_changed);
if (ret != 0) {
- flog_err(
- BGP_ERR_ES_INVALID,
- "%u ERROR: Failed to updated ES route ESI: %s VTEP %s",
- bgp->vrf_id,
- esi_to_str(&p->prefix.es_addr.esi, buf, sizeof(buf)),
- ipaddr2str(&es->originator_ip, buf1, sizeof(buf1)));
+ flog_err(EC_BGP_ES_INVALID,
+ "%u ERROR: Failed to updated ES route ESI: %s VTEP %s",
+ bgp->vrf_id,
+ esi_to_str(&p->prefix.es_addr.esi, buf, sizeof(buf)),
+ ipaddr2str(&es->originator_ip, buf1, sizeof(buf1)));
}
assert(ri);
@@ -2191,9 +2189,9 @@ static int delete_routes_for_es(struct bgp *bgp, struct evpnes *es)
build_evpn_type4_prefix(&p, &es->esi, es->originator_ip.ipaddr_v4);
ret = delete_evpn_type4_route(bgp, es, &p);
if (ret) {
- flog_err(BGP_ERR_EVPN_ROUTE_DELETE,
- "%u failed to delete type-4 route for ESI %s",
- bgp->vrf_id, esi_to_str(&es->esi, buf, sizeof(buf)));
+ flog_err(EC_BGP_EVPN_ROUTE_DELETE,
+ "%u failed to delete type-4 route for ESI %s",
+ bgp->vrf_id, esi_to_str(&es->esi, buf, sizeof(buf)));
}
/* Delete all routes from per ES table */
@@ -2851,7 +2849,7 @@ static int install_uninstall_routes_for_es(struct bgp *bgp,
if (ret) {
flog_err(
- BGP_ERR_EVPN_FAIL,
+ EC_BGP_EVPN_FAIL,
"Failed to %s EVPN %s route in ESI %s",
install ? "install"
: "uninstall",
@@ -2931,7 +2929,7 @@ static int install_uninstall_routes_for_vrf(struct bgp *bgp_vrf, int install)
if (ret) {
flog_err(
- BGP_ERR_EVPN_FAIL,
+ EC_BGP_EVPN_FAIL,
"Failed to %s EVPN %s route in VRF %s",
install ? "install"
: "uninstall",
@@ -3005,7 +3003,7 @@ static int install_uninstall_routes_for_vni(struct bgp *bgp,
if (ret) {
flog_err(
- BGP_ERR_EVPN_FAIL,
+ EC_BGP_EVPN_FAIL,
"%u: Failed to %s EVPN %s route in VNI %u",
bgp->vrf_id,
install ? "install"
@@ -3108,7 +3106,7 @@ static int install_uninstall_route_in_es(struct bgp *bgp, struct evpnes *es,
if (ret) {
flog_err(
- BGP_ERR_EVPN_FAIL,
+ EC_BGP_EVPN_FAIL,
"%u: Failed to %s EVPN %s route in ESI %s", bgp->vrf_id,
install ? "install" : "uninstall", "ES",
esi_to_str(&evp->prefix.es_addr.esi, buf, sizeof(buf)));
@@ -3150,12 +3148,12 @@ static int install_uninstall_route_in_vrfs(struct bgp *bgp_def, afi_t afi,
ri);
if (ret) {
- flog_err(BGP_ERR_EVPN_FAIL,
- "%u: Failed to %s prefix %s in VRF %s",
- bgp_def->vrf_id,
- install ? "install" : "uninstall",
- prefix2str(evp, buf, sizeof(buf)),
- vrf_id_to_name(bgp_vrf->vrf_id));
+ flog_err(EC_BGP_EVPN_FAIL,
+ "%u: Failed to %s prefix %s in VRF %s",
+ bgp_def->vrf_id,
+ install ? "install" : "uninstall",
+ prefix2str(evp, buf, sizeof(buf)),
+ vrf_id_to_name(bgp_vrf->vrf_id));
return ret;
}
}
@@ -3186,14 +3184,13 @@ static int install_uninstall_route_in_vnis(struct bgp *bgp, afi_t afi,
ret = uninstall_evpn_route_entry(bgp, vpn, evp, ri);
if (ret) {
- flog_err(
- BGP_ERR_EVPN_FAIL,
- "%u: Failed to %s EVPN %s route in VNI %u",
- bgp->vrf_id, install ? "install" : "uninstall",
- evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE
- ? "MACIP"
- : "IMET",
- vpn->vni);
+ flog_err(EC_BGP_EVPN_FAIL,
+ "%u: Failed to %s EVPN %s route in VNI %u",
+ bgp->vrf_id, install ? "install" : "uninstall",
+ evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE
+ ? "MACIP"
+ : "IMET",
+ vpn->vni);
return ret;
}
}
@@ -3559,9 +3556,9 @@ static int process_type2_route(struct peer *peer, afi_t afi, safi_t safi,
*/
if (psize != 33 && psize != 37 && psize != 49 && psize != 36
&& psize != 40 && psize != 52) {
- flog_err(BGP_ERR_EVPN_ROUTE_INVALID,
- "%u:%s - Rx EVPN Type-2 NLRI with invalid length %d",
- peer->bgp->vrf_id, peer->host, psize);
+ flog_err(EC_BGP_EVPN_ROUTE_INVALID,
+ "%u:%s - Rx EVPN Type-2 NLRI with invalid length %d",
+ peer->bgp->vrf_id, peer->host, psize);
return -1;
}
@@ -3597,7 +3594,7 @@ static int process_type2_route(struct peer *peer, afi_t afi, safi_t safi,
pfx += ETH_ALEN;
} else {
flog_err(
- BGP_ERR_EVPN_ROUTE_INVALID,
+ EC_BGP_EVPN_ROUTE_INVALID,
"%u:%s - Rx EVPN Type-2 NLRI with unsupported MAC address length %d",
peer->bgp->vrf_id, peer->host, macaddr_len);
return -1;
@@ -3609,7 +3606,7 @@ static int process_type2_route(struct peer *peer, afi_t afi, safi_t safi,
if (ipaddr_len != 0 && ipaddr_len != IPV4_MAX_BITLEN
&& ipaddr_len != IPV6_MAX_BITLEN) {
flog_err(
- BGP_ERR_EVPN_ROUTE_INVALID,
+ EC_BGP_EVPN_ROUTE_INVALID,
"%u:%s - Rx EVPN Type-2 NLRI with unsupported IP address length %d",
peer->bgp->vrf_id, peer->host, ipaddr_len);
return -1;
@@ -3670,9 +3667,9 @@ static int process_type3_route(struct peer *peer, afi_t afi, safi_t safi,
* IP len (1) and IP (4 or 16).
*/
if (psize != 17 && psize != 29) {
- flog_err(BGP_ERR_EVPN_ROUTE_INVALID,
- "%u:%s - Rx EVPN Type-3 NLRI with invalid length %d",
- peer->bgp->vrf_id, peer->host, psize);
+ flog_err(EC_BGP_EVPN_ROUTE_INVALID,
+ "%u:%s - Rx EVPN Type-3 NLRI with invalid length %d",
+ peer->bgp->vrf_id, peer->host, psize);
return -1;
}
@@ -3684,7 +3681,7 @@ static int process_type3_route(struct peer *peer, afi_t afi, safi_t safi,
(attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL))) {
if (attr->pmsi_tnl_type != PMSI_TNLTYPE_INGR_REPL) {
flog_warn(
- BGP_WARN_EVPN_PMSI_PRESENT,
+ EC_BGP_EVPN_PMSI_PRESENT,
"%u:%s - Rx EVPN Type-3 NLRI with unsupported PTA %d",
peer->bgp->vrf_id, peer->host,
attr->pmsi_tnl_type);
@@ -3715,7 +3712,7 @@ static int process_type3_route(struct peer *peer, afi_t afi, safi_t safi,
memcpy(&p.prefix.imet_addr.ip.ip.addr, pfx, IPV4_MAX_BYTELEN);
} else {
flog_err(
- BGP_ERR_EVPN_ROUTE_INVALID,
+ EC_BGP_EVPN_ROUTE_INVALID,
"%u:%s - Rx EVPN Type-3 NLRI with unsupported IP address length %d",
peer->bgp->vrf_id, peer->host, ipaddr_len);
return -1;
@@ -3751,9 +3748,9 @@ static int process_type4_route(struct peer *peer, afi_t afi, safi_t safi,
* RD (8), ESI (10), ip-len (1), ip (4 or 16)
*/
if (psize != 23 && psize != 35) {
- flog_err(BGP_ERR_EVPN_ROUTE_INVALID,
- "%u:%s - Rx EVPN Type-4 NLRI with invalid length %d",
- peer->bgp->vrf_id, peer->host, psize);
+ flog_err(EC_BGP_EVPN_ROUTE_INVALID,
+ "%u:%s - Rx EVPN Type-4 NLRI with invalid length %d",
+ peer->bgp->vrf_id, peer->host, psize);
return -1;
}
@@ -3774,7 +3771,7 @@ static int process_type4_route(struct peer *peer, afi_t afi, safi_t safi,
memcpy(&vtep_ip, pfx, IPV4_MAX_BYTELEN);
} else {
flog_err(
- BGP_ERR_EVPN_ROUTE_INVALID,
+ EC_BGP_EVPN_ROUTE_INVALID,
"%u:%s - Rx EVPN Type-4 NLRI with unsupported IP address length %d",
peer->bgp->vrf_id, peer->host, ipaddr_len);
return -1;
@@ -3816,9 +3813,9 @@ static int process_type5_route(struct peer *peer, afi_t afi, safi_t safi,
* Note that the IP and GW should both be IPv4 or both IPv6.
*/
if (psize != 34 && psize != 58) {
- flog_err(BGP_ERR_EVPN_ROUTE_INVALID,
- "%u:%s - Rx EVPN Type-5 NLRI with invalid length %d",
- peer->bgp->vrf_id, peer->host, psize);
+ flog_err(EC_BGP_EVPN_ROUTE_INVALID,
+ "%u:%s - Rx EVPN Type-5 NLRI with invalid length %d",
+ peer->bgp->vrf_id, peer->host, psize);
return -1;
}
@@ -3850,7 +3847,7 @@ static int process_type5_route(struct peer *peer, afi_t afi, safi_t safi,
ippfx_len = *pfx++;
if (ippfx_len > IPV6_MAX_BITLEN) {
flog_err(
- BGP_ERR_EVPN_ROUTE_INVALID,
+ EC_BGP_EVPN_ROUTE_INVALID,
"%u:%s - Rx EVPN Type-5 NLRI with invalid IP Prefix length %d",
peer->bgp->vrf_id, peer->host, ippfx_len);
return -1;
@@ -4077,7 +4074,7 @@ void bgp_evpn_withdraw_type5_route(struct bgp *bgp_vrf, struct prefix *p,
ret = delete_evpn_type5_route(bgp_vrf, &evp);
if (ret) {
flog_err(
- BGP_ERR_EVPN_ROUTE_DELETE,
+ EC_BGP_EVPN_ROUTE_DELETE,
"%u failed to delete type-5 route for prefix %s in vrf %s",
bgp_vrf->vrf_id, prefix2str(p, buf, sizeof(buf)),
vrf_id_to_name(bgp_vrf->vrf_id));
@@ -4123,9 +4120,9 @@ void bgp_evpn_advertise_type5_route(struct bgp *bgp_vrf, struct prefix *p,
build_type5_prefix_from_ip_prefix(&evp, p);
ret = update_evpn_type5_route(bgp_vrf, &evp, src_attr);
if (ret)
- flog_err(BGP_ERR_EVPN_ROUTE_CREATE,
- "%u: Failed to create type-5 route for prefix %s",
- bgp_vrf->vrf_id, prefix2str(p, buf, sizeof(buf)));
+ flog_err(EC_BGP_EVPN_ROUTE_CREATE,
+ "%u: Failed to create type-5 route for prefix %s",
+ bgp_vrf->vrf_id, prefix2str(p, buf, sizeof(buf)));
}
/* Inject all prefixes of a particular address-family (currently, IPv4 or
@@ -4684,7 +4681,7 @@ int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr,
withdraw ? NULL : attr, pnt,
psize, addpath_id)) {
flog_err(
- BGP_ERR_EVPN_FAIL,
+ EC_BGP_EVPN_FAIL,
"%u:%s - Error in processing EVPN type-2 NLRI size %d",
peer->bgp->vrf_id, peer->host, psize);
return -1;
@@ -4696,7 +4693,7 @@ int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr,
withdraw ? NULL : attr, pnt,
psize, addpath_id)) {
flog_err(
- BGP_ERR_PKT_PROCESS,
+ EC_BGP_PKT_PROCESS,
"%u:%s - Error in processing EVPN type-3 NLRI size %d",
peer->bgp->vrf_id, peer->host, psize);
return -1;
@@ -4708,7 +4705,7 @@ int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr,
withdraw ? NULL : attr, pnt,
psize, addpath_id)) {
flog_err(
- BGP_ERR_PKT_PROCESS,
+ EC_BGP_PKT_PROCESS,
"%u:%s - Error in processing EVPN type-4 NLRI size %d",
peer->bgp->vrf_id, peer->host, psize);
return -1;
@@ -4719,7 +4716,7 @@ int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr,
if (process_type5_route(peer, afi, safi, attr, pnt,
psize, addpath_id, withdraw)) {
flog_err(
- BGP_ERR_PKT_PROCESS,
+ EC_BGP_PKT_PROCESS,
"%u:%s - Error in processing EVPN type-5 NLRI size %d",
peer->bgp->vrf_id, peer->host, psize);
return -1;
@@ -5164,7 +5161,7 @@ int bgp_evpn_local_macip_del(struct bgp *bgp, vni_t vni, struct ethaddr *mac,
/* Lookup VNI hash - should exist. */
vpn = bgp_evpn_lookup_vni(bgp, vni);
if (!vpn || !is_vni_live(vpn)) {
- flog_warn(BGP_WARN_EVPN_VPN_VNI,
+ flog_warn(EC_BGP_EVPN_VPN_VNI,
"%u: VNI hash entry for VNI %u %s at MACIP DEL",
bgp->vrf_id, vni, vpn ? "not live" : "not found");
return -1;
@@ -5189,7 +5186,7 @@ int bgp_evpn_local_macip_add(struct bgp *bgp, vni_t vni, struct ethaddr *mac,
/* Lookup VNI hash - should exist. */
vpn = bgp_evpn_lookup_vni(bgp, vni);
if (!vpn || !is_vni_live(vpn)) {
- flog_warn(BGP_WARN_EVPN_VPN_VNI,
+ flog_warn(EC_BGP_EVPN_VPN_VNI,
"%u: VNI hash entry for VNI %u %s at MACIP ADD",
bgp->vrf_id, vni, vpn ? "not live" : "not found");
return -1;
@@ -5202,7 +5199,7 @@ int bgp_evpn_local_macip_add(struct bgp *bgp, vni_t vni, struct ethaddr *mac,
char buf2[INET6_ADDRSTRLEN];
flog_err(
- BGP_ERR_EVPN_ROUTE_CREATE,
+ EC_BGP_EVPN_ROUTE_CREATE,
"%u:Failed to create Type-2 route, VNI %u %s MAC %s IP %s (flags: 0x%x)",
bgp->vrf_id, vpn->vni,
CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_STICKY)
@@ -5244,7 +5241,7 @@ int bgp_evpn_local_l3vni_add(vni_t l3vni, vrf_id_t vrf_id, struct ethaddr *rmac,
bgp_def = bgp_get_default();
if (!bgp_def) {
flog_err(
- BGP_ERR_NO_DFLT,
+ EC_BGP_NO_DFLT,
"Cannot process L3VNI %u ADD - default BGP instance not yet created",
l3vni);
return -1;
@@ -5261,16 +5258,16 @@ int bgp_evpn_local_l3vni_add(vni_t l3vni, vrf_id_t vrf_id, struct ethaddr *rmac,
BGP_INSTANCE_TYPE_VRF);
switch (ret) {
case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
- flog_err(BGP_ERR_MULTI_INSTANCE,
- "'bgp multiple-instance' not present\n");
+ flog_err(EC_BGP_MULTI_INSTANCE,
+ "'bgp multiple-instance' not present\n");
return -1;
case BGP_ERR_AS_MISMATCH:
- flog_err(BGP_ERR_EVPN_AS_MISMATCH,
- "BGP is already running; AS is %u\n", as);
+ flog_err(EC_BGP_EVPN_AS_MISMATCH,
+ "BGP is already running; AS is %u\n", as);
return -1;
case BGP_ERR_INSTANCE_MISMATCH:
- flog_err(BGP_ERR_EVPN_INSTANCE_MISMATCH,
- "BGP instance name and AS number mismatch\n");
+ flog_err(EC_BGP_EVPN_INSTANCE_MISMATCH,
+ "BGP instance name and AS number mismatch\n");
return -1;
}
@@ -5332,7 +5329,7 @@ int bgp_evpn_local_l3vni_del(vni_t l3vni, vrf_id_t vrf_id)
bgp_vrf = bgp_lookup_by_vrf_id(vrf_id);
if (!bgp_vrf) {
flog_err(
- BGP_ERR_NO_DFLT,
+ EC_BGP_NO_DFLT,
"Cannot process L3VNI %u Del - Could not find BGP instance",
l3vni);
return -1;
@@ -5341,7 +5338,7 @@ int bgp_evpn_local_l3vni_del(vni_t l3vni, vrf_id_t vrf_id)
bgp_def = bgp_get_default();
if (!bgp_def) {
flog_err(
- BGP_ERR_NO_DFLT,
+ EC_BGP_NO_DFLT,
"Cannot process L3VNI %u Del - Could not find default BGP instance",
l3vni);
return -1;
@@ -5403,7 +5400,7 @@ int bgp_evpn_local_vni_del(struct bgp *bgp, vni_t vni)
if (!vpn) {
if (bgp_debug_zebra(NULL))
flog_warn(
- BGP_WARN_EVPN_VPN_VNI,
+ EC_BGP_EVPN_VPN_VNI,
"%u: VNI hash entry for VNI %u not found at DEL",
bgp->vrf_id, vni);
return 0;
@@ -5473,7 +5470,7 @@ int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni,
vpn = bgp_evpn_new(bgp, vni, originator_ip, tenant_vrf_id);
if (!vpn) {
flog_err(
- BGP_ERR_VNI,
+ EC_BGP_VNI,
"%u: Failed to allocate VNI entry for VNI %u - at Add",
bgp->vrf_id, vni);
return -1;
@@ -5496,9 +5493,9 @@ int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni,
/* Create EVPN type-3 route and schedule for processing. */
build_evpn_type3_prefix(&p, vpn->originator_ip);
if (update_evpn_route(bgp, vpn, &p, 0, 0)) {
- flog_err(BGP_ERR_EVPN_ROUTE_CREATE,
- "%u: Type3 route creation failure for VNI %u",
- bgp->vrf_id, vni);
+ flog_err(EC_BGP_EVPN_ROUTE_CREATE,
+ "%u: Type3 route creation failure for VNI %u",
+ bgp->vrf_id, vni);
return -1;
}
@@ -5526,15 +5523,15 @@ int bgp_evpn_local_es_del(struct bgp *bgp,
struct evpnes *es = NULL;
if (!bgp->esihash) {
- flog_err(BGP_ERR_ES_CREATE, "%u: ESI hash not yet created",
- bgp->vrf_id);
+ flog_err(EC_BGP_ES_CREATE, "%u: ESI hash not yet created",
+ bgp->vrf_id);
return -1;
}
/* Lookup ESI hash - should exist. */
es = bgp_evpn_lookup_es(bgp, esi);
if (!es) {
- flog_warn(BGP_WARN_EVPN_ESI,
+ flog_warn(EC_BGP_EVPN_ESI,
"%u: ESI hash entry for ESI %s at Local ES DEL",
bgp->vrf_id, esi_to_str(esi, buf, sizeof(buf)));
return -1;
@@ -5563,8 +5560,8 @@ int bgp_evpn_local_es_add(struct bgp *bgp,
struct prefix_evpn p;
if (!bgp->esihash) {
- flog_err(BGP_ERR_ES_CREATE, "%u: ESI hash not yet created",
- bgp->vrf_id);
+ flog_err(EC_BGP_ES_CREATE, "%u: ESI hash not yet created",
+ bgp->vrf_id);
return -1;
}
@@ -5574,7 +5571,7 @@ int bgp_evpn_local_es_add(struct bgp *bgp,
es = bgp_evpn_es_new(bgp, esi, originator_ip);
if (!es) {
flog_err(
- BGP_ERR_ES_CREATE,
+ EC_BGP_ES_CREATE,
"%u: Failed to allocate ES entry for ESI %s - at Local ES Add",
bgp->vrf_id, esi_to_str(esi, buf, sizeof(buf)));
return -1;
@@ -5585,9 +5582,9 @@ int bgp_evpn_local_es_add(struct bgp *bgp,
build_evpn_type4_prefix(&p, esi, originator_ip->ipaddr_v4);
if (update_evpn_type4_route(bgp, es, &p)) {
- flog_err(BGP_ERR_EVPN_ROUTE_CREATE,
- "%u: Type4 route creation failure for ESI %s",
- bgp->vrf_id, esi_to_str(esi, buf, sizeof(buf)));
+ flog_err(EC_BGP_EVPN_ROUTE_CREATE,
+ "%u: Type4 route creation failure for ESI %s",
+ bgp->vrf_id, esi_to_str(esi, buf, sizeof(buf)));
return -1;
}
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c
index a6cc2d9b5..6f907c3ab 100644
--- a/bgpd/bgp_evpn_vty.c
+++ b/bgpd/bgp_evpn_vty.c
@@ -1890,9 +1890,10 @@ static struct bgpevpn *evpn_create_update_vni(struct bgp *bgp, vni_t vni)
if (!vpn) {
/* Check if this L2VNI is already configured as L3VNI */
if (bgp_evpn_lookup_l3vni_l2vni_table(vni)) {
- flog_err(BGP_ERR_VNI,
- "%u: Failed to create L2VNI %u, it is configured as L3VNI",
- bgp->vrf_id, vni);
+ flog_err(
+ EC_BGP_VNI,
+ "%u: Failed to create L2VNI %u, it is configured as L3VNI",
+ bgp->vrf_id, vni);
return NULL;
}
@@ -1902,7 +1903,7 @@ static struct bgpevpn *evpn_create_update_vni(struct bgp *bgp, vni_t vni)
vpn = bgp_evpn_new(bgp, vni, bgp->router_id, 0);
if (!vpn) {
flog_err(
- BGP_ERR_VNI,
+ EC_BGP_VNI,
"%u: Failed to allocate VNI entry for VNI %u - at Config",
bgp->vrf_id, vni);
return NULL;
diff --git a/bgpd/bgp_flowspec.c b/bgpd/bgp_flowspec.c
index c604135bf..ab8bfcb77 100644
--- a/bgpd/bgp_flowspec.c
+++ b/bgpd/bgp_flowspec.c
@@ -104,15 +104,14 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr,
safi = packet->safi;
if (afi == AFI_IP6) {
- flog_err(LIB_ERR_DEVELOPMENT,
- "BGP flowspec IPv6 not supported");
+ flog_err(EC_LIB_DEVELOPMENT, "BGP flowspec IPv6 not supported");
return -1;
}
if (packet->length >= FLOWSPEC_NLRI_SIZELIMIT) {
- flog_err(BGP_ERR_FLOWSPEC_PACKET,
- "BGP flowspec nlri length maximum reached (%u)",
- packet->length);
+ flog_err(EC_BGP_FLOWSPEC_PACKET,
+ "BGP flowspec nlri length maximum reached (%u)",
+ packet->length);
return -1;
}
@@ -128,14 +127,16 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr,
/* When packet overflow occur return immediately. */
if (pnt + psize > lim) {
- flog_err(BGP_ERR_FLOWSPEC_PACKET,
- "Flowspec NLRI length inconsistent ( size %u seen)",
- psize);
+ flog_err(
+ EC_BGP_FLOWSPEC_PACKET,
+ "Flowspec NLRI length inconsistent ( size %u seen)",
+ psize);
return -1;
}
if (bgp_fs_nlri_validate(pnt, psize) < 0) {
- flog_err(BGP_ERR_FLOWSPEC_PACKET,
- "Bad flowspec format or NLRI options not supported");
+ flog_err(
+ EC_BGP_FLOWSPEC_PACKET,
+ "Bad flowspec format or NLRI options not supported");
return -1;
}
p.family = AF_FLOWSPEC;
@@ -188,9 +189,9 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr,
ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL,
NULL, NULL, 0, NULL);
if (ret) {
- flog_err(BGP_ERR_FLOWSPEC_INSTALLATION,
- "Flowspec NLRI failed to be %s.",
- attr ? "added" : "withdrawn");
+ flog_err(EC_BGP_FLOWSPEC_INSTALLATION,
+ "Flowspec NLRI failed to be %s.",
+ attr ? "added" : "withdrawn");
return -1;
}
}
diff --git a/bgpd/bgp_flowspec_util.c b/bgpd/bgp_flowspec_util.c
index 9f92a3c3a..cb71a64a8 100644
--- a/bgpd/bgp_flowspec_util.c
+++ b/bgpd/bgp_flowspec_util.c
@@ -68,9 +68,8 @@ static int bgp_flowspec_call_non_opaque_decode(uint8_t *nlri_content, int len,
len,
mval, error);
if (*error < 0)
- flog_err(BGP_ERR_FLOWSPEC_PACKET,
- "%s: flowspec_op_decode error %d",
- __func__, *error);
+ flog_err(EC_BGP_FLOWSPEC_PACKET,
+ "%s: flowspec_op_decode error %d", __func__, *error);
else
*match_num = *error;
return ret;
@@ -447,9 +446,9 @@ int bgp_flowspec_match_rules_fill(uint8_t *nlri_content, int len,
len - offset,
prefix, &error);
if (error < 0)
- flog_err(BGP_ERR_FLOWSPEC_PACKET,
- "%s: flowspec_ip_address error %d",
- __func__, error);
+ flog_err(EC_BGP_FLOWSPEC_PACKET,
+ "%s: flowspec_ip_address error %d",
+ __func__, error);
else
bpem->match_bitmask |= bitmask;
offset += ret;
@@ -542,9 +541,10 @@ int bgp_flowspec_match_rules_fill(uint8_t *nlri_content, int len,
len - offset,
&bpem->tcpflags, &error);
if (error < 0)
- flog_err(BGP_ERR_FLOWSPEC_PACKET,
- "%s: flowspec_tcpflags_decode error %d",
- __func__, error);
+ flog_err(
+ EC_BGP_FLOWSPEC_PACKET,
+ "%s: flowspec_tcpflags_decode error %d",
+ __func__, error);
else
bpem->match_tcpflags_num = error;
/* contains the number of slots used */
@@ -557,16 +557,17 @@ int bgp_flowspec_match_rules_fill(uint8_t *nlri_content, int len,
len - offset, &bpem->fragment,
&error);
if (error < 0)
- flog_err(BGP_ERR_FLOWSPEC_PACKET,
- "%s: flowspec_fragment_type_decode error %d",
- __func__, error);
+ flog_err(
+ EC_BGP_FLOWSPEC_PACKET,
+ "%s: flowspec_fragment_type_decode error %d",
+ __func__, error);
else
bpem->match_fragment_num = error;
offset += ret;
break;
default:
- flog_err(LIB_ERR_DEVELOPMENT, "%s: unknown type %d\n",
- __func__, type);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: unknown type %d\n",
+ __func__, type);
}
}
return error;
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index 14d692ebf..384d2bca8 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -167,7 +167,7 @@ static struct peer *peer_xfer_conn(struct peer *from_peer)
*/
if (peer->curr) {
flog_err(
- BGP_ERR_PKT_PROCESS,
+ EC_BGP_PKT_PROCESS,
"[%s] Dropping pending packet on connection transfer:",
peer->host);
uint16_t type = stream_getc_from(peer->curr,
@@ -246,7 +246,7 @@ static struct peer *peer_xfer_conn(struct peer *from_peer)
if (bgp_getsockname(peer) < 0) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%%bgp_getsockname() failed for %s peer %s fd %d (from_peer fd %d)",
(CHECK_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER)
? "accept"
@@ -259,7 +259,7 @@ static struct peer *peer_xfer_conn(struct peer *from_peer)
if (from_peer->status > Active) {
if (bgp_getsockname(from_peer) < 0) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%%bgp_getsockname() failed for %s from_peer %s fd %d (peer fd %d)",
(CHECK_FLAG(from_peer->sflags,
@@ -1286,15 +1286,15 @@ static int bgp_connect_check(struct thread *thread)
static int bgp_connect_success(struct peer *peer)
{
if (peer->fd < 0) {
- flog_err(BGP_ERR_CONNECT,
- "bgp_connect_success peer's fd is negative value %d",
- peer->fd);
+ flog_err(EC_BGP_CONNECT,
+ "bgp_connect_success peer's fd is negative value %d",
+ peer->fd);
bgp_stop(peer);
return -1;
}
if (bgp_getsockname(peer) < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s: bgp_getsockname(): failed for peer %s, fd %d",
__FUNCTION__, peer->host, peer->fd);
bgp_notify_send(peer, BGP_NOTIFY_FSM_ERR,
@@ -1354,10 +1354,10 @@ int bgp_start(struct peer *peer)
if (BGP_PEER_START_SUPPRESSED(peer)) {
if (bgp_debug_neighbor_events(peer))
- flog_err(BGP_ERR_FSM,
- "%s [FSM] Trying to start suppressed peer"
- " - this is never supposed to happen!",
- peer->host);
+ flog_err(EC_BGP_FSM,
+ "%s [FSM] Trying to start suppressed peer"
+ " - this is never supposed to happen!",
+ peer->host);
return -1;
}
@@ -1390,7 +1390,7 @@ int bgp_start(struct peer *peer)
if (peer->bgp->vrf_id == VRF_UNKNOWN) {
if (bgp_debug_neighbor_events(peer))
flog_err(
- BGP_ERR_FSM,
+ EC_BGP_FSM,
"%s [FSM] In a VRF that is not initialised yet",
peer->host);
return -1;
@@ -1444,9 +1444,9 @@ int bgp_start(struct peer *peer)
"%s [FSM] Non blocking connect waiting result, fd %d",
peer->host, peer->fd);
if (peer->fd < 0) {
- flog_err(BGP_ERR_FSM,
- "bgp_start peer's fd is negative value %d",
- peer->fd);
+ flog_err(EC_BGP_FSM,
+ "bgp_start peer's fd is negative value %d",
+ peer->fd);
return -1;
}
/*
@@ -1492,9 +1492,8 @@ static int bgp_fsm_open(struct peer *peer)
peer and change to Idle status. */
static int bgp_fsm_event_error(struct peer *peer)
{
- flog_err(BGP_ERR_FSM,
- "%s [FSM] unexpected packet received in state %s", peer->host,
- lookup_msg(bgp_status_msg, peer->status, NULL));
+ flog_err(EC_BGP_FSM, "%s [FSM] unexpected packet received in state %s",
+ peer->host, lookup_msg(bgp_status_msg, peer->status, NULL));
return bgp_stop_with_notify(peer, BGP_NOTIFY_FSM_ERR, 0);
}
@@ -1526,7 +1525,7 @@ static int bgp_establish(struct peer *peer)
other = peer->doppelganger;
peer = peer_xfer_conn(peer);
if (!peer) {
- flog_err(BGP_ERR_CONNECT, "%%Neighbor failed in xfer_conn");
+ flog_err(EC_BGP_CONNECT, "%%Neighbor failed in xfer_conn");
return -1;
}
@@ -1686,7 +1685,7 @@ static int bgp_fsm_update(struct peer *peer)
static int bgp_ignore(struct peer *peer)
{
flog_err(
- BGP_ERR_FSM,
+ EC_BGP_FSM,
"%s [FSM] Ignoring event %s in state %s, prior events %s, %s, fd %d",
peer->host, bgp_event_str[peer->cur_event],
lookup_msg(bgp_status_msg, peer->status, NULL),
@@ -1699,7 +1698,7 @@ static int bgp_ignore(struct peer *peer)
static int bgp_fsm_exeption(struct peer *peer)
{
flog_err(
- BGP_ERR_FSM,
+ EC_BGP_FSM,
"%s [FSM] Unexpected event %s in state %s, prior events %s, %s, fd %d",
peer->host, bgp_event_str[peer->cur_event],
lookup_msg(bgp_status_msg, peer->status, NULL),
@@ -1974,7 +1973,7 @@ int bgp_event_update(struct peer *peer, int event)
*/
if (!dyn_nbr && !passive_conn && peer->bgp) {
flog_err(
- BGP_ERR_FSM,
+ EC_BGP_FSM,
"%s [FSM] Failure handling event %s in state %s, "
"prior events %s, %s, fd %d",
peer->host, bgp_event_str[peer->cur_event],
diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c
index 311f98001..c3bfbe4a9 100644
--- a/bgpd/bgp_io.c
+++ b/bgpd/bgp_io.c
@@ -402,9 +402,9 @@ static uint16_t bgp_read(struct peer *peer)
SET_FLAG(status, BGP_IO_TRANS_ERR);
/* Fatal error; tear down session */
} else if (nbytes < 0) {
- flog_err(BGP_ERR_UPDATE_RCV,
- "%s [Error] bgp_read_packet error: %s", peer->host,
- safe_strerror(errno));
+ flog_err(EC_BGP_UPDATE_RCV,
+ "%s [Error] bgp_read_packet error: %s", peer->host,
+ safe_strerror(errno));
if (peer->status == Established) {
if (CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_MODE)) {
diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c
index c32df275a..ba059d66e 100644
--- a/bgpd/bgp_label.c
+++ b/bgpd/bgp_label.c
@@ -192,7 +192,7 @@ static int bgp_nlri_get_labels(struct peer *peer, uint8_t *pnt, uint8_t plen,
if (!(bgp_is_withdraw_label(label) || label_bos(label)))
flog_warn(
- BGP_WARN_INVALID_LABEL_STACK,
+ EC_BGP_INVALID_LABEL_STACK,
"%s rcvd UPDATE with invalid label stack - no bottom of stack",
peer->host);
@@ -247,7 +247,7 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr,
/* sanity check against packet data */
if ((pnt + psize) > lim) {
flog_err(
- BGP_ERR_UPDATE_RCV,
+ EC_BGP_UPDATE_RCV,
"%s [Error] Update packet error / L-U (prefix length %d exceeds packet size %u)",
peer->host, prefixlen, (uint)(lim - pnt));
return -1;
@@ -259,10 +259,10 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr,
/* There needs to be at least one label */
if (prefixlen < 24) {
- flog_err(BGP_ERR_UPDATE_RCV,
- "%s [Error] Update packet error"
- " (wrong label length %d)",
- peer->host, prefixlen);
+ flog_err(EC_BGP_UPDATE_RCV,
+ "%s [Error] Update packet error"
+ " (wrong label length %d)",
+ peer->host, prefixlen);
bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_INVAL_NETWORK);
return -1;
@@ -288,7 +288,7 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr,
* ignored.
*/
flog_err(
- BGP_ERR_UPDATE_RCV,
+ EC_BGP_UPDATE_RCV,
"%s: IPv4 labeled-unicast NLRI is multicast address %s, ignoring",
peer->host, inet_ntoa(p.u.prefix4));
continue;
@@ -301,7 +301,7 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr,
char buf[BUFSIZ];
flog_err(
- BGP_ERR_UPDATE_RCV,
+ EC_BGP_UPDATE_RCV,
"%s: IPv6 labeled-unicast NLRI is link-local address %s, ignoring",
peer->host,
inet_ntop(AF_INET6, &p.u.prefix6, buf,
@@ -314,7 +314,7 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr,
char buf[BUFSIZ];
flog_err(
- BGP_ERR_UPDATE_RCV,
+ EC_BGP_UPDATE_RCV,
"%s: IPv6 unicast NLRI is multicast address %s, ignoring",
peer->host,
inet_ntop(AF_INET6, &p.u.prefix6, buf,
@@ -338,7 +338,7 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr,
/* Packet length consistency check. */
if (pnt != lim) {
flog_err(
- BGP_ERR_UPDATE_RCV,
+ EC_BGP_UPDATE_RCV,
"%s [Error] Update packet error / L-U (%zu data remaining after parsing)",
peer->host, lim - pnt);
return -1;
diff --git a/bgpd/bgp_labelpool.c b/bgpd/bgp_labelpool.c
index 8d15649ea..7a7a40027 100644
--- a/bgpd/bgp_labelpool.c
+++ b/bgpd/bgp_labelpool.c
@@ -127,8 +127,8 @@ static wq_item_status lp_cbq_docallback(struct work_queue *wq, void *data)
if (lcbq->label == MPLS_LABEL_NONE) {
/* shouldn't happen */
- flog_err(BGP_ERR_LABEL, "%s: error: label==MPLS_LABEL_NONE",
- __func__);
+ flog_err(EC_BGP_LABEL, "%s: error: label==MPLS_LABEL_NONE",
+ __func__);
return WQ_SUCCESS;
}
@@ -338,9 +338,9 @@ void bgp_lp_get(
if (rc) {
/* shouldn't happen */
- flog_err(BGP_ERR_LABEL,
- "%s: can't insert new LCB into ledger list",
- __func__);
+ flog_err(EC_BGP_LABEL,
+ "%s: can't insert new LCB into ledger list",
+ __func__);
XFREE(MTYPE_BGP_LABEL_CB, lcb);
return;
}
@@ -427,9 +427,9 @@ void bgp_lp_event_chunk(uint8_t keep, uint32_t first, uint32_t last)
struct lp_fifo *lf;
if (last < first) {
- flog_err(BGP_ERR_LABEL,
- "%s: zebra label chunk invalid: first=%u, last=%u",
- __func__, first, last);
+ flog_err(EC_BGP_LABEL,
+ "%s: zebra label chunk invalid: first=%u, last=%u",
+ __func__, first, last);
return;
}
diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c
index e0834604b..d888090e6 100644
--- a/bgpd/bgp_main.c
+++ b/bgpd/bgp_main.c
@@ -410,7 +410,7 @@ int main(int argc, char **argv)
if (multipath_num > MULTIPATH_NUM
|| multipath_num <= 0) {
flog_err(
- BGP_ERR_MULTIPATH,
+ EC_BGP_MULTIPATH,
"Multipath Number specified must be less than %d and greater than 0",
MULTIPATH_NUM);
return 1;
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c
index 459775c8e..276945cbf 100644
--- a/bgpd/bgp_mplsvpn.c
+++ b/bgpd/bgp_mplsvpn.c
@@ -152,7 +152,7 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr,
if (prefixlen < VPN_PREFIXLEN_MIN_BYTES * 8) {
flog_err(
- BGP_ERR_UPDATE_RCV,
+ EC_BGP_UPDATE_RCV,
"%s [Error] Update packet error / VPN (prefix length %d less than VPN min length)",
peer->host, prefixlen);
return -1;
@@ -161,7 +161,7 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr,
/* sanity check against packet data */
if ((pnt + psize) > lim) {
flog_err(
- BGP_ERR_UPDATE_RCV,
+ EC_BGP_UPDATE_RCV,
"%s [Error] Update packet error / VPN (prefix length %d exceeds packet size %u)",
peer->host, prefixlen, (uint)(lim - pnt));
return -1;
@@ -170,7 +170,7 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr,
/* sanity check against storage for the IP address portion */
if ((psize - VPN_PREFIXLEN_MIN_BYTES) > (ssize_t)sizeof(p.u)) {
flog_err(
- BGP_ERR_UPDATE_RCV,
+ EC_BGP_UPDATE_RCV,
"%s [Error] Update packet error / VPN (psize %d exceeds storage size %zu)",
peer->host,
prefixlen - VPN_PREFIXLEN_MIN_BYTES * 8,
@@ -181,7 +181,7 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr,
/* Sanity check against max bitlen of the address family */
if ((psize - VPN_PREFIXLEN_MIN_BYTES) > prefix_blen(&p)) {
flog_err(
- BGP_ERR_UPDATE_RCV,
+ EC_BGP_UPDATE_RCV,
"%s [Error] Update packet error / VPN (psize %d exceeds family (%u) max byte len %u)",
peer->host,
prefixlen - VPN_PREFIXLEN_MIN_BYTES * 8,
@@ -218,8 +218,7 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr,
#endif
default:
- flog_err(BGP_ERR_UPDATE_RCV, "Unknown RD type %d",
- type);
+ flog_err(EC_BGP_UPDATE_RCV, "Unknown RD type %d", type);
break; /* just report */
}
@@ -242,7 +241,7 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr,
/* Packet length consistency check. */
if (pnt != lim) {
flog_err(
- BGP_ERR_UPDATE_RCV,
+ EC_BGP_UPDATE_RCV,
"%s [Error] Update packet error / VPN (%zu data remaining after parsing)",
peer->host, lim - pnt);
return -1;
@@ -366,10 +365,10 @@ int vpn_leak_label_callback(
return 0;
}
/* Shouldn't happen: different label allocation */
- flog_err(BGP_ERR_LABEL,
- "%s: %s had label %u but got new assignment %u",
- __func__, vp->bgp->name_pretty, vp->tovpn_label,
- label);
+ flog_err(EC_BGP_LABEL,
+ "%s: %s had label %u but got new assignment %u",
+ __func__, vp->bgp->name_pretty, vp->tovpn_label,
+ label);
/* use new one */
}
diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c
index 96d2e2f2a..458edab50 100644
--- a/bgpd/bgp_network.c
+++ b/bgpd/bgp_network.c
@@ -84,7 +84,7 @@ static int bgp_md5_set_socket(int socket, union sockunion *su,
#endif /* HAVE_TCP_MD5SIG */
if (ret < 0)
- flog_warn(BGP_WARN_NO_TCP_MD5,
+ flog_warn(EC_BGP_NO_TCP_MD5,
"can't set TCP_MD5SIG option on socket %d: %s",
socket, safe_strerror(en));
@@ -149,7 +149,7 @@ int bgp_set_socket_ttl(struct peer *peer, int bgp_sock)
ret = sockopt_ttl(peer->su.sa.sa_family, bgp_sock, peer->ttl);
if (ret) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%s: Can't set TxTTL on peer (rtrid %s) socket, err = %d",
__func__,
inet_ntop(AF_INET, &peer->remote_id, buf,
@@ -165,7 +165,7 @@ int bgp_set_socket_ttl(struct peer *peer, int bgp_sock)
ret = sockopt_ttl(peer->su.sa.sa_family, bgp_sock, MAXTTL);
if (ret) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%s: Can't set TxTTL on peer (rtrid %s) socket, err = %d",
__func__,
inet_ntop(AF_INET, &peer->remote_id, buf,
@@ -177,7 +177,7 @@ int bgp_set_socket_ttl(struct peer *peer, int bgp_sock)
MAXTTL + 1 - peer->gtsm_hops);
if (ret) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%s: Can't set MinTTL on peer (rtrid %s) socket, err = %d",
__func__,
inet_ntop(AF_INET, &peer->remote_id, buf,
@@ -222,10 +222,9 @@ static int bgp_get_instance_for_inc_conn(int sock, struct bgp **bgp_inst)
rc = getsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, name, &name_len);
if (rc != 0) {
#if defined(HAVE_CUMULUS)
- flog_err(
- LIB_ERR_SOCKET,
- "[Error] BGP SO_BINDTODEVICE get failed (%s), sock %d",
- safe_strerror(errno), sock);
+ flog_err(EC_LIB_SOCKET,
+ "[Error] BGP SO_BINDTODEVICE get failed (%s), sock %d",
+ safe_strerror(errno), sock);
return -1;
#endif
}
@@ -280,7 +279,7 @@ static int bgp_accept(struct thread *thread)
/* Register accept thread. */
accept_sock = THREAD_FD(thread);
if (accept_sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "accept_sock is nevative value %d",
+ flog_err_sys(EC_LIB_SOCKET, "accept_sock is nevative value %d",
accept_sock);
return -1;
}
@@ -292,7 +291,7 @@ static int bgp_accept(struct thread *thread)
/* Accept client connection. */
bgp_sock = sockunion_accept(accept_sock, &su);
if (bgp_sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"[Error] BGP socket accept failed (%s)",
safe_strerror(errno));
return -1;
@@ -562,7 +561,7 @@ int bgp_connect(struct peer *peer)
sockopt_reuseaddr(peer->fd);
sockopt_reuseport(peer->fd);
if (sockopt_mark_default(peer->fd, DATAPLANE_MARK, &bgpd_privs) < 0)
- flog_warn(BGP_WARN_NO_SOCKOPT_MARK,
+ flog_warn(EC_BGP_NO_SOCKOPT_MARK,
"Unable to set mark on FD for peer %s, err=%s",
peer->host, safe_strerror(errno));
@@ -623,7 +622,7 @@ int bgp_getsockname(struct peer *peer)
peer)) {
#if defined(HAVE_CUMULUS)
flog_err(
- BGP_ERR_NH_UPD,
+ EC_BGP_NH_UPD,
"%s: nexthop_set failed, resetting connection - intf %p",
peer->host, peer->nexthop.ifp);
return -1;
@@ -659,14 +658,13 @@ static int bgp_listener(int sock, struct sockaddr *sa, socklen_t salen,
}
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "bind: %s", safe_strerror(en));
+ flog_err_sys(EC_LIB_SOCKET, "bind: %s", safe_strerror(en));
return ret;
}
ret = listen(sock, SOMAXCONN);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "listen: %s",
- safe_strerror(errno));
+ flog_err_sys(EC_LIB_SOCKET, "listen: %s", safe_strerror(errno));
return ret;
}
@@ -708,7 +706,7 @@ int bgp_socket(struct bgp *bgp, unsigned short port, const char *address)
bgp->vrf_id);
}
if (ret != 0) {
- flog_err_sys(LIB_ERR_SOCKET, "getaddrinfo: %s",
+ flog_err_sys(EC_LIB_SOCKET, "getaddrinfo: %s",
gai_strerror(ret));
return -1;
}
@@ -729,7 +727,7 @@ int bgp_socket(struct bgp *bgp, unsigned short port, const char *address)
? bgp->name : NULL));
}
if (sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "socket: %s",
+ flog_err_sys(EC_LIB_SOCKET, "socket: %s",
safe_strerror(errno));
continue;
}
@@ -748,10 +746,10 @@ int bgp_socket(struct bgp *bgp, unsigned short port, const char *address)
freeaddrinfo(ainfo_save);
if (count == 0 && bgp->inst_type != BGP_INSTANCE_TYPE_VRF) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%s: no usable addresses please check other programs usage of specified port %d",
__func__, port);
- flog_err_sys(LIB_ERR_SOCKET, "%s: Program cannot continue",
+ flog_err_sys(EC_LIB_SOCKET, "%s: Program cannot continue",
__func__);
exit(-1);
}
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index cf055fd43..3d2a4ee0d 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -345,7 +345,7 @@ void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id)
bgp = bgp_lookup_by_vrf_id(vrf_id);
if (!bgp) {
flog_err(
- BGP_ERR_NH_UPD,
+ EC_BGP_NH_UPD,
"parse nexthop update: instance not found for vrf_id %u",
vrf_id);
return;
@@ -592,7 +592,7 @@ static void sendmsg_zebra_rnh(struct bgp_nexthop_cache *bnc, int command)
bnc->bgp->vrf_id);
/* TBD: handle the failure */
if (ret < 0)
- flog_warn(BGP_WARN_ZEBRA_SEND,
+ flog_warn(EC_BGP_ZEBRA_SEND,
"sendmsg_nexthop: zclient_send_message() failed");
if ((command == ZEBRA_NEXTHOP_REGISTER)
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
index 2a32f02f4..62b412af0 100644
--- a/bgpd/bgp_open.c
+++ b/bgpd/bgp_open.c
@@ -255,7 +255,7 @@ static int bgp_capability_mp(struct peer *peer, struct capability_header *hdr)
/* Verify length is 4 */
if (hdr->length != 4) {
flog_warn(
- BGP_WARN_CAPABILITY_INVALID_LENGTH,
+ EC_BGP_CAPABILITY_INVALID_LENGTH,
"MP Cap: Received invalid length %d, non-multiple of 4",
hdr->length);
return -1;
@@ -451,7 +451,7 @@ static int bgp_capability_restart(struct peer *peer,
/* Verify length is a multiple of 4 */
if ((caphdr->length - 2) % 4) {
flog_warn(
- BGP_WARN_CAPABILITY_INVALID_LENGTH,
+ EC_BGP_CAPABILITY_INVALID_LENGTH,
"Restart Cap: Received invalid length %d, non-multiple of 4",
caphdr->length);
return -1;
@@ -523,9 +523,9 @@ static as_t bgp_capability_as4(struct peer *peer, struct capability_header *hdr)
SET_FLAG(peer->cap, PEER_CAP_AS4_RCV);
if (hdr->length != CAPABILITY_CODE_AS4_LEN) {
- flog_err(BGP_ERR_PKT_OPEN,
- "%s AS4 capability has incorrect data length %d",
- peer->host, hdr->length);
+ flog_err(EC_BGP_PKT_OPEN,
+ "%s AS4 capability has incorrect data length %d",
+ peer->host, hdr->length);
return 0;
}
@@ -549,7 +549,7 @@ static int bgp_capability_addpath(struct peer *peer,
/* Verify length is a multiple of 4 */
if (hdr->length % 4) {
flog_warn(
- BGP_WARN_CAPABILITY_INVALID_LENGTH,
+ EC_BGP_CAPABILITY_INVALID_LENGTH,
"Add Path: Received invalid length %d, non-multiple of 4",
hdr->length);
return -1;
@@ -608,7 +608,7 @@ static int bgp_capability_enhe(struct peer *peer, struct capability_header *hdr)
/* Verify length is a multiple of 4 */
if (hdr->length % 6) {
flog_warn(
- BGP_WARN_CAPABILITY_INVALID_LENGTH,
+ EC_BGP_CAPABILITY_INVALID_LENGTH,
"Extended NH: Received invalid length %d, non-multiple of 6",
hdr->length);
return -1;
@@ -651,7 +651,7 @@ static int bgp_capability_enhe(struct peer *peer, struct capability_header *hdr)
|| !(safi == SAFI_UNICAST
|| safi == SAFI_LABELED_UNICAST)) {
flog_warn(
- BGP_WARN_CAPABILITY_INVALID_DATA,
+ EC_BGP_CAPABILITY_INVALID_DATA,
"%s Unexpected afi/safi/next-hop afi: %u/%u/%u "
"in Extended Next-hop capability, ignoring",
peer->host, pkt_afi, pkt_safi, pkt_nh_afi);
@@ -683,7 +683,7 @@ static int bgp_capability_hostname(struct peer *peer,
len = stream_getc(s);
if (stream_get_getp(s) + len > end) {
flog_warn(
- BGP_WARN_CAPABILITY_INVALID_DATA,
+ EC_BGP_CAPABILITY_INVALID_DATA,
"%s: Received malformed hostname capability from peer %s",
__FUNCTION__, peer->host);
return -1;
@@ -714,7 +714,7 @@ static int bgp_capability_hostname(struct peer *peer,
if (stream_get_getp(s) + 1 > end) {
flog_warn(
- BGP_WARN_CAPABILITY_INVALID_DATA,
+ EC_BGP_CAPABILITY_INVALID_DATA,
"%s: Received invalid domain name len (hostname capability) from peer %s",
__FUNCTION__, peer->host);
return -1;
@@ -723,7 +723,7 @@ static int bgp_capability_hostname(struct peer *peer,
len = stream_getc(s);
if (stream_get_getp(s) + len > end) {
flog_warn(
- BGP_WARN_CAPABILITY_INVALID_DATA,
+ EC_BGP_CAPABILITY_INVALID_DATA,
"%s: Received runt domain name (hostname capability) from peer %s",
__FUNCTION__, peer->host);
return -1;
@@ -960,12 +960,12 @@ static int bgp_capability_parse(struct peer *peer, size_t length,
specific
capabilities. It seems reasonable for now...
*/
- flog_warn(BGP_WARN_CAPABILITY_VENDOR,
+ flog_warn(EC_BGP_CAPABILITY_VENDOR,
"%s Vendor specific capability %d",
peer->host, caphdr.code);
} else {
flog_warn(
- BGP_WARN_CAPABILITY_UNKNOWN,
+ EC_BGP_CAPABILITY_UNKNOWN,
"%s unrecognized capability code: %d - ignored",
peer->host, caphdr.code);
memcpy(*error, sp, caphdr.length + 2);
@@ -981,7 +981,7 @@ static int bgp_capability_parse(struct peer *peer, size_t length,
if (stream_get_getp(s) != (start + caphdr.length)) {
if (stream_get_getp(s) > (start + caphdr.length))
flog_warn(
- BGP_WARN_CAPABILITY_INVALID_LENGTH,
+ EC_BGP_CAPABILITY_INVALID_LENGTH,
"%s Cap-parser for %s read past cap-length, %u!",
peer->host,
lookup_msg(capcode_str, caphdr.code,
@@ -1197,10 +1197,10 @@ int bgp_open_option_parse(struct peer *peer, uint8_t length, int *mp_capability)
&& !peer->afc_nego[AFI_IP6][SAFI_ENCAP]
&& !peer->afc_nego[AFI_IP6][SAFI_FLOWSPEC]
&& !peer->afc_nego[AFI_L2VPN][SAFI_EVPN]) {
- flog_err(BGP_ERR_PKT_OPEN,
- "%s [Error] Configured AFI/SAFIs do not "
- "overlap with received MP capabilities",
- peer->host);
+ flog_err(EC_BGP_PKT_OPEN,
+ "%s [Error] Configured AFI/SAFIs do not "
+ "overlap with received MP capabilities",
+ peer->host);
if (error != error_data)
bgp_notify_send_with_data(
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index d8bab6041..96f3c8324 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -1091,9 +1091,9 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
/* Just in case we have a silly peer who sends AS4 capability set to 0
*/
if (CHECK_FLAG(peer->cap, PEER_CAP_AS4_RCV) && !as4) {
- flog_err(BGP_ERR_PKT_OPEN,
- "%s bad OPEN, got AS4 capability, but AS4 set to 0",
- peer->host);
+ flog_err(EC_BGP_PKT_OPEN,
+ "%s bad OPEN, got AS4 capability, but AS4 set to 0",
+ peer->host);
bgp_notify_send_with_data(peer, BGP_NOTIFY_OPEN_ERR,
BGP_NOTIFY_OPEN_BAD_PEER_AS,
notify_data_remote_as4, 4);
@@ -1107,7 +1107,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
*/
if (as4 == BGP_AS_TRANS) {
flog_err(
- BGP_ERR_PKT_OPEN,
+ EC_BGP_PKT_OPEN,
"%s [AS4] NEW speaker using AS_TRANS for AS4, not allowed",
peer->host);
bgp_notify_send_with_data(peer, BGP_NOTIFY_OPEN_ERR,
@@ -1137,7 +1137,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
&& as4 != remote_as) {
/* raise error, log this, close session */
flog_err(
- BGP_ERR_PKT_OPEN,
+ EC_BGP_PKT_OPEN,
"%s bad OPEN, got AS4 capability, but remote_as %u"
" mismatch with 16bit 'myasn' %u in open",
peer->host, as4, remote_as);
@@ -1304,7 +1304,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
/* Get sockname. */
if ((ret = bgp_getsockname(peer)) < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s: bgp_getsockname() failed for peer: %s",
__FUNCTION__, peer->host);
return BGP_Stop;
@@ -1320,7 +1320,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
if (!peer->nexthop.v4.s_addr) {
#if defined(HAVE_CUMULUS)
flog_err(
- BGP_ERR_SND_FAIL,
+ EC_BGP_SND_FAIL,
"%s: No local IPv4 addr resetting connection, fd %d",
peer->host, peer->fd);
bgp_notify_send(peer, BGP_NOTIFY_CEASE,
@@ -1337,7 +1337,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
if (IN6_IS_ADDR_UNSPECIFIED(&peer->nexthop.v6_global)) {
#if defined(HAVE_CUMULUS)
flog_err(
- BGP_ERR_SND_FAIL,
+ EC_BGP_SND_FAIL,
"%s: No local IPv6 addr resetting connection, fd %d",
peer->host, peer->fd);
bgp_notify_send(peer, BGP_NOTIFY_CEASE,
@@ -1399,10 +1399,10 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
/* Status must be Established. */
if (peer->status != Established) {
- flog_err(BGP_ERR_INVALID_STATUS,
- "%s [FSM] Update packet received under status %s",
- peer->host,
- lookup_msg(bgp_status_msg, peer->status, NULL));
+ flog_err(EC_BGP_INVALID_STATUS,
+ "%s [FSM] Update packet received under status %s",
+ peer->host,
+ lookup_msg(bgp_status_msg, peer->status, NULL));
bgp_notify_send(peer, BGP_NOTIFY_FSM_ERR, 0);
return BGP_Stop;
}
@@ -1423,10 +1423,10 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
Attribute Length + 23 exceeds the message Length), then the Error
Subcode is set to Malformed Attribute List. */
if (stream_pnt(s) + 2 > end) {
- flog_err(BGP_ERR_UPDATE_RCV,
- "%s [Error] Update packet error"
- " (packet length is short for unfeasible length)",
- peer->host);
+ flog_err(EC_BGP_UPDATE_RCV,
+ "%s [Error] Update packet error"
+ " (packet length is short for unfeasible length)",
+ peer->host);
bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_MAL_ATTR);
return BGP_Stop;
@@ -1437,10 +1437,10 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
/* Unfeasible Route Length check. */
if (stream_pnt(s) + withdraw_len > end) {
- flog_err(BGP_ERR_UPDATE_RCV,
- "%s [Error] Update packet error"
- " (packet unfeasible length overflow %d)",
- peer->host, withdraw_len);
+ flog_err(EC_BGP_UPDATE_RCV,
+ "%s [Error] Update packet error"
+ " (packet unfeasible length overflow %d)",
+ peer->host, withdraw_len);
bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_MAL_ATTR);
return BGP_Stop;
@@ -1458,7 +1458,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
/* Attribute total length check. */
if (stream_pnt(s) + 2 > end) {
flog_warn(
- BGP_WARN_UPDATE_PACKET_SHORT,
+ EC_BGP_UPDATE_PACKET_SHORT,
"%s [Error] Packet Error (update packet is short for attribute length)",
peer->host);
bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
@@ -1472,7 +1472,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
/* Attribute length check. */
if (stream_pnt(s) + attribute_len > end) {
flog_warn(
- BGP_WARN_UPDATE_PACKET_LONG,
+ EC_BGP_UPDATE_PACKET_LONG,
"%s [Error] Packet Error (update packet attribute length overflow %d)",
peer->host, attribute_len);
bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
@@ -1512,7 +1512,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
if (attr_parse_ret == BGP_ATTR_PARSE_WITHDRAW)
flog_err(
- BGP_ERR_UPDATE_RCV,
+ EC_BGP_UPDATE_RCV,
"%s rcvd UPDATE with errors in attr(s)!! Withdrawing route.",
peer->host);
@@ -1572,8 +1572,8 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
}
if (nlri_ret < 0) {
- flog_err(BGP_ERR_UPDATE_RCV,
- "%s [Error] Error parsing NLRI", peer->host);
+ flog_err(EC_BGP_UPDATE_RCV,
+ "%s [Error] Error parsing NLRI", peer->host);
if (peer->status == Established)
bgp_notify_send(
peer, BGP_NOTIFY_UPDATE_ERR,
@@ -1744,9 +1744,9 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size)
/* If peer does not have the capability, send notification. */
if (!CHECK_FLAG(peer->cap, PEER_CAP_REFRESH_ADV)) {
- flog_err(BGP_ERR_NO_CAP,
- "%s [Error] BGP route refresh is not enabled",
- peer->host);
+ flog_err(EC_BGP_NO_CAP,
+ "%s [Error] BGP route refresh is not enabled",
+ peer->host);
bgp_notify_send(peer, BGP_NOTIFY_HEADER_ERR,
BGP_NOTIFY_HEADER_BAD_MESTYPE);
return BGP_Stop;
@@ -1755,7 +1755,7 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size)
/* Status must be Established. */
if (peer->status != Established) {
flog_err(
- BGP_ERR_INVALID_STATUS,
+ EC_BGP_INVALID_STATUS,
"%s [Error] Route refresh packet received under status %s",
peer->host,
lookup_msg(bgp_status_msg, peer->status, NULL));
@@ -2105,7 +2105,7 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt,
}
} else {
flog_warn(
- BGP_WARN_UNRECOGNIZED_CAPABILITY,
+ EC_BGP_UNRECOGNIZED_CAPABILITY,
"%s unrecognized capability code: %d - ignored",
peer->host, hdr->code);
}
@@ -2136,9 +2136,9 @@ int bgp_capability_receive(struct peer *peer, bgp_size_t size)
/* If peer does not have the capability, send notification. */
if (!CHECK_FLAG(peer->cap, PEER_CAP_DYNAMIC_ADV)) {
- flog_err(BGP_ERR_NO_CAP,
- "%s [Error] BGP dynamic capability is not enabled",
- peer->host);
+ flog_err(EC_BGP_NO_CAP,
+ "%s [Error] BGP dynamic capability is not enabled",
+ peer->host);
bgp_notify_send(peer, BGP_NOTIFY_HEADER_ERR,
BGP_NOTIFY_HEADER_BAD_MESTYPE);
return BGP_Stop;
@@ -2147,7 +2147,7 @@ int bgp_capability_receive(struct peer *peer, bgp_size_t size)
/* Status must be Established. */
if (peer->status != Established) {
flog_err(
- BGP_ERR_NO_CAP,
+ EC_BGP_NO_CAP,
"%s [Error] Dynamic capability packet received under status %s",
peer->host,
lookup_msg(bgp_status_msg, peer->status, NULL));
@@ -2229,7 +2229,7 @@ int bgp_process_packet(struct thread *thread)
mprc = bgp_open_receive(peer, size);
if (mprc == BGP_Stop)
flog_err(
- BGP_ERR_PKT_OPEN,
+ EC_BGP_PKT_OPEN,
"%s: BGP OPEN receipt failed for peer: %s",
__FUNCTION__, peer->host);
break;
@@ -2240,7 +2240,7 @@ int bgp_process_packet(struct thread *thread)
mprc = bgp_update_receive(peer, size);
if (mprc == BGP_Stop)
flog_err(
- BGP_ERR_UPDATE_RCV,
+ EC_BGP_UPDATE_RCV,
"%s: BGP UPDATE receipt failed for peer: %s",
__FUNCTION__, peer->host);
break;
@@ -2250,7 +2250,7 @@ int bgp_process_packet(struct thread *thread)
mprc = bgp_notify_receive(peer, size);
if (mprc == BGP_Stop)
flog_err(
- BGP_ERR_NOTIFY_RCV,
+ EC_BGP_NOTIFY_RCV,
"%s: BGP NOTIFY receipt failed for peer: %s",
__FUNCTION__, peer->host);
break;
@@ -2261,7 +2261,7 @@ int bgp_process_packet(struct thread *thread)
mprc = bgp_keepalive_receive(peer, size);
if (mprc == BGP_Stop)
flog_err(
- BGP_ERR_KEEP_RCV,
+ EC_BGP_KEEP_RCV,
"%s: BGP KEEPALIVE receipt failed for peer: %s",
__FUNCTION__, peer->host);
break;
@@ -2272,7 +2272,7 @@ int bgp_process_packet(struct thread *thread)
mprc = bgp_route_refresh_receive(peer, size);
if (mprc == BGP_Stop)
flog_err(
- BGP_ERR_RFSH_RCV,
+ EC_BGP_RFSH_RCV,
"%s: BGP ROUTEREFRESH receipt failed for peer: %s",
__FUNCTION__, peer->host);
break;
@@ -2282,7 +2282,7 @@ int bgp_process_packet(struct thread *thread)
mprc = bgp_capability_receive(peer, size);
if (mprc == BGP_Stop)
flog_err(
- BGP_ERR_CAP_RCV,
+ EC_BGP_CAP_RCV,
"%s: BGP CAPABILITY receipt failed for peer: %s",
__FUNCTION__, peer->host);
break;
diff --git a/bgpd/bgp_pbr.c b/bgpd/bgp_pbr.c
index b182fde1e..552eb253e 100644
--- a/bgpd/bgp_pbr.c
+++ b/bgpd/bgp_pbr.c
@@ -653,9 +653,10 @@ static int bgp_pbr_build_and_validate_entry(struct prefix *p,
action_count++;
if (action_count > ACTIONS_MAX_NUM) {
if (BGP_DEBUG(pbr, PBR_ERROR))
- flog_err(BGP_ERR_FLOWSPEC_PACKET,
- "%s: flowspec actions exceeds limit (max %u)",
- __func__, action_count);
+ flog_err(
+ EC_BGP_FLOWSPEC_PACKET,
+ "%s: flowspec actions exceeds limit (max %u)",
+ __func__, action_count);
break;
}
api_action = &api->actions[action_count - 1];
@@ -2251,17 +2252,16 @@ void bgp_pbr_update_entry(struct bgp *bgp, struct prefix *p,
if (!bgp_zebra_tm_chunk_obtained()) {
if (BGP_DEBUG(pbr, PBR_ERROR))
- flog_err(BGP_ERR_TABLE_CHUNK,
- "%s: table chunk not obtained yet",
- __func__);
+ flog_err(EC_BGP_TABLE_CHUNK,
+ "%s: table chunk not obtained yet", __func__);
return;
}
if (bgp_pbr_build_and_validate_entry(p, info, &api) < 0) {
if (BGP_DEBUG(pbr, PBR_ERROR))
- flog_err(BGP_ERR_FLOWSPEC_INSTALLATION,
- "%s: cancel updating entry %p in bgp pbr",
- __func__, info);
+ flog_err(EC_BGP_FLOWSPEC_INSTALLATION,
+ "%s: cancel updating entry %p in bgp pbr",
+ __func__, info);
return;
}
bgp_pbr_handle_entry(bgp, info, &api, nlri_update);
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 4c2df0dd0..5c65d5e61 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -355,7 +355,7 @@ static void bgp_pcount_adjust(struct bgp_node *rn, struct bgp_info *ri)
if (ri->peer->pcount[table->afi][table->safi])
ri->peer->pcount[table->afi][table->safi]--;
else
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"Asked to decrement 0 prefix count for peer");
} else if (BGP_INFO_COUNTABLE(ri)
&& !CHECK_FLAG(ri->flags, BGP_INFO_COUNTED)) {
@@ -4216,7 +4216,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr,
/* Prefix length check. */
if (p.prefixlen > prefix_blen(&p) * 8) {
flog_err(
- BGP_ERR_UPDATE_RCV,
+ EC_BGP_UPDATE_RCV,
"%s [Error] Update packet error (wrong prefix length %d for afi %u)",
peer->host, p.prefixlen, packet->afi);
return -1;
@@ -4228,7 +4228,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr,
/* When packet overflow occur return immediately. */
if (pnt + psize > lim) {
flog_err(
- BGP_ERR_UPDATE_RCV,
+ EC_BGP_UPDATE_RCV,
"%s [Error] Update packet error (prefix length %d overflows packet)",
peer->host, p.prefixlen);
return -1;
@@ -4238,7 +4238,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr,
* prefix */
if (psize > (ssize_t)sizeof(p.u)) {
flog_err(
- BGP_ERR_UPDATE_RCV,
+ EC_BGP_UPDATE_RCV,
"%s [Error] Update packet error (prefix length %d too large for prefix storage %zu)",
peer->host, p.prefixlen, sizeof(p.u));
return -1;
@@ -4260,7 +4260,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr,
* ignored.
*/
flog_err(
- BGP_ERR_UPDATE_RCV,
+ EC_BGP_UPDATE_RCV,
"%s: IPv4 unicast NLRI is multicast address %s, ignoring",
peer->host, inet_ntoa(p.u.prefix4));
continue;
@@ -4273,7 +4273,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr,
char buf[BUFSIZ];
flog_err(
- BGP_ERR_UPDATE_RCV,
+ EC_BGP_UPDATE_RCV,
"%s: IPv6 unicast NLRI is link-local address %s, ignoring",
peer->host,
inet_ntop(AF_INET6, &p.u.prefix6, buf,
@@ -4285,7 +4285,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr,
char buf[BUFSIZ];
flog_err(
- BGP_ERR_UPDATE_RCV,
+ EC_BGP_UPDATE_RCV,
"%s: IPv6 unicast NLRI is multicast address %s, ignoring",
peer->host,
inet_ntop(AF_INET6, &p.u.prefix6, buf,
@@ -4315,7 +4315,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr,
/* Packet length consistency check. */
if (pnt != lim) {
flog_err(
- BGP_ERR_UPDATE_RCV,
+ EC_BGP_UPDATE_RCV,
"%s [Error] Update packet error (prefix length mismatch with total length)",
peer->host);
return -1;
@@ -9890,12 +9890,14 @@ static int bgp_peer_count_walker(struct thread *t)
if (CHECK_FLAG(ri->flags, BGP_INFO_COUNTED)) {
pc->count[PCOUNT_COUNTED]++;
if (CHECK_FLAG(ri->flags, BGP_INFO_UNUSEABLE))
- flog_err(LIB_ERR_DEVELOPMENT,
- "Attempting to count but flags say it is unusable");
+ flog_err(
+ EC_LIB_DEVELOPMENT,
+ "Attempting to count but flags say it is unusable");
} else {
if (!CHECK_FLAG(ri->flags, BGP_INFO_UNUSEABLE))
- flog_err(LIB_ERR_DEVELOPMENT,
- "Not counted but flags say we should");
+ flog_err(
+ EC_LIB_DEVELOPMENT,
+ "Not counted but flags say we should");
}
}
}
diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c
index 37740671c..7f7b4a893 100644
--- a/bgpd/bgp_updgrp.c
+++ b/bgpd/bgp_updgrp.c
@@ -1631,9 +1631,9 @@ void update_group_adjust_peer(struct peer_af *paf)
if (!updgrp) {
updgrp = update_group_create(paf);
if (!updgrp) {
- flog_err(BGP_ERR_UPDGRP_CREATE,
- "couldn't create update group for peer %s",
- paf->peer->host);
+ flog_err(EC_BGP_UPDGRP_CREATE,
+ "couldn't create update group for peer %s",
+ paf->peer->host);
return;
}
}
diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c
index f3047369b..56a82c801 100644
--- a/bgpd/bgp_updgrp_packet.c
+++ b/bgpd/bgp_updgrp_packet.c
@@ -428,7 +428,7 @@ struct stream *bpacket_reformat_for_peer(struct bpacket *pkt,
default:
/* TODO: handle IPv6 nexthops */
flog_warn(
- BGP_WARN_INVALID_NEXTHOP_LENGTH,
+ EC_BGP_INVALID_NEXTHOP_LENGTH,
"%s: %s: invalid MP nexthop length (AFI IP): %u",
__func__, peer->host, nhlen);
stream_free(s);
@@ -534,7 +534,7 @@ struct stream *bpacket_reformat_for_peer(struct bpacket *pkt,
default:
/* TODO: handle IPv4 nexthops */
flog_warn(
- BGP_WARN_INVALID_NEXTHOP_LENGTH,
+ EC_BGP_INVALID_NEXTHOP_LENGTH,
"%s: %s: invalid MP nexthop length (AFI IP6): %u",
__func__, peer->host, nhlen);
stream_free(s);
@@ -790,7 +790,7 @@ struct bpacket *subgroup_update_packet(struct update_subgroup *subgrp)
* return */
if (space_remaining < space_needed) {
flog_err(
- BGP_ERR_UPDGRP_ATTR_LEN,
+ EC_BGP_UPDGRP_ATTR_LEN,
"u%" PRIu64 ":s%" PRIu64
" attributes too long, cannot send UPDATE",
subgrp->update_group->id, subgrp->id);
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index e6c7ebd45..e6d44c1a2 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -10822,7 +10822,7 @@ static void bgp_show_all_instances_neighbors_vty(struct vty *vty,
if (use_json) {
if (!(json = json_object_new_object())) {
flog_err(
- BGP_ERR_JSON_MEM_ERROR,
+ EC_BGP_JSON_MEM_ERROR,
"Unable to allocate memory for JSON object");
vty_out(vty,
"{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}\n");
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index 43afc317e..7a1a4658a 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -1078,8 +1078,8 @@ int bgp_zebra_get_table_range(uint32_t chunk_size,
return -1;
ret = tm_get_table_chunk(zclient, chunk_size, start, end);
if (ret < 0) {
- flog_err(BGP_ERR_TABLE_CHUNK,
- "BGP: Error getting table chunk %u", chunk_size);
+ flog_err(EC_BGP_TABLE_CHUNK,
+ "BGP: Error getting table chunk %u", chunk_size);
return -1;
}
zlog_info("BGP: Table Manager returns range from chunk %u is [%u %u]",
@@ -2390,10 +2390,10 @@ static int bgp_zebra_process_local_macip(int command, struct zclient *zclient,
ipa_len = stream_getl(s);
if (ipa_len != 0 && ipa_len != IPV4_MAX_BYTELEN
&& ipa_len != IPV6_MAX_BYTELEN) {
- flog_err(BGP_ERR_MACIP_LEN,
- "%u:Recv MACIP %s with invalid IP addr length %d",
- vrf_id, (command == ZEBRA_MACIP_ADD) ? "Add" : "Del",
- ipa_len);
+ flog_err(EC_BGP_MACIP_LEN,
+ "%u:Recv MACIP %s with invalid IP addr length %d",
+ vrf_id, (command == ZEBRA_MACIP_ADD) ? "Add" : "Del",
+ ipa_len);
return -1;
}
@@ -2487,13 +2487,13 @@ static void bgp_zebra_process_label_chunk(
STREAM_GETL(s, last);
if (zclient->redist_default != proto) {
- flog_err(BGP_ERR_LM_ERROR, "Got LM msg with wrong proto %u",
- proto);
+ flog_err(EC_BGP_LM_ERROR, "Got LM msg with wrong proto %u",
+ proto);
return;
}
if (zclient->instance != instance) {
- flog_err(BGP_ERR_LM_ERROR, "Got LM msg with wrong instance %u",
- proto);
+ flog_err(EC_BGP_LM_ERROR, "Got LM msg with wrong instance %u",
+ proto);
return;
}
@@ -2501,8 +2501,8 @@ static void bgp_zebra_process_label_chunk(
first < MPLS_LABEL_UNRESERVED_MIN ||
last > MPLS_LABEL_UNRESERVED_MAX) {
- flog_err(BGP_ERR_LM_ERROR, "%s: Invalid Label chunk: %u - %u",
- __func__, first, last);
+ flog_err(EC_BGP_LM_ERROR, "%s: Invalid Label chunk: %u - %u",
+ __func__, first, last);
return;
}
if (BGP_DEBUG(zebra, ZEBRA)) {
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 066db1c77..7df8de55f 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -1804,8 +1804,8 @@ static int peer_activate_af(struct peer *peer, afi_t afi, safi_t safi)
int active;
if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) {
- flog_err(BGP_ERR_PEER_GROUP, "%s was called for peer-group %s",
- __func__, peer->host);
+ flog_err(EC_BGP_PEER_GROUP, "%s was called for peer-group %s",
+ __func__, peer->host);
return 1;
}
@@ -1918,8 +1918,8 @@ static int non_peergroup_deactivate_af(struct peer *peer, afi_t afi,
safi_t safi)
{
if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) {
- flog_err(BGP_ERR_PEER_GROUP, "%s was called for peer-group %s",
- __func__, peer->host);
+ flog_err(EC_BGP_PEER_GROUP, "%s was called for peer-group %s",
+ __func__, peer->host);
return 1;
}
@@ -1931,9 +1931,9 @@ static int non_peergroup_deactivate_af(struct peer *peer, afi_t afi,
peer->afc[afi][safi] = 0;
if (peer_af_delete(peer, afi, safi) != 0) {
- flog_err(BGP_ERR_PEER_DELETE,
- "couldn't delete af structure for peer %s",
- peer->host);
+ flog_err(EC_BGP_PEER_DELETE,
+ "couldn't delete af structure for peer %s",
+ peer->host);
return 1;
}
@@ -1982,9 +1982,9 @@ int peer_deactivate(struct peer *peer, afi_t afi, safi_t safi)
group = peer->group;
if (peer_af_delete(peer, afi, safi) != 0) {
- flog_err(BGP_ERR_PEER_DELETE,
- "couldn't delete af structure for peer %s",
- peer->host);
+ flog_err(EC_BGP_PEER_DELETE,
+ "couldn't delete af structure for peer %s",
+ peer->host);
}
for (ALL_LIST_ELEMENTS(group->peer, node, nnode, tmp_peer)) {
diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c
index 18c3c6385..16dcbd4ee 100644
--- a/bgpd/rfapi/rfapi.c
+++ b/bgpd/rfapi/rfapi.c
@@ -3942,8 +3942,8 @@ void *rfapi_rfp_init_group_config_ptr_vty(void *rfp_start_val,
size);
break;
default:
- flog_err(LIB_ERR_DEVELOPMENT, "%s: Unknown group type=%d",
- __func__, type);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: Unknown group type=%d",
+ __func__, type);
/* should never happen */
assert("Unknown type" == NULL);
break;
@@ -4057,8 +4057,8 @@ void *rfapi_rfp_get_group_config_ptr_name(
criteria, search_cb);
break;
default:
- flog_err(LIB_ERR_DEVELOPMENT, "%s: Unknown group type=%d",
- __func__, type);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: Unknown group type=%d",
+ __func__, type);
/* should never happen */
assert("Unknown type" == NULL);
break;
diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c
index f014f16fc..398de6b3a 100644
--- a/bgpd/rfapi/rfapi_import.c
+++ b/bgpd/rfapi/rfapi_import.c
@@ -3033,7 +3033,7 @@ static void rfapiBgpInfoFilteredImportEncap(
break;
default:
- flog_err(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", __func__, afi);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: bad afi %d", __func__, afi);
return;
}
@@ -3492,7 +3492,7 @@ void rfapiBgpInfoFilteredImportVPN(
break;
default:
- flog_err(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", __func__, afi);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: bad afi %d", __func__, afi);
return;
}
@@ -3897,8 +3897,7 @@ rfapiBgpInfoFilteredImportFunction(safi_t safi)
default:
/* not expected */
- flog_err(LIB_ERR_DEVELOPMENT, "%s: bad safi %d", __func__,
- safi);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: bad safi %d", __func__, safi);
return rfapiBgpInfoFilteredImportBadSafi;
}
}
diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c
index 628917564..f830c3ed5 100644
--- a/bgpd/rfapi/vnc_export_bgp.c
+++ b/bgpd/rfapi/vnc_export_bgp.c
@@ -188,8 +188,8 @@ void vnc_direct_bgp_add_route_ce(struct bgp *bgp, struct agg_node *rn,
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT,
- "%s: can't get afi of route node", __func__);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi of route node",
+ __func__);
return;
}
@@ -335,7 +335,7 @@ void vnc_direct_bgp_del_route_ce(struct bgp *bgp, struct agg_node *rn,
struct prefix ce_nexthop;
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: bad afi", __func__);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: bad afi", __func__);
return;
}
@@ -700,8 +700,8 @@ void vnc_direct_bgp_add_prefix(struct bgp *bgp,
afi_t afi = family2afi(rn->p.family);
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT,
- "%s: can't get afi of route node", __func__);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi of route node",
+ __func__);
return;
}
@@ -810,8 +810,8 @@ void vnc_direct_bgp_del_prefix(struct bgp *bgp,
afi_t afi = family2afi(rn->p.family);
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: can't get afi route node",
- __func__);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi route node",
+ __func__);
return;
}
@@ -926,8 +926,8 @@ void vnc_direct_bgp_add_nve(struct bgp *bgp, struct rfapi_descriptor *rfd)
afi_t afi = family2afi(rfd->vn_addr.addr_family);
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT,
- "%s: can't get afi of nve vn addr", __func__);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi of nve vn addr",
+ __func__);
return;
}
@@ -979,8 +979,8 @@ void vnc_direct_bgp_add_nve(struct bgp *bgp, struct rfapi_descriptor *rfd)
if (afi == AFI_IP || afi == AFI_IP6) {
rt = import_table->imported_vpn[afi];
} else {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: bad afi %d",
- __func__, afi);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: bad afi %d",
+ __func__, afi);
return;
}
@@ -1073,8 +1073,8 @@ void vnc_direct_bgp_del_nve(struct bgp *bgp, struct rfapi_descriptor *rfd)
afi_t afi = family2afi(rfd->vn_addr.addr_family);
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT,
- "%s: can't get afi of nve vn addr", __func__);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi of nve vn addr",
+ __func__);
return;
}
@@ -1121,8 +1121,8 @@ void vnc_direct_bgp_del_nve(struct bgp *bgp, struct rfapi_descriptor *rfd)
if (afi == AFI_IP || afi == AFI_IP6) {
rt = import_table->imported_vpn[afi];
} else {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: bad afi %d",
- __func__, afi);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: bad afi %d",
+ __func__, afi);
return;
}
@@ -1298,7 +1298,7 @@ static void vnc_direct_bgp_add_group_afi(struct bgp *bgp,
if (afi == AFI_IP || afi == AFI_IP6) {
rt = import_table->imported_vpn[afi];
} else {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", __func__, afi);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: bad afi %d", __func__, afi);
return;
}
@@ -1642,8 +1642,8 @@ void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi,
struct attr *iattr;
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT,
- "%s: can't get afi of route node", __func__);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi of route node",
+ __func__);
return;
}
@@ -1762,8 +1762,8 @@ void vnc_direct_bgp_rh_del_route(struct bgp *bgp, afi_t afi,
struct vnc_export_info *eti;
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: can't get afi route node",
- __func__);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi route node",
+ __func__);
return;
}
diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c
index 74dc20a93..71a4485d3 100644
--- a/bgpd/rfapi/vnc_import_bgp.c
+++ b/bgpd/rfapi/vnc_import_bgp.c
@@ -603,8 +603,8 @@ static void vnc_import_bgp_add_route_mode_resolve_nve(
*/
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: can't get afi of prefix",
- __func__);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi of prefix",
+ __func__);
return;
}
@@ -720,8 +720,8 @@ static void vnc_import_bgp_add_route_mode_plain(struct bgp *bgp,
}
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: can't get afi of prefix",
- __func__);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi of prefix",
+ __func__);
return;
}
@@ -908,8 +908,8 @@ vnc_import_bgp_add_route_mode_nvegroup(struct bgp *bgp, struct prefix *prefix,
assert(rfg);
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: can't get afi of prefix",
- __func__);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi of prefix",
+ __func__);
return;
}
@@ -2634,8 +2634,8 @@ void vnc_import_bgp_add_route(struct bgp *bgp, struct prefix *prefix,
VNC_RHNCK(enter);
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: can't get afi of prefix",
- __func__);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi of prefix",
+ __func__);
return;
}
diff --git a/bgpd/rfapi/vnc_zebra.c b/bgpd/rfapi/vnc_zebra.c
index a93fb6073..1db175536 100644
--- a/bgpd/rfapi/vnc_zebra.c
+++ b/bgpd/rfapi/vnc_zebra.c
@@ -571,8 +571,8 @@ static void vnc_zebra_add_del_prefix(struct bgp *bgp,
return;
if (rn->p.family != AF_INET && rn->p.family != AF_INET6) {
- flog_err(LIB_ERR_DEVELOPMENT,
- "%s: invalid route node addr family", __func__);
+ flog_err(EC_LIB_DEVELOPMENT,
+ "%s: invalid route node addr family", __func__);
return;
}
@@ -644,8 +644,8 @@ static void vnc_zebra_add_del_nve(struct bgp *bgp, struct rfapi_descriptor *rfd,
return;
if (afi != AFI_IP && afi != AFI_IP6) {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: invalid vn addr family",
- __func__);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: invalid vn addr family",
+ __func__);
return;
}
@@ -743,13 +743,13 @@ static void vnc_zebra_add_del_group_afi(struct bgp *bgp,
if (afi == AFI_IP || afi == AFI_IP6) {
rt = import_table->imported_vpn[afi];
} else {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", __func__, afi);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: bad afi %d", __func__, afi);
return;
}
if (!family) {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: computed bad family: %d",
- __func__, family);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: computed bad family: %d",
+ __func__, family);
return;
}
diff --git a/eigrpd/eigrp_errors.c b/eigrpd/eigrp_errors.c
index 3db0ec854..75cf95355 100644
--- a/eigrpd/eigrp_errors.c
+++ b/eigrpd/eigrp_errors.c
@@ -26,13 +26,13 @@
/* clang-format off */
static struct log_ref ferr_eigrp_err[] = {
{
- .code = EIGRP_ERR_PACKET,
+ .code = EC_EIGRP_PACKET,
.title = "EIGRP Packet Error",
.description = "EIGRP has a packet that does not correctly decode or encode",
.suggestion = "Gather log files from both sides of the neighbor relationship and open an issue"
},
{
- .code = EIGRP_ERR_CONFIG,
+ .code = EC_EIGRP_CONFIG,
.title = "EIGRP Configuration Error",
.description = "EIGRP has detected a configuration error",
.suggestion = "Correct the configuration issue, if it still persists open an Issue"
diff --git a/eigrpd/eigrp_errors.h b/eigrpd/eigrp_errors.h
index e1ace8ab4..3270e6513 100644
--- a/eigrpd/eigrp_errors.h
+++ b/eigrpd/eigrp_errors.h
@@ -24,8 +24,8 @@
#include "lib/ferr.h"
enum eigrp_log_refs {
- EIGRP_ERR_PACKET = EIGRP_FERR_START,
- EIGRP_ERR_CONFIG,
+ EC_EIGRP_PACKET = EIGRP_FERR_START,
+ EC_EIGRP_CONFIG,
};
extern void eigrp_error_init(void);
diff --git a/eigrpd/eigrp_hello.c b/eigrpd/eigrp_hello.c
index d438db28d..413a35f2f 100644
--- a/eigrpd/eigrp_hello.c
+++ b/eigrpd/eigrp_hello.c
@@ -421,9 +421,9 @@ void eigrp_sw_version_initialize(void)
ret = sscanf(ver_string, "%" SCNu32 ".%" SCNu32, &FRR_MAJOR,
&FRR_MINOR);
if (ret != 2)
- flog_err(EIGRP_ERR_PACKET,
- "Did not Properly parse %s, please fix VERSION string",
- VERSION);
+ flog_err(EC_EIGRP_PACKET,
+ "Did not Properly parse %s, please fix VERSION string",
+ VERSION);
}
/**
diff --git a/eigrpd/eigrp_neighbor.c b/eigrpd/eigrp_neighbor.c
index b10673d9e..66dd5f341 100644
--- a/eigrpd/eigrp_neighbor.c
+++ b/eigrpd/eigrp_neighbor.c
@@ -336,8 +336,8 @@ int eigrp_nbr_count_get(void)
void eigrp_nbr_hard_restart(struct eigrp_neighbor *nbr, struct vty *vty)
{
if (nbr == NULL) {
- flog_err(EIGRP_ERR_CONFIG,
- "Nbr Hard restart: Neighbor not specified.");
+ flog_err(EC_EIGRP_CONFIG,
+ "Nbr Hard restart: Neighbor not specified.");
return;
}
diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c
index 6338e5cf7..f3b583abd 100644
--- a/eigrpd/eigrp_packet.c
+++ b/eigrpd/eigrp_packet.c
@@ -348,14 +348,14 @@ int eigrp_write(struct thread *thread)
/* Get one packet from queue. */
ep = eigrp_fifo_next(ei->obuf);
if (!ep) {
- flog_err(LIB_ERR_DEVELOPMENT,
- "%s: Interface %s no packet on queue?",
- __PRETTY_FUNCTION__, ei->ifp->name);
+ flog_err(EC_LIB_DEVELOPMENT,
+ "%s: Interface %s no packet on queue?",
+ __PRETTY_FUNCTION__, ei->ifp->name);
goto out;
}
if (ep->length < EIGRP_HEADER_LEN) {
- flog_err(EIGRP_ERR_PACKET,
- "%s: Packet just has a header?", __PRETTY_FUNCTION__);
+ flog_err(EC_EIGRP_PACKET, "%s: Packet just has a header?",
+ __PRETTY_FUNCTION__);
eigrp_header_dump((struct eigrp_header *)ep->s->data);
eigrp_packet_delete(ei);
goto out;
@@ -1214,9 +1214,8 @@ uint16_t eigrp_add_internalTLV_to_stream(struct stream *s,
stream_putw(s, length);
break;
default:
- flog_err(LIB_ERR_DEVELOPMENT,
- "%s: Unexpected prefix length: %d",
- __PRETTY_FUNCTION__, pe->destination->prefixlen);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: Unexpected prefix length: %d",
+ __PRETTY_FUNCTION__, pe->destination->prefixlen);
return 0;
}
stream_putl(s, 0x00000000);
diff --git a/eigrpd/eigrp_reply.c b/eigrpd/eigrp_reply.c
index b6e6352de..ccf049673 100644
--- a/eigrpd/eigrp_reply.c
+++ b/eigrpd/eigrp_reply.c
@@ -170,10 +170,11 @@ void eigrp_reply_receive(struct eigrp *eigrp, struct ip *iph,
if (!dest) {
char buf[PREFIX_STRLEN];
- flog_err(EIGRP_ERR_PACKET,
- "%s: Received prefix %s which we do not know about",
- __PRETTY_FUNCTION__,
- prefix2str(&dest_addr, buf, sizeof(buf)));
+ flog_err(
+ EC_EIGRP_PACKET,
+ "%s: Received prefix %s which we do not know about",
+ __PRETTY_FUNCTION__,
+ prefix2str(&dest_addr, buf, sizeof(buf)));
eigrp_IPv4_InternalTLV_free(tlv);
continue;
}
diff --git a/eigrpd/eigrp_topology.c b/eigrpd/eigrp_topology.c
index 61eee99f6..80814d6d3 100644
--- a/eigrpd/eigrp_topology.c
+++ b/eigrpd/eigrp_topology.c
@@ -412,8 +412,8 @@ eigrp_topology_update_distance(struct eigrp_fsm_action_message *msg)
}
break;
default:
- flog_err(LIB_ERR_DEVELOPMENT, "%s: Please implement handler",
- __PRETTY_FUNCTION__);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: Please implement handler",
+ __PRETTY_FUNCTION__);
break;
}
distance_done:
diff --git a/eigrpd/eigrpd.c b/eigrpd/eigrpd.c
index 91c0046bb..b30f14f74 100644
--- a/eigrpd/eigrpd.c
+++ b/eigrpd/eigrpd.c
@@ -163,7 +163,7 @@ static struct eigrp *eigrp_new(const char *AS)
if ((eigrp_socket = eigrp_sock_init()) < 0) {
flog_err_sys(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"eigrp_new: fatal error: eigrp_sock_init was unable to open a socket");
exit(1);
}
diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c
index 817a44baf..d318079f6 100644
--- a/isisd/isis_circuit.c
+++ b/isisd/isis_circuit.c
@@ -568,7 +568,7 @@ int isis_circuit_up(struct isis_circuit *circuit)
if (circuit->area->lsp_mtu > isis_circuit_pdu_size(circuit)) {
flog_err(
- ISIS_ERR_CONFIG,
+ EC_ISIS_CONFIG,
"Interface MTU %zu on %s is too low to support area lsp mtu %u!",
isis_circuit_pdu_size(circuit),
circuit->interface->name, circuit->area->lsp_mtu);
@@ -580,7 +580,7 @@ int isis_circuit_up(struct isis_circuit *circuit)
circuit->circuit_id = isis_circuit_id_gen(isis, circuit->interface);
if (!circuit->circuit_id) {
flog_err(
- ISIS_ERR_CONFIG,
+ EC_ISIS_CONFIG,
"There are already 255 broadcast circuits active!");
return ISIS_ERROR;
}
diff --git a/isisd/isis_csm.c b/isisd/isis_csm.c
index aae90b008..e50f57ae1 100644
--- a/isisd/isis_csm.c
+++ b/isisd/isis_csm.c
@@ -139,11 +139,11 @@ isis_csm_state_change(int event, struct isis_circuit *circuit, void *arg)
isis_circuit_if_add(circuit, (struct interface *)arg);
if (isis_circuit_up(circuit) != ISIS_OK) {
flog_err(
- ISIS_ERR_CONFIG,
+ EC_ISIS_CONFIG,
"Could not bring up %s because of invalid config.",
circuit->interface->name);
flog_err(
- ISIS_ERR_CONFIG,
+ EC_ISIS_CONFIG,
"Clearing config for %s. Please re-examine it.",
circuit->interface->name);
if (circuit->ip_router) {
diff --git a/isisd/isis_errors.c b/isisd/isis_errors.c
index ecff65da1..755e70dbf 100644
--- a/isisd/isis_errors.c
+++ b/isisd/isis_errors.c
@@ -26,13 +26,13 @@
/* clang-format off */
static struct log_ref ferr_isis_err[] = {
{
- .code = ISIS_ERR_PACKET,
+ .code = EC_ISIS_PACKET,
.title = "ISIS Packet Error",
.description = "Isis has detected an error with a packet from a peer",
.suggestion = "Gather log information and open an issue then restart FRR"
},
{
- .code = ISIS_ERR_CONFIG,
+ .code = EC_ISIS_CONFIG,
.title = "ISIS Configuration Error",
.description = "Isis has detected an error within configuration for the router",
.suggestion = "Ensure configuration is correct"
diff --git a/isisd/isis_errors.h b/isisd/isis_errors.h
index f738254a3..073273760 100644
--- a/isisd/isis_errors.h
+++ b/isisd/isis_errors.h
@@ -24,8 +24,8 @@
#include "lib/ferr.h"
enum isis_log_refs {
- ISIS_ERR_PACKET = ISIS_FERR_START,
- ISIS_ERR_CONFIG,
+ EC_ISIS_PACKET = ISIS_FERR_START,
+ EC_ISIS_CONFIG,
};
extern void isis_error_init(void);
diff --git a/isisd/isis_events.c b/isisd/isis_events.c
index 52a0b9fac..342787af3 100644
--- a/isisd/isis_events.c
+++ b/isisd/isis_events.c
@@ -158,7 +158,7 @@ void isis_circuit_is_type_set(struct isis_circuit *circuit, int newtype)
if (!(newtype & circuit->area->is_type)) {
flog_err(
- ISIS_ERR_CONFIG,
+ EC_ISIS_CONFIG,
"ISIS-Evt (%s) circuit type change - invalid level %s because area is %s",
circuit->area->area_tag, circuit_t2string(newtype),
circuit_t2string(circuit->area->is_type));
diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c
index e8777e9b5..8cfe480ef 100644
--- a/isisd/isis_lsp.c
+++ b/isisd/isis_lsp.c
@@ -473,7 +473,7 @@ void lsp_update(struct isis_lsp *lsp, struct isis_lsp_hdr *hdr,
{
if (lsp->own_lsp) {
flog_err(
- LIB_ERR_DEVELOPMENT,
+ EC_LIB_DEVELOPMENT,
"ISIS-Upd (%s): BUG updating LSP %s still marked as own LSP",
area->area_tag, rawlspid_print(lsp->hdr.lsp_id));
lsp_clear_data(lsp);
@@ -1277,9 +1277,9 @@ static int lsp_regenerate(struct isis_area *area, int level)
lsp = lsp_search(lspid, lspdb);
if (!lsp) {
- flog_err(LIB_ERR_DEVELOPMENT,
- "ISIS-Upd (%s): lsp_regenerate: no L%d LSP found!",
- area->area_tag, level);
+ flog_err(EC_LIB_DEVELOPMENT,
+ "ISIS-Upd (%s): lsp_regenerate: no L%d LSP found!",
+ area->area_tag, level);
return ISIS_ERROR;
}
@@ -1646,9 +1646,9 @@ static int lsp_regenerate_pseudo(struct isis_circuit *circuit, int level)
lsp = lsp_search(lsp_id, lspdb);
if (!lsp) {
- flog_err(LIB_ERR_DEVELOPMENT,
- "lsp_regenerate_pseudo: no l%d LSP %s found!", level,
- rawlspid_print(lsp_id));
+ flog_err(EC_LIB_DEVELOPMENT,
+ "lsp_regenerate_pseudo: no l%d LSP %s found!", level,
+ rawlspid_print(lsp_id));
return ISIS_ERROR;
}
diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c
index a335a96cd..7843fb9b9 100644
--- a/isisd/isis_pdu.c
+++ b/isisd/isis_pdu.c
@@ -90,10 +90,10 @@ static int ack_lsp(struct isis_lsp_hdr *hdr, struct isis_circuit *circuit,
retval = circuit->tx(circuit, level);
if (retval != ISIS_OK)
- flog_err(ISIS_ERR_PACKET,
- "ISIS-Upd (%s): Send L%d LSP PSNP on %s failed",
- circuit->area->area_tag, level,
- circuit->interface->name);
+ flog_err(EC_ISIS_PACKET,
+ "ISIS-Upd (%s): Send L%d LSP PSNP on %s failed",
+ circuit->area->area_tag, level,
+ circuit->interface->name);
return retval;
}
@@ -625,9 +625,9 @@ static int process_hello(uint8_t pdu_type, struct isis_circuit *circuit,
}
if (!p2p_hello && !(level & iih.circ_type)) {
- flog_err(ISIS_ERR_PACKET,
- "Level %d LAN Hello with Circuit Type %d", level,
- iih.circ_type);
+ flog_err(EC_ISIS_PACKET,
+ "Level %d LAN Hello with Circuit Type %d", level,
+ iih.circ_type);
return ISIS_ERROR;
}
@@ -1408,7 +1408,7 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
/* Verify that at least the 8 bytes fixed header have been received */
if (stream_get_endp(circuit->rcv_stream) < ISIS_FIXED_HDR_LEN) {
- flog_err(ISIS_ERR_PACKET, "PDU is too short to be IS-IS.");
+ flog_err(EC_ISIS_PACKET, "PDU is too short to be IS-IS.");
return ISIS_ERROR;
}
@@ -1423,14 +1423,14 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
uint8_t max_area_addrs = stream_getc(circuit->rcv_stream);
if (idrp == ISO9542_ESIS) {
- flog_err(LIB_ERR_DEVELOPMENT,
- "No support for ES-IS packet IDRP=%" PRIx8, idrp);
+ flog_err(EC_LIB_DEVELOPMENT,
+ "No support for ES-IS packet IDRP=%" PRIx8, idrp);
return ISIS_ERROR;
}
if (idrp != ISO10589_ISIS) {
- flog_err(ISIS_ERR_PACKET, "Not an IS-IS packet IDRP=%" PRIx8,
- idrp);
+ flog_err(EC_ISIS_PACKET, "Not an IS-IS packet IDRP=%" PRIx8,
+ idrp);
return ISIS_ERROR;
}
@@ -1441,7 +1441,7 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
if (id_len != 0 && id_len != ISIS_SYS_ID_LEN) {
flog_err(
- ISIS_ERR_PACKET,
+ EC_ISIS_PACKET,
"IDFieldLengthMismatch: ID Length field in a received PDU %" PRIu8
", while the parameter for this IS is %u",
id_len, ISIS_SYS_ID_LEN);
@@ -1455,16 +1455,16 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
}
if (length != expected_length) {
- flog_err(ISIS_ERR_PACKET,
- "Exepected fixed header length = %" PRIu8
- " but got %" PRIu8,
- expected_length, length);
+ flog_err(EC_ISIS_PACKET,
+ "Exepected fixed header length = %" PRIu8
+ " but got %" PRIu8,
+ expected_length, length);
return ISIS_ERROR;
}
if (stream_get_endp(circuit->rcv_stream) < length) {
flog_err(
- ISIS_ERR_PACKET,
+ EC_ISIS_PACKET,
"PDU is too short to contain fixed header of given PDU type.");
return ISIS_ERROR;
}
@@ -1485,7 +1485,7 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
&& max_area_addrs != 0
&& max_area_addrs != isis->max_area_addrs) {
flog_err(
- ISIS_ERR_PACKET,
+ EC_ISIS_PACKET,
"maximumAreaAddressesMismatch: maximumAreaAdresses in a received PDU %" PRIu8
" while the parameter for this IS is %u",
max_area_addrs, isis->max_area_addrs);
@@ -1727,10 +1727,10 @@ int send_hello(struct isis_circuit *circuit, int level)
retval = circuit->tx(circuit, level);
if (retval != ISIS_OK)
- flog_err(ISIS_ERR_PACKET,
- "ISIS-Adj (%s): Send L%d IIH on %s failed",
- circuit->area->area_tag, level,
- circuit->interface->name);
+ flog_err(EC_ISIS_PACKET,
+ "ISIS-Adj (%s): Send L%d IIH on %s failed",
+ circuit->area->area_tag, level,
+ circuit->interface->name);
return retval;
}
@@ -1925,10 +1925,10 @@ int send_csnp(struct isis_circuit *circuit, int level)
int retval = circuit->tx(circuit, level);
if (retval != ISIS_OK) {
- flog_err(ISIS_ERR_PACKET,
- "ISIS-Snp (%s): Send L%d CSNP on %s failed",
- circuit->area->area_tag, level,
- circuit->interface->name);
+ flog_err(EC_ISIS_PACKET,
+ "ISIS-Snp (%s): Send L%d CSNP on %s failed",
+ circuit->area->area_tag, level,
+ circuit->interface->name);
isis_free_tlvs(tlvs);
return retval;
}
@@ -2092,10 +2092,10 @@ static int send_psnp(int level, struct isis_circuit *circuit)
int retval = circuit->tx(circuit, level);
if (retval != ISIS_OK) {
- flog_err(ISIS_ERR_PACKET,
- "ISIS-Snp (%s): Send L%d PSNP on %s failed",
- circuit->area->area_tag, level,
- circuit->interface->name);
+ flog_err(EC_ISIS_PACKET,
+ "ISIS-Snp (%s): Send L%d PSNP on %s failed",
+ circuit->area->area_tag, level,
+ circuit->interface->name);
isis_free_tlvs(tlvs);
return retval;
}
@@ -2188,7 +2188,7 @@ void send_lsp(void *arg, struct isis_lsp *lsp, enum isis_tx_type tx_type)
* the circuit's MTU. So handle and log this case here. */
if (stream_get_endp(lsp->pdu) > stream_get_size(circuit->snd_stream)) {
flog_err(
- ISIS_ERR_PACKET,
+ EC_ISIS_PACKET,
"ISIS-Upd (%s): Can't send L%d LSP %s, seq 0x%08" PRIx32
", cksum 0x%04" PRIx16 ", lifetime %" PRIu16
"s on %s. LSP Size is %zu while interface stream size is %zu.",
@@ -2228,12 +2228,12 @@ void send_lsp(void *arg, struct isis_lsp *lsp, enum isis_tx_type tx_type)
clear_srm = 0;
retval = circuit->tx(circuit, lsp->level);
if (retval != ISIS_OK) {
- flog_err(ISIS_ERR_PACKET,
- "ISIS-Upd (%s): Send L%d LSP on %s failed %s",
- circuit->area->area_tag, lsp->level,
- circuit->interface->name,
- (retval == ISIS_WARNING) ? "temporarily"
- : "permanently");
+ flog_err(EC_ISIS_PACKET,
+ "ISIS-Upd (%s): Send L%d LSP on %s failed %s",
+ circuit->area->area_tag, lsp->level,
+ circuit->interface->name,
+ (retval == ISIS_WARNING) ? "temporarily"
+ : "permanently");
}
out:
diff --git a/isisd/isis_spf_private.h b/isisd/isis_spf_private.h
index af552e0ed..109aafb4e 100644
--- a/isisd/isis_spf_private.h
+++ b/isisd/isis_spf_private.h
@@ -321,7 +321,7 @@ static void isis_vertex_id_init(struct isis_vertex *vertex, const void *id,
} else if (VTYPE_IP(vtype)) {
memcpy(&vertex->N.ip, id, sizeof(vertex->N.ip));
} else {
- flog_err(LIB_ERR_DEVELOPMENT, "Unknown Vertex Type");
+ flog_err(EC_LIB_DEVELOPMENT, "Unknown Vertex Type");
}
}
diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c
index 935e95959..137d9622d 100644
--- a/ldpd/ldpd.c
+++ b/ldpd/ldpd.c
@@ -484,7 +484,7 @@ start_child(enum ldpd_process p, char *argv0, int fd_async, int fd_sync)
nullfd = open("/dev/null", O_RDONLY | O_NOCTTY);
if (nullfd == -1) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"%s: failed to open /dev/null: %s", __func__,
safe_strerror(errno));
} else {
diff --git a/lib/agentx.c b/lib/agentx.c
index c319649e3..55bb9e99e 100644
--- a/lib/agentx.c
+++ b/lib/agentx.c
@@ -142,23 +142,19 @@ static int agentx_log_callback(int major, int minor, void *serverarg,
msg[strlen(msg) - 1] = '\0';
switch (slm->priority) {
case LOG_EMERG:
- flog_err(LIB_ERR_SNMP,
- "snmp[emerg]: %s", msg ? msg : slm->msg);
+ flog_err(EC_LIB_SNMP, "snmp[emerg]: %s", msg ? msg : slm->msg);
break;
case LOG_ALERT:
- flog_err(LIB_ERR_SNMP,
- "snmp[alert]: %s", msg ? msg : slm->msg);
+ flog_err(EC_LIB_SNMP, "snmp[alert]: %s", msg ? msg : slm->msg);
break;
case LOG_CRIT:
- flog_err(LIB_ERR_SNMP,
- "snmp[crit]: %s", msg ? msg : slm->msg);
+ flog_err(EC_LIB_SNMP, "snmp[crit]: %s", msg ? msg : slm->msg);
break;
case LOG_ERR:
- flog_err(LIB_ERR_SNMP,
- "snmp[err]: %s", msg ? msg : slm->msg);
+ flog_err(EC_LIB_SNMP, "snmp[err]: %s", msg ? msg : slm->msg);
break;
case LOG_WARNING:
- flog_warn(LIB_WARN_SNMP, "snmp[warning]: %s",
+ flog_warn(EC_LIB_SNMP, "snmp[warning]: %s",
msg ? msg : slm->msg);
break;
case LOG_NOTICE:
diff --git a/lib/buffer.c b/lib/buffer.c
index 11bacf83b..bb2cdb7e5 100644
--- a/lib/buffer.c
+++ b/lib/buffer.c
@@ -332,7 +332,7 @@ buffer_status_t buffer_flush_window(struct buffer *b, int fd, int width,
} else {
/* This should absolutely never occur. */
flog_err_sys(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"%s: corruption detected: iov_small overflowed; "
"head %p, tail %p, head->next %p",
__func__, (void *)b->head,
@@ -365,7 +365,7 @@ buffer_status_t buffer_flush_window(struct buffer *b, int fd, int width,
iov_size =
((iov_index > IOV_MAX) ? IOV_MAX : iov_index);
if ((nbytes = writev(fd, c_iov, iov_size)) < 0) {
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"%s: writev to fd %d failed: %s",
__func__, fd, safe_strerror(errno));
break;
@@ -378,7 +378,7 @@ buffer_status_t buffer_flush_window(struct buffer *b, int fd, int width,
}
#else /* IOV_MAX */
if ((nbytes = writev(fd, iov, iov_index)) < 0)
- flog_err(LIB_ERR_SOCKET, "%s: writev to fd %d failed: %s",
+ flog_err(EC_LIB_SOCKET, "%s: writev to fd %d failed: %s",
__func__, fd, safe_strerror(errno));
#endif /* IOV_MAX */
@@ -439,7 +439,7 @@ in one shot. */
if (ERRNO_IO_RETRY(errno))
/* Calling code should try again later. */
return BUFFER_PENDING;
- flog_err(LIB_ERR_SOCKET, "%s: write error on fd %d: %s",
+ flog_err(EC_LIB_SOCKET, "%s: write error on fd %d: %s",
__func__, fd, safe_strerror(errno));
return BUFFER_ERROR;
}
@@ -448,7 +448,7 @@ in one shot. */
while (written > 0) {
if (!(d = b->head)) {
flog_err(
- LIB_ERR_DEVELOPMENT,
+ EC_LIB_DEVELOPMENT,
"%s: corruption detected: buffer queue empty, but written is %lu",
__func__, (unsigned long)written);
break;
@@ -493,7 +493,7 @@ buffer_status_t buffer_write(struct buffer *b, int fd, const void *p,
if (ERRNO_IO_RETRY(errno))
nbytes = 0;
else {
- flog_err(LIB_ERR_SOCKET, "%s: write error on fd %d: %s",
+ flog_err(EC_LIB_SOCKET, "%s: write error on fd %d: %s",
__func__, fd, safe_strerror(errno));
return BUFFER_ERROR;
}
diff --git a/lib/command.c b/lib/command.c
index 26afc762f..f3c8b1ed0 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -2421,7 +2421,7 @@ static int set_log_file(struct vty *vty, const char *fname, int loglevel)
cwd[MAXPATHLEN] = '\0';
if (getcwd(cwd, MAXPATHLEN) == NULL) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"config_log_file: Unable to alloc mem!");
return CMD_WARNING_CONFIG_FAILED;
}
diff --git a/lib/frr_zmq.c b/lib/frr_zmq.c
index 02d9b68bc..cfea238d9 100644
--- a/lib/frr_zmq.c
+++ b/lib/frr_zmq.c
@@ -141,8 +141,8 @@ static int frrzmq_read_msg(struct thread *t)
return 0;
out_err:
- flog_err(LIB_ERR_ZMQ, "ZeroMQ read error: %s(%d)", strerror(errno),
- errno);
+ flog_err(EC_LIB_ZMQ, "ZeroMQ read error: %s(%d)", strerror(errno),
+ errno);
if (cb->read.cb_error)
cb->read.cb_error(cb->read.arg, cb->zmqsock);
return 1;
@@ -255,8 +255,8 @@ static int frrzmq_write_msg(struct thread *t)
return 0;
out_err:
- flog_err(LIB_ERR_ZMQ, "ZeroMQ write error: %s(%d)", strerror(errno),
- errno);
+ flog_err(EC_LIB_ZMQ, "ZeroMQ write error: %s(%d)", strerror(errno),
+ errno);
if (cb->write.cb_error)
cb->write.cb_error(cb->write.arg, cb->zmqsock);
return 1;
diff --git a/lib/if.c b/lib/if.c
index 2f2073c0a..6fbedde75 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -1159,7 +1159,7 @@ const char *if_link_type_str(enum zebra_link_type llt)
llts(ZEBRA_LLT_IEEE802154, "IEEE 802.15.4");
llts(ZEBRA_LLT_IEEE802154_PHY, "IEEE 802.15.4 Phy");
default:
- flog_err(LIB_ERR_DEVELOPMENT, "Unknown value %d", llt);
+ flog_err(EC_LIB_DEVELOPMENT, "Unknown value %d", llt);
return "Unknown type!";
#undef llts
}
diff --git a/lib/if.h b/lib/if.h
index a861cf2d8..f9c2f7e0b 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -297,35 +297,31 @@ DECLARE_QOBJ_TYPE(interface)
#define IFNAME_RB_INSERT(vrf, ifp) \
if (RB_INSERT(if_name_head, &vrf->ifaces_by_name, (ifp))) \
- flog_err( \
- LIB_ERR_INTERFACE, \
- "%s(%s): corruption detected -- interface with this " \
- "name exists already in VRF %u!", \
- __func__, (ifp)->name, (ifp)->vrf_id);
+ flog_err(EC_LIB_INTERFACE, \
+ "%s(%s): corruption detected -- interface with this " \
+ "name exists already in VRF %u!", \
+ __func__, (ifp)->name, (ifp)->vrf_id);
#define IFNAME_RB_REMOVE(vrf, ifp) \
if (RB_REMOVE(if_name_head, &vrf->ifaces_by_name, (ifp)) == NULL) \
- flog_err( \
- LIB_ERR_INTERFACE, \
- "%s(%s): corruption detected -- interface with this " \
- "name doesn't exist in VRF %u!", \
- __func__, (ifp)->name, (ifp)->vrf_id);
+ flog_err(EC_LIB_INTERFACE, \
+ "%s(%s): corruption detected -- interface with this " \
+ "name doesn't exist in VRF %u!", \
+ __func__, (ifp)->name, (ifp)->vrf_id);
#define IFINDEX_RB_INSERT(vrf, ifp) \
if (RB_INSERT(if_index_head, &vrf->ifaces_by_index, (ifp))) \
- flog_err( \
- LIB_ERR_INTERFACE, \
- "%s(%u): corruption detected -- interface with this " \
- "ifindex exists already in VRF %u!", \
- __func__, (ifp)->ifindex, (ifp)->vrf_id);
+ flog_err(EC_LIB_INTERFACE, \
+ "%s(%u): corruption detected -- interface with this " \
+ "ifindex exists already in VRF %u!", \
+ __func__, (ifp)->ifindex, (ifp)->vrf_id);
#define IFINDEX_RB_REMOVE(vrf, ifp) \
if (RB_REMOVE(if_index_head, &vrf->ifaces_by_index, (ifp)) == NULL) \
- flog_err( \
- LIB_ERR_INTERFACE, \
- "%s(%u): corruption detected -- interface with this " \
- "ifindex doesn't exist in VRF %u!", \
- __func__, (ifp)->ifindex, (ifp)->vrf_id);
+ flog_err(EC_LIB_INTERFACE, \
+ "%s(%u): corruption detected -- interface with this " \
+ "ifindex doesn't exist in VRF %u!", \
+ __func__, (ifp)->ifindex, (ifp)->vrf_id);
#define FOR_ALL_INTERFACES(vrf, ifp) \
if (vrf) \
diff --git a/lib/lib_errors.c b/lib/lib_errors.c
index a608aa9e6..03ad974da 100644
--- a/lib/lib_errors.c
+++ b/lib/lib_errors.c
@@ -27,43 +27,43 @@
/* clang-format off */
static struct log_ref ferr_lib_warn[] = {
{
- .code = LIB_WARN_SNMP,
+ .code = EC_LIB_SNMP,
.title = "SNMP has discovered a warning",
.description = "The SNMP AgentX library has returned a warning that we should report to the end user",
.suggestion = "Gather Log data and open an Issue.",
},
{
- .code = LIB_WARN_STREAM,
+ .code = EC_LIB_STREAM,
.title = "The stream subsystem has encountered an error",
.description = "During sanity checking stream.c has detected an error in the data associated with a particular stream",
.suggestion = "Gather log data and open an Issue, restart FRR",
},
{
- .code = LIB_WARN_LINUX_NS,
+ .code = EC_LIB_LINUX_NS,
.title = "The Linux namespace subsystem has encountered a parsing error",
.description = "During system startup an invalid parameter for the namesapce was give to FRR",
.suggestion = "Gather log data and open an Issue. restart FRR",
},
{
- .code = LIB_WARN_SLOW_THREAD,
+ .code = EC_LIB_SLOW_THREAD,
.title = "The Event subsystem has detected a slow process",
.description = "The Event subsystem has detected a slow process, this typically indicates that FRR is having trouble completing work in a timely manner. This can be either a misconfiguration, bug, or some combination therof.",
.suggestion = "Gather log data and open an Issue",
},
{
- .code = LIB_WARN_RMAP_RECURSION_LIMIT,
+ .code = EC_LIB_RMAP_RECURSION_LIMIT,
.title = "Reached the Route-Map Recursion Limit",
.description = "The Route-Map subsystem has detected a route-map depth of RMAP_RECURSION_LIMIT and has stopped processing",
.suggestion = "Re-work the Route-Map in question to not have so many route-map statements, or recompile FRR with a higher limit",
},
{
- .code = LIB_WARN_BACKUP_CONFIG,
+ .code = EC_LIB_BACKUP_CONFIG,
.title = "Unable to open configuration file",
.description = "The config subsystem attempted to read in it's configuration file which failed, so we are falling back to the backup config file to see if it is available",
.suggestion = "Create configuration file",
},
{
- .code = LIB_WARN_VRF_LENGTH,
+ .code = EC_LIB_VRF_LENGTH,
.title = "The VRF subsystem has encountered a parsing error",
.description = "The VRF subsystem, during initialization, has found a parsing error with input it has received",
.suggestion = "Check the length of the vrf name and adjust accordingly",
@@ -75,85 +75,79 @@ static struct log_ref ferr_lib_warn[] = {
static struct log_ref ferr_lib_err[] = {
{
- .code = LIB_ERR_PRIVILEGES,
+ .code = EC_LIB_PRIVILEGES,
.title = "Failure to raise or lower privileges",
.description = "FRR attempted to raise or lower its privileges and was unable to do so",
.suggestion = "Ensure that you are running FRR as the frr user and that the user has sufficient privileges to properly access root privileges"
},
{
- .code = LIB_ERR_VRF_START,
+ .code = EC_LIB_VRF_START,
.title = "VRF Failure on Start",
.description = "Upon startup FRR failed to properly initialize and startup the VRF subsystem",
.suggestion = "Ensure that there is sufficient memory to start processes and restart FRR",
},
{
- .code = LIB_ERR_SOCKET,
+ .code = EC_LIB_SOCKET,
.title = "Socket Error",
.description = "When attempting to access a socket a system error has occured and we were unable to properly complete the request",
.suggestion = "Ensure that there are sufficient system resources available and ensure that the frr user has sufficient permisions to work. If necessary open an Issue",
},
{
- .code = LIB_ERR_ZAPI_MISSMATCH,
+ .code = EC_LIB_ZAPI_MISSMATCH,
.title = "ZAPI Error",
.description = "A version miss-match has been detected between zebra and client protocol",
.suggestion = "Two different versions of FRR have been installed and the install is not properly setup. Completely stop FRR, remove it from the system and reinstall. Typically only developers should see this issue."
},
{
- .code = LIB_ERR_ZAPI_ENCODE,
+ .code = EC_LIB_ZAPI_ENCODE,
.title = "ZAPI Error",
.description = "The ZAPI subsystem has detected an encoding issue, between zebra and a client protocol",
.suggestion = "Gather data and open an Issue, also Restart FRR"
},
{
- .code = LIB_ERR_ZAPI_SOCKET,
+ .code = EC_LIB_ZAPI_SOCKET,
.title = "ZAPI Error",
.description = "The ZAPI subsystem has detected a socket error between zebra and a client",
.suggestion = "Restart FRR"
},
{
- .code = LIB_ERR_SYSTEM_CALL,
+ .code = EC_LIB_SYSTEM_CALL,
.title = "System Call Error",
.description = "FRR has detected a error from using a vital system call and has probably already exited",
.suggestion = "Ensure permissions are correct for FRR files, users and groups are correct. Additionally check that sufficient system resources are available."
},
{
- .code = LIB_ERR_VTY,
+ .code = EC_LIB_VTY,
.title = "VTY Subsystem Error",
.description = "FRR has detected a problem with the specified configuration file",
.suggestion = "Ensure configuration file exists and has correct permissions for operations Additionally ensure that all config lines are correct as well",
},
{
- .code = LIB_ERR_SNMP,
- .title = "SNMP Subsystem Error",
- .description = "FRR has detected a problem with the snmp library it uses A callback from this subsystem has indicated some error",
- .suggestion = "Examine callback message and ensure snmp is properly setup and working"
- },
- {
- .code = LIB_ERR_INTERFACE,
+ .code = EC_LIB_INTERFACE,
.title = "Interface Subsystem Error",
.description = "FRR has detected a problem with interface data from the kernel as it deviates from what we would expect to happen via normal netlink messaging",
.suggestion = "Open an Issue with all relevant log files and restart FRR"
},
{
- .code = LIB_ERR_NS,
+ .code = EC_LIB_NS,
.title = "NameSpace Subsystem Error",
.description = "FRR has detected a problem with NameSpace data from the kernel as it deviates from what we would expect to happen via normal kernel messaging",
.suggestion = "Open an Issue with all relevant log files and restart FRR"
},
{
- .code = LIB_ERR_DEVELOPMENT,
+ .code = EC_LIB_DEVELOPMENT,
.title = "Developmental Escape Error",
.description = "FRR has detected an issue where new development has not properly updated all code paths.",
.suggestion = "Open an Issue with all relevant log files"
},
{
- .code = LIB_ERR_ZMQ,
+ .code = EC_LIB_ZMQ,
.title = "ZMQ Subsystem Error",
.description = "FRR has detected an issue with the Zero MQ subsystem and ZeroMQ is not working properly now",
.suggestion = "Open an Issue with all relevant log files and restart FRR"
},
{
- .code = LIB_ERR_UNAVAILABLE,
+ .code = EC_LIB_UNAVAILABLE,
.title = "Feature or system unavailable",
.description = "FRR was not compiled with support for a particular feature, or it is not available on the current platform",
.suggestion = "Recompile FRR with the feature enabled, or find out what platforms support the feature"
diff --git a/lib/lib_errors.h b/lib/lib_errors.h
index dcaf888e1..e0f698a07 100644
--- a/lib/lib_errors.h
+++ b/lib/lib_errors.h
@@ -24,27 +24,26 @@
#include "lib/ferr.h"
enum lib_log_refs {
- LIB_ERR_PRIVILEGES = LIB_FERR_START,
- LIB_ERR_VRF_START,
- LIB_ERR_SOCKET,
- LIB_ERR_ZAPI_MISSMATCH,
- LIB_ERR_ZAPI_ENCODE,
- LIB_ERR_ZAPI_SOCKET,
- LIB_ERR_SYSTEM_CALL,
- LIB_ERR_VTY,
- LIB_ERR_SNMP,
- LIB_ERR_INTERFACE,
- LIB_ERR_NS,
- LIB_ERR_DEVELOPMENT,
- LIB_ERR_ZMQ,
- LIB_ERR_UNAVAILABLE,
- LIB_WARN_SNMP,
- LIB_WARN_STREAM,
- LIB_WARN_LINUX_NS,
- LIB_WARN_SLOW_THREAD,
- LIB_WARN_RMAP_RECURSION_LIMIT,
- LIB_WARN_BACKUP_CONFIG,
- LIB_WARN_VRF_LENGTH,
+ EC_LIB_PRIVILEGES = LIB_FERR_START,
+ EC_LIB_VRF_START,
+ EC_LIB_SOCKET,
+ EC_LIB_ZAPI_MISSMATCH,
+ EC_LIB_ZAPI_ENCODE,
+ EC_LIB_ZAPI_SOCKET,
+ EC_LIB_SYSTEM_CALL,
+ EC_LIB_VTY,
+ EC_LIB_INTERFACE,
+ EC_LIB_NS,
+ EC_LIB_DEVELOPMENT,
+ EC_LIB_ZMQ,
+ EC_LIB_UNAVAILABLE,
+ EC_LIB_SNMP,
+ EC_LIB_STREAM,
+ EC_LIB_LINUX_NS,
+ EC_LIB_SLOW_THREAD,
+ EC_LIB_RMAP_RECURSION_LIMIT,
+ EC_LIB_BACKUP_CONFIG,
+ EC_LIB_VRF_LENGTH,
};
extern void lib_error_init(void);
diff --git a/lib/libfrr.c b/lib/libfrr.c
index ecdc27757..69e688261 100644
--- a/lib/libfrr.c
+++ b/lib/libfrr.c
@@ -274,12 +274,14 @@ static void frr_guard_daemon(void)
lock.l_type = F_WRLCK;
lock.l_whence = SEEK_SET;
if (fcntl(fd, F_GETLK, &lock) < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(
+ EC_LIB_SYSTEM_CALL,
"Could not do F_GETLK pid_file %s (%s), exiting",
path, safe_strerror(errno));
exit(1);
} else if (lock.l_type == F_WRLCK) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(
+ EC_LIB_SYSTEM_CALL,
"Process %d has a write lock on file %s already! Error: (%s)",
lock.l_pid, path, safe_strerror(errno));
exit(1);
@@ -543,15 +545,15 @@ static void frr_mkdir(const char *path, bool strip)
if (errno == EEXIST)
return;
- flog_err(LIB_ERR_SYSTEM_CALL, "failed to mkdir \"%s\": %s",
- path, strerror(errno));
+ flog_err(EC_LIB_SYSTEM_CALL, "failed to mkdir \"%s\": %s", path,
+ strerror(errno));
return;
}
zprivs_get_ids(&ids);
if (chown(path, ids.uid_normal, ids.gid_normal))
- flog_err(LIB_ERR_SYSTEM_CALL, "failed to chown \"%s\": %s",
- path, strerror(errno));
+ flog_err(EC_LIB_SYSTEM_CALL, "failed to chown \"%s\": %s", path,
+ strerror(errno));
}
static struct thread_master *master;
@@ -860,7 +862,7 @@ static void frr_terminal_close(int isexit)
nullfd = open("/dev/null", O_RDONLY | O_NOCTTY);
if (nullfd == -1) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"%s: failed to open /dev/null: %s", __func__,
safe_strerror(errno));
} else {
@@ -933,7 +935,7 @@ void frr_run(struct thread_master *master)
} else if (di->daemon_mode) {
int nullfd = open("/dev/null", O_RDONLY | O_NOCTTY);
if (nullfd == -1) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"%s: failed to open /dev/null: %s",
__func__, safe_strerror(errno));
} else {
diff --git a/lib/log.c b/lib/log.c
index 521783e4b..52ea8d900 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -634,7 +634,7 @@ void zlog_backtrace(int priority)
size = backtrace(array, array_size(array));
if (size <= 0 || (size_t)size > array_size(array)) {
flog_err_sys(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"Cannot get backtrace, returned invalid # of frames %d "
"(valid range is between 1 and %lu)",
size, (unsigned long)(array_size(array)));
@@ -642,7 +642,7 @@ void zlog_backtrace(int priority)
}
zlog(priority, "Backtrace for %d stack frames:", size);
if (!(strings = backtrace_symbols(array, size))) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"Cannot get backtrace symbols (out of memory?)");
for (i = 0; i < size; i++)
zlog(priority, "[bt %d] %p", i, array[i]);
@@ -716,7 +716,7 @@ void _zlog_assert_failed(const char *assertion, const char *file,
void memory_oom(size_t size, const char *name)
{
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"out of memory: failed to allocate %zu bytes for %s"
"object",
size, name);
@@ -872,7 +872,7 @@ int zlog_rotate(void)
pthread_mutex_unlock(&loglock);
flog_err_sys(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"Log rotate failed: cannot open file %s for append: %s",
zl->filename, safe_strerror(save_errno));
ret = -1;
@@ -989,8 +989,8 @@ static const struct zebra_desc_table *zroute_lookup(unsigned int zroute)
unsigned int i;
if (zroute >= array_size(route_types)) {
- flog_err(LIB_ERR_DEVELOPMENT, "unknown zebra route type: %u",
- zroute);
+ flog_err(EC_LIB_DEVELOPMENT, "unknown zebra route type: %u",
+ zroute);
return &unknown;
}
if (zroute == route_types[zroute].type)
@@ -1004,9 +1004,8 @@ static const struct zebra_desc_table *zroute_lookup(unsigned int zroute)
return &route_types[i];
}
}
- flog_err(LIB_ERR_DEVELOPMENT,
- "internal error: cannot find route type %u in table!",
- zroute);
+ flog_err(EC_LIB_DEVELOPMENT,
+ "internal error: cannot find route type %u in table!", zroute);
return &unknown;
}
@@ -1023,8 +1022,8 @@ char zebra_route_char(unsigned int zroute)
const char *zserv_command_string(unsigned int command)
{
if (command >= array_size(command_types)) {
- flog_err(LIB_ERR_DEVELOPMENT, "unknown zserv command type: %u",
- command);
+ flog_err(EC_LIB_DEVELOPMENT, "unknown zserv command type: %u",
+ command);
return unknown.string;
}
return command_types[command].string;
diff --git a/lib/netns_linux.c b/lib/netns_linux.c
index e3170fee1..ef2f5dc95 100644
--- a/lib/netns_linux.c
+++ b/lib/netns_linux.c
@@ -219,7 +219,7 @@ static int ns_enable_internal(struct ns *ns, void (*func)(ns_id_t, void *))
}
if (!ns_is_enabled(ns)) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"Can not enable NS %u: %s!", ns->ns_id,
safe_strerror(errno));
return 0;
@@ -227,9 +227,9 @@ static int ns_enable_internal(struct ns *ns, void (*func)(ns_id_t, void *))
/* Non default NS. leave */
if (ns->ns_id == NS_UNKNOWN) {
- flog_err(LIB_ERR_NS,
- "Can not enable NS %s %u: Invalid NSID",
- ns->name, ns->ns_id);
+ flog_err(EC_LIB_NS,
+ "Can not enable NS %s %u: Invalid NSID",
+ ns->name, ns->ns_id);
return 0;
}
if (func)
@@ -441,7 +441,7 @@ char *ns_netns_pathname(struct vty *vty, const char *name)
pathname,
safe_strerror(errno));
else
- flog_warn(LIB_WARN_LINUX_NS,
+ flog_warn(EC_LIB_LINUX_NS,
"Invalid pathname for %s: %s", pathname,
safe_strerror(errno));
return NULL;
@@ -452,7 +452,7 @@ char *ns_netns_pathname(struct vty *vty, const char *name)
vty_out(vty, "NS name (%s) invalid: too long (>%d)\n",
check_base, NS_NAMSIZ - 1);
else
- flog_warn(LIB_WARN_LINUX_NS,
+ flog_warn(EC_LIB_LINUX_NS,
"NS name (%s) invalid: too long (>%d)",
check_base, NS_NAMSIZ - 1);
return NULL;
@@ -487,8 +487,8 @@ void ns_init_management(ns_id_t default_ns_id, ns_id_t internal_ns)
ns_init();
default_ns = ns_get_created_internal(NULL, NULL, default_ns_id);
if (!default_ns) {
- flog_err(LIB_ERR_NS, "%s: failed to create the default NS!",
- __func__);
+ flog_err(EC_LIB_NS, "%s: failed to create the default NS!",
+ __func__);
exit(1);
}
if (have_netns()) {
@@ -505,8 +505,8 @@ void ns_init_management(ns_id_t default_ns_id, ns_id_t internal_ns)
/* Enable the default NS. */
if (!ns_enable(default_ns, NULL)) {
- flog_err(LIB_ERR_NS, "%s: failed to enable the default NS!",
- __func__);
+ flog_err(EC_LIB_NS, "%s: failed to enable the default NS!",
+ __func__);
exit(1);
}
}
diff --git a/lib/network.c b/lib/network.c
index 41bd321bc..411661a5e 100644
--- a/lib/network.c
+++ b/lib/network.c
@@ -79,13 +79,13 @@ int set_nonblocking(int fd)
should
never be negative. */
if ((flags = fcntl(fd, F_GETFL)) < 0) {
- flog_err(LIB_ERR_SYSTEM_CALL,
+ flog_err(EC_LIB_SYSTEM_CALL,
"fcntl(F_GETFL) failed for fd %d: %s", fd,
safe_strerror(errno));
return -1;
}
if (fcntl(fd, F_SETFL, (flags | O_NONBLOCK)) < 0) {
- flog_err(LIB_ERR_SYSTEM_CALL,
+ flog_err(EC_LIB_SYSTEM_CALL,
"fcntl failed setting fd %d non-blocking: %s", fd,
safe_strerror(errno));
return -1;
diff --git a/lib/pid_output.c b/lib/pid_output.c
index c6120de86..b0643c4fe 100644
--- a/lib/pid_output.c
+++ b/lib/pid_output.c
@@ -42,7 +42,7 @@ pid_t pid_output(const char *path)
oldumask = umask(0777 & ~PIDFILE_MASK);
fd = open(path, O_RDWR | O_CREAT, PIDFILE_MASK);
if (fd < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"Can't create pid lock file %s (%s), exiting",
path, safe_strerror(errno));
umask(oldumask);
@@ -59,7 +59,7 @@ pid_t pid_output(const char *path)
lock.l_whence = SEEK_SET;
if (fcntl(fd, F_SETLK, &lock) < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"Could not lock pid_file %s (%s), exiting",
path, safe_strerror(errno));
exit(1);
@@ -69,12 +69,12 @@ pid_t pid_output(const char *path)
pidsize = strlen(buf);
if ((tmp = write(fd, buf, pidsize)) != (int)pidsize)
flog_err_sys(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"Could not write pid %d to pid_file %s, rc was %d: %s",
(int)pid, path, tmp, safe_strerror(errno));
else if (ftruncate(fd, pidsize) < 0)
flog_err_sys(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"Could not truncate pid_file %s to %u bytes: %s",
path, (unsigned int)pidsize,
safe_strerror(errno));
diff --git a/lib/prefix.c b/lib/prefix.c
index a7f4fda1b..21c3af7d4 100644
--- a/lib/prefix.c
+++ b/lib/prefix.c
@@ -657,9 +657,9 @@ void prefix_copy(struct prefix *dest, const struct prefix *src)
memcpy((void *)dest->u.prefix_flowspec.ptr,
(void *)src->u.prefix_flowspec.ptr, len);
} else {
- flog_err(LIB_ERR_DEVELOPMENT,
- "prefix_copy(): Unknown address family %d",
- src->family);
+ flog_err(EC_LIB_DEVELOPMENT,
+ "prefix_copy(): Unknown address family %d",
+ src->family);
assert(0);
}
}
diff --git a/lib/privs.c b/lib/privs.c
index d77a63a2d..838ff8fc9 100644
--- a/lib/privs.c
+++ b/lib/privs.c
@@ -290,7 +290,7 @@ zebra_privs_current_t zprivs_state_caps(void)
zprivs_state.syscaps_p->caps[i], CAP_EFFECTIVE,
&val)) {
flog_err(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"zprivs_state_caps: could not cap_get_flag, %s",
safe_strerror(errno));
return ZPRIVS_UNKNOWN;
diff --git a/lib/routemap.c b/lib/routemap.c
index 9e3dd3c0a..66c15b9f2 100644
--- a/lib/routemap.c
+++ b/lib/routemap.c
@@ -1447,7 +1447,7 @@ route_map_result_t route_map_apply(struct route_map *map,
if (recursion > RMAP_RECURSION_LIMIT) {
flog_warn(
- LIB_WARN_RMAP_RECURSION_LIMIT,
+ EC_LIB_RMAP_RECURSION_LIMIT,
"route-map recursion limit (%d) reached, discarding route",
RMAP_RECURSION_LIMIT);
recursion = 0;
diff --git a/lib/sigevent.c b/lib/sigevent.c
index 115781af5..57b41503e 100644
--- a/lib/sigevent.c
+++ b/lib/sigevent.c
@@ -84,7 +84,7 @@ int quagga_sigevent_process(void)
sigdelset(&newmask, SIGKILL);
if ((sigprocmask(SIG_BLOCK, &newmask, &oldmask)) < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"quagga_signal_timer: couldnt block signals!");
return -1;
}
@@ -330,7 +330,7 @@ static void trap_default_signals(void)
if (sigaction(sigmap[i].sigs[j], &act, NULL)
< 0)
flog_err(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"Unable to set signal handler for signal %d: %s",
sigmap[i].sigs[j],
safe_strerror(errno));
diff --git a/lib/skiplist.c b/lib/skiplist.c
index 585cf859e..3933429c3 100644
--- a/lib/skiplist.c
+++ b/lib/skiplist.c
@@ -183,8 +183,8 @@ int skiplist_insert(register struct skiplist *l, register void *key,
/* DEBUG */
if (!key) {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: key is 0, value is %p",
- __func__, value);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: key is 0, value is %p",
+ __func__, value);
}
p = l->header;
diff --git a/lib/sockopt.c b/lib/sockopt.c
index 25e9973e5..ea04f2a43 100644
--- a/lib/sockopt.c
+++ b/lib/sockopt.c
@@ -38,7 +38,7 @@ void setsockopt_so_recvbuf(int sock, int size)
size /= 2;
if (size != orig_req)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"%s: fd %d: SO_RCVBUF set to %d (requested %d)",
__func__, sock, size, orig_req);
}
@@ -52,7 +52,7 @@ void setsockopt_so_sendbuf(const int sock, int size)
size /= 2;
if (size != orig_req)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"%s: fd %d: SO_SNDBUF set to %d (requested %d)",
__func__, sock, size, orig_req);
}
@@ -64,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;
@@ -94,13 +94,13 @@ int setsockopt_ipv6_pktinfo(int sock, int val)
ret = setsockopt(sock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &val,
sizeof(val));
if (ret < 0)
- flog_err(LIB_ERR_SOCKET,
+ 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)
- flog_err(LIB_ERR_SOCKET, "can't setsockopt IPV6_PKTINFO : %s",
+ flog_err(EC_LIB_SOCKET, "can't setsockopt IPV6_PKTINFO : %s",
safe_strerror(errno));
#endif /* INIA_IPV6 */
return ret;
@@ -117,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)
- flog_err(LIB_ERR_SOCKET, "can't setsockopt IPV6_CHECKSUM");
+ flog_err(EC_LIB_SOCKET, "can't setsockopt IPV6_CHECKSUM");
return ret;
}
@@ -129,8 +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)
- flog_err(LIB_ERR_SOCKET,
- "can't setsockopt IPV6_MULTICAST_HOPS");
+ flog_err(EC_LIB_SOCKET, "can't setsockopt IPV6_MULTICAST_HOPS");
return ret;
}
@@ -142,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)
- flog_err(LIB_ERR_SOCKET, "can't setsockopt IPV6_UNICAST_HOPS");
+ flog_err(EC_LIB_SOCKET, "can't setsockopt IPV6_UNICAST_HOPS");
return ret;
}
@@ -154,11 +153,11 @@ int setsockopt_ipv6_hoplimit(int sock, int val)
ret = setsockopt(sock, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &val,
sizeof(val));
if (ret < 0)
- flog_err(LIB_ERR_SOCKET, "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)
- flog_err(LIB_ERR_SOCKET, "can't setsockopt IPV6_HOPLIMIT");
+ flog_err(EC_LIB_SOCKET, "can't setsockopt IPV6_HOPLIMIT");
#endif
return ret;
}
@@ -171,8 +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)
- flog_err(LIB_ERR_SOCKET,
- "can't setsockopt IPV6_MULTICAST_LOOP");
+ flog_err(EC_LIB_SOCKET, "can't setsockopt IPV6_MULTICAST_LOOP");
return ret;
}
@@ -193,7 +191,7 @@ int setsockopt_ipv6_tclass(int sock, int tclass)
ret = setsockopt(sock, IPPROTO_IPV6, IPV6_TCLASS, &tclass,
sizeof(tclass));
if (ret < 0)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"Can't set IPV6_TCLASS option for fd %d to %#x: %s",
sock, tclass, safe_strerror(errno));
#endif
@@ -397,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)
- flog_err(LIB_ERR_SOCKET, "can't setsockopt IP_MULTICAST_LOOP");
+ flog_err(EC_LIB_SOCKET, "can't setsockopt IP_MULTICAST_LOOP");
return ret;
}
@@ -409,13 +407,13 @@ 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)
- flog_err(LIB_ERR_SOCKET,
+ 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)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"Can't set IP_RECVIF option for fd %d to %d: %s", sock,
val, safe_strerror(errno));
#else
@@ -435,7 +433,7 @@ int setsockopt_ipv4_tos(int sock, int tos)
ret = setsockopt(sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos));
if (ret < 0)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"Can't set IP_TOS option for fd %d to %#x: %s", sock,
tos, safe_strerror(errno));
return ret;
@@ -454,7 +452,7 @@ int setsockopt_ifindex(int af, int sock, ifindex_t val)
ret = setsockopt_ipv6_pktinfo(sock, val);
break;
default:
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"setsockopt_ifindex: unknown address family %d", af);
}
return ret;
@@ -544,7 +542,7 @@ ifindex_t getsockopt_ifindex(int af, struct msghdr *msgh)
return (getsockopt_ipv6_ifindex(msgh));
break;
default:
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"getsockopt_ifindex: unknown address family %d", af);
return 0;
}
@@ -660,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));
}
diff --git a/lib/sockunion.c b/lib/sockunion.c
index f4e806e92..bee82a067 100644
--- a/lib/sockunion.c
+++ b/lib/sockunion.c
@@ -140,7 +140,7 @@ int sockunion_socket(const union sockunion *su)
sock = socket(su->sa.sa_family, SOCK_STREAM, 0);
if (sock < 0) {
char buf[SU_ADDRSTRLEN];
- flog_err(LIB_ERR_SOCKET, "Can't make socket for %s : %s",
+ flog_err(EC_LIB_SOCKET, "Can't make socket for %s : %s",
sockunion_log(su, buf, SU_ADDRSTRLEN),
safe_strerror(errno));
return -1;
@@ -235,7 +235,7 @@ int sockunion_stream_socket(union sockunion *su)
sock = socket(su->sa.sa_family, SOCK_STREAM, 0);
if (sock < 0)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"can't make socket sockunion_stream_socket");
return sock;
@@ -274,7 +274,7 @@ int sockunion_bind(int sock, union sockunion *su, unsigned short port,
ret = bind(sock, (struct sockaddr *)su, size);
if (ret < 0) {
char buf[SU_ADDRSTRLEN];
- flog_err(LIB_ERR_SOCKET, "can't bind socket for %s : %s",
+ flog_err(EC_LIB_SOCKET, "can't bind socket for %s : %s",
sockunion_log(su, buf, SU_ADDRSTRLEN),
safe_strerror(errno));
}
@@ -290,7 +290,7 @@ int sockopt_reuseaddr(int sock)
ret = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *)&on,
sizeof(on));
if (ret < 0) {
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"can't set sockopt SO_REUSEADDR to socket %d", sock);
return -1;
}
@@ -306,7 +306,7 @@ int sockopt_reuseport(int sock)
ret = setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, (void *)&on,
sizeof(on));
if (ret < 0) {
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"can't set sockopt SO_REUSEPORT to socket %d", sock);
return -1;
}
@@ -328,7 +328,7 @@ int sockopt_ttl(int family, int sock, int ttl)
ret = setsockopt(sock, IPPROTO_IP, IP_TTL, (void *)&ttl,
sizeof(int));
if (ret < 0) {
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"can't set sockopt IP_TTL %d to socket %d",
ttl, sock);
return -1;
@@ -341,7 +341,7 @@ int sockopt_ttl(int family, int sock, int ttl)
(void *)&ttl, sizeof(int));
if (ret < 0) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"can't set sockopt IPV6_UNICAST_HOPS %d to socket %d",
ttl, sock);
return -1;
@@ -389,7 +389,7 @@ int sockopt_minttl(int family, int sock, int minttl)
sizeof(minttl));
if (ret < 0)
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"can't set sockopt IP_MINTTL to %d on socket %d: %s",
minttl, sock, safe_strerror(errno));
return ret;
@@ -401,7 +401,7 @@ int sockopt_minttl(int family, int sock, int minttl)
&minttl, sizeof(minttl));
if (ret < 0)
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"can't set sockopt IPV6_MINHOPCOUNT to %d on socket %d: %s",
minttl, sock, safe_strerror(errno));
return ret;
@@ -421,7 +421,7 @@ int sockopt_v6only(int family, int sock)
ret = setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&on,
sizeof(int));
if (ret < 0) {
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"can't set sockopt IPV6_V6ONLY "
"to socket %d",
sock);
@@ -539,7 +539,7 @@ union sockunion *sockunion_getsockname(int fd)
ret = getsockname(fd, (struct sockaddr *)&name, &len);
if (ret < 0) {
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"Can't get local address and port by getsockname: %s",
safe_strerror(errno));
return NULL;
@@ -576,8 +576,7 @@ union sockunion *sockunion_getpeername(int fd)
len = sizeof name;
ret = getpeername(fd, (struct sockaddr *)&name, &len);
if (ret < 0) {
- flog_err(LIB_ERR_SOCKET,
- "Can't get remote address and port: %s",
+ flog_err(EC_LIB_SOCKET, "Can't get remote address and port: %s",
safe_strerror(errno));
return NULL;
}
diff --git a/lib/stream.c b/lib/stream.c
index 8424a941d..6c187bd35 100644
--- a/lib/stream.c
+++ b/lib/stream.c
@@ -54,7 +54,7 @@ DEFINE_MTYPE_STATIC(LIB, STREAM_FIFO, "Stream FIFO")
* using stream_put..._at() functions.
*/
#define STREAM_WARN_OFFSETS(S) \
- flog_warn(LIB_WARN_STREAM, \
+ flog_warn(EC_LIB_STREAM, \
"&(struct stream): %p, size: %lu, getp: %lu, endp: %lu\n", \
(void *)(S), (unsigned long)(S)->size, \
(unsigned long)(S)->getp, (unsigned long)(S)->endp)
@@ -69,7 +69,7 @@ DEFINE_MTYPE_STATIC(LIB, STREAM_FIFO, "Stream FIFO")
#define STREAM_BOUND_WARN(S, WHAT) \
do { \
- flog_warn(LIB_WARN_STREAM, "%s: Attempt to %s out of bounds", \
+ flog_warn(EC_LIB_STREAM, "%s: Attempt to %s out of bounds", \
__func__, (WHAT)); \
STREAM_WARN_OFFSETS(S); \
assert(0); \
@@ -77,7 +77,7 @@ DEFINE_MTYPE_STATIC(LIB, STREAM_FIFO, "Stream FIFO")
#define STREAM_BOUND_WARN2(S, WHAT) \
do { \
- flog_warn(LIB_WARN_STREAM, "%s: Attempt to %s out of bounds", \
+ flog_warn(EC_LIB_STREAM, "%s: Attempt to %s out of bounds", \
__func__, (WHAT)); \
STREAM_WARN_OFFSETS(S); \
} while (0)
@@ -87,7 +87,7 @@ DEFINE_MTYPE_STATIC(LIB, STREAM_FIFO, "Stream FIFO")
do { \
if (((S)->endp + (Z)) > (S)->size) { \
flog_warn( \
- LIB_WARN_STREAM, \
+ EC_LIB_STREAM, \
"CHECK_SIZE: truncating requested size %lu\n", \
(unsigned long)(Z)); \
STREAM_WARN_OFFSETS(S); \
@@ -968,7 +968,7 @@ ssize_t stream_read_try(struct stream *s, int fd, size_t size)
/* Error: was it transient (return -2) or fatal (return -1)? */
if (ERRNO_IO_RETRY(errno))
return -2;
- flog_err(LIB_ERR_SOCKET, "%s: read failed on fd %d: %s", __func__, fd,
+ flog_err(EC_LIB_SOCKET, "%s: read failed on fd %d: %s", __func__, fd,
safe_strerror(errno));
return -1;
}
@@ -999,7 +999,7 @@ ssize_t stream_recvfrom(struct stream *s, int fd, size_t size, int flags,
/* Error: was it transient (return -2) or fatal (return -1)? */
if (ERRNO_IO_RETRY(errno))
return -2;
- flog_err(LIB_ERR_SOCKET, "%s: read failed on fd %d: %s", __func__, fd,
+ flog_err(EC_LIB_SOCKET, "%s: read failed on fd %d: %s", __func__, fd,
safe_strerror(errno));
return -1;
}
diff --git a/lib/thread.c b/lib/thread.c
index b2740baf5..2c3db27c7 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -1481,7 +1481,7 @@ struct thread *thread_fetch(struct thread_master *m, struct thread *fetch)
}
/* else die */
- flog_err(LIB_ERR_SYSTEM_CALL, "poll() error: %s",
+ flog_err(EC_LIB_SYSTEM_CALL, "poll() error: %s",
safe_strerror(errno));
pthread_mutex_unlock(&m->mtx);
fetch = NULL;
@@ -1620,7 +1620,7 @@ void thread_call(struct thread *thread)
* to fix.
*/
flog_warn(
- LIB_WARN_SLOW_THREAD,
+ EC_LIB_SLOW_THREAD,
"SLOW THREAD: task %s (%lx) ran for %lums (cpu time %lums)",
thread->funcname, (unsigned long)thread->func,
realtime / 1000, cputime / 1000);
diff --git a/lib/vrf.c b/lib/vrf.c
index 4b7e84275..eca9913e1 100644
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -489,8 +489,8 @@ void vrf_init(int (*create)(struct vrf *), int (*enable)(struct vrf *),
/* The default VRF always exists. */
default_vrf = vrf_get(VRF_DEFAULT, VRF_DEFAULT_NAME);
if (!default_vrf) {
- flog_err(LIB_ERR_VRF_START,
- "vrf_init: failed to create the default VRF!");
+ flog_err(EC_LIB_VRF_START,
+ "vrf_init: failed to create the default VRF!");
exit(1);
}
if (vrf_is_backend_netns()) {
@@ -505,8 +505,8 @@ void vrf_init(int (*create)(struct vrf *), int (*enable)(struct vrf *),
/* Enable the default VRF. */
if (!vrf_enable(default_vrf)) {
- flog_err(LIB_ERR_VRF_START,
- "vrf_init: failed to enable the default VRF!");
+ flog_err(EC_LIB_VRF_START,
+ "vrf_init: failed to enable the default VRF!");
exit(1);
}
@@ -576,7 +576,7 @@ int vrf_socket(int domain, int type, int protocol, vrf_id_t vrf_id,
ret = vrf_switch_to_netns(vrf_id);
if (ret < 0)
- flog_err_sys(LIB_ERR_SOCKET, "%s: Can't switch to VRF %u (%s)",
+ flog_err_sys(EC_LIB_SOCKET, "%s: Can't switch to VRF %u (%s)",
__func__, vrf_id, safe_strerror(errno));
if (ret > 0 && interfacename && vrf_default_accepts_vrf(type)) {
@@ -590,7 +590,7 @@ int vrf_socket(int domain, int type, int protocol, vrf_id_t vrf_id,
save_errno = errno;
ret2 = vrf_switchback_to_initial();
if (ret2 < 0)
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s: Can't switchback from VRF %u (%s)", __func__,
vrf_id, safe_strerror(errno));
errno = save_errno;
@@ -631,7 +631,7 @@ int vrf_handler_create(struct vty *vty, const char *vrfname,
vrfname, VRF_NAMSIZ);
else
flog_warn(
- LIB_WARN_VRF_LENGTH,
+ EC_LIB_VRF_LENGTH,
"%% VRF name %s invalid: length exceeds %d bytes\n",
vrfname, VRF_NAMSIZ);
return CMD_WARNING_CONFIG_FAILED;
@@ -961,13 +961,13 @@ int vrf_getaddrinfo(const char *node, const char *service,
ret = vrf_switch_to_netns(vrf_id);
if (ret < 0)
- flog_err_sys(LIB_ERR_SOCKET, "%s: Can't switch to VRF %u (%s)",
+ flog_err_sys(EC_LIB_SOCKET, "%s: Can't switch to VRF %u (%s)",
__func__, vrf_id, safe_strerror(errno));
ret = getaddrinfo(node, service, hints, res);
save_errno = errno;
ret2 = vrf_switchback_to_initial();
if (ret2 < 0)
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s: Can't switchback from VRF %u (%s)", __func__,
vrf_id, safe_strerror(errno));
errno = save_errno;
@@ -980,7 +980,7 @@ int vrf_ioctl(vrf_id_t vrf_id, int d, unsigned long request, char *params)
ret = vrf_switch_to_netns(vrf_id);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "%s: Can't switch to VRF %u (%s)",
+ flog_err_sys(EC_LIB_SOCKET, "%s: Can't switch to VRF %u (%s)",
__func__, vrf_id, safe_strerror(errno));
return 0;
}
@@ -988,7 +988,7 @@ int vrf_ioctl(vrf_id_t vrf_id, int d, unsigned long request, char *params)
saved_errno = errno;
ret = vrf_switchback_to_initial();
if (ret < 0)
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s: Can't switchback from VRF %u (%s)", __func__,
vrf_id, safe_strerror(errno));
errno = saved_errno;
@@ -1002,13 +1002,13 @@ int vrf_sockunion_socket(const union sockunion *su, vrf_id_t vrf_id,
ret = vrf_switch_to_netns(vrf_id);
if (ret < 0)
- flog_err_sys(LIB_ERR_SOCKET, "%s: Can't switch to VRF %u (%s)",
+ flog_err_sys(EC_LIB_SOCKET, "%s: Can't switch to VRF %u (%s)",
__func__, vrf_id, safe_strerror(errno));
ret = sockunion_socket(su);
save_errno = errno;
ret2 = vrf_switchback_to_initial();
if (ret2 < 0)
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s: Can't switchback from VRF %u (%s)", __func__,
vrf_id, safe_strerror(errno));
errno = save_errno;
diff --git a/lib/vty.c b/lib/vty.c
index 921f92df1..f812dd427 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -314,7 +314,7 @@ static int vty_log_out(struct vty *vty, const char *level,
/* Fatal I/O error. */
vty->monitor =
0; /* disable monitoring to avoid infinite recursion */
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"%s: write failed to vty client fd %d, closing: %s",
__func__, vty->fd, safe_strerror(errno));
buffer_reset(vty->obuf);
@@ -536,7 +536,7 @@ static int vty_command(struct vty *vty, char *buf)
> CONSUMED_TIME_CHECK)
/* Warn about CPU hog that must be fixed. */
flog_warn(
- LIB_WARN_SLOW_THREAD,
+ EC_LIB_SLOW_THREAD,
"SLOW COMMAND: command took %lums (cpu time %lums): %s",
realtime / 1000, cputime / 1000, buf);
}
@@ -1329,14 +1329,14 @@ static int vty_telnet_option(struct vty *vty, unsigned char *buf, int nbytes)
case TELOPT_NAWS:
if (vty->sb_len != TELNET_NAWS_SB_LEN)
flog_err(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"RFC 1073 violation detected: telnet NAWS option "
"should send %d characters, but we received %lu",
TELNET_NAWS_SB_LEN,
(unsigned long)vty->sb_len);
else if (sizeof(vty->sb_buf) < TELNET_NAWS_SB_LEN)
flog_err(
- LIB_ERR_DEVELOPMENT,
+ EC_LIB_DEVELOPMENT,
"Bug detected: sizeof(vty->sb_buf) %lu < %d, too small to handle the telnet NAWS option",
(unsigned long)sizeof(vty->sb_buf),
TELNET_NAWS_SB_LEN);
@@ -1452,7 +1452,7 @@ static int vty_read(struct thread *thread)
vty->monitor = 0; /* disable monitoring to avoid
infinite recursion */
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%s: read error on vty client fd %d, closing: %s",
__func__, vty->fd, safe_strerror(errno));
buffer_reset(vty->obuf);
@@ -1906,7 +1906,7 @@ static int vty_accept(struct thread *thread)
/* We can handle IPv4 or IPv6 socket. */
vty_sock = sockunion_accept(accept_sock, &su);
if (vty_sock < 0) {
- flog_err(LIB_ERR_SOCKET, "can't accept vty socket : %s",
+ flog_err(EC_LIB_SOCKET, "can't accept vty socket : %s",
safe_strerror(errno));
return -1;
}
@@ -1980,7 +1980,7 @@ static void vty_serv_sock_addrinfo(const char *hostname, unsigned short port)
ret = getaddrinfo(hostname, port_str, &req, &ainfo);
if (ret != 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "getaddrinfo failed: %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "getaddrinfo failed: %s",
gai_strerror(ret));
exit(1);
}
@@ -2041,7 +2041,7 @@ static void vty_serv_un(const char *path)
/* Make UNIX domain socket. */
sock = socket(AF_UNIX, SOCK_STREAM, 0);
if (sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"Cannot create unix stream socket: %s",
safe_strerror(errno));
return;
@@ -2061,7 +2061,7 @@ static void vty_serv_un(const char *path)
ret = bind(sock, (struct sockaddr *)&serv, len);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "Cannot bind path %s: %s", path,
+ flog_err_sys(EC_LIB_SOCKET, "Cannot bind path %s: %s", path,
safe_strerror(errno));
close(sock); /* Avoid sd leak. */
return;
@@ -2069,7 +2069,7 @@ static void vty_serv_un(const char *path)
ret = listen(sock, 5);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "listen(fd %d) failed: %s", sock,
+ flog_err_sys(EC_LIB_SOCKET, "listen(fd %d) failed: %s", sock,
safe_strerror(errno));
close(sock); /* Avoid sd leak. */
return;
@@ -2085,7 +2085,7 @@ static void vty_serv_un(const char *path)
if ((int)ids.gid_vty > 0) {
/* set group of socket */
if (chown(path, -1, ids.gid_vty)) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"vty_serv_un: could chown socket, %s",
safe_strerror(errno));
}
@@ -2115,14 +2115,14 @@ static int vtysh_accept(struct thread *thread)
(socklen_t *)&client_len);
if (sock < 0) {
- flog_err(LIB_ERR_SOCKET, "can't accept vty socket : %s",
+ flog_err(EC_LIB_SOCKET, "can't accept vty socket : %s",
safe_strerror(errno));
return -1;
}
if (set_nonblocking(sock) < 0) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"vtysh_accept: could not set vty socket %d to non-blocking, %s, closing",
sock, safe_strerror(errno));
close(sock);
@@ -2154,7 +2154,7 @@ static int vtysh_flush(struct vty *vty)
case BUFFER_ERROR:
vty->monitor =
0; /* disable monitoring to avoid infinite recursion */
- flog_err(LIB_ERR_SOCKET, "%s: write error to fd %d, closing",
+ flog_err(EC_LIB_SOCKET, "%s: write error to fd %d, closing",
__func__, vty->fd);
buffer_reset(vty->lbuf);
buffer_reset(vty->obuf);
@@ -2190,7 +2190,7 @@ static int vtysh_read(struct thread *thread)
vty->monitor = 0; /* disable monitoring to avoid
infinite recursion */
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%s: read failed on vtysh client fd %d, closing: %s",
__func__, sock, safe_strerror(errno));
}
@@ -2420,9 +2420,8 @@ static void vty_read_file(FILE *confp)
nl = strchr(vty->error_buf, '\n');
if (nl)
*nl = '\0';
- flog_err(LIB_ERR_VTY,
- "ERROR: %s on config line %u: %s", message, line_num,
- vty->error_buf);
+ flog_err(EC_LIB_VTY, "ERROR: %s on config line %u: %s", message,
+ line_num, vty->error_buf);
}
vty_close(vty);
@@ -2496,7 +2495,7 @@ bool vty_read_config(const char *config_file, char *config_default_dir)
if (!IS_DIRECTORY_SEP(config_file[0])) {
if (getcwd(cwd, MAXPATHLEN) == NULL) {
flog_err_sys(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"Failure to determine Current Working Directory %d!",
errno);
exit(1);
@@ -2512,19 +2511,19 @@ bool vty_read_config(const char *config_file, char *config_default_dir)
if (confp == NULL) {
flog_warn(
- LIB_WARN_BACKUP_CONFIG,
+ EC_LIB_BACKUP_CONFIG,
"%s: failed to open configuration file %s: %s, checking backup",
__func__, fullpath, safe_strerror(errno));
confp = vty_use_backup_config(fullpath);
if (confp)
flog_warn(
- LIB_WARN_BACKUP_CONFIG,
+ EC_LIB_BACKUP_CONFIG,
"WARNING: using backup configuration file!");
else {
- flog_err(LIB_ERR_VTY,
- "can't open configuration file [%s]",
- config_file);
+ flog_err(EC_LIB_VTY,
+ "can't open configuration file [%s]",
+ config_file);
exit(1);
}
}
@@ -2561,7 +2560,7 @@ bool vty_read_config(const char *config_file, char *config_default_dir)
confp = fopen(config_default_dir, "r");
if (confp == NULL) {
flog_err(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"%s: failed to open configuration file %s: %s, checking backup",
__func__, config_default_dir,
safe_strerror(errno));
@@ -2569,13 +2568,13 @@ bool vty_read_config(const char *config_file, char *config_default_dir)
confp = vty_use_backup_config(config_default_dir);
if (confp) {
flog_warn(
- LIB_WARN_BACKUP_CONFIG,
+ EC_LIB_BACKUP_CONFIG,
"WARNING: using backup configuration file!");
fullpath = config_default_dir;
} else {
- flog_err(LIB_ERR_VTY,
- "can't open configuration file [%s]",
- config_default_dir);
+ flog_err(EC_LIB_VTY,
+ "can't open configuration file [%s]",
+ config_default_dir);
goto tmp_free_and_out;
}
} else
@@ -3088,13 +3087,13 @@ static void vty_save_cwd(void)
* Hence not worrying about it too much.
*/
if (!chdir(SYSCONFDIR)) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"Failure to chdir to %s, errno: %d",
SYSCONFDIR, errno);
exit(-1);
}
if (getcwd(cwd, MAXPATHLEN) == NULL) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"Failure to getcwd, errno: %d", errno);
exit(-1);
}
diff --git a/lib/zclient.c b/lib/zclient.c
index 340eb0db3..1cdf4ff22 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -250,7 +250,7 @@ static int zclient_flush_data(struct thread *thread)
switch (buffer_flush_available(zclient->wb, zclient->sock)) {
case BUFFER_ERROR:
flog_err(
- LIB_ERR_ZAPI_SOCKET,
+ EC_LIB_ZAPI_SOCKET,
"%s: buffer_flush_available failed on zclient fd %d, closing",
__func__, zclient->sock);
return zclient_failed(zclient);
@@ -274,7 +274,7 @@ int zclient_send_message(struct zclient *zclient)
STREAM_DATA(zclient->obuf),
stream_get_endp(zclient->obuf))) {
case BUFFER_ERROR:
- flog_err(LIB_ERR_ZAPI_SOCKET,
+ flog_err(EC_LIB_ZAPI_SOCKET,
"%s: buffer_write failed to zclient fd %d, closing",
__func__, zclient->sock);
return zclient_failed(zclient);
@@ -315,9 +315,10 @@ int zclient_read_header(struct stream *s, int sock, uint16_t *size,
STREAM_GETW(s, *cmd);
if (*version != ZSERV_VERSION || *marker != ZEBRA_HEADER_MARKER) {
- flog_err(LIB_ERR_ZAPI_MISSMATCH,
- "%s: socket %d version mismatch, marker %d, version %d",
- __func__, sock, *marker, *version);
+ flog_err(
+ EC_LIB_ZAPI_MISSMATCH,
+ "%s: socket %d version mismatch, marker %d, version %d",
+ __func__, sock, *marker, *version);
return -1;
}
@@ -577,7 +578,7 @@ int zclient_start(struct zclient *zclient)
}
if (set_nonblocking(zclient->sock) < 0)
- flog_err(LIB_ERR_ZAPI_SOCKET, "%s: set_nonblocking(%d) failed",
+ flog_err(EC_LIB_ZAPI_SOCKET, "%s: set_nonblocking(%d) failed",
__func__, zclient->sock);
/* Clear fail count. */
@@ -774,7 +775,7 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api)
prefix2str(&api->prefix, buf, sizeof(buf));
flog_err(
- LIB_ERR_ZAPI_ENCODE,
+ EC_LIB_ZAPI_ENCODE,
"%s: prefix %s: can't encode %u nexthops (maximum is %u)",
__func__, buf, api->nexthop_num, MULTIPATH_NUM);
return -1;
@@ -818,12 +819,12 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api)
char buf[PREFIX2STR_BUFFER];
prefix2str(&api->prefix, buf,
sizeof(buf));
- flog_err(LIB_ERR_ZAPI_ENCODE,
- "%s: prefix %s: can't encode "
- "%u labels (maximum is %u)",
- __func__, buf,
- api_nh->label_num,
- MPLS_MAX_LABELS);
+ flog_err(EC_LIB_ZAPI_ENCODE,
+ "%s: prefix %s: can't encode "
+ "%u labels (maximum is %u)",
+ __func__, buf,
+ api_nh->label_num,
+ MPLS_MAX_LABELS);
return -1;
}
@@ -868,7 +869,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
/* Type, flags, message. */
STREAM_GETC(s, api->type);
if (api->type > ZEBRA_ROUTE_MAX) {
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"%s: Specified route type: %d is not a legal value\n",
__PRETTY_FUNCTION__, api->type);
return -1;
@@ -886,7 +887,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
case AF_INET:
if (api->prefix.prefixlen > IPV4_MAX_PREFIXLEN) {
flog_err(
- LIB_ERR_ZAPI_ENCODE,
+ EC_LIB_ZAPI_ENCODE,
"%s: V4 prefixlen is %d which should not be more than 32",
__PRETTY_FUNCTION__, api->prefix.prefixlen);
return -1;
@@ -895,14 +896,14 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
case AF_INET6:
if (api->prefix.prefixlen > IPV6_MAX_PREFIXLEN) {
flog_err(
- LIB_ERR_ZAPI_ENCODE,
+ EC_LIB_ZAPI_ENCODE,
"%s: v6 prefixlen is %d which should not be more than 128",
__PRETTY_FUNCTION__, api->prefix.prefixlen);
return -1;
}
break;
default:
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"%s: Specified family %d is not v4 or v6",
__PRETTY_FUNCTION__, api->prefix.family);
return -1;
@@ -914,7 +915,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
STREAM_GETC(s, api->src_prefix.prefixlen);
if (api->src_prefix.prefixlen > IPV6_MAX_PREFIXLEN) {
flog_err(
- LIB_ERR_ZAPI_ENCODE,
+ EC_LIB_ZAPI_ENCODE,
"%s: SRC Prefix prefixlen received: %d is too large",
__PRETTY_FUNCTION__, api->src_prefix.prefixlen);
return -1;
@@ -925,7 +926,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
if (api->prefix.family != AF_INET6
|| api->src_prefix.prefixlen == 0) {
flog_err(
- LIB_ERR_ZAPI_ENCODE,
+ EC_LIB_ZAPI_ENCODE,
"%s: SRC prefix specified in some manner that makes no sense",
__PRETTY_FUNCTION__);
return -1;
@@ -936,7 +937,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
if (CHECK_FLAG(api->message, ZAPI_MESSAGE_NEXTHOP)) {
STREAM_GETW(s, api->nexthop_num);
if (api->nexthop_num > MULTIPATH_NUM) {
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"%s: invalid number of nexthops (%u)",
__func__, api->nexthop_num);
return -1;
@@ -978,7 +979,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
if (api_nh->label_num > MPLS_MAX_LABELS) {
flog_err(
- LIB_ERR_ZAPI_ENCODE,
+ EC_LIB_ZAPI_ENCODE,
"%s: invalid number of MPLS labels (%u)",
__func__, api_nh->label_num);
return -1;
@@ -1238,7 +1239,7 @@ bool zapi_nexthop_update_decode(struct stream *s, struct zapi_route *nhr)
}
STREAM_GETC(s, nhr->nexthops[i].label_num);
if (nhr->nexthops[i].label_num > MPLS_MAX_LABELS) {
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"%s: invalid number of MPLS labels (%u)",
__func__, nhr->nexthops[i].label_num);
return false;
@@ -1424,7 +1425,7 @@ struct interface *zebra_interface_state_read(struct stream *s, vrf_id_t vrf_id)
/* Lookup this by interface index. */
ifp = if_lookup_by_name(ifname_tmp, vrf_id);
if (ifp == NULL) {
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"INTERFACE_STATE: Cannot find IF %s in VRF %d",
ifname_tmp, vrf_id);
return NULL;
@@ -1451,10 +1452,11 @@ static void link_params_set_value(struct stream *s, struct if_link_params *iflp)
for (i = 0; i < bwclassnum && i < MAX_CLASS_TYPE; i++)
iflp->unrsv_bw[i] = stream_getf(s);
if (i < bwclassnum)
- flog_err(LIB_ERR_ZAPI_MISSMATCH,
- "%s: received %d > %d (MAX_CLASS_TYPE) bw entries"
- " - outdated library?",
- __func__, bwclassnum, MAX_CLASS_TYPE);
+ flog_err(
+ EC_LIB_ZAPI_MISSMATCH,
+ "%s: received %d > %d (MAX_CLASS_TYPE) bw entries"
+ " - outdated library?",
+ __func__, bwclassnum, MAX_CLASS_TYPE);
}
iflp->admin_grp = stream_getl(s);
iflp->rmt_as = stream_getl(s);
@@ -1483,9 +1485,9 @@ struct interface *zebra_interface_link_params_read(struct stream *s)
struct interface *ifp = if_lookup_by_index(ifindex, VRF_DEFAULT);
if (ifp == NULL) {
- flog_err(LIB_ERR_ZAPI_ENCODE,
- "%s: unknown ifindex %u, shouldn't happen", __func__,
- ifindex);
+ flog_err(EC_LIB_ZAPI_ENCODE,
+ "%s: unknown ifindex %u, shouldn't happen", __func__,
+ ifindex);
return NULL;
}
@@ -1634,7 +1636,7 @@ struct connected *zebra_interface_address_read(int type, struct stream *s,
/* Lookup index. */
ifp = if_lookup_by_index(ifindex, vrf_id);
if (ifp == NULL) {
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"INTERFACE_ADDRESS_%s: Cannot find IF %u in VRF %d",
(type == ZEBRA_INTERFACE_ADDRESS_ADD) ? "ADD" : "DEL",
ifindex, vrf_id);
@@ -1673,7 +1675,7 @@ struct connected *zebra_interface_address_read(int type, struct stream *s,
* "peer" */
char buf[PREFIX_STRLEN];
flog_err(
- LIB_ERR_ZAPI_ENCODE,
+ EC_LIB_ZAPI_ENCODE,
"warning: interface %s address %s with peer flag set, but no peer address!",
ifp->name,
prefix2str(ifc->address, buf,
@@ -1727,7 +1729,7 @@ zebra_interface_nbr_address_read(int type, struct stream *s, vrf_id_t vrf_id)
/* Lookup index. */
ifp = if_lookup_by_index(ifindex, vrf_id);
if (ifp == NULL) {
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"INTERFACE_NBR_%s: Cannot find IF %u in VRF %d",
(type == ZEBRA_INTERFACE_NBR_ADDRESS_ADD) ? "ADD"
: "DELETE",
@@ -1777,7 +1779,7 @@ struct interface *zebra_interface_vrf_update_read(struct stream *s,
/* Lookup interface. */
ifp = if_lookup_by_index(ifindex, vrf_id);
if (ifp == NULL) {
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"INTERFACE_VRF_UPDATE: Cannot find IF %u in VRF %d",
ifindex, vrf_id);
return NULL;
@@ -1823,8 +1825,8 @@ static int zclient_read_sync_response(struct zclient *zclient,
size);
}
if (ret != 0) {
- flog_err(LIB_ERR_ZAPI_ENCODE,
- "%s: Invalid Sync Message Reply", __func__);
+ flog_err(EC_LIB_ZAPI_ENCODE, "%s: Invalid Sync Message Reply",
+ __func__);
return -1;
}
@@ -1866,13 +1868,13 @@ int lm_label_manager_connect(struct zclient *zclient)
ret = writen(zclient->sock, s->data, stream_get_endp(s));
if (ret < 0) {
- flog_err(LIB_ERR_ZAPI_SOCKET, "Can't write to zclient sock");
+ flog_err(EC_LIB_ZAPI_SOCKET, "Can't write to zclient sock");
close(zclient->sock);
zclient->sock = -1;
return -1;
}
if (ret == 0) {
- flog_err(LIB_ERR_ZAPI_SOCKET, "Zclient sock closed");
+ flog_err(EC_LIB_ZAPI_SOCKET, "Zclient sock closed");
close(zclient->sock);
zclient->sock = -1;
return -1;
@@ -1893,13 +1895,15 @@ int lm_label_manager_connect(struct zclient *zclient)
/* sanity */
if (proto != zclient->redist_default)
- flog_err(LIB_ERR_ZAPI_ENCODE,
- "Wrong proto (%u) in LM connect response. Should be %u",
- proto, zclient->redist_default);
+ flog_err(
+ EC_LIB_ZAPI_ENCODE,
+ "Wrong proto (%u) in LM connect response. Should be %u",
+ proto, zclient->redist_default);
if (instance != zclient->instance)
- flog_err(LIB_ERR_ZAPI_ENCODE,
- "Wrong instId (%u) in LM connect response. Should be %u",
- instance, zclient->instance);
+ flog_err(
+ EC_LIB_ZAPI_ENCODE,
+ "Wrong instId (%u) in LM connect response. Should be %u",
+ instance, zclient->instance);
/* result code */
result = stream_getc(s);
@@ -1988,15 +1992,13 @@ int lm_get_label_chunk(struct zclient *zclient, uint8_t keep,
ret = writen(zclient->sock, s->data, stream_get_endp(s));
if (ret < 0) {
- flog_err(LIB_ERR_ZAPI_SOCKET,
- "Can't write to zclient sock");
+ flog_err(EC_LIB_ZAPI_SOCKET, "Can't write to zclient sock");
close(zclient->sock);
zclient->sock = -1;
return -1;
}
if (ret == 0) {
- flog_err(LIB_ERR_ZAPI_SOCKET,
- "Zclient sock closed");
+ flog_err(EC_LIB_ZAPI_SOCKET, "Zclient sock closed");
close(zclient->sock);
zclient->sock = -1;
return -1;
@@ -2017,13 +2019,13 @@ int lm_get_label_chunk(struct zclient *zclient, uint8_t keep,
/* sanities */
if (proto != zclient->redist_default)
- flog_err(LIB_ERR_ZAPI_ENCODE,
- "Wrong proto (%u) in get chunk response. Should be %u",
- proto, zclient->redist_default);
+ flog_err(EC_LIB_ZAPI_ENCODE,
+ "Wrong proto (%u) in get chunk response. Should be %u",
+ proto, zclient->redist_default);
if (instance != zclient->instance)
- flog_err(LIB_ERR_ZAPI_ENCODE,
- "Wrong instId (%u) in get chunk response Should be %u",
- instance, zclient->instance);
+ flog_err(EC_LIB_ZAPI_ENCODE,
+ "Wrong instId (%u) in get chunk response Should be %u",
+ instance, zclient->instance);
/* keep */
response_keep = stream_getc(s);
@@ -2033,15 +2035,16 @@ int lm_get_label_chunk(struct zclient *zclient, uint8_t keep,
/* not owning this response */
if (keep != response_keep) {
- flog_err(LIB_ERR_ZAPI_ENCODE,
- "Invalid Label chunk: %u - %u, keeps mismatch %u != %u",
- *start, *end, keep, response_keep);
+ flog_err(
+ EC_LIB_ZAPI_ENCODE,
+ "Invalid Label chunk: %u - %u, keeps mismatch %u != %u",
+ *start, *end, keep, response_keep);
}
/* sanity */
if (*start > *end || *start < MPLS_LABEL_UNRESERVED_MIN
|| *end > MPLS_LABEL_UNRESERVED_MAX) {
- flog_err(LIB_ERR_ZAPI_ENCODE,
- "Invalid Label chunk: %u - %u", *start, *end);
+ flog_err(EC_LIB_ZAPI_ENCODE, "Invalid Label chunk: %u - %u",
+ *start, *end);
return -1;
}
@@ -2091,14 +2094,13 @@ int lm_release_label_chunk(struct zclient *zclient, uint32_t start,
ret = writen(zclient->sock, s->data, stream_get_endp(s));
if (ret < 0) {
- flog_err(LIB_ERR_ZAPI_SOCKET, "Can't write to zclient sock");
+ flog_err(EC_LIB_ZAPI_SOCKET, "Can't write to zclient sock");
close(zclient->sock);
zclient->sock = -1;
return -1;
}
if (ret == 0) {
- flog_err(LIB_ERR_ZAPI_SOCKET,
- "Zclient sock connection closed");
+ flog_err(EC_LIB_ZAPI_SOCKET, "Zclient sock connection closed");
close(zclient->sock);
zclient->sock = -1;
return -1;
@@ -2201,15 +2203,15 @@ int tm_get_table_chunk(struct zclient *zclient, uint32_t chunk_size,
ret = writen(zclient->sock, s->data, stream_get_endp(s));
if (ret < 0) {
- flog_err(LIB_ERR_ZAPI_SOCKET,
- "%s: can't write to zclient->sock", __func__);
+ flog_err(EC_LIB_ZAPI_SOCKET, "%s: can't write to zclient->sock",
+ __func__);
close(zclient->sock);
zclient->sock = -1;
return -1;
}
if (ret == 0) {
- flog_err(LIB_ERR_ZAPI_SOCKET,
- "%s: zclient->sock connection closed", __func__);
+ flog_err(EC_LIB_ZAPI_SOCKET,
+ "%s: zclient->sock connection closed", __func__);
close(zclient->sock);
zclient->sock = -1;
return -1;
@@ -2295,8 +2297,7 @@ int zebra_send_pw(struct zclient *zclient, int command, struct zapi_pw *pw)
stream_write(s, (uint8_t *)&pw->nexthop.ipv6, 16);
break;
default:
- flog_err(LIB_ERR_ZAPI_ENCODE,
- "%s: unknown af", __func__);
+ flog_err(EC_LIB_ZAPI_ENCODE, "%s: unknown af", __func__);
return -1;
}
@@ -2398,16 +2399,17 @@ static int zclient_read(struct thread *thread)
command = stream_getw(zclient->ibuf);
if (marker != ZEBRA_HEADER_MARKER || version != ZSERV_VERSION) {
- flog_err(LIB_ERR_ZAPI_MISSMATCH,
- "%s: socket %d version mismatch, marker %d, version %d",
- __func__, zclient->sock, marker, version);
+ flog_err(
+ EC_LIB_ZAPI_MISSMATCH,
+ "%s: socket %d version mismatch, marker %d, version %d",
+ __func__, zclient->sock, marker, version);
return zclient_failed(zclient);
}
if (length < ZEBRA_HEADER_SIZE) {
- flog_err(LIB_ERR_ZAPI_MISSMATCH,
- "%s: socket %d message length %u is less than %d ",
- __func__, zclient->sock, length, ZEBRA_HEADER_SIZE);
+ flog_err(EC_LIB_ZAPI_MISSMATCH,
+ "%s: socket %d message length %u is less than %d ",
+ __func__, zclient->sock, length, ZEBRA_HEADER_SIZE);
return zclient_failed(zclient);
}
@@ -2415,7 +2417,7 @@ static int zclient_read(struct thread *thread)
if (length > STREAM_SIZE(zclient->ibuf)) {
struct stream *ns;
flog_err(
- LIB_ERR_ZAPI_ENCODE,
+ EC_LIB_ZAPI_ENCODE,
"%s: message size %u exceeds buffer size %lu, expanding...",
__func__, length,
(unsigned long)STREAM_SIZE(zclient->ibuf));
diff --git a/nhrpd/nhrp_errors.c b/nhrpd/nhrp_errors.c
index c557ba8a6..4c4f55be9 100644
--- a/nhrpd/nhrp_errors.c
+++ b/nhrpd/nhrp_errors.c
@@ -26,13 +26,13 @@
/* clang-format off */
static struct log_ref ferr_nhrp_err[] = {
{
- .code = NHRP_ERR_SWAN,
+ .code = EC_NHRP_SWAN,
.title = "NHRP Strong Swan Error",
.description = "NHRP has detected a error with the Strongswan code",
.suggestion = "Ensure that StrongSwan is configured correctly. Restart StrongSwan and FRR"
},
{
- .code = NHRP_ERR_RESOLVER,
+ .code = EC_NHRP_RESOLVER,
.title = "NHRP DNS Resolution",
.description = "NHRP has detected an error in an attempt to resolve a hostname",
.suggestion = "Ensure that DNS is working properly and the hostname is configured in dns. If you are still seeing this error, open an issue"
diff --git a/nhrpd/nhrp_errors.h b/nhrpd/nhrp_errors.h
index c9e947eb2..593714786 100644
--- a/nhrpd/nhrp_errors.h
+++ b/nhrpd/nhrp_errors.h
@@ -24,8 +24,8 @@
#include "lib/ferr.h"
enum nhrp_log_refs {
- NHRP_ERR_SWAN = NHRP_FERR_START,
- NHRP_ERR_RESOLVER,
+ EC_NHRP_SWAN = NHRP_FERR_START,
+ EC_NHRP_RESOLVER,
};
extern void nhrp_error_init(void);
diff --git a/nhrpd/resolver.c b/nhrpd/resolver.c
index f017d974d..830f0e1c8 100644
--- a/nhrpd/resolver.c
+++ b/nhrpd/resolver.c
@@ -198,9 +198,10 @@ void resolver_resolve(struct resolver_query *query, int af,
union sockunion *))
{
if (query->callback != NULL) {
- flog_err(NHRP_ERR_RESOLVER,
- "Trying to resolve '%s', but previous query was not finished yet",
- hostname);
+ flog_err(
+ EC_NHRP_RESOLVER,
+ "Trying to resolve '%s', but previous query was not finished yet",
+ hostname);
return;
}
diff --git a/nhrpd/vici.c b/nhrpd/vici.c
index c1a99685f..3de4609a2 100644
--- a/nhrpd/vici.c
+++ b/nhrpd/vici.c
@@ -218,9 +218,10 @@ static void parse_sa_message(struct vici_message_ctx *ctx,
if (str2sockunion(buf,
&sactx->local.host)
< 0)
- flog_err(NHRP_ERR_SWAN,
- "VICI: bad strongSwan local-host: %s",
- buf);
+ flog_err(
+ EC_NHRP_SWAN,
+ "VICI: bad strongSwan local-host: %s",
+ buf);
} else if (blob_equal(key, "local-id")
&& ctx->nsections == 1) {
sactx->local.id = *val;
@@ -236,9 +237,10 @@ static void parse_sa_message(struct vici_message_ctx *ctx,
if (str2sockunion(buf,
&sactx->remote.host)
< 0)
- flog_err(NHRP_ERR_SWAN,
- "VICI: bad strongSwan remote-host: %s",
- buf);
+ flog_err(
+ EC_NHRP_SWAN,
+ "VICI: bad strongSwan remote-host: %s",
+ buf);
} else if (blob_equal(key, "remote-id")
&& ctx->nsections == 1) {
sactx->remote.id = *val;
@@ -281,7 +283,7 @@ static void parse_cmd_response(struct vici_message_ctx *ctx,
case VICI_KEY_VALUE:
if (blob_equal(key, "errmsg")
&& blob2buf(val, buf, sizeof(buf)))
- flog_err(NHRP_ERR_SWAN, "VICI: strongSwan: %s", buf);
+ flog_err(EC_NHRP_SWAN, "VICI: strongSwan: %s", buf);
break;
default:
break;
@@ -340,7 +342,8 @@ static void vici_recv_message(struct vici_conn *vici, struct zbuf *msg)
break;
case VICI_EVENT_UNKNOWN:
case VICI_CMD_UNKNOWN:
- flog_err(NHRP_ERR_SWAN,
+ flog_err(
+ EC_NHRP_SWAN,
"VICI: StrongSwan does not support mandatory events (unpatched?)");
break;
case VICI_EVENT_CONFIRM:
diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c
index 228a525e7..cd688bbf8 100644
--- a/ospf6d/ospf6_message.c
+++ b/ospf6d/ospf6_message.c
@@ -1559,8 +1559,7 @@ int ospf6_receive(struct thread *thread)
/* receive message */
len = ospf6_recvmsg(&src, &dst, &ifindex, iovector);
if (len > iobuflen) {
- flog_err(LIB_ERR_DEVELOPMENT,
- "Excess message read");
+ flog_err(EC_LIB_DEVELOPMENT, "Excess message read");
return 0;
}
@@ -1708,7 +1707,7 @@ static void ospf6_send(struct in6_addr *src, struct in6_addr *dst,
/* send message */
len = ospf6_sendmsg(src, dst, &oi->interface->ifindex, iovector);
if (len != ntohs(oh->length))
- flog_err(LIB_ERR_DEVELOPMENT, "Could not send entire message");
+ flog_err(EC_LIB_DEVELOPMENT, "Could not send entire message");
}
static uint32_t ospf6_packet_max(struct ospf6_interface *oi)
diff --git a/ospf6d/ospf6_network.c b/ospf6d/ospf6_network.c
index 8988a53e5..8df5f1cc4 100644
--- a/ospf6d/ospf6_network.c
+++ b/ospf6d/ospf6_network.c
@@ -118,7 +118,7 @@ int ospf6_sso(ifindex_t ifindex, struct in6_addr *group, int option)
sizeof(mreq6));
if (ret < 0) {
flog_err_sys(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"Network: setsockopt (%d) on ifindex %d failed: %s",
option, ifindex, safe_strerror(errno));
return ret;
diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c
index 021e825ae..bba3c0db5 100644
--- a/ospf6d/ospf6_route.c
+++ b/ospf6d/ospf6_route.c
@@ -574,8 +574,9 @@ static void route_table_assert(struct ospf6_route_table *table)
if (link_error == 0 && num == table->count)
return;
- flog_err(LIB_ERR_DEVELOPMENT, "PANIC !!");
- flog_err(LIB_ERR_DEVELOPMENT, "Something has gone wrong with ospf6_route_table[%p]", table);
+ flog_err(EC_LIB_DEVELOPMENT, "PANIC !!");
+ flog_err(EC_LIB_DEVELOPMENT,
+ "Something has gone wrong with ospf6_route_table[%p]", table);
zlog_debug("table count = %d, real number = %d", table->count, num);
zlog_debug("DUMP START");
for (r = ospf6_route_head(table); r; r = ospf6_route_next(r)) {
diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c
index 9c13c51b1..d9ddc1bb8 100644
--- a/ospf6d/ospf6_spf.c
+++ b/ospf6d/ospf6_spf.c
@@ -273,8 +273,8 @@ static void ospf6_nexthop_calc(struct ospf6_vertex *w, struct ospf6_vertex *v,
ifindex = (VERTEX_IS_TYPE(NETWORK, v) ? ospf6_spf_get_ifindex_from_nh(v)
: ROUTER_LSDESC_GET_IFID(lsdesc));
if (ifindex == 0) {
- flog_err(LIB_ERR_DEVELOPMENT,
- "No nexthop ifindex at vertex %s", v->name);
+ flog_err(EC_LIB_DEVELOPMENT, "No nexthop ifindex at vertex %s",
+ v->name);
return;
}
diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c
index 06a84dcb9..c968b35d9 100644
--- a/ospf6d/ospf6_zebra.c
+++ b/ospf6d/ospf6_zebra.c
@@ -363,10 +363,10 @@ static void ospf6_zebra_route_update(int type, struct ospf6_route *request)
ret = zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
if (ret < 0)
- flog_err(LIB_ERR_ZAPI_SOCKET,
- "zclient_route_send() %s failed: %s",
- (type == REM ? "delete" : "add"),
- safe_strerror(errno));
+ flog_err(EC_LIB_ZAPI_SOCKET,
+ "zclient_route_send() %s failed: %s",
+ (type == REM ? "delete" : "add"),
+ safe_strerror(errno));
return;
}
diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c
index 8cd61a4a9..870037efc 100644
--- a/ospfd/ospf_abr.c
+++ b/ospfd/ospf_abr.c
@@ -743,7 +743,7 @@ void ospf_abr_announce_network_to_area(struct prefix_ipv4 *p, uint32_t cost,
prefix2str((struct prefix *)p, buf,
sizeof(buf));
- flog_warn(OSPF_WARN_LSA_MISSING,
+ flog_warn(EC_OSPF_LSA_MISSING,
"%s: Could not refresh %s to %s",
__func__, buf,
inet_ntoa(area->area_id));
@@ -766,7 +766,7 @@ void ospf_abr_announce_network_to_area(struct prefix_ipv4 *p, uint32_t cost,
char buf[PREFIX2STR_BUFFER];
prefix2str((struct prefix *)p, buf, sizeof(buf));
- flog_warn(OSPF_WARN_LSA_MISSING,
+ flog_warn(EC_OSPF_LSA_MISSING,
"%s: Could not originate %s to %s", __func__,
buf, inet_ntoa(area->area_id));
return;
@@ -1135,7 +1135,7 @@ static void ospf_abr_announce_rtr_to_area(struct prefix_ipv4 *p, uint32_t cost,
char buf[PREFIX2STR_BUFFER];
prefix2str((struct prefix *)p, buf, sizeof(buf));
- flog_warn(OSPF_WARN_LSA_MISSING,
+ flog_warn(EC_OSPF_LSA_MISSING,
"%s: Could not refresh/originate %s to %s",
__func__, buf, inet_ntoa(area->area_id));
return;
diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c
index d4a8a266c..0f7652795 100644
--- a/ospfd/ospf_apiserver.c
+++ b/ospfd/ospf_apiserver.c
@@ -154,7 +154,7 @@ int ospf_apiserver_init(void)
ospf_apiserver_lsa_update, ospf_apiserver_lsa_delete);
if (rc != 0) {
flog_warn(
- OSPF_WARN_OPAQUE_REGISTRATION,
+ EC_OSPF_OPAQUE_REGISTRATION,
"ospf_apiserver_init: Failed to register opaque type [0/0]");
}
@@ -869,7 +869,7 @@ int ospf_apiserver_register_opaque_type(struct ospf_apiserver *apiserv,
NULL /* ospf_apiserver_lsa_delete */);
if (rc != 0) {
- flog_warn(OSPF_WARN_OPAQUE_REGISTRATION,
+ flog_warn(EC_OSPF_OPAQUE_REGISTRATION,
"Failed to register opaque type [%d/%d]", lsa_type,
opaque_type);
return OSPF_API_OPAQUETYPEINUSE;
@@ -1665,7 +1665,7 @@ int ospf_apiserver_originate1(struct ospf_lsa *lsa)
/* Install this LSA into LSDB. */
if (ospf_lsa_install(ospf, lsa->oi, lsa) == NULL) {
- flog_warn(OSPF_WARN_LSA_INSTALL_FAILURE,
+ flog_warn(EC_OSPF_LSA_INSTALL_FAILURE,
"ospf_apiserver_originate1: ospf_lsa_install failed");
return -1;
}
@@ -1778,7 +1778,7 @@ struct ospf_lsa *ospf_apiserver_lsa_refresher(struct ospf_lsa *lsa)
/* Install LSA into LSDB. */
if (ospf_lsa_install(ospf, new->oi, new) == NULL) {
flog_warn(
- OSPF_WARN_LSA_INSTALL_FAILURE,
+ EC_OSPF_LSA_INSTALL_FAILURE,
"ospf_apiserver_lsa_refresher: ospf_lsa_install failed");
ospf_lsa_unlock(&new);
goto out;
diff --git a/ospfd/ospf_errors.c b/ospfd/ospf_errors.c
index 4646ed33b..566fc2920 100644
--- a/ospfd/ospf_errors.c
+++ b/ospfd/ospf_errors.c
@@ -26,85 +26,85 @@
/* clang-format off */
static struct log_ref ferr_ospf_warn[] = {
{
- .code = OSPF_WARN_SET_METRIC_PLUS,
+ .code = EC_OSPF_SET_METRIC_PLUS,
.title = "OSPF does not support `set metric +rtt/-rtt`",
.description = "This implementation of OSPF does not currently support `set metric +rtt/-rtt`",
.suggestion = "Do not use this particular set command for an ospf route-map",
},
{
- .code = OSPF_WARN_MD5,
+ .code = EC_OSPF_MD5,
.title = "OSPF has noticed a MD5 issue",
.description = "Something has gone wrong with the calculation of the MD5 data",
.suggestion = "Ensure your key is correct, gather log data from this side as well as peer and open an Issue",
},
{
- .code = OSPF_WARN_PACKET,
+ .code = EC_OSPF_PACKET,
.title = "OSPF has detected packet information missmatch",
.description = "OSPF has detected that packet information received is incorrect",
.suggestion = "Ensure interface configuration is correct, gather log files from here and the peer and open an Issue",
},
{
- .code = OSPF_WARN_LARGE_LSA,
+ .code = EC_OSPF_LARGE_LSA,
.title = "OSPF has determined that a LSA packet will be too large",
.description = "OSPF has received data that is causing it to recalculate how large packets should be and has discovered that the packet size needed would be too large and we will need to fragment packets",
.suggestion = "Further divide up your network with areas",
},
{
- .code = OSPF_WARN_LSA_UNEXPECTED,
+ .code = EC_OSPF_LSA_UNEXPECTED,
.title = "OSPF has received a LSA-type that it was not expecting",
.description = "OSPF has received a LSA-type that it was not expecting during processing",
.suggestion = "Gather log data from this machine and it's peer and open an Issue",
},
{
- .code = OSPF_WARN_LSA,
+ .code = EC_OSPF_LSA,
.title = "OSPF has discovered inconsistent internal state for a LSA",
.description = "During handling of a LSA, OSPF has discovered that the LSA's internal state is inconsistent",
.suggestion = "Gather log data and open an Issue",
},
{
- .code = OSPF_WARN_OPAQUE_REGISTRATION,
+ .code = EC_OSPF_OPAQUE_REGISTRATION,
.title = "OSPF has failed to properly register Opaque Handler",
.description = "During initialization OSPF has detected a failure to install an opaque handler",
.suggestion = "Gather log data and open an Issue",
},
{
- .code = OSPF_WARN_TE_UNEXPECTED,
+ .code = EC_OSPF_TE_UNEXPECTED,
.title = "OSPF has received TE information that it was not expecting",
.description = "OSPF has received TE information that it was not expecting during normal processing of data",
.suggestion = "Gather log data from this machine and it's peer and open an Issue",
},
{
- .code = OSPF_WARN_LSA_INSTALL_FAILURE,
+ .code = EC_OSPF_LSA_INSTALL_FAILURE,
.title = "OSPF was unable to save the LSA into it's database",
.description = "During processing of a new lsa and attempting to save the lsa into the OSPF database, this process failed.",
.suggestion = "Gather log data from this machine and open an Issue",
},
{
- .code = OSPF_WARN_LSA_NULL,
+ .code = EC_OSPF_LSA_NULL,
.title = "OSPF has received a NULL lsa pointer",
.description = "When processing a LSA update we have found and noticed an internal error where we are passing around a NULL pointer",
.suggestion = "Gather data from this machine and it's peer and open an Issue",
},
{
- .code = OSPF_WARN_EXT_LSA_UNEXPECTED,
+ .code = EC_OSPF_EXT_LSA_UNEXPECTED,
.title = "OSPF has received EXT information that leaves it in an unexpected state",
.description = "While processing EXT LSA information, OSPF has noticed that the internal state of OSPF has gotten inconsistent",
.suggestion = "Gather data from this machine and it's peer and open an Issue",
},
{
- .code = OSPF_WARN_LSA_MISSING,
+ .code = EC_OSPF_LSA_MISSING,
.title = "OSPF attempted to look up a LSA and it was not found",
.description = "During processing of new LSA information, we attempted to look up an old LSA and it was not found",
.suggestion = "Gather data from this machine and open an Issue",
},
{
- .code = OSPF_WARN_PTP_NEIGHBOR,
+ .code = EC_OSPF_PTP_NEIGHBOR,
.title = "OSPF has detected more than 1 neighbor on a P2P interface",
.description = "If you configure a ospf interface as P2P we should not detect more than one neighbor on the interface",
.suggestion = "Fix your config",
},
{
- .code = OSPF_WARN_LSA_SIZE,
+ .code = EC_OSPF_LSA_SIZE,
.title = "OSPF has detected an invalid LSA size",
.description = "OSPF has detected a state where we are attempting to grow a LSA but the LSA has reached it's maximum size",
.suggestion = "Gather data and open an Issue",
@@ -116,55 +116,55 @@ static struct log_ref ferr_ospf_warn[] = {
static struct log_ref ferr_ospf_err[] = {
{
- .code = OSPF_ERR_PKT_PROCESS,
+ .code = EC_OSPF_PKT_PROCESS,
.title = "Failure to process a packet",
.description = "OSPF attempted to process a received packet but could not",
.suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting"
},
{
- .code = OSPF_ERR_ROUTER_LSA_MISMATCH,
+ .code = EC_OSPF_ROUTER_LSA_MISMATCH,
.title = "Failure to process Router LSA",
.description = "OSPF attempted to process a Router LSA but Advertising ID mismatch with link id",
.suggestion = "Check OSPF network config for any config issue, If the problem persists, report the problem for troubleshooting"
},
{
- .code = OSPF_ERR_DOMAIN_CORRUPT,
+ .code = EC_OSPF_DOMAIN_CORRUPT,
.title = "OSPF Domain Corruption",
.description = "OSPF attempted to process a Router LSA but Advertising ID mismatch with link id",
.suggestion = "Check OSPF network Database for corrupted LSA, If the problem persists, shutdown OSPF domain and report the problem for troubleshooting"
},
{
- .code = OSPF_ERR_INIT_FAIL,
+ .code = EC_OSPF_INIT_FAIL,
.title = "OSPF Initialization failure",
.description = "OSPF failed to initialized OSPF default insance",
.suggestion = "Ensure there is adequate memory on the device. If the problem persists, report the problem for troubleshooting"
},
{
- .code = OSPF_ERR_SR_INVALID_DB,
+ .code = EC_OSPF_SR_INVALID_DB,
.title = "OSPF SR Invalid DB",
.description = "OSPF Segment Routing Database is invalid",
.suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting"
},
{
- .code = OSPF_ERR_SR_NODE_CREATE,
+ .code = EC_OSPF_SR_NODE_CREATE,
.title = "OSPF SR hash node creation failed",
.description = "OSPF Segment Routing node creation failed",
.suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting"
},
{
- .code = OSPF_ERR_SR_INVALID_LSA_ID,
+ .code = EC_OSPF_SR_INVALID_LSA_ID,
.title = "OSPF SR Invalid LSA ID",
.description = "OSPF Segment Routing invalid lsa id",
.suggestion = "Restart OSPF instance, If the problem persists, report the problem for troubleshooting"
},
{
- .code = OSPF_ERR_INVALID_ALGORITHM,
+ .code = EC_OSPF_INVALID_ALGORITHM,
.title = "OSPF SR Invalid Algorithm",
.description = "OSPF Segment Routing invalid Algorithm",
.suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting"
},
{
- .code = OSPF_ERR_FSM_INVALID_STATE,
+ .code = EC_OSPF_FSM_INVALID_STATE,
.title = "OSPF FSM invalid state detected",
.description = "OSPF has attempted to change states when it should not be able to",
.suggestion = "Gather log files and open an issue",
diff --git a/ospfd/ospf_errors.h b/ospfd/ospf_errors.h
index 664f6f1bd..cea649a6f 100644
--- a/ospfd/ospf_errors.h
+++ b/ospfd/ospf_errors.h
@@ -24,29 +24,29 @@
#include "lib/ferr.h"
enum ospf_log_refs {
- OSPF_ERR_PKT_PROCESS = OSPF_FERR_START,
- OSPF_ERR_ROUTER_LSA_MISMATCH,
- OSPF_ERR_DOMAIN_CORRUPT,
- OSPF_ERR_INIT_FAIL,
- OSPF_ERR_SR_INVALID_DB,
- OSPF_ERR_SR_NODE_CREATE,
- OSPF_ERR_SR_INVALID_LSA_ID,
- OSPF_ERR_INVALID_ALGORITHM,
- OSPF_ERR_FSM_INVALID_STATE,
- OSPF_WARN_SET_METRIC_PLUS,
- OSPF_WARN_MD5,
- OSPF_WARN_PACKET,
- OSPF_WARN_LARGE_LSA,
- OSPF_WARN_LSA_UNEXPECTED,
- OSPF_WARN_LSA,
- OSPF_WARN_OPAQUE_REGISTRATION,
- OSPF_WARN_TE_UNEXPECTED,
- OSPF_WARN_LSA_INSTALL_FAILURE,
- OSPF_WARN_LSA_NULL,
- OSPF_WARN_EXT_LSA_UNEXPECTED,
- OSPF_WARN_LSA_MISSING,
- OSPF_WARN_PTP_NEIGHBOR,
- OSPF_WARN_LSA_SIZE,
+ EC_OSPF_PKT_PROCESS = OSPF_FERR_START,
+ EC_OSPF_ROUTER_LSA_MISMATCH,
+ EC_OSPF_DOMAIN_CORRUPT,
+ EC_OSPF_INIT_FAIL,
+ EC_OSPF_SR_INVALID_DB,
+ EC_OSPF_SR_NODE_CREATE,
+ EC_OSPF_SR_INVALID_LSA_ID,
+ EC_OSPF_INVALID_ALGORITHM,
+ EC_OSPF_FSM_INVALID_STATE,
+ EC_OSPF_SET_METRIC_PLUS,
+ EC_OSPF_MD5,
+ EC_OSPF_PACKET,
+ EC_OSPF_LARGE_LSA,
+ EC_OSPF_LSA_UNEXPECTED,
+ EC_OSPF_LSA,
+ EC_OSPF_OPAQUE_REGISTRATION,
+ EC_OSPF_TE_UNEXPECTED,
+ EC_OSPF_LSA_INSTALL_FAILURE,
+ EC_OSPF_LSA_NULL,
+ EC_OSPF_EXT_LSA_UNEXPECTED,
+ EC_OSPF_LSA_MISSING,
+ EC_OSPF_PTP_NEIGHBOR,
+ EC_OSPF_LSA_SIZE,
};
extern void ospf_error_init(void);
diff --git a/ospfd/ospf_ext.c b/ospfd/ospf_ext.c
index 1aab61168..316019c15 100644
--- a/ospfd/ospf_ext.c
+++ b/ospfd/ospf_ext.c
@@ -137,7 +137,7 @@ int ospf_ext_init(void)
NULL); /* del_lsa_hook */
if (rc != 0) {
- flog_warn(OSPF_WARN_OPAQUE_REGISTRATION,
+ flog_warn(EC_OSPF_OPAQUE_REGISTRATION,
"EXT (%s): Failed to register Extended Link LSA",
__func__);
return rc;
@@ -159,7 +159,7 @@ int ospf_ext_init(void)
ospf_ext_pref_lsa_update, /* new_lsa_hook */
NULL); /* del_lsa_hook */
if (rc != 0) {
- flog_warn(OSPF_WARN_OPAQUE_REGISTRATION,
+ flog_warn(EC_OSPF_OPAQUE_REGISTRATION,
"EXT (%s): Failed to register Extended Prefix LSA",
__func__);
return rc;
@@ -315,7 +315,7 @@ static void set_prefix_sid(struct ext_itf *exti, uint8_t algorithm,
if ((algorithm != SR_ALGORITHM_SPF)
&& (algorithm != SR_ALGORITHM_STRICT_SPF)) {
- flog_err(OSPF_ERR_INVALID_ALGORITHM,
+ flog_err(EC_OSPF_INVALID_ALGORITHM,
"EXT (%s): unrecognized algorithm, not SPF or S-SPF",
__func__);
return;
@@ -571,7 +571,7 @@ static int ospf_ext_link_del_if(struct interface *ifp)
rc = 0;
} else {
- flog_warn(OSPF_WARN_EXT_LSA_UNEXPECTED,
+ flog_warn(EC_OSPF_EXT_LSA_UNEXPECTED,
"EXT (%s): interface %s is not found", __func__,
ifp ? ifp->name : "-");
}
@@ -619,7 +619,7 @@ static void ospf_ext_pref_ism_change(struct ospf_interface *oi, int old_status)
/* Get interface information for Segment Routing */
exti = lookup_ext_by_ifp(oi->ifp);
if (exti == NULL) {
- flog_warn(OSPF_WARN_EXT_LSA_UNEXPECTED,
+ flog_warn(EC_OSPF_EXT_LSA_UNEXPECTED,
"EXT (%s): Cannot get Extended info. from OI(%s)",
__func__, IF_NAME(oi));
return;
@@ -657,14 +657,14 @@ static void ospf_ext_link_nsm_change(struct ospf_neighbor *nbr, int old_status)
/* Get interface information for Segment Routing */
exti = lookup_ext_by_ifp(oi->ifp);
if (exti == NULL) {
- flog_warn(OSPF_WARN_EXT_LSA_UNEXPECTED,
+ flog_warn(EC_OSPF_EXT_LSA_UNEXPECTED,
"EXT (%s): Cannot get Extended info. from OI(%s)",
__func__, IF_NAME(oi));
return;
}
if (oi->area == NULL || oi->area->ospf == NULL) {
- flog_warn(OSPF_WARN_EXT_LSA_UNEXPECTED,
+ flog_warn(EC_OSPF_EXT_LSA_UNEXPECTED,
"EXT (%s): Cannot refer to OSPF from OI(%s)",
__func__, IF_NAME(oi));
return;
@@ -760,7 +760,7 @@ static int ospf_ext_link_lsa_update(struct ospf_lsa *lsa)
{
/* Sanity Check */
if (lsa == NULL) {
- flog_warn(OSPF_WARN_LSA_NULL, "EXT (%s): Abort! LSA is NULL",
+ flog_warn(EC_OSPF_LSA_NULL, "EXT (%s): Abort! LSA is NULL",
__func__);
return -1;
}
@@ -794,7 +794,7 @@ static int ospf_ext_pref_lsa_update(struct ospf_lsa *lsa)
/* Sanity Check */
if (lsa == NULL) {
- flog_warn(OSPF_WARN_LSA_NULL, "EXT (%s): Abort! LSA is NULL",
+ flog_warn(EC_OSPF_LSA_NULL, "EXT (%s): Abort! LSA is NULL",
__func__);
return -1;
}
@@ -1062,14 +1062,14 @@ static int ospf_ext_pref_lsa_originate1(struct ospf_area *area,
/* Create new Opaque-LSA/Extended Prefix Opaque LSA instance. */
new = ospf_ext_pref_lsa_new(area, exti);
if (new == NULL) {
- flog_warn(OSPF_WARN_EXT_LSA_UNEXPECTED,
+ flog_warn(EC_OSPF_EXT_LSA_UNEXPECTED,
"EXT (%s): ospf_ext_pref_lsa_new() error", __func__);
return rc;
}
/* Install this LSA into LSDB. */
if (ospf_lsa_install(area->ospf, NULL /*oi */, new) == NULL) {
- flog_warn(OSPF_WARN_LSA_INSTALL_FAILURE,
+ flog_warn(EC_OSPF_LSA_INSTALL_FAILURE,
"EXT (%s): ospf_lsa_install() error", __func__);
ospf_lsa_unlock(&new);
return rc;
@@ -1116,14 +1116,14 @@ static int ospf_ext_link_lsa_originate1(struct ospf_area *area,
/* Create new Opaque-LSA/Extended Link Opaque LSA instance. */
new = ospf_ext_link_lsa_new(area, exti);
if (new == NULL) {
- flog_warn(OSPF_WARN_EXT_LSA_UNEXPECTED,
+ flog_warn(EC_OSPF_EXT_LSA_UNEXPECTED,
"EXT (%s): ospf_ext_link_lsa_new() error", __func__);
return rc;
}
/* Install this LSA into LSDB. */
if (ospf_lsa_install(area->ospf, NULL /*oi */, new) == NULL) {
- flog_warn(OSPF_WARN_LSA_INSTALL_FAILURE,
+ flog_warn(EC_OSPF_LSA_INSTALL_FAILURE,
"EXT (%s): ospf_lsa_install() error", __func__);
ospf_lsa_unlock(&new);
return rc;
@@ -1191,7 +1191,7 @@ static int ospf_ext_pref_lsa_originate(void *arg)
if (CHECK_FLAG(exti->flags,
EXT_LPFLG_LSA_FORCED_REFRESH)) {
flog_warn(
- OSPF_WARN_EXT_LSA_UNEXPECTED,
+ EC_OSPF_EXT_LSA_UNEXPECTED,
"EXT (%s): Refresh instead of Originate",
__func__);
UNSET_FLAG(exti->flags,
@@ -1249,7 +1249,7 @@ static int ospf_ext_link_lsa_originate(void *arg)
if (CHECK_FLAG(exti->flags,
EXT_LPFLG_LSA_FORCED_REFRESH)) {
flog_warn(
- OSPF_WARN_EXT_LSA_UNEXPECTED,
+ EC_OSPF_EXT_LSA_UNEXPECTED,
"EXT (%s): Refresh instead of Originate",
__func__);
UNSET_FLAG(exti->flags,
@@ -1300,7 +1300,7 @@ static struct ospf_lsa *ospf_ext_pref_lsa_refresh(struct ospf_lsa *lsa)
/* Lookup this lsa corresponding Extended parameters */
exti = lookup_ext_by_instance(lsa);
if (exti == NULL) {
- flog_warn(OSPF_WARN_EXT_LSA_UNEXPECTED,
+ flog_warn(EC_OSPF_EXT_LSA_UNEXPECTED,
"EXT (%s): Invalid parameter LSA ID", __func__);
/* Flush it anyway. */
lsa->data->ls_age = htons(OSPF_LSA_MAXAGE);
@@ -1308,7 +1308,7 @@ static struct ospf_lsa *ospf_ext_pref_lsa_refresh(struct ospf_lsa *lsa)
/* Check if Interface was not disable in the interval */
if ((exti != NULL) && !CHECK_FLAG(exti->flags, EXT_LPFLG_LSA_ACTIVE)) {
- flog_warn(OSPF_WARN_EXT_LSA_UNEXPECTED,
+ flog_warn(EC_OSPF_EXT_LSA_UNEXPECTED,
"EXT (%s): Interface was Disabled: Flush it!",
__func__);
/* Flush it anyway. */
@@ -1327,7 +1327,7 @@ static struct ospf_lsa *ospf_ext_pref_lsa_refresh(struct ospf_lsa *lsa)
new = ospf_ext_pref_lsa_new(area, exti);
if (new == NULL) {
- flog_warn(OSPF_WARN_EXT_LSA_UNEXPECTED,
+ flog_warn(EC_OSPF_EXT_LSA_UNEXPECTED,
"EXT (%s): ospf_ext_pref_lsa_new() error", __func__);
return NULL;
}
@@ -1345,7 +1345,7 @@ static struct ospf_lsa *ospf_ext_pref_lsa_refresh(struct ospf_lsa *lsa)
top = ospf_lookup_by_vrf_id(VRF_DEFAULT);
if (ospf_lsa_install(top, NULL /*oi */, new) == NULL) {
- flog_warn(OSPF_WARN_LSA_INSTALL_FAILURE,
+ flog_warn(EC_OSPF_LSA_INSTALL_FAILURE,
"EXT (%s): ospf_lsa_install() error", __func__);
ospf_lsa_unlock(&new);
return NULL;
@@ -1387,7 +1387,7 @@ static struct ospf_lsa *ospf_ext_link_lsa_refresh(struct ospf_lsa *lsa)
/* Lookup this LSA corresponding Extended parameters */
exti = lookup_ext_by_instance(lsa);
if (exti == NULL) {
- flog_warn(OSPF_WARN_EXT_LSA_UNEXPECTED,
+ flog_warn(EC_OSPF_EXT_LSA_UNEXPECTED,
"EXT (%s): Invalid parameter LSA ID", __func__);
/* Flush it anyway. */
lsa->data->ls_age = htons(OSPF_LSA_MAXAGE);
@@ -1395,7 +1395,7 @@ static struct ospf_lsa *ospf_ext_link_lsa_refresh(struct ospf_lsa *lsa)
/* Check if Interface was not disable in the interval */
if ((exti != NULL) && !CHECK_FLAG(exti->flags, EXT_LPFLG_LSA_ACTIVE)) {
- flog_warn(OSPF_WARN_EXT_LSA_UNEXPECTED,
+ flog_warn(EC_OSPF_EXT_LSA_UNEXPECTED,
"EXT (%s): Interface was Disabled: Flush it!",
__func__);
lsa->data->ls_age = htons(OSPF_LSA_MAXAGE);
@@ -1412,7 +1412,7 @@ static struct ospf_lsa *ospf_ext_link_lsa_refresh(struct ospf_lsa *lsa)
/* Create new Opaque-LSA/Extended Link instance */
new = ospf_ext_link_lsa_new(area, exti);
if (new == NULL) {
- flog_warn(OSPF_WARN_EXT_LSA_UNEXPECTED,
+ flog_warn(EC_OSPF_EXT_LSA_UNEXPECTED,
"EXT (%s): Error creating new LSA", __func__);
return NULL;
}
@@ -1421,7 +1421,7 @@ static struct ospf_lsa *ospf_ext_link_lsa_refresh(struct ospf_lsa *lsa)
/* Install this LSA into LSDB. */
/* Given "lsa" will be freed in the next function */
if (ospf_lsa_install(top, NULL /*oi */, new) == NULL) {
- flog_warn(OSPF_WARN_LSA_INSTALL_FAILURE,
+ flog_warn(EC_OSPF_LSA_INSTALL_FAILURE,
"EXT (%s): Error installing new LSA", __func__);
ospf_lsa_unlock(&new);
return NULL;
@@ -1470,7 +1470,7 @@ static void ospf_ext_pref_lsa_schedule(struct ext_itf *exti,
/* Set LSA header information */
if (exti->area == NULL) {
flog_warn(
- OSPF_WARN_EXT_LSA_UNEXPECTED,
+ EC_OSPF_EXT_LSA_UNEXPECTED,
"EXT (%s): Flooding is Area scope but area is not yet set",
__func__);
if (OspfEXT.area == NULL) {
@@ -1531,7 +1531,7 @@ static void ospf_ext_link_lsa_schedule(struct ext_itf *exti,
/* Set LSA header information */
if (exti->area == NULL) {
flog_warn(
- OSPF_WARN_EXT_LSA_UNEXPECTED,
+ EC_OSPF_EXT_LSA_UNEXPECTED,
"EXT (%s): Flooding is Area scope but area is not yet set",
__func__);
if (OspfEXT.area == NULL) {
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index 4d46e9739..a752630a3 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -398,7 +398,7 @@ struct ospf_neighbor *ospf_nbr_lookup_ptop(struct ospf_interface *oi)
/* PtoP link must have only 1 neighbor. */
if (ospf_nbr_count(oi, 0) > 1)
- flog_warn(OSPF_WARN_PTP_NEIGHBOR,
+ flog_warn(EC_OSPF_PTP_NEIGHBOR,
"Point-to-Point link has more than 1 neighobrs.");
return nbr;
@@ -448,7 +448,7 @@ static char link_info_set(struct stream **s, struct in_addr id,
if (ret == OSPF_MAX_LSA_SIZE) {
flog_warn(
- OSPF_WARN_LSA_SIZE,
+ EC_OSPF_LSA_SIZE,
"%s: Out of space in LSA stream, left %zd, size %zd",
__func__, STREAM_WRITEABLE(*s),
STREAM_SIZE(*s));
@@ -1819,7 +1819,7 @@ struct ospf_lsa *ospf_translated_nssa_originate(struct ospf *ospf,
}
if ((new = ospf_lsa_install(ospf, NULL, new)) == NULL) {
- flog_warn(OSPF_WARN_LSA_INSTALL_FAILURE,
+ flog_warn(EC_OSPF_LSA_INSTALL_FAILURE,
"ospf_lsa_translated_nssa_originate(): "
"Could not install LSA "
"id %s",
@@ -1920,7 +1920,7 @@ struct ospf_lsa *ospf_translated_nssa_refresh(struct ospf *ospf,
if (!(new = ospf_lsa_install(ospf, NULL, new))) {
flog_warn(
- OSPF_WARN_LSA_INSTALL_FAILURE,
+ EC_OSPF_LSA_INSTALL_FAILURE,
"ospf_translated_nssa_refresh(): Could not install translated LSA, Id %s",
inet_ntoa(type7->data->id));
return NULL;
@@ -2061,7 +2061,7 @@ int ospf_external_lsa_originate_timer(struct thread *thread)
if (!ospf_external_lsa_originate(ospf, ei))
flog_warn(
- OSPF_WARN_LSA_INSTALL_FAILURE,
+ EC_OSPF_LSA_INSTALL_FAILURE,
"LSA: AS-external-LSA was not originated.");
}
}
diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c
index 8853802d0..9fb0e0ad1 100644
--- a/ospfd/ospf_main.c
+++ b/ospfd/ospf_main.c
@@ -216,8 +216,8 @@ int main(int argc, char **argv)
ospf',
when quagga(ospfd) is restarted */
if (!ospf_get_instance(instance)) {
- flog_err(OSPF_ERR_INIT_FAIL, "OSPF instance init failed: %s",
- strerror(errno));
+ flog_err(EC_OSPF_INIT_FAIL, "OSPF instance init failed: %s",
+ strerror(errno));
exit(1);
}
diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c
index ed11f4535..e30bb0ffe 100644
--- a/ospfd/ospf_network.c
+++ b/ospfd/ospf_network.c
@@ -52,7 +52,7 @@ int ospf_if_add_allspfrouters(struct ospf *top, struct prefix *p,
ifindex);
if (ret < 0)
flog_err(
- LIB_ERR_SOCKET,
+ 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?",
@@ -77,7 +77,7 @@ int ospf_if_drop_allspfrouters(struct ospf *top, struct prefix *p,
p->u.prefix4, htonl(OSPF_ALLSPFROUTERS),
ifindex);
if (ret < 0)
- flog_err(LIB_ERR_SOCKET,
+ 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,
@@ -103,7 +103,7 @@ int ospf_if_add_alldrouters(struct ospf *top, struct prefix *p,
ifindex);
if (ret < 0)
flog_err(
- LIB_ERR_SOCKET,
+ 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?",
@@ -126,7 +126,7 @@ int ospf_if_drop_alldrouters(struct ospf *top, struct prefix *p,
p->u.prefix4, htonl(OSPF_ALLDROUTERS),
ifindex);
if (ret < 0)
- flog_err(LIB_ERR_SOCKET,
+ 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,
@@ -147,7 +147,7 @@ int ospf_if_ipmulticast(struct ospf *top, struct prefix *p, ifindex_t ifindex)
/* Prevent receiving self-origined multicast packets. */
ret = setsockopt_ipv4_multicast_loop(top->fd, 0);
if (ret < 0)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"can't setsockopt IP_MULTICAST_LOOP(0) for fd %d: %s",
top->fd, safe_strerror(errno));
@@ -157,7 +157,7 @@ int ospf_if_ipmulticast(struct ospf *top, struct prefix *p, ifindex_t ifindex)
ret = setsockopt(top->fd, IPPROTO_IP, IP_MULTICAST_TTL, (void *)&val,
len);
if (ret < 0)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"can't setsockopt IP_MULTICAST_TTL(1) for fd %d: %s",
top->fd, safe_strerror(errno));
#ifndef GNU_LINUX
@@ -166,7 +166,7 @@ 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(LIB_ERR_SOCKET,
+ 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,
@@ -194,7 +194,7 @@ int ospf_sock_init(struct ospf *ospf)
ospf_sock = vrf_socket(AF_INET, SOCK_RAW, IPPROTO_OSPFIGP,
ospf->vrf_id, ospf->name);
if (ospf_sock < 0) {
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"ospf_read_sock_init: socket: %s",
safe_strerror(errno));
exit(1);
@@ -205,7 +205,7 @@ int ospf_sock_init(struct ospf *ospf)
ret = setsockopt(ospf_sock, IPPROTO_IP, IP_HDRINCL, &hincl,
sizeof(hincl));
if (ret < 0) {
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"Can't set IP_HDRINCL option for fd %d: %s",
ospf_sock, safe_strerror(errno));
close(ospf_sock);
@@ -217,7 +217,7 @@ int ospf_sock_init(struct ospf *ospf)
ret = setsockopt_ipv4_tos(ospf_sock,
IPTOS_PREC_INTERNETCONTROL);
if (ret < 0) {
- flog_err(LIB_ERR_SOCKET,
+ 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. */
@@ -225,14 +225,13 @@ int ospf_sock_init(struct ospf *ospf)
}
#else /* !IPTOS_PREC_INTERNETCONTROL */
#warning "IP_HDRINCL not available, nor is IPTOS_PREC_INTERNETCONTROL"
- flog_err(LIB_ERR_UNAVAILABLE,
- "IP_HDRINCL option not available");
+ flog_err(EC_LIB_UNAVAILABLE, "IP_HDRINCL option not available");
#endif /* IP_HDRINCL */
ret = setsockopt_ifindex(AF_INET, ospf_sock, 1);
if (ret < 0)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"Can't set pktinfo option for fd %d",
ospf_sock);
diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c
index fc8b516af..91d187f41 100644
--- a/ospfd/ospf_nsm.c
+++ b/ospfd/ospf_nsm.c
@@ -797,7 +797,7 @@ int ospf_nsm_event(struct thread *thread)
* try set next_state.
*/
flog_err(
- OSPF_ERR_FSM_INVALID_STATE,
+ EC_OSPF_FSM_INVALID_STATE,
"NSM[%s:%s]: %s (%s): "
"Warning: action tried to change next_state to %s",
IF_NAME(nbr->oi), inet_ntoa(nbr->router_id),
diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c
index 9066dda73..bbc559ca3 100644
--- a/ospfd/ospf_opaque.c
+++ b/ospfd/ospf_opaque.c
@@ -353,7 +353,7 @@ static struct list *ospf_get_opaque_funclist(uint8_t lsa_type)
funclist = ospf_opaque_type11_funclist;
break;
default:
- flog_warn(OSPF_WARN_LSA_UNEXPECTED,
+ flog_warn(EC_OSPF_LSA_UNEXPECTED,
"ospf_get_opaque_funclist: Unexpected LSA-type(%u)",
lsa_type);
break;
@@ -389,7 +389,7 @@ int ospf_register_opaque_functab(
for (ALL_LIST_ELEMENTS(funclist, node, nnode, functab))
if (functab->opaque_type == opaque_type) {
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"ospf_register_opaque_functab: Duplicated entry?: lsa_type(%u), opaque_type(%u)",
lsa_type, opaque_type);
return -1;
@@ -568,7 +568,7 @@ register_opaque_info_per_type(struct ospf_opaque_functab *functab,
break;
default:
flog_warn(
- OSPF_WARN_LSA_UNEXPECTED,
+ EC_OSPF_LSA_UNEXPECTED,
"register_opaque_info_per_type: Unexpected LSA-type(%u)",
new->data->type);
free_opaque_info_per_type((void *)oipt);
@@ -613,7 +613,7 @@ static void free_opaque_info_owner(void *val)
break;
}
default:
- flog_warn(OSPF_WARN_LSA_UNEXPECTED,
+ flog_warn(EC_OSPF_LSA_UNEXPECTED,
"free_opaque_info_owner: Unexpected LSA-type(%u)",
oipt->lsa_type);
break; /* This case may not exist. */
@@ -659,7 +659,7 @@ lookup_opaque_info_by_type(struct ospf_lsa *lsa)
listtop = oi->opaque_lsa_self;
else
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"Type-9 Opaque-LSA: Reference to OI is missing?");
break;
case OSPF_OPAQUE_AREA_LSA:
@@ -667,21 +667,21 @@ lookup_opaque_info_by_type(struct ospf_lsa *lsa)
listtop = area->opaque_lsa_self;
else
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"Type-10 Opaque-LSA: Reference to AREA is missing?");
break;
case OSPF_OPAQUE_AS_LSA:
top = ospf_lookup_by_vrf_id(lsa->vrf_id);
if ((area = lsa->area) != NULL && (top = area->ospf) == NULL) {
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"Type-11 Opaque-LSA: Reference to OSPF is missing?");
break; /* Unlikely to happen. */
}
listtop = top->opaque_lsa_self;
break;
default:
- flog_warn(OSPF_WARN_LSA_UNEXPECTED,
+ flog_warn(EC_OSPF_LSA_UNEXPECTED,
"lookup_opaque_info_by_type: Unexpected LSA-type(%u)",
lsa->data->type);
break;
@@ -1523,7 +1523,7 @@ static void ospf_opaque_lsa_reoriginate_resume(struct list *listtop, void *arg)
if ((*functab->lsa_originator)(arg) != 0) {
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"ospf_opaque_lsa_reoriginate_resume: Failed (opaque-type=%u)",
oipt->opaque_type);
continue;
@@ -1563,7 +1563,7 @@ struct ospf_lsa *ospf_opaque_lsa_install(struct ospf_lsa *lsa, int rt_recalc)
}
/* Register the new lsa entry and get its control info. */
else if ((oipi = register_opaque_lsa(lsa)) == NULL) {
- flog_warn(OSPF_WARN_LSA,
+ flog_warn(EC_OSPF_LSA,
"ospf_opaque_lsa_install: register_opaque_lsa() ?");
goto out;
}
@@ -1576,7 +1576,7 @@ struct ospf_lsa *ospf_opaque_lsa_install(struct ospf_lsa *lsa, int rt_recalc)
case OSPF_OPAQUE_LINK_LSA:
if ((top = oi_to_top(lsa->oi)) == NULL) {
/* Above conditions must have passed. */
- flog_warn(OSPF_WARN_LSA,
+ flog_warn(EC_OSPF_LSA,
"ospf_opaque_lsa_install: Something wrong?");
goto out;
}
@@ -1584,7 +1584,7 @@ struct ospf_lsa *ospf_opaque_lsa_install(struct ospf_lsa *lsa, int rt_recalc)
case OSPF_OPAQUE_AREA_LSA:
if (lsa->area == NULL || (top = lsa->area->ospf) == NULL) {
/* Above conditions must have passed. */
- flog_warn(OSPF_WARN_LSA,
+ flog_warn(EC_OSPF_LSA,
"ospf_opaque_lsa_install: Something wrong?");
goto out;
}
@@ -1593,13 +1593,13 @@ struct ospf_lsa *ospf_opaque_lsa_install(struct ospf_lsa *lsa, int rt_recalc)
top = ospf_lookup_by_vrf_id(lsa->vrf_id);
if (lsa->area != NULL && (top = lsa->area->ospf) == NULL) {
/* Above conditions must have passed. */
- flog_warn(OSPF_WARN_LSA,
+ flog_warn(EC_OSPF_LSA,
"ospf_opaque_lsa_install: Something wrong?");
goto out;
}
break;
default:
- flog_warn(OSPF_WARN_LSA_UNEXPECTED,
+ flog_warn(EC_OSPF_LSA_UNEXPECTED,
"ospf_opaque_lsa_install: Unexpected LSA-type(%u)",
lsa->data->type);
goto out;
@@ -1673,13 +1673,13 @@ void ospf_opaque_lsa_reoriginate_schedule(void *lsa_type_dependent,
if ((oi = (struct ospf_interface *)lsa_type_dependent)
== NULL) {
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"ospf_opaque_lsa_reoriginate_schedule: Type-9 Opaque-LSA: Invalid parameter?");
goto out;
}
if ((top = oi_to_top(oi)) == NULL) {
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"ospf_opaque_lsa_reoriginate_schedule: OI(%s) -> TOP?",
IF_NAME(oi));
goto out;
@@ -1688,7 +1688,7 @@ void ospf_opaque_lsa_reoriginate_schedule(void *lsa_type_dependent,
&& list_isempty(oi->opaque_lsa_self)
&& oi->t_opaque_lsa_self != NULL) {
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"Type-9 Opaque-LSA (opaque_type=%u): Common origination for OI(%s) has already started",
opaque_type, IF_NAME(oi));
goto out;
@@ -1698,13 +1698,13 @@ void ospf_opaque_lsa_reoriginate_schedule(void *lsa_type_dependent,
case OSPF_OPAQUE_AREA_LSA:
if ((area = (struct ospf_area *)lsa_type_dependent) == NULL) {
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"ospf_opaque_lsa_reoriginate_schedule: Type-10 Opaque-LSA: Invalid parameter?");
goto out;
}
if ((top = area->ospf) == NULL) {
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"ospf_opaque_lsa_reoriginate_schedule: AREA(%s) -> TOP?",
inet_ntoa(area->area_id));
goto out;
@@ -1713,7 +1713,7 @@ void ospf_opaque_lsa_reoriginate_schedule(void *lsa_type_dependent,
&& list_isempty(area->opaque_lsa_self)
&& area->t_opaque_lsa_self != NULL) {
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"Type-10 Opaque-LSA (opaque_type=%u): Common origination for AREA(%s) has already started",
opaque_type, inet_ntoa(area->area_id));
goto out;
@@ -1723,7 +1723,7 @@ void ospf_opaque_lsa_reoriginate_schedule(void *lsa_type_dependent,
case OSPF_OPAQUE_AS_LSA:
if ((top = (struct ospf *)lsa_type_dependent) == NULL) {
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"ospf_opaque_lsa_reoriginate_schedule: Type-11 Opaque-LSA: Invalid parameter?");
goto out;
}
@@ -1731,7 +1731,7 @@ void ospf_opaque_lsa_reoriginate_schedule(void *lsa_type_dependent,
&& list_isempty(top->opaque_lsa_self)
&& top->t_opaque_lsa_self != NULL) {
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"Type-11 Opaque-LSA (opaque_type=%u): Common origination has already started",
opaque_type);
goto out;
@@ -1745,7 +1745,7 @@ void ospf_opaque_lsa_reoriginate_schedule(void *lsa_type_dependent,
break;
default:
flog_warn(
- OSPF_WARN_LSA_UNEXPECTED,
+ EC_OSPF_LSA_UNEXPECTED,
"ospf_opaque_lsa_reoriginate_schedule: Unexpected LSA-type(%u)",
lsa_type);
goto out;
@@ -1767,7 +1767,7 @@ void ospf_opaque_lsa_reoriginate_schedule(void *lsa_type_dependent,
struct ospf_opaque_functab *functab;
if ((functab = ospf_opaque_functab_lookup(lsa)) == NULL) {
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"ospf_opaque_lsa_reoriginate_schedule: No associated function?: lsa_type(%u), opaque_type(%u)",
lsa_type, opaque_type);
goto out;
@@ -1775,7 +1775,7 @@ void ospf_opaque_lsa_reoriginate_schedule(void *lsa_type_dependent,
if ((oipt = register_opaque_info_per_type(functab, lsa))
== NULL) {
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"ospf_opaque_lsa_reoriginate_schedule: Cannot get a control info?: lsa_type(%u), opaque_type(%u)",
lsa_type, opaque_type);
goto out;
@@ -1848,7 +1848,7 @@ static int ospf_opaque_type9_lsa_reoriginate_timer(struct thread *t)
if ((functab = oipt->functab) == NULL
|| functab->lsa_originator == NULL) {
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"ospf_opaque_type9_lsa_reoriginate_timer: No associated function?");
goto out;
}
@@ -1856,7 +1856,7 @@ static int ospf_opaque_type9_lsa_reoriginate_timer(struct thread *t)
oi = (struct ospf_interface *)oipt->owner;
if ((top = oi_to_top(oi)) == NULL) {
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"ospf_opaque_type9_lsa_reoriginate_timer: Something wrong?");
goto out;
}
@@ -1900,7 +1900,7 @@ static int ospf_opaque_type10_lsa_reoriginate_timer(struct thread *t)
if ((functab = oipt->functab) == NULL
|| functab->lsa_originator == NULL) {
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"ospf_opaque_type10_lsa_reoriginate_timer: No associated function?");
goto out;
}
@@ -1908,7 +1908,7 @@ static int ospf_opaque_type10_lsa_reoriginate_timer(struct thread *t)
area = (struct ospf_area *)oipt->owner;
if (area == NULL || (top = area->ospf) == NULL) {
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"ospf_opaque_type10_lsa_reoriginate_timer: Something wrong?");
goto out;
}
@@ -1956,14 +1956,14 @@ static int ospf_opaque_type11_lsa_reoriginate_timer(struct thread *t)
if ((functab = oipt->functab) == NULL
|| functab->lsa_originator == NULL) {
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"ospf_opaque_type11_lsa_reoriginate_timer: No associated function?");
goto out;
}
if ((top = (struct ospf *)oipt->owner) == NULL) {
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"ospf_opaque_type11_lsa_reoriginate_timer: Something wrong?");
goto out;
}
@@ -2000,14 +2000,14 @@ void ospf_opaque_lsa_refresh_schedule(struct ospf_lsa *lsa0)
if ((oipt = lookup_opaque_info_by_type(lsa0)) == NULL
|| (oipi = lookup_opaque_info_by_id(oipt, lsa0)) == NULL) {
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"ospf_opaque_lsa_refresh_schedule: Invalid parameter?");
goto out;
}
/* Given "lsa0" and current "oipi->lsa" may different, but harmless. */
if ((lsa = oipi->lsa) == NULL) {
- flog_warn(OSPF_WARN_LSA,
+ flog_warn(EC_OSPF_LSA,
"ospf_opaque_lsa_refresh_schedule: Something wrong?");
goto out;
}
@@ -2036,7 +2036,7 @@ void ospf_opaque_lsa_refresh_schedule(struct ospf_lsa *lsa0)
break;
default:
flog_warn(
- OSPF_WARN_LSA_UNEXPECTED,
+ EC_OSPF_LSA_UNEXPECTED,
"ospf_opaque_lsa_refresh_schedule: Unexpected LSA-type(%u)",
lsa->data->type);
goto out;
@@ -2088,14 +2088,14 @@ void ospf_opaque_lsa_flush_schedule(struct ospf_lsa *lsa0)
if ((oipt = lookup_opaque_info_by_type(lsa0)) == NULL
|| (oipi = lookup_opaque_info_by_id(oipt, lsa0)) == NULL) {
- flog_warn(OSPF_WARN_LSA,
+ flog_warn(EC_OSPF_LSA,
"ospf_opaque_lsa_flush_schedule: Invalid parameter?");
goto out;
}
/* Given "lsa0" and current "oipi->lsa" may different, but harmless. */
if ((lsa = oipi->lsa) == NULL) {
- flog_warn(OSPF_WARN_LSA,
+ flog_warn(EC_OSPF_LSA,
"ospf_opaque_lsa_flush_schedule: Something wrong?");
goto out;
}
@@ -2113,7 +2113,7 @@ void ospf_opaque_lsa_flush_schedule(struct ospf_lsa *lsa0)
break;
default:
flog_warn(
- OSPF_WARN_LSA_UNEXPECTED,
+ EC_OSPF_LSA_UNEXPECTED,
"ospf_opaque_lsa_flush_schedule: Unexpected LSA-type(%u)",
lsa->data->type);
goto out;
@@ -2171,7 +2171,7 @@ void ospf_opaque_self_originated_lsa_received(struct ospf_neighbor *nbr,
break;
default:
flog_warn(
- OSPF_WARN_LSA_UNEXPECTED,
+ EC_OSPF_LSA_UNEXPECTED,
"ospf_opaque_self_originated_lsa_received: Unexpected LSA-type(%u)",
lsa->data->type);
return;
@@ -2190,7 +2190,7 @@ struct ospf *oi_to_top(struct ospf_interface *oi)
if (oi == NULL || (area = oi->area) == NULL
|| (top = area->ospf) == NULL)
- flog_warn(OSPF_WARN_LSA,
+ flog_warn(EC_OSPF_LSA,
"Broken relationship for \"OI -> AREA -> OSPF\"?");
return top;
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index 59340fbf1..c4c4d2f03 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -233,7 +233,7 @@ void ospf_packet_add(struct ospf_interface *oi, struct ospf_packet *op)
{
if (!oi->obuf) {
flog_err(
- OSPF_ERR_PKT_PROCESS,
+ EC_OSPF_PKT_PROCESS,
"ospf_packet_add(interface %s in state %d [%s], packet type %s, "
"destination %s) called with NULL obuf, ignoring "
"(please report this bug)!\n",
@@ -257,7 +257,7 @@ static void ospf_packet_add_top(struct ospf_interface *oi,
{
if (!oi->obuf) {
flog_err(
- OSPF_ERR_PKT_PROCESS,
+ EC_OSPF_PKT_PROCESS,
"ospf_packet_add(interface %s in state %d [%s], packet type %s, "
"destination %s) called with NULL obuf, ignoring "
"(please report this bug)!\n",
@@ -342,9 +342,8 @@ static int ospf_check_md5_digest(struct ospf_interface *oi,
ck = ospf_crypt_key_lookup(OSPF_IF_PARAM(oi, auth_crypt),
ospfh->u.crypt.key_id);
if (ck == NULL) {
- flog_warn(OSPF_WARN_MD5,
- "interface %s: ospf_check_md5 no key %d", IF_NAME(oi),
- ospfh->u.crypt.key_id);
+ flog_warn(EC_OSPF_MD5, "interface %s: ospf_check_md5 no key %d",
+ IF_NAME(oi), ospfh->u.crypt.key_id);
return 0;
}
@@ -354,7 +353,7 @@ static int ospf_check_md5_digest(struct ospf_interface *oi,
if (nbr
&& ntohl(nbr->crypt_seqnum) > ntohl(ospfh->u.crypt.crypt_seqnum)) {
flog_warn(
- OSPF_WARN_MD5,
+ EC_OSPF_MD5,
"interface %s: ospf_check_md5 bad sequence %d (expect %d)",
IF_NAME(oi), ntohl(ospfh->u.crypt.crypt_seqnum),
ntohl(nbr->crypt_seqnum));
@@ -370,7 +369,7 @@ static int ospf_check_md5_digest(struct ospf_interface *oi,
/* compare the two */
if (memcmp((caddr_t)ospfh + length, digest, OSPF_AUTH_MD5_SIZE)) {
- flog_warn(OSPF_WARN_MD5,
+ flog_warn(EC_OSPF_MD5,
"interface %s: ospf_check_md5 checksum mismatch",
IF_NAME(oi));
return 0;
@@ -438,7 +437,7 @@ static int ospf_make_md5_digest(struct ospf_interface *oi,
if (stream_get_endp(op->s) != op->length)
/* XXX size_t */
flog_warn(
- OSPF_WARN_MD5,
+ EC_OSPF_MD5,
"ospf_make_md5_digest: length mismatch stream %lu ospf_packet %u",
(unsigned long)stream_get_endp(op->s), op->length);
@@ -602,7 +601,7 @@ static void ospf_write_frags(int fd, struct ospf_packet *op, struct ip *iph,
if (ret < 0)
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"*** ospf_write_frags: sendmsg failed to %s,"
" id %d, off %d, len %d, mtu %u failed with %s",
inet_ntoa(iph->ip_dst), iph->ip_id, iph->ip_off,
@@ -806,7 +805,7 @@ static int ospf_write(struct thread *thread)
if (ret < 0)
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"*** sendmsg in ospf_write failed to %s, "
"id %d, off %d, len %d, interface %s, mtu %u: %s",
inet_ntoa(iph.ip_dst), iph.ip_id, iph.ip_off,
@@ -923,7 +922,7 @@ static void ospf_hello(struct ip *iph, struct ospf_header *ospfh,
&& oi->type != OSPF_IFTYPE_VIRTUALLINK)
if (oi->address->prefixlen != p.prefixlen) {
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"Packet %s [Hello:RECV]: NetworkMask mismatch on %s (configured prefix length is %d, but hello packet indicates %d).",
inet_ntoa(ospfh->router_id), IF_NAME(oi),
(int)oi->address->prefixlen, (int)p.prefixlen);
@@ -932,7 +931,7 @@ static void ospf_hello(struct ip *iph, struct ospf_header *ospfh,
/* Compare Router Dead Interval. */
if (OSPF_IF_PARAM(oi, v_wait) != ntohl(hello->dead_interval)) {
- flog_warn(OSPF_WARN_PACKET,
+ flog_warn(EC_OSPF_PACKET,
"Packet %s [Hello:RECV]: RouterDeadInterval mismatch "
"(expected %u, but received %u).",
inet_ntoa(ospfh->router_id),
@@ -946,7 +945,7 @@ static void ospf_hello(struct ip *iph, struct ospf_header *ospfh,
if (OSPF_IF_PARAM(oi, v_hello)
!= ntohs(hello->hello_interval)) {
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"Packet %s [Hello:RECV]: HelloInterval mismatch "
"(expected %u, but received %u).",
inet_ntoa(ospfh->router_id),
@@ -971,7 +970,7 @@ static void ospf_hello(struct ip *iph, struct ospf_header *ospfh,
* Drop this Hello packet not to establish neighbor
* relationship.
*/
- flog_warn(OSPF_WARN_PACKET,
+ flog_warn(EC_OSPF_PACKET,
"Packet %s [Hello:RECV]: T-bit on, drop it.",
inet_ntoa(ospfh->router_id));
return;
@@ -984,7 +983,7 @@ static void ospf_hello(struct ip *iph, struct ospf_header *ospfh,
* This router does know the correct usage of O-bit
* the bit should be set in DD packet only.
*/
- flog_warn(OSPF_WARN_PACKET,
+ flog_warn(EC_OSPF_PACKET,
"Packet %s [Hello:RECV]: O-bit abuse?",
inet_ntoa(ospfh->router_id));
#ifdef STRICT_OBIT_USAGE_CHECK
@@ -1002,7 +1001,7 @@ static void ospf_hello(struct ip *iph, struct ospf_header *ospfh,
&& !CHECK_FLAG(OPTIONS(oi), OSPF_OPTION_E)
&& !CHECK_FLAG(hello->options, OSPF_OPTION_E))) {
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"NSSA-Packet-%s[Hello:RECV]: my options: %x, his options %x",
inet_ntoa(ospfh->router_id), OPTIONS(oi),
hello->options);
@@ -1020,7 +1019,7 @@ static void ospf_hello(struct ip *iph, struct ospf_header *ospfh,
if (CHECK_FLAG(OPTIONS(oi), OSPF_OPTION_E)
!= CHECK_FLAG(hello->options, OSPF_OPTION_E)) {
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"Packet %s [Hello:RECV]: my options: %x, his options %x",
inet_ntoa(ospfh->router_id), OPTIONS(oi),
hello->options);
@@ -1137,7 +1136,7 @@ static void ospf_db_desc_proc(struct stream *s, struct ospf_interface *oi,
/* Unknown LS type. */
if (lsah->type < OSPF_MIN_LSA || lsah->type >= OSPF_MAX_LSA) {
- flog_warn(OSPF_WARN_PACKET,
+ flog_warn(EC_OSPF_PACKET,
"Packet [DD:RECV]: Unknown LS type %d.",
lsah->type);
OSPF_NSM_EVENT_SCHEDULE(nbr, NSM_SeqNumberMismatch);
@@ -1146,7 +1145,7 @@ static void ospf_db_desc_proc(struct stream *s, struct ospf_interface *oi,
if (IS_OPAQUE_LSA(lsah->type)
&& !CHECK_FLAG(nbr->options, OSPF_OPTION_O)) {
- flog_warn(OSPF_WARN_PACKET,
+ flog_warn(EC_OSPF_PACKET,
"LSA[Type%d:%s]: Opaque capability mismatch?",
lsah->type, inet_ntoa(lsah->id));
OSPF_NSM_EVENT_SCHEDULE(nbr, NSM_SeqNumberMismatch);
@@ -1161,7 +1160,7 @@ static void ospf_db_desc_proc(struct stream *s, struct ospf_interface *oi,
allow if from NSSA. */
if (oi->area->external_routing == OSPF_AREA_STUB) {
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"Packet [DD:RECV]: LSA[Type%d:%s] from %s area.",
lsah->type, inet_ntoa(lsah->id),
(oi->area->external_routing
@@ -1288,7 +1287,7 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh,
nbr = ospf_nbr_lookup(oi, iph, ospfh);
if (nbr == NULL) {
- flog_warn(OSPF_WARN_PACKET, "Packet[DD]: Unknown Neighbor %s",
+ flog_warn(EC_OSPF_PACKET, "Packet[DD]: Unknown Neighbor %s",
inet_ntoa(ospfh->router_id));
return;
}
@@ -1297,7 +1296,7 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh,
if ((OSPF_IF_PARAM(oi, mtu_ignore) == 0)
&& (ntohs(dd->mtu) > oi->ifp->mtu)) {
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"Packet[DD]: Neighbor %s MTU %u is larger than [%s]'s MTU %u",
inet_ntoa(nbr->router_id), ntohs(dd->mtu), IF_NAME(oi),
oi->ifp->mtu);
@@ -1336,8 +1335,7 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh,
* In Hello protocol, optional capability must have checked
* to prevent this T-bit enabled router be my neighbor.
*/
- flog_warn(OSPF_WARN_PACKET,
- "Packet[DD]: Neighbor %s: T-bit on?",
+ flog_warn(EC_OSPF_PACKET, "Packet[DD]: Neighbor %s: T-bit on?",
inet_ntoa(nbr->router_id));
return;
}
@@ -1362,7 +1360,7 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh,
case NSM_Attempt:
case NSM_TwoWay:
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"Packet[DD]: Neighbor %s state is %s, packet discarded.",
inet_ntoa(nbr->router_id),
lookup_msg(ospf_nsm_state_msg, nbr->state, NULL));
@@ -1416,7 +1414,7 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh,
/* Reset I, leaving MS */
UNSET_FLAG(nbr->dd_flags, OSPF_DD_FLAG_I);
} else {
- flog_warn(OSPF_WARN_PACKET,
+ flog_warn(EC_OSPF_PACKET,
"Packet[DD]: Neighbor %s Negotiation fails.",
inet_ntoa(nbr->router_id));
break;
@@ -1438,7 +1436,7 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh,
&& IPV4_ADDR_SAME(&DR(oi),
&nbr->address.u.prefix4)) {
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"DR-neighbor[%s] is NOT opaque-capable; Opaque-LSAs cannot be reliably advertised in this network.",
inet_ntoa(nbr->router_id));
/* This situation is undesirable, but not a real
@@ -1474,7 +1472,7 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh,
/* Check Master/Slave bit mismatch */
if (IS_SET_DD_MS(dd->flags)
!= IS_SET_DD_MS(nbr->last_recv.flags)) {
- flog_warn(OSPF_WARN_PACKET,
+ flog_warn(EC_OSPF_PACKET,
"Packet[DD]: Neighbor %s MS-bit mismatch.",
inet_ntoa(nbr->router_id));
OSPF_NSM_EVENT_SCHEDULE(nbr, NSM_SeqNumberMismatch);
@@ -1499,7 +1497,7 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh,
/* Save the new options for debugging */
nbr->options = dd->options;
#endif /* ORIGINAL_CODING */
- flog_warn(OSPF_WARN_PACKET,
+ flog_warn(EC_OSPF_PACKET,
"Packet[DD]: Neighbor %s options mismatch.",
inet_ntoa(nbr->router_id));
OSPF_NSM_EVENT_SCHEDULE(nbr, NSM_SeqNumberMismatch);
@@ -1512,7 +1510,7 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh,
|| (!IS_SET_DD_MS(nbr->dd_flags)
&& ntohl(dd->dd_seqnum) != nbr->dd_seqnum + 1)) {
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"Packet[DD]: Neighbor %s sequence number mismatch.",
inet_ntoa(nbr->router_id));
OSPF_NSM_EVENT_SCHEDULE(nbr, NSM_SeqNumberMismatch);
@@ -1562,7 +1560,7 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh,
OSPF_NSM_EVENT_SCHEDULE(nbr, NSM_SeqNumberMismatch);
break;
default:
- flog_warn(OSPF_WARN_PACKET,
+ flog_warn(EC_OSPF_PACKET,
"Packet[DD]: Neighbor %s NSM illegal status %u.",
inet_ntoa(nbr->router_id), nbr->state);
break;
@@ -1589,7 +1587,7 @@ static void ospf_ls_req(struct ip *iph, struct ospf_header *ospfh,
nbr = ospf_nbr_lookup(oi, iph, ospfh);
if (nbr == NULL) {
- flog_warn(OSPF_WARN_PACKET,
+ flog_warn(EC_OSPF_PACKET,
"Link State Request: Unknown Neighbor %s.",
inet_ntoa(ospfh->router_id));
return;
@@ -1602,7 +1600,7 @@ static void ospf_ls_req(struct ip *iph, struct ospf_header *ospfh,
if (nbr->state != NSM_Exchange && nbr->state != NSM_Loading
&& nbr->state != NSM_Full) {
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"Link State Request received from %s: Neighbor state is %s, packet discarded.",
inet_ntoa(ospfh->router_id),
lookup_msg(ospf_nsm_state_msg, nbr->state, NULL));
@@ -1695,7 +1693,7 @@ static struct list *ospf_ls_upd_list_lsa(struct ospf_neighbor *nbr,
if (length > size) {
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"Link State Update: LSA length exceeds packet size.");
break;
}
@@ -1710,7 +1708,7 @@ static struct list *ospf_ls_upd_list_lsa(struct ospf_neighbor *nbr,
* chance to compress repeated messages in syslog on the
* other */
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"Link State Update: LSA checksum error %x/%x, ID=%s from: nbr %s, router ID %s, adv router %s",
sum, lsah->checksum, inet_ntoa(lsah->id),
inet_ntoa(nbr->src), inet_ntoa(nbr->router_id),
@@ -1720,7 +1718,7 @@ static struct list *ospf_ls_upd_list_lsa(struct ospf_neighbor *nbr,
/* Examine the LSA's LS type. */
if (lsah->type < OSPF_MIN_LSA || lsah->type >= OSPF_MAX_LSA) {
- flog_warn(OSPF_WARN_PACKET,
+ flog_warn(EC_OSPF_PACKET,
"Link State Update: Unknown LS type %d",
lsah->type);
continue;
@@ -1745,7 +1743,7 @@ static struct list *ospf_ls_upd_list_lsa(struct ospf_neighbor *nbr,
* the bit will be set in Type-9,10,11 LSAs
* only.
*/
- flog_warn(OSPF_WARN_PACKET,
+ flog_warn(EC_OSPF_PACKET,
"LSA[Type%d:%s]: O-bit abuse?",
lsah->type, inet_ntoa(lsah->id));
continue;
@@ -1765,7 +1763,7 @@ static struct list *ospf_ls_upd_list_lsa(struct ospf_neighbor *nbr,
continue;
}
} else if (IS_OPAQUE_LSA(lsah->type)) {
- flog_warn(OSPF_WARN_PACKET,
+ flog_warn(EC_OSPF_PACKET,
"LSA[Type%d:%s]: Opaque capability mismatch?",
lsah->type, inet_ntoa(lsah->id));
continue;
@@ -1836,7 +1834,7 @@ static void ospf_ls_upd(struct ospf *ospf, struct ip *iph,
/* Check neighbor. */
nbr = ospf_nbr_lookup(oi, iph, ospfh);
if (nbr == NULL) {
- flog_warn(OSPF_WARN_PACKET,
+ flog_warn(EC_OSPF_PACKET,
"Link State Update: Unknown Neighbor %s on int: %s",
inet_ntoa(ospfh->router_id), IF_NAME(oi));
return;
@@ -1948,18 +1946,18 @@ static void ospf_ls_upd(struct ospf *ospf, struct ip *iph,
char buf2[INET_ADDRSTRLEN];
char buf3[INET_ADDRSTRLEN];
- flog_err(OSPF_ERR_ROUTER_LSA_MISMATCH,
- "Incoming Router-LSA from %s with "
- "Adv-ID[%s] != LS-ID[%s]",
- inet_ntop(AF_INET, &ospfh->router_id,
- buf1, INET_ADDRSTRLEN),
- inet_ntop(AF_INET, &lsa->data->id,
- buf2, INET_ADDRSTRLEN),
- inet_ntop(AF_INET,
- &lsa->data->adv_router,
- buf3, INET_ADDRSTRLEN));
+ flog_err(EC_OSPF_ROUTER_LSA_MISMATCH,
+ "Incoming Router-LSA from %s with "
+ "Adv-ID[%s] != LS-ID[%s]",
+ inet_ntop(AF_INET, &ospfh->router_id,
+ buf1, INET_ADDRSTRLEN),
+ inet_ntop(AF_INET, &lsa->data->id,
+ buf2, INET_ADDRSTRLEN),
+ inet_ntop(AF_INET,
+ &lsa->data->adv_router, buf3,
+ INET_ADDRSTRLEN));
flog_err(
- OSPF_ERR_DOMAIN_CORRUPT,
+ EC_OSPF_DOMAIN_CORRUPT,
"OSPF domain compromised by attack or corruption. "
"Verify correct operation of -ALL- OSPF routers.");
DISCARD_LSA(lsa, 0);
@@ -2119,7 +2117,7 @@ static void ospf_ls_upd(struct ospf *ospf, struct ip *iph,
if (ospf_ls_request_lookup(nbr, lsa)) {
OSPF_NSM_EVENT_SCHEDULE(nbr, NSM_BadLSReq);
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"LSA[%s] instance exists on Link state request list",
dump_lsa_key(lsa));
@@ -2232,7 +2230,7 @@ static void ospf_ls_ack(struct ip *iph, struct ospf_header *ospfh,
nbr = ospf_nbr_lookup(oi, iph, ospfh);
if (nbr == NULL) {
- flog_warn(OSPF_WARN_PACKET,
+ flog_warn(EC_OSPF_PACKET,
"Link State Acknowledgment: Unknown Neighbor %s.",
inet_ntoa(ospfh->router_id));
return;
@@ -2303,14 +2301,14 @@ static struct stream *ospf_recv_packet(struct ospf *ospf, int fd,
ret = stream_recvmsg(ibuf, fd, &msgh, 0, OSPF_MAX_PACKET_SIZE + 1);
if (ret < 0) {
- flog_warn(OSPF_WARN_PACKET, "stream_recvmsg failed: %s",
+ flog_warn(EC_OSPF_PACKET, "stream_recvmsg failed: %s",
safe_strerror(errno));
return NULL;
}
if ((unsigned int)ret < sizeof(iph)) /* ret must be > 0 now */
{
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"ospf_recv_packet: discarding runt packet of length %d "
"(ip header size is %u)",
ret, (unsigned int)sizeof(iph));
@@ -2357,7 +2355,7 @@ static struct stream *ospf_recv_packet(struct ospf *ospf, int fd,
if (ret != ip_len) {
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"ospf_recv_packet read length mismatch: ip_len is %d, "
"but recvmsg returned %d",
ip_len, ret);
@@ -2464,7 +2462,7 @@ static int ospf_check_auth(struct ospf_interface *oi, struct ospf_header *ospfh)
if (OSPF_AUTH_NULL != (iface_auth_type = ospf_auth_type(oi))) {
if (IS_DEBUG_OSPF_PACKET(ospfh->type - 1, RECV))
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"interface %s: auth-type mismatch, local %s, rcvd Null",
IF_NAME(oi),
lookup_msg(ospf_auth_type_str,
@@ -2474,7 +2472,7 @@ static int ospf_check_auth(struct ospf_interface *oi, struct ospf_header *ospfh)
if (!ospf_check_sum(ospfh)) {
if (IS_DEBUG_OSPF_PACKET(ospfh->type - 1, RECV))
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"interface %s: Null auth OK, but checksum error, Router-ID %s",
IF_NAME(oi),
inet_ntoa(ospfh->router_id));
@@ -2486,7 +2484,7 @@ static int ospf_check_auth(struct ospf_interface *oi, struct ospf_header *ospfh)
!= (iface_auth_type = ospf_auth_type(oi))) {
if (IS_DEBUG_OSPF_PACKET(ospfh->type - 1, RECV))
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"interface %s: auth-type mismatch, local %s, rcvd Simple",
IF_NAME(oi),
lookup_msg(ospf_auth_type_str,
@@ -2496,7 +2494,7 @@ static int ospf_check_auth(struct ospf_interface *oi, struct ospf_header *ospfh)
if (memcmp(OSPF_IF_PARAM(oi, auth_simple), ospfh->u.auth_data,
OSPF_AUTH_SIMPLE_SIZE)) {
if (IS_DEBUG_OSPF_PACKET(ospfh->type - 1, RECV))
- flog_warn(OSPF_WARN_PACKET,
+ flog_warn(EC_OSPF_PACKET,
"interface %s: Simple auth failed",
IF_NAME(oi));
return 0;
@@ -2504,7 +2502,7 @@ static int ospf_check_auth(struct ospf_interface *oi, struct ospf_header *ospfh)
if (!ospf_check_sum(ospfh)) {
if (IS_DEBUG_OSPF_PACKET(ospfh->type - 1, RECV))
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"interface %s: Simple auth OK, checksum error, Router-ID %s",
IF_NAME(oi),
inet_ntoa(ospfh->router_id));
@@ -2516,7 +2514,7 @@ static int ospf_check_auth(struct ospf_interface *oi, struct ospf_header *ospfh)
!= (iface_auth_type = ospf_auth_type(oi))) {
if (IS_DEBUG_OSPF_PACKET(ospfh->type - 1, RECV))
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"interface %s: auth-type mismatch, local %s, rcvd Cryptographic",
IF_NAME(oi),
lookup_msg(ospf_auth_type_str,
@@ -2526,7 +2524,7 @@ static int ospf_check_auth(struct ospf_interface *oi, struct ospf_header *ospfh)
if (ospfh->checksum) {
if (IS_DEBUG_OSPF_PACKET(ospfh->type - 1, RECV))
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"interface %s: OSPF header checksum is not 0",
IF_NAME(oi));
return 0;
@@ -2541,7 +2539,7 @@ static int ospf_check_auth(struct ospf_interface *oi, struct ospf_header *ospfh)
bug? */
!ospf_check_md5_digest(oi, ospfh)) {
if (IS_DEBUG_OSPF_PACKET(ospfh->type - 1, RECV))
- flog_warn(OSPF_WARN_MD5,
+ flog_warn(EC_OSPF_MD5,
"interface %s: MD5 auth failed",
IF_NAME(oi));
return 0;
@@ -2550,7 +2548,7 @@ static int ospf_check_auth(struct ospf_interface *oi, struct ospf_header *ospfh)
default:
if (IS_DEBUG_OSPF_PACKET(ospfh->type - 1, RECV))
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"interface %s: invalid packet auth-type (%02x)",
IF_NAME(oi), pkt_auth_type);
return 0;
@@ -2899,7 +2897,7 @@ static int ospf_verify_header(struct stream *ibuf, struct ospf_interface *oi,
{
/* Check Area ID. */
if (!ospf_check_area_id(oi, ospfh)) {
- flog_warn(OSPF_WARN_PACKET,
+ flog_warn(EC_OSPF_PACKET,
"interface %s: ospf_read invalid Area ID %s.",
IF_NAME(oi), inet_ntoa(ospfh->area_id));
return -1;
@@ -2908,7 +2906,7 @@ static int ospf_verify_header(struct stream *ibuf, struct ospf_interface *oi,
/* Check network mask, Silently discarded. */
if (!ospf_check_network_mask(oi, iph->ip_src)) {
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"interface %s: ospf_read network address is not same [%s]",
IF_NAME(oi), inet_ntoa(iph->ip_src));
return -1;
@@ -3053,14 +3051,14 @@ int ospf_read(struct thread *thread)
*/
else if (oi->ifp != ifp) {
if (IS_DEBUG_OSPF_EVENT)
- flog_warn(OSPF_WARN_PACKET,
+ flog_warn(EC_OSPF_PACKET,
"Packet from [%s] received on wrong link %s",
inet_ntoa(iph->ip_src), ifp->name);
return 0;
} else if (oi->state == ISM_Down) {
char buf[2][INET_ADDRSTRLEN];
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"Ignoring packet from %s to %s received on interface that is "
"down [%s]; interface flags are %s",
inet_ntop(AF_INET, &iph->ip_src, buf[0],
@@ -3086,7 +3084,7 @@ int ospf_read(struct thread *thread)
if (iph->ip_dst.s_addr == htonl(OSPF_ALLDROUTERS)
&& (oi->state != ISM_DR && oi->state != ISM_Backup)) {
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"Dropping packet for AllDRouters from [%s] via [%s] (ISM: %s)",
inet_ntoa(iph->ip_src), IF_NAME(oi),
lookup_msg(ospf_ism_state_msg, oi->state, NULL));
@@ -3149,7 +3147,7 @@ int ospf_read(struct thread *thread)
ospf_ls_ack(iph, ospfh, ibuf, oi, length);
break;
default:
- flog_warn(OSPF_WARN_PACKET,
+ flog_warn(EC_OSPF_PACKET,
"interface %s: OSPF packet header type %d is illegal",
IF_NAME(oi), ospfh->type);
break;
@@ -3882,7 +3880,7 @@ static struct ospf_packet *ospf_ls_upd_packet_new(struct list *update,
> ospf_packet_max(oi)) {
if (!warned) {
flog_warn(
- OSPF_WARN_LARGE_LSA,
+ EC_OSPF_LARGE_LSA,
"ospf_ls_upd_packet_new: oversized LSA encountered!"
"will need to fragment. Not optimal. Try divide up"
" your network with areas. Use 'debug ospf packet send'"
@@ -3910,7 +3908,7 @@ static struct ospf_packet *ospf_ls_upd_packet_new(struct list *update,
size = oi->ifp->mtu;
if (size > OSPF_MAX_PACKET_SIZE) {
- flog_warn(OSPF_WARN_LARGE_LSA,
+ flog_warn(EC_OSPF_LARGE_LSA,
"ospf_ls_upd_packet_new: oversized LSA id:%s too big,"
" %d bytes, packet size %ld, dropping it completely."
" OSPF routing is broken!",
@@ -4072,10 +4070,10 @@ void ospf_ls_upd_send(struct ospf_neighbor *nbr, struct list *update, int flag,
if (oi->type == OSPF_IFTYPE_NBMA) {
if (flag == OSPF_SEND_PACKET_INDIRECT)
flog_warn(
- OSPF_WARN_PACKET,
+ EC_OSPF_PACKET,
"* LS-Update is directly sent on NBMA network.");
if (IPV4_ADDR_SAME(&oi->address->u.prefix4, &p.prefix))
- flog_warn(OSPF_WARN_PACKET,
+ flog_warn(EC_OSPF_PACKET,
"* LS-Update is sent to myself.");
}
diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c
index 974822ba8..e95fc43aa 100644
--- a/ospfd/ospf_ri.c
+++ b/ospfd/ospf_ri.c
@@ -187,7 +187,7 @@ static int ospf_router_info_register(uint8_t scope)
if (rc != 0) {
flog_warn(
- OSPF_WARN_OPAQUE_REGISTRATION,
+ EC_OSPF_OPAQUE_REGISTRATION,
"ospf_router_info_init: Failed to register functions");
return rc;
}
@@ -829,7 +829,7 @@ static int ospf_router_info_lsa_originate1(void *arg)
/* Install this LSA into LSDB. */
if (ospf_lsa_install(top, NULL /*oi */, new) == NULL) {
flog_warn(
- OSPF_WARN_LSA_INSTALL_FAILURE,
+ EC_OSPF_LSA_INSTALL_FAILURE,
"ospf_router_info_lsa_originate1: ospf_lsa_install() ?");
ospf_lsa_unlock(&new);
return rc;
@@ -879,7 +879,7 @@ static int ospf_router_info_lsa_originate(void *arg)
} else {
if (!is_mandated_params_set(OspfRI))
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"ospf_router_info_lsa_originate: lacks mandated ROUTER INFORMATION parameters");
/* Ok, let's try to originate an LSA */
@@ -911,7 +911,7 @@ static struct ospf_lsa *ospf_router_info_lsa_refresh(struct ospf_lsa *lsa)
/* Verify that the Router Information ID is supported */
if (GET_OPAQUE_ID(ntohl(lsa->data->id.s_addr)) != 0) {
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"ospf_router_info_lsa_refresh: Unsupported Router Information ID");
return NULL;
}
@@ -932,7 +932,7 @@ static struct ospf_lsa *ospf_router_info_lsa_refresh(struct ospf_lsa *lsa)
/* Given "lsa" will be freed in the next function. */
top = ospf_lookup_by_vrf_id(lsa->vrf_id);
if (ospf_lsa_install(top, NULL /*oi */, new) == NULL) {
- flog_warn(OSPF_WARN_LSA_INSTALL_FAILURE,
+ flog_warn(EC_OSPF_LSA_INSTALL_FAILURE,
"ospf_router_info_lsa_refresh: ospf_lsa_install() ?");
ospf_lsa_unlock(&new);
return new;
@@ -982,7 +982,7 @@ static void ospf_router_info_lsa_schedule(enum lsa_opcode opcode)
top = ospf_lookup_by_vrf_id(VRF_DEFAULT);
if ((OspfRI.scope == OSPF_OPAQUE_AREA_LSA) && (OspfRI.area == NULL)) {
flog_warn(
- OSPF_WARN_LSA,
+ EC_OSPF_LSA,
"ospf_router_info_lsa_schedule(): Router Info is Area scope flooding but area is not set");
OspfRI.area = ospf_area_lookup_by_area_id(top, OspfRI.area_id);
}
@@ -1023,7 +1023,7 @@ static int ospf_router_info_lsa_update(struct ospf_lsa *lsa)
/* Sanity Check */
if (lsa == NULL) {
- flog_warn(OSPF_WARN_LSA, "OSPF-RI (%s): Abort! LSA is NULL",
+ flog_warn(EC_OSPF_LSA, "OSPF-RI (%s): Abort! LSA is NULL",
__func__);
return -1;
}
@@ -1449,7 +1449,7 @@ DEFUN (router_info,
vty_out(vty,
"%% Unable to register Router Information callbacks.");
flog_err(
- OSPF_ERR_INIT_FAIL,
+ EC_OSPF_INIT_FAIL,
"Unable to register Router Information callbacks. Abort!");
return CMD_WARNING_CONFIG_FAILED;
}
diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c
index d4513eebd..54009639f 100644
--- a/ospfd/ospf_routemap.c
+++ b/ospfd/ospf_routemap.c
@@ -393,7 +393,7 @@ static void *route_set_metric_compile(const char *arg)
metric->type = metric_absolute;
if (strmatch(arg, "+rtt") || strmatch(arg, "-rtt")) {
- flog_warn(OSPF_WARN_SET_METRIC_PLUS,
+ flog_warn(EC_OSPF_SET_METRIC_PLUS,
"OSPF does not support 'set metric +rtt / -rtt'");
return metric;
}
diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c
index 41bf0a410..7896fb632 100644
--- a/ospfd/ospf_spf.c
+++ b/ospfd/ospf_spf.c
@@ -860,7 +860,7 @@ static void ospf_spf_next(struct vertex *v, struct ospf *ospf,
zlog_debug("found the LSA");
break;
default:
- flog_warn(OSPF_WARN_LSA,
+ flog_warn(EC_OSPF_LSA,
"Invalid LSA link type %d", type);
continue;
}
diff --git a/ospfd/ospf_sr.c b/ospfd/ospf_sr.c
index 17aa10ba0..33ec09b9f 100644
--- a/ospfd/ospf_sr.c
+++ b/ospfd/ospf_sr.c
@@ -821,7 +821,7 @@ static struct sr_prefix *get_ext_prefix_sid(struct tlv_header *tlvh)
case EXT_SUBTLV_PREFIX_SID:
psid = (struct ext_subtlv_prefix_sid *)sub_tlvh;
if (psid->algorithm != SR_ALGORITHM_SPF) {
- flog_err(OSPF_ERR_INVALID_ALGORITHM,
+ flog_err(EC_OSPF_INVALID_ALGORITHM,
"SR (%s): Unsupported Algorithm",
__func__);
XFREE(MTYPE_OSPF_SR_PARAMS, srp);
@@ -1102,7 +1102,7 @@ void ospf_sr_ri_lsa_update(struct ospf_lsa *lsa)
return;
if (OspfSR.neighbors == NULL) {
- flog_err(OSPF_ERR_SR_INVALID_DB,
+ flog_err(EC_OSPF_SR_INVALID_DB,
"SR (%s): Abort! no valid SR DataBase", __func__);
return;
}
@@ -1113,18 +1113,18 @@ void ospf_sr_ri_lsa_update(struct ospf_lsa *lsa)
/* Sanity check */
if (srn == NULL) {
- flog_err(OSPF_ERR_SR_NODE_CREATE,
- "SR (%s): Abort! can't create SR node in hash table",
- __func__);
+ flog_err(EC_OSPF_SR_NODE_CREATE,
+ "SR (%s): Abort! can't create SR node in hash table",
+ __func__);
return;
}
if ((srn->instance != 0) && (srn->instance != ntohl(lsah->id.s_addr))) {
- flog_err(OSPF_ERR_SR_INVALID_LSA_ID,
- "SR (%s): Abort! Wrong "
- "LSA ID 4.0.0.%u for SR node %s/%u",
- __func__, GET_OPAQUE_ID(ntohl(lsah->id.s_addr)),
- inet_ntoa(lsah->adv_router), srn->instance);
+ flog_err(EC_OSPF_SR_INVALID_LSA_ID,
+ "SR (%s): Abort! Wrong "
+ "LSA ID 4.0.0.%u for SR node %s/%u",
+ __func__, GET_OPAQUE_ID(ntohl(lsah->id.s_addr)),
+ inet_ntoa(lsah->adv_router), srn->instance);
return;
}
@@ -1167,7 +1167,7 @@ void ospf_sr_ri_lsa_update(struct ospf_lsa *lsa)
/* Check that we collect mandatory parameters */
if (srn->algo[0] == SR_ALGORITHM_UNSET || srgb.range_size == 0
|| srgb.lower_bound == 0) {
- flog_err(OSPF_ERR_SR_NODE_CREATE,
+ flog_err(EC_OSPF_SR_NODE_CREATE,
"SR (%s): Missing mandatory parameters. Abort!",
__func__);
hash_release(OspfSR.neighbors, &(srn->adv_router));
@@ -1214,7 +1214,7 @@ void ospf_sr_ri_lsa_delete(struct ospf_lsa *lsa)
/* Sanity check */
if (OspfSR.neighbors == NULL) {
- flog_err(OSPF_ERR_SR_INVALID_DB,
+ flog_err(EC_OSPF_SR_INVALID_DB,
"SR (%s): Abort! no valid SR Data Base", __func__);
return;
}
@@ -1224,18 +1224,17 @@ void ospf_sr_ri_lsa_delete(struct ospf_lsa *lsa)
/* Sanity check */
if (srn == NULL) {
- flog_err(OSPF_ERR_SR_NODE_CREATE,
- "SR (%s): Abort! no entry in SRDB for SR Node %s",
- __func__, inet_ntoa(lsah->adv_router));
+ flog_err(EC_OSPF_SR_NODE_CREATE,
+ "SR (%s): Abort! no entry in SRDB for SR Node %s",
+ __func__, inet_ntoa(lsah->adv_router));
return;
}
if ((srn->instance != 0) && (srn->instance != ntohl(lsah->id.s_addr))) {
- flog_err(
- OSPF_ERR_SR_INVALID_LSA_ID,
- "SR (%s): Abort! Wrong LSA ID 4.0.0.%u for SR node %s",
- __func__, GET_OPAQUE_ID(ntohl(lsah->id.s_addr)),
- inet_ntoa(lsah->adv_router));
+ flog_err(EC_OSPF_SR_INVALID_LSA_ID,
+ "SR (%s): Abort! Wrong LSA ID 4.0.0.%u for SR node %s",
+ __func__, GET_OPAQUE_ID(ntohl(lsah->id.s_addr)),
+ inet_ntoa(lsah->adv_router));
return;
}
@@ -1261,7 +1260,7 @@ void ospf_sr_ext_link_lsa_update(struct ospf_lsa *lsa)
/* Sanity check */
if (OspfSR.neighbors == NULL) {
- flog_err(OSPF_ERR_SR_INVALID_DB,
+ flog_err(EC_OSPF_SR_INVALID_DB,
"SR (%s): Abort! no valid SR DataBase", __func__);
return;
}
@@ -1273,9 +1272,9 @@ void ospf_sr_ext_link_lsa_update(struct ospf_lsa *lsa)
/* Sanity check */
if (srn == NULL) {
- flog_err(OSPF_ERR_SR_NODE_CREATE,
- "SR (%s): Abort! can't create SR node in hash table",
- __func__);
+ flog_err(EC_OSPF_SR_NODE_CREATE,
+ "SR (%s): Abort! can't create SR node in hash table",
+ __func__);
return;
}
@@ -1313,7 +1312,7 @@ void ospf_sr_ext_link_lsa_delete(struct ospf_lsa *lsa)
/* Sanity check */
if (OspfSR.neighbors == NULL) {
- flog_err(OSPF_ERR_SR_INVALID_DB,
+ flog_err(EC_OSPF_SR_INVALID_DB,
"SR (%s): Abort! no valid SR DataBase", __func__);
return;
}
@@ -1327,7 +1326,7 @@ void ospf_sr_ext_link_lsa_delete(struct ospf_lsa *lsa)
* processing Router Information LSA deletion
*/
if (srn == NULL) {
- flog_err(OSPF_ERR_SR_INVALID_DB,
+ flog_err(EC_OSPF_SR_INVALID_DB,
"SR (%s): Stop! no entry in SRDB for SR Node %s",
__func__, inet_ntoa(lsah->adv_router));
return;
@@ -1345,7 +1344,7 @@ void ospf_sr_ext_link_lsa_delete(struct ospf_lsa *lsa)
listnode_delete(srn->ext_link, srl);
XFREE(MTYPE_OSPF_SR_PARAMS, srl);
} else {
- flog_err(OSPF_ERR_SR_INVALID_DB,
+ flog_err(EC_OSPF_SR_INVALID_DB,
"SR (%s): Didn't found corresponding SR Link 8.0.0.%u "
"for SR Node %s",
__func__, GET_OPAQUE_ID(ntohl(lsah->id.s_addr)),
@@ -1372,7 +1371,7 @@ void ospf_sr_ext_prefix_lsa_update(struct ospf_lsa *lsa)
/* Sanity check */
if (OspfSR.neighbors == NULL) {
- flog_err(OSPF_ERR_SR_INVALID_DB,
+ flog_err(EC_OSPF_SR_INVALID_DB,
"SR (%s): Abort! no valid SR DataBase", __func__);
return;
}
@@ -1384,7 +1383,7 @@ void ospf_sr_ext_prefix_lsa_update(struct ospf_lsa *lsa)
/* Sanity check */
if (srn == NULL) {
- flog_err(OSPF_ERR_SR_NODE_CREATE,
+ flog_err(EC_OSPF_SR_NODE_CREATE,
"SR (%s): Abort! can't create SR node in hash table",
__func__);
return;
@@ -1425,7 +1424,7 @@ void ospf_sr_ext_prefix_lsa_delete(struct ospf_lsa *lsa)
/* Sanity check */
if (OspfSR.neighbors == NULL) {
- flog_err(OSPF_ERR_SR_INVALID_DB,
+ flog_err(EC_OSPF_SR_INVALID_DB,
"SR (%s): Abort! no valid SR DataBase", __func__);
return;
}
@@ -1439,7 +1438,7 @@ void ospf_sr_ext_prefix_lsa_delete(struct ospf_lsa *lsa)
* processing Router Information LSA deletion
*/
if (srn == NULL) {
- flog_err(OSPF_ERR_SR_INVALID_DB,
+ flog_err(EC_OSPF_SR_INVALID_DB,
"SR (%s): Stop! no entry in SRDB for SR Node %s",
__func__, inet_ntoa(lsah->adv_router));
return;
@@ -1457,7 +1456,7 @@ void ospf_sr_ext_prefix_lsa_delete(struct ospf_lsa *lsa)
XFREE(MTYPE_OSPF_SR_PARAMS, srp);
} else {
flog_err(
- OSPF_ERR_SR_INVALID_DB,
+ EC_OSPF_SR_INVALID_DB,
"SR (%s): Didn't found corresponding SR Prefix 7.0.0.%u for SR Node %s",
__func__, GET_OPAQUE_ID(ntohl(lsah->id.s_addr)),
inet_ntoa(lsah->adv_router));
diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c
index f3be77195..f45682c77 100644
--- a/ospfd/ospf_te.c
+++ b/ospfd/ospf_te.c
@@ -104,7 +104,7 @@ int ospf_mpls_te_init(void)
NULL /* ospf_mpls_te_del_lsa_hook */);
if (rc != 0) {
flog_warn(
- OSPF_WARN_OPAQUE_REGISTRATION,
+ EC_OSPF_OPAQUE_REGISTRATION,
"ospf_mpls_te_init: Failed to register Traffic Engineering functions");
return rc;
}
@@ -142,7 +142,7 @@ static int ospf_mpls_te_register(enum inter_as_mode mode)
if (rc != 0) {
flog_warn(
- OSPF_WARN_OPAQUE_REGISTRATION,
+ EC_OSPF_OPAQUE_REGISTRATION,
"ospf_router_info_init: Failed to register Inter-AS functions");
return rc;
}
@@ -820,19 +820,19 @@ static int is_mandated_params_set(struct mpls_te_link *lp)
if (ntohs(OspfMplsTE.router_addr.header.type) == 0) {
flog_warn(
- OSPF_WARN_TE_UNEXPECTED,
+ EC_OSPF_TE_UNEXPECTED,
"MPLS-TE(is_mandated_params_set) Missing Router Address");
return rc;
}
if (ntohs(lp->link_type.header.type) == 0) {
- flog_warn(OSPF_WARN_TE_UNEXPECTED,
+ flog_warn(EC_OSPF_TE_UNEXPECTED,
"MPLS-TE(is_mandated_params_set) Missing Link Type");
return rc;
}
if (!IS_INTER_AS(lp->type) && (ntohs(lp->link_id.header.type) == 0)) {
- flog_warn(OSPF_WARN_TE_UNEXPECTED,
+ flog_warn(EC_OSPF_TE_UNEXPECTED,
"MPLS-TE(is_mandated_params_set) Missing Link ID");
return rc;
}
@@ -925,7 +925,7 @@ void ospf_mpls_te_update_if(struct interface *ifp)
/* Get Link context from interface */
if ((lp = lookup_linkparams_by_ifp(ifp)) == NULL) {
flog_warn(
- OSPF_WARN_TE_UNEXPECTED,
+ EC_OSPF_TE_UNEXPECTED,
"OSPF MPLS-TE Update: Did not find Link Parameters context for interface %s",
ifp->name);
return;
@@ -970,7 +970,7 @@ static void ospf_mpls_te_ism_change(struct ospf_interface *oi, int old_state)
if ((lp = lookup_linkparams_by_ifp(oi->ifp)) == NULL) {
flog_warn(
- OSPF_WARN_TE_UNEXPECTED,
+ EC_OSPF_TE_UNEXPECTED,
"ospf_mpls_te_ism_change: Cannot get linkparams from OI(%s)?",
IF_NAME(oi));
return;
@@ -978,7 +978,7 @@ static void ospf_mpls_te_ism_change(struct ospf_interface *oi, int old_state)
if (oi->area == NULL || oi->area->ospf == NULL) {
flog_warn(
- OSPF_WARN_TE_UNEXPECTED,
+ EC_OSPF_TE_UNEXPECTED,
"ospf_mpls_te_ism_change: Cannot refer to OSPF from OI(%s)?",
IF_NAME(oi));
return;
@@ -989,7 +989,7 @@ static void ospf_mpls_te_ism_change(struct ospf_interface *oi, int old_state)
|| (lp->area != NULL && oi->area == NULL)) {
/* How should we consider this case? */
flog_warn(
- OSPF_WARN_TE_UNEXPECTED,
+ EC_OSPF_TE_UNEXPECTED,
"MPLS-TE: Area for OI(%s) has changed to [%s], flush previous LSAs",
IF_NAME(oi),
oi->area ? inet_ntoa(oi->area->area_id) : "N/A");
@@ -1224,14 +1224,14 @@ static int ospf_mpls_te_lsa_originate1(struct ospf_area *area,
new = ospf_mpls_te_lsa_new(area->ospf, area, lp);
if (new == NULL) {
flog_warn(
- OSPF_WARN_TE_UNEXPECTED,
+ EC_OSPF_TE_UNEXPECTED,
"ospf_mpls_te_lsa_originate1: ospf_mpls_te_lsa_new() ?");
return rc;
}
/* Install this LSA into LSDB. */
if (ospf_lsa_install(area->ospf, NULL /*oi*/, new) == NULL) {
- flog_warn(OSPF_WARN_LSA_INSTALL_FAILURE,
+ flog_warn(EC_OSPF_LSA_INSTALL_FAILURE,
"ospf_mpls_te_lsa_originate1: ospf_lsa_install() ?");
ospf_lsa_unlock(&new);
return rc;
@@ -1326,7 +1326,7 @@ static int ospf_mpls_te_lsa_originate2(struct ospf *top,
new = ospf_mpls_te_lsa_new(top, NULL, lp);
if (new == NULL) {
flog_warn(
- OSPF_WARN_LSA_UNEXPECTED,
+ EC_OSPF_LSA_UNEXPECTED,
"ospf_mpls_te_lsa_originate2: ospf_router_info_lsa_new() ?");
return rc;
}
@@ -1334,7 +1334,7 @@ static int ospf_mpls_te_lsa_originate2(struct ospf *top,
/* Install this LSA into LSDB. */
if (ospf_lsa_install(top, NULL /*oi */, new) == NULL) {
- flog_warn(OSPF_WARN_LSA_INSTALL_FAILURE,
+ flog_warn(EC_OSPF_LSA_INSTALL_FAILURE,
"ospf_mpls_te_lsa_originate2: ospf_lsa_install() ?");
ospf_lsa_unlock(&new);
return rc;
@@ -1390,7 +1390,7 @@ static int ospf_mpls_te_lsa_originate_as(void *arg)
if (!is_mandated_params_set(lp)) {
flog_warn(
- OSPF_WARN_TE_UNEXPECTED,
+ EC_OSPF_TE_UNEXPECTED,
"ospf_mpls_te_lsa_originate_as: Link(%s) lacks some mandated MPLS-TE parameters.",
lp->ifp ? lp->ifp->name : "?");
continue;
@@ -1437,7 +1437,7 @@ static struct ospf_lsa *ospf_mpls_te_lsa_refresh(struct ospf_lsa *lsa)
/* At first, resolve lsa/lp relationship. */
if ((lp = lookup_linkparams_by_instance(lsa)) == NULL) {
- flog_warn(OSPF_WARN_TE_UNEXPECTED,
+ flog_warn(EC_OSPF_TE_UNEXPECTED,
"ospf_mpls_te_lsa_refresh: Invalid parameter?");
lsa->data->ls_age =
htons(OSPF_LSA_MAXAGE); /* Flush it anyway. */
@@ -1448,7 +1448,7 @@ static struct ospf_lsa *ospf_mpls_te_lsa_refresh(struct ospf_lsa *lsa)
/* Check if lp was not disable in the interval */
if (!CHECK_FLAG(lp->flags, LPFLG_LSA_ACTIVE)) {
flog_warn(
- OSPF_WARN_TE_UNEXPECTED,
+ EC_OSPF_TE_UNEXPECTED,
"ospf_mpls_te_lsa_refresh: lp was disabled: Flush it!");
lsa->data->ls_age =
htons(OSPF_LSA_MAXAGE); /* Flush it anyway. */
@@ -1464,7 +1464,7 @@ static struct ospf_lsa *ospf_mpls_te_lsa_refresh(struct ospf_lsa *lsa)
/* Create new Opaque-LSA/MPLS-TE instance. */
new = ospf_mpls_te_lsa_new(top, area, lp);
if (new == NULL) {
- flog_warn(OSPF_WARN_TE_UNEXPECTED,
+ flog_warn(EC_OSPF_TE_UNEXPECTED,
"ospf_mpls_te_lsa_refresh: ospf_mpls_te_lsa_new() ?");
return NULL;
}
@@ -1478,7 +1478,7 @@ static struct ospf_lsa *ospf_mpls_te_lsa_refresh(struct ospf_lsa *lsa)
top = area->ospf;
if (ospf_lsa_install(top, NULL /*oi */, new) == NULL) {
- flog_warn(OSPF_WARN_LSA_INSTALL_FAILURE,
+ flog_warn(EC_OSPF_LSA_INSTALL_FAILURE,
"ospf_mpls_te_lsa_refresh: ospf_lsa_install() ?");
ospf_lsa_unlock(&new);
return NULL;
@@ -1534,7 +1534,7 @@ void ospf_mpls_te_lsa_schedule(struct mpls_te_link *lp, enum lsa_opcode opcode)
/* Unable to set the area context. Abort! */
if (lp->area == NULL) {
flog_warn(
- OSPF_WARN_TE_UNEXPECTED,
+ EC_OSPF_TE_UNEXPECTED,
"MPLS-TE(ospf_mpls_te_lsa_schedule) Area context is null. Abort !");
return;
}
@@ -1577,7 +1577,7 @@ void ospf_mpls_te_lsa_schedule(struct mpls_te_link *lp, enum lsa_opcode opcode)
ospf_opaque_lsa_flush_schedule(&lsa);
break;
default:
- flog_warn(OSPF_WARN_TE_UNEXPECTED,
+ flog_warn(EC_OSPF_TE_UNEXPECTED,
"ospf_mpls_te_lsa_schedule: Unknown opcode (%u)",
opcode);
break;
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index b18c5a93a..d481e9e4c 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -325,7 +325,7 @@ static struct ospf *ospf_new(unsigned short instance, const char *name)
if ((ospf_sock_init(new)) < 0) {
if (new->vrf_id != VRF_UNKNOWN)
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%s: ospf_sock_init is unable to open a socket",
__func__);
return new;
diff --git a/pimd/pim_errors.c b/pimd/pim_errors.c
index d154752bd..0674a4e99 100644
--- a/pimd/pim_errors.c
+++ b/pimd/pim_errors.c
@@ -26,13 +26,13 @@
/* clang-format off */
static struct log_ref ferr_pim_err[] = {
{
- .code = PIM_ERR_MSDP_PACKET,
+ .code = EC_PIM_MSDP_PACKET,
.title = "PIM MSDP Packet Error",
.description = "PIM has received a packet from a peer that does not correctly decode",
.suggestion = "Check MSDP peer and ensure it is correctly working"
},
{
- .code = PIM_ERR_CONFIG,
+ .code = EC_PIM_CONFIG,
.title = "PIM Configuration Error",
.description = "PIM has detected a configuration error",
.suggestion = "Ensure the configuration is correct and apply correct configuration"
diff --git a/pimd/pim_errors.h b/pimd/pim_errors.h
index ad9c95a93..d73caa3f8 100644
--- a/pimd/pim_errors.h
+++ b/pimd/pim_errors.h
@@ -24,8 +24,8 @@
#include "lib/ferr.h"
enum pim_log_refs {
- PIM_ERR_MSDP_PACKET = PIM_FERR_START,
- PIM_ERR_CONFIG,
+ EC_PIM_MSDP_PACKET = PIM_FERR_START,
+ EC_PIM_CONFIG,
};
extern void pim_error_init(void);
diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c
index 270f1e3f2..64537cfa8 100644
--- a/pimd/pim_igmp.c
+++ b/pimd/pim_igmp.c
@@ -98,7 +98,7 @@ static int igmp_sock_open(struct in_addr ifaddr, struct interface *ifp,
if (!join) {
flog_err_sys(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"IGMP socket fd=%d could not join any group on interface address %s",
fd, inet_ntoa(ifaddr));
close(fd);
@@ -700,7 +700,7 @@ static void sock_close(struct igmp_sock *igmp)
if (close(igmp->fd)) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"Failure closing IGMP socket %s fd=%d on interface %s: errno=%d: %s",
inet_ntoa(igmp->ifaddr), igmp->fd,
igmp->interface->name, errno, safe_strerror(errno));
diff --git a/pimd/pim_igmpv3.c b/pimd/pim_igmpv3.c
index 7b21376c9..430cba76b 100644
--- a/pimd/pim_igmpv3.c
+++ b/pimd/pim_igmpv3.c
@@ -1585,7 +1585,7 @@ void igmp_v3_send_query(struct igmp_group *group, int fd, const char *ifname,
msg_size = IGMP_V3_SOURCES_OFFSET + (num_sources << 2);
if (msg_size > query_buf_size) {
flog_err(
- LIB_ERR_DEVELOPMENT,
+ EC_LIB_DEVELOPMENT,
"%s %s: unable to send: msg_size=%zd larger than query_buf_size=%d",
__FILE__, __PRETTY_FUNCTION__, msg_size,
query_buf_size);
diff --git a/pimd/pim_msdp.c b/pimd/pim_msdp.c
index 7fcf42e8c..5a75ed329 100644
--- a/pimd/pim_msdp.c
+++ b/pimd/pim_msdp.c
@@ -519,7 +519,7 @@ static void pim_msdp_sa_local_del_on_up_del(struct pim_instance *pim,
* changes; perhaps
* address this in the next release? - XXX */
flog_err(
- LIB_ERR_DEVELOPMENT,
+ EC_LIB_DEVELOPMENT,
"MSDP sa %s SPT teardown is causing the local entry to be removed",
sa->sg_str);
return;
diff --git a/pimd/pim_msdp_packet.c b/pimd/pim_msdp_packet.c
index 65232aafa..39e39b955 100644
--- a/pimd/pim_msdp_packet.c
+++ b/pimd/pim_msdp_packet.c
@@ -147,7 +147,7 @@ static void pim_msdp_connect_check(struct pim_msdp_peer *mp)
/* If getsockopt is fail, this is fatal error. */
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"can't get sockopt for nonblocking connect");
pim_msdp_peer_reset_tcp_conn(mp, "connect-failed");
return;
@@ -484,9 +484,9 @@ static void pim_msdp_pkt_sa_rx_one(struct pim_msdp_peer *mp, struct in_addr rp)
if (prefix_len != 32) {
/* ignore SA update if the prefix length is not 32 */
- flog_err(PIM_ERR_MSDP_PACKET,
- "rxed sa update with invalid prefix length %d",
- prefix_len);
+ flog_err(EC_PIM_MSDP_PACKET,
+ "rxed sa update with invalid prefix length %d",
+ prefix_len);
return;
}
if (PIM_DEBUG_MSDP_PACKETS) {
diff --git a/pimd/pim_msdp_socket.c b/pimd/pim_msdp_socket.c
index feac42cf5..7997d3138 100644
--- a/pimd/pim_msdp_socket.c
+++ b/pimd/pim_msdp_socket.c
@@ -43,7 +43,7 @@ static void pim_msdp_update_sock_send_buffer_size(int fd)
socklen_t optlen = sizeof(optval);
if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &optval, &optlen) < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"getsockopt of SO_SNDBUF failed %s\n",
safe_strerror(errno));
return;
@@ -52,7 +52,7 @@ static void pim_msdp_update_sock_send_buffer_size(int fd)
if (optval < size) {
if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size))
< 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"Couldn't increase send buffer: %s\n",
safe_strerror(errno));
}
@@ -74,8 +74,8 @@ static int pim_msdp_sock_accept(struct thread *thread)
/* re-register accept thread */
accept_sock = THREAD_FD(thread);
if (accept_sock < 0) {
- flog_err(LIB_ERR_DEVELOPMENT,
- "accept_sock is negative value %d", accept_sock);
+ flog_err(EC_LIB_DEVELOPMENT, "accept_sock is negative value %d",
+ accept_sock);
return -1;
}
pim->msdp.listener.thread = NULL;
@@ -85,7 +85,7 @@ static int pim_msdp_sock_accept(struct thread *thread)
/* accept client connection. */
msdp_sock = sockunion_accept(accept_sock, &su);
if (msdp_sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "pim_msdp_sock_accept failed (%s)",
+ flog_err_sys(EC_LIB_SOCKET, "pim_msdp_sock_accept failed (%s)",
safe_strerror(errno));
return -1;
}
@@ -95,9 +95,9 @@ static int pim_msdp_sock_accept(struct thread *thread)
if (!mp || !PIM_MSDP_PEER_IS_LISTENER(mp)) {
++pim->msdp.rejected_accepts;
if (PIM_DEBUG_MSDP_EVENTS) {
- flog_err(PIM_ERR_MSDP_PACKET,
- "msdp peer connection refused from %s",
- sockunion2str(&su, buf, SU_ADDRSTRLEN));
+ flog_err(EC_PIM_MSDP_PACKET,
+ "msdp peer connection refused from %s",
+ sockunion2str(&su, buf, SU_ADDRSTRLEN));
}
close(msdp_sock);
return -1;
@@ -141,8 +141,7 @@ int pim_msdp_sock_listen(struct pim_instance *pim)
sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "socket: %s",
- safe_strerror(errno));
+ flog_err_sys(EC_LIB_SOCKET, "socket: %s", safe_strerror(errno));
return sock;
}
@@ -161,14 +160,14 @@ int pim_msdp_sock_listen(struct pim_instance *pim)
struct interface *ifp =
if_lookup_by_name(pim->vrf->name, pim->vrf_id);
if (!ifp) {
- flog_err(LIB_ERR_INTERFACE,
- "%s: Unable to lookup vrf interface: %s",
- __PRETTY_FUNCTION__, pim->vrf->name);
+ flog_err(EC_LIB_INTERFACE,
+ "%s: Unable to lookup vrf interface: %s",
+ __PRETTY_FUNCTION__, pim->vrf->name);
close(sock);
return -1;
}
if (pim_socket_bind(sock, ifp)) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s: Unable to bind to socket: %s",
__PRETTY_FUNCTION__, safe_strerror(errno));
close(sock);
@@ -182,7 +181,7 @@ int pim_msdp_sock_listen(struct pim_instance *pim)
}
if (rc < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"pim_msdp_socket bind to port %d: %s",
ntohs(sin.sin_port), safe_strerror(errno));
close(sock);
@@ -191,7 +190,7 @@ int pim_msdp_sock_listen(struct pim_instance *pim)
rc = listen(sock, 3 /* backlog */);
if (rc < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "pim_msdp_socket listen: %s",
+ flog_err_sys(EC_LIB_SOCKET, "pim_msdp_socket listen: %s",
safe_strerror(errno));
close(sock);
return rc;
@@ -232,7 +231,7 @@ int pim_msdp_sock_connect(struct pim_msdp_peer *mp)
/* Make socket for the peer. */
mp->fd = sockunion_socket(&mp->su_peer);
if (mp->fd < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"pim_msdp_socket socket failure: %s",
safe_strerror(errno));
return -1;
@@ -242,13 +241,13 @@ int pim_msdp_sock_connect(struct pim_msdp_peer *mp)
struct interface *ifp =
if_lookup_by_name(mp->pim->vrf->name, mp->pim->vrf_id);
if (!ifp) {
- flog_err(LIB_ERR_INTERFACE,
- "%s: Unable to lookup vrf interface: %s",
- __PRETTY_FUNCTION__, mp->pim->vrf->name);
+ flog_err(EC_LIB_INTERFACE,
+ "%s: Unable to lookup vrf interface: %s",
+ __PRETTY_FUNCTION__, mp->pim->vrf->name);
return -1;
}
if (pim_socket_bind(mp->fd, ifp)) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s: Unable to bind to socket: %s",
__PRETTY_FUNCTION__, safe_strerror(errno));
close(mp->fd);
@@ -267,7 +266,7 @@ int pim_msdp_sock_connect(struct pim_msdp_peer *mp)
/* source bind */
rc = sockunion_bind(mp->fd, &mp->su_local, 0, &mp->su_local);
if (rc < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"pim_msdp_socket connect bind failure: %s",
safe_strerror(errno));
close(mp->fd);
diff --git a/pimd/pim_neighbor.c b/pimd/pim_neighbor.c
index 11d847636..bff1e7ff1 100644
--- a/pimd/pim_neighbor.c
+++ b/pimd/pim_neighbor.c
@@ -801,7 +801,7 @@ void pim_neighbor_update(struct pim_neighbor *neigh,
if (neigh->prefix_list == addr_list) {
if (addr_list) {
flog_err(
- LIB_ERR_DEVELOPMENT,
+ EC_LIB_DEVELOPMENT,
"%s: internal error: trying to replace same prefix list=%p",
__PRETTY_FUNCTION__, (void *)addr_list);
}
diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c
index cf078064d..0696a680e 100644
--- a/pimd/pim_pim.c
+++ b/pimd/pim_pim.c
@@ -116,9 +116,9 @@ void pim_sock_delete(struct interface *ifp, const char *delete_message)
delete_message);
if (!ifp->info) {
- flog_err(PIM_ERR_CONFIG,
- "%s: %s: but PIM not enabled on interface %s (!)",
- __PRETTY_FUNCTION__, delete_message, ifp->name);
+ flog_err(EC_PIM_CONFIG,
+ "%s: %s: but PIM not enabled on interface %s (!)",
+ __PRETTY_FUNCTION__, delete_message, ifp->name);
return;
}
diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c
index 031e527eb..51ca0945b 100644
--- a/pimd/pim_rp.c
+++ b/pimd/pim_rp.c
@@ -113,8 +113,8 @@ void pim_rp_init(struct pim_instance *pim)
rp_info = XCALLOC(MTYPE_PIM_RP, sizeof(*rp_info));
if (!str2prefix("224.0.0.0/4", &rp_info->group)) {
- flog_err(LIB_ERR_DEVELOPMENT,
- "Unable to convert 224.0.0.0/4 to prefix");
+ flog_err(EC_LIB_DEVELOPMENT,
+ "Unable to convert 224.0.0.0/4 to prefix");
list_delete_and_null(&pim->rp_list);
route_table_finish(pim->rp_table);
XFREE(MTYPE_PIM_RP, rp_info);
@@ -236,7 +236,7 @@ static struct rp_info *pim_rp_find_match_group(struct pim_instance *pim,
rn = route_node_match(pim->rp_table, group);
if (!rn) {
flog_err(
- LIB_ERR_DEVELOPMENT,
+ EC_LIB_DEVELOPMENT,
"%s: BUG We should have found default group information\n",
__PRETTY_FUNCTION__);
return best;
@@ -625,7 +625,7 @@ int pim_rp_del(struct pim_instance *pim, const char *rp,
if (rn) {
if (rn->info != rp_info)
flog_err(
- LIB_ERR_DEVELOPMENT,
+ EC_LIB_DEVELOPMENT,
"Expected rn->info to be equal to rp_info");
if (PIM_DEBUG_TRACE) {
diff --git a/pimd/pim_sock.c b/pimd/pim_sock.c
index 1f584a2f9..c4538a4ac 100644
--- a/pimd/pim_sock.c
+++ b/pimd/pim_sock.c
@@ -151,7 +151,7 @@ int pim_socket_mcast(int protocol, struct in_addr ifaddr, struct interface *ifp,
}
#else
flog_err(
- LIB_ERR_DEVELOPMENT,
+ EC_LIB_DEVELOPMENT,
"%s %s: Missing IP_PKTINFO and IP_RECVDSTADDR: unable to get dst addr from recvmsg()",
__FILE__, __PRETTY_FUNCTION__);
close(fd);
@@ -289,7 +289,7 @@ int pim_socket_join(int fd, struct in_addr group, struct in_addr ifaddr,
sprintf(ifaddr_str, "<ifaddr?>");
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_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;
diff --git a/pimd/pim_ssm.c b/pimd/pim_ssm.c
index 8347878d3..dfc7063fd 100644
--- a/pimd/pim_ssm.c
+++ b/pimd/pim_ssm.c
@@ -73,9 +73,9 @@ static int pim_is_grp_standard_ssm(struct prefix *group)
if (first) {
if (!str2prefix(PIM_SSM_STANDARD_RANGE, &group_ssm))
- flog_err(LIB_ERR_DEVELOPMENT,
- "%s: Failure to Read Group Address: %s",
- __PRETTY_FUNCTION__, PIM_SSM_STANDARD_RANGE);
+ flog_err(EC_LIB_DEVELOPMENT,
+ "%s: Failure to Read Group Address: %s",
+ __PRETTY_FUNCTION__, PIM_SSM_STANDARD_RANGE);
first = 0;
}
diff --git a/pimd/pim_ssmpingd.c b/pimd/pim_ssmpingd.c
index be30d9c73..a5082608b 100644
--- a/pimd/pim_ssmpingd.c
+++ b/pimd/pim_ssmpingd.c
@@ -83,7 +83,7 @@ static int ssmpingd_socket(struct in_addr addr, int port, int mttl)
fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (fd < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s: could not create socket: errno=%d: %s",
__PRETTY_FUNCTION__, errno, safe_strerror(errno));
return -1;
@@ -127,7 +127,7 @@ static int ssmpingd_socket(struct in_addr addr, int port, int mttl)
}
#else
flog_err(
- LIB_ERR_DEVELOPMENT,
+ EC_LIB_DEVELOPMENT,
"%s %s: missing IP_PKTINFO and IP_RECVDSTADDR: unable to get dst addr from recvmsg()",
__FILE__, __PRETTY_FUNCTION__);
close(fd);
diff --git a/pimd/pim_time.c b/pimd/pim_time.c
index 029e55116..23c85c2fa 100644
--- a/pimd/pim_time.c
+++ b/pimd/pim_time.c
@@ -35,7 +35,7 @@ static int gettime_monotonic(struct timeval *tv)
result = gettimeofday(tv, 0);
if (result) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"%s: gettimeofday() failure: errno=%d: %s",
__PRETTY_FUNCTION__, errno, safe_strerror(errno));
}
@@ -52,7 +52,7 @@ int64_t pim_time_monotonic_sec()
struct timeval now_tv;
if (gettime_monotonic(&now_tv)) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"%s: gettime_monotonic() failure: errno=%d: %s",
__PRETTY_FUNCTION__, errno, safe_strerror(errno));
return -1;
@@ -71,7 +71,7 @@ int64_t pim_time_monotonic_dsec()
int64_t now_dsec;
if (gettime_monotonic(&now_tv)) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"%s: gettime_monotonic() failure: errno=%d: %s",
__PRETTY_FUNCTION__, errno, safe_strerror(errno));
return -1;
@@ -89,7 +89,7 @@ int64_t pim_time_monotonic_usec(void)
int64_t now_dsec;
if (gettime_monotonic(&now_tv)) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"%s: gettime_monotonic() failure: errno=%d: %s",
__PRETTY_FUNCTION__, errno, safe_strerror(errno));
return -1;
diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c
index baa07a8ec..48a228c74 100644
--- a/pimd/pim_zlookup.c
+++ b/pimd/pim_zlookup.c
@@ -123,8 +123,8 @@ void zclient_lookup_new(void)
{
zlookup = zclient_new_notify(master, &zclient_options_default);
if (!zlookup) {
- flog_err(LIB_ERR_ZAPI_SOCKET, "%s: zclient_new() failure",
- __PRETTY_FUNCTION__);
+ flog_err(EC_LIB_ZAPI_SOCKET, "%s: zclient_new() failure",
+ __PRETTY_FUNCTION__);
return;
}
@@ -170,9 +170,9 @@ static int zclient_read_nexthop(struct pim_instance *pim,
err = zclient_read_header(s, zlookup->sock, &length, &marker,
&version, &vrf_id, &command);
if (err < 0) {
- flog_err(LIB_ERR_ZAPI_MISSMATCH,
- "%s: zclient_read_header() failed",
- __PRETTY_FUNCTION__);
+ flog_err(EC_LIB_ZAPI_MISSMATCH,
+ "%s: zclient_read_header() failed",
+ __PRETTY_FUNCTION__);
zclient_lookup_failed(zlookup);
return -1;
}
@@ -315,9 +315,9 @@ static int zclient_lookup_nexthop_once(struct pim_instance *pim,
/* Check socket. */
if (zlookup->sock < 0) {
- flog_err(LIB_ERR_ZAPI_SOCKET,
- "%s: zclient lookup socket is not connected",
- __PRETTY_FUNCTION__);
+ flog_err(EC_LIB_ZAPI_SOCKET,
+ "%s: zclient lookup socket is not connected",
+ __PRETTY_FUNCTION__);
zclient_lookup_failed(zlookup);
return -1;
}
@@ -338,14 +338,14 @@ static int zclient_lookup_nexthop_once(struct pim_instance *pim,
ret = writen(zlookup->sock, s->data, stream_get_endp(s));
if (ret < 0) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%s: writen() failure: %d writing to zclient lookup socket",
__PRETTY_FUNCTION__, errno);
zclient_lookup_failed(zlookup);
return -2;
}
if (ret == 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s: connection closed on zclient lookup socket",
__PRETTY_FUNCTION__);
zclient_lookup_failed(zlookup);
@@ -516,7 +516,7 @@ int pim_zlookup_sg_statistics(struct channel_oil *c_oil)
ret = writen(zlookup->sock, s->data, count);
if (ret <= 0) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%s: writen() failure: %d writing to zclient lookup socket",
__PRETTY_FUNCTION__, errno);
return -1;
@@ -535,9 +535,9 @@ int pim_zlookup_sg_statistics(struct channel_oil *c_oil)
err = zclient_read_header(s, zlookup->sock, &length, &marker,
&version, &vrf_id, &command);
if (err < 0) {
- flog_err(LIB_ERR_ZAPI_MISSMATCH,
- "%s: zclient_read_header() failed",
- __PRETTY_FUNCTION__);
+ flog_err(EC_LIB_ZAPI_MISSMATCH,
+ "%s: zclient_read_header() failed",
+ __PRETTY_FUNCTION__);
zclient_lookup_failed(zlookup);
return -1;
}
@@ -553,7 +553,7 @@ int pim_zlookup_sg_statistics(struct channel_oil *c_oil)
more.src = c_oil->oil.mfcc_origin;
more.grp = c_oil->oil.mfcc_mcastgrp;
flog_err(
- LIB_ERR_ZAPI_MISSMATCH,
+ EC_LIB_ZAPI_MISSMATCH,
"%s: Received wrong %s(%s) information requested",
__PRETTY_FUNCTION__, pim_str_sg_dump(&more),
c_oil->pim->vrf->name);
diff --git a/pimd/pimd.c b/pimd/pimd.c
index dd0c7e3c2..5d3018b2f 100644
--- a/pimd/pimd.c
+++ b/pimd/pimd.c
@@ -86,7 +86,7 @@ void pim_init()
{
if (!inet_aton(PIM_ALL_PIM_ROUTERS, &qpim_all_pim_routers_addr)) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%s %s: could not solve %s to group address: errno=%d: %s",
__FILE__, __PRETTY_FUNCTION__, PIM_ALL_PIM_ROUTERS,
errno, safe_strerror(errno));
diff --git a/ripd/rip_errors.c b/ripd/rip_errors.c
index 363b1b7fb..b6fc43ee7 100644
--- a/ripd/rip_errors.c
+++ b/ripd/rip_errors.c
@@ -24,16 +24,13 @@
#include "rip_errors.h"
static struct log_ref ferr_rip_err[] = {
- {
- .code = RIP_ERR_PACKET,
- .title = "RIP Packet Error",
- .description = "RIP has detected a packet encode/decode issue",
- .suggestion = "Gather log files from both sides and open a Issue"
- },
+ {.code = EC_RIP_PACKET,
+ .title = "RIP Packet Error",
+ .description = "RIP has detected a packet encode/decode issue",
+ .suggestion = "Gather log files from both sides and open a Issue"},
{
.code = END_FERR,
- }
-};
+ }};
void rip_error_init(void)
{
diff --git a/ripd/rip_errors.h b/ripd/rip_errors.h
index 6b5f5c016..feadf430e 100644
--- a/ripd/rip_errors.h
+++ b/ripd/rip_errors.h
@@ -24,7 +24,7 @@
#include "lib/ferr.h"
enum rip_log_refs {
- RIP_ERR_PACKET = RIP_FERR_START,
+ EC_RIP_PACKET = RIP_FERR_START,
RIP_ERR_CONFIG,
};
diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c
index 5b50c031a..bbac1a0a0 100644
--- a/ripd/rip_interface.c
+++ b/ripd/rip_interface.c
@@ -865,7 +865,7 @@ static int rip_interface_wakeup(struct thread *t)
/* Join to multicast group. */
if (rip_multicast_join(ifp, rip->sock) < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"multicast join failed, interface %s not running",
ifp->name);
return 0;
diff --git a/ripd/ripd.c b/ripd/ripd.c
index 560e649a8..94c3d4bc9 100644
--- a/ripd/ripd.c
+++ b/ripd/ripd.c
@@ -1056,9 +1056,10 @@ static void rip_auth_md5_set(struct stream *s, struct rip_interface *ri,
/* Check packet length. */
if (len < (RIP_HEADER_SIZE + RIP_RTE_SIZE)) {
- flog_err(RIP_ERR_PACKET,
- "rip_auth_md5_set(): packet length %ld is less than minimum length.",
- len);
+ flog_err(
+ EC_RIP_PACKET,
+ "rip_auth_md5_set(): packet length %ld is less than minimum length.",
+ len);
return;
}
@@ -1339,7 +1340,7 @@ static int rip_create_socket(void)
/* Make datagram socket. */
sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "Cannot create UDP socket: %s",
+ flog_err_sys(EC_LIB_SOCKET, "Cannot create UDP socket: %s",
safe_strerror(errno));
exit(1);
}
diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c
index d7d3d245d..a1d25f296 100644
--- a/ripngd/ripng_interface.c
+++ b/ripngd/ripng_interface.c
@@ -643,7 +643,7 @@ static int ripng_interface_wakeup(struct thread *t)
/* Join to multicast group. */
if (ripng_multicast_join(ifp) < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"multicast join failed, interface %s not running",
ifp->name);
return 0;
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c
index 850216b44..fbc06b034 100644
--- a/ripngd/ripngd.c
+++ b/ripngd/ripngd.c
@@ -95,7 +95,7 @@ static int ripng_make_socket(void)
sock = socket(AF_INET6, SOCK_DGRAM, 0);
if (sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "Can't make ripng socket");
+ flog_err_sys(EC_LIB_SOCKET, "Can't make ripng socket");
return sock;
}
@@ -199,14 +199,13 @@ int ripng_send_packet(caddr_t buf, int bufsize, struct sockaddr_in6 *to,
if (ret < 0) {
if (to)
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"RIPng send fail on %s to %s: %s",
ifp->name, inet6_ntoa(to->sin6_addr),
safe_strerror(errno));
else
- flog_err_sys(LIB_ERR_SOCKET,
- "RIPng send fail on %s: %s", ifp->name,
- safe_strerror(errno));
+ flog_err_sys(EC_LIB_SOCKET, "RIPng send fail on %s: %s",
+ ifp->name, safe_strerror(errno));
}
return ret;
diff --git a/watchfrr/watchfrr.c b/watchfrr/watchfrr.c
index 07a29ca6d..9bbe04c33 100644
--- a/watchfrr/watchfrr.c
+++ b/watchfrr/watchfrr.c
@@ -249,7 +249,7 @@ static pid_t run_background(char *shell_cmd)
switch (child = fork()) {
case -1:
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"fork failed, cannot run command [%s]: %s",
shell_cmd, safe_strerror(errno));
return -1;
@@ -265,14 +265,14 @@ static pid_t run_background(char *shell_cmd)
char dashc[] = "-c";
char *const argv[4] = {shell, dashc, shell_cmd, NULL};
execv("/bin/sh", argv);
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"execv(/bin/sh -c '%s') failed: %s",
shell_cmd, safe_strerror(errno));
_exit(127);
}
default:
/* Parent process: we will reap the child later. */
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"Forked background command [pid %d]: %s",
(int)child, shell_cmd);
return child;
@@ -334,7 +334,7 @@ static void sigchild(void)
switch (child = waitpid(-1, &status, WNOHANG)) {
case -1:
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "waitpid failed: %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "waitpid failed: %s",
safe_strerror(errno));
return;
case 0:
@@ -359,7 +359,7 @@ static void sigchild(void)
gettimeofday(&restart->time, NULL);
} else {
flog_err_sys(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"waitpid returned status for an unknown child process %d",
(int)child);
name = "(unknown)";
@@ -381,7 +381,7 @@ static void sigchild(void)
name, (int)child);
} else
flog_err_sys(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"cannot interpret %s %s process %d wait status 0x%x",
what, name, (int)child, status);
phase_check();
@@ -493,9 +493,9 @@ static int wakeup_init(struct thread *t_wakeup)
dmn->t_wakeup = NULL;
if (try_connect(dmn) < 0) {
SET_WAKEUP_DOWN(dmn);
- flog_err(WATCHFRR_ERR_CONNECTION,
- "%s state -> down : initial connection attempt failed",
- dmn->name);
+ flog_err(EC_WATCHFRR_CONNECTION,
+ "%s state -> down : initial connection attempt failed",
+ dmn->name);
dmn->state = DAEMON_DOWN;
}
return 0;
@@ -504,8 +504,8 @@ static int wakeup_init(struct thread *t_wakeup)
static void daemon_down(struct daemon *dmn, const char *why)
{
if (IS_UP(dmn) || (dmn->state == DAEMON_INIT))
- flog_err(WATCHFRR_ERR_CONNECTION,
- "%s state -> down : %s", dmn->name, why);
+ flog_err(EC_WATCHFRR_CONNECTION, "%s state -> down : %s",
+ dmn->name, why);
else if (gs.loglevel > LOG_DEBUG)
zlog_debug("%s still down : %s", dmn->name, why);
if (IS_UP(dmn))
@@ -698,7 +698,7 @@ static int try_connect(struct daemon *dmn)
of creating a socket. */
if (access(addr.sun_path, W_OK) < 0) {
if (errno != ENOENT)
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"%s: access to socket %s denied: %s",
dmn->name, addr.sun_path,
safe_strerror(errno));
@@ -706,13 +706,13 @@ static int try_connect(struct daemon *dmn)
}
if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "%s(%s): cannot make socket: %s",
+ flog_err_sys(EC_LIB_SOCKET, "%s(%s): cannot make socket: %s",
__func__, addr.sun_path, safe_strerror(errno));
return -1;
}
if (set_nonblocking(sock) < 0 || set_cloexec(sock) < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"%s(%s): set_nonblocking/cloexec(%d) failed",
__func__, addr.sun_path, sock);
close(sock);
@@ -751,9 +751,9 @@ static int try_connect(struct daemon *dmn)
static int phase_hanging(struct thread *t_hanging)
{
gs.t_phase_hanging = NULL;
- flog_err(WATCHFRR_ERR_CONNECTION,
- "Phase [%s] hanging for %ld seconds, aborting phased restart",
- phase_str[gs.phase], PHASE_TIMEOUT);
+ flog_err(EC_WATCHFRR_CONNECTION,
+ "Phase [%s] hanging for %ld seconds, aborting phased restart",
+ phase_str[gs.phase], PHASE_TIMEOUT);
gs.phase = PHASE_NONE;
return 0;
}
@@ -867,10 +867,10 @@ static int wakeup_unresponsive(struct thread *t_wakeup)
dmn->t_wakeup = NULL;
if (dmn->state != DAEMON_UNRESPONSIVE)
- flog_err(WATCHFRR_ERR_CONNECTION,
- "%s: no longer unresponsive (now %s), "
- "wakeup should have been cancelled!",
- dmn->name, state_str[dmn->state]);
+ flog_err(EC_WATCHFRR_CONNECTION,
+ "%s: no longer unresponsive (now %s), "
+ "wakeup should have been cancelled!",
+ dmn->name, state_str[dmn->state]);
else {
SET_WAKEUP_UNRESPONSIVE(dmn);
try_restart(dmn);
@@ -884,10 +884,10 @@ static int wakeup_no_answer(struct thread *t_wakeup)
dmn->t_wakeup = NULL;
dmn->state = DAEMON_UNRESPONSIVE;
- flog_err(WATCHFRR_ERR_CONNECTION,
- "%s state -> unresponsive : no response yet to ping "
- "sent %ld seconds ago",
- dmn->name, gs.timeout);
+ flog_err(EC_WATCHFRR_CONNECTION,
+ "%s state -> unresponsive : no response yet to ping "
+ "sent %ld seconds ago",
+ dmn->name, gs.timeout);
SET_WAKEUP_UNRESPONSIVE(dmn);
try_restart(dmn);
return 0;
diff --git a/watchfrr/watchfrr_errors.c b/watchfrr/watchfrr_errors.c
index 662e7f654..c720b6509 100644
--- a/watchfrr/watchfrr_errors.c
+++ b/watchfrr/watchfrr_errors.c
@@ -26,7 +26,7 @@
/* clang-format off */
static struct log_ref ferr_watchfrr_err[] = {
{
- .code = WATCHFRR_ERR_CONNECTION,
+ .code = EC_WATCHFRR_CONNECTION,
.title = "WATCHFRR Connection Error",
.description = "WATCHFRR has detected a connectivity issue with one of the FRR daemons",
.suggestion = "Ensure that FRR is still running and if not please open an Issue"
diff --git a/watchfrr/watchfrr_errors.h b/watchfrr/watchfrr_errors.h
index 4652f950f..93103b655 100644
--- a/watchfrr/watchfrr_errors.h
+++ b/watchfrr/watchfrr_errors.h
@@ -24,7 +24,7 @@
#include "lib/ferr.h"
enum watchfrr_log_refs {
- WATCHFRR_ERR_CONNECTION = WATCHFRR_FERR_START,
+ EC_WATCHFRR_CONNECTION = WATCHFRR_FERR_START,
};
extern void watchfrr_error_init(void);
diff --git a/zebra/connected.c b/zebra/connected.c
index ff9c82883..54f4394a5 100644
--- a/zebra/connected.c
+++ b/zebra/connected.c
@@ -237,7 +237,7 @@ void connected_up(struct interface *ifp, struct connected *ifc)
#endif
break;
default:
- flog_warn(ZEBRA_ERR_CONNECTED_AFI_UNKNOWN,
+ flog_warn(EC_ZEBRA_CONNECTED_AFI_UNKNOWN,
"Received unknown AFI: %s", afi2str(afi));
return;
break;
@@ -312,7 +312,7 @@ void connected_add_ipv4(struct interface *ifp, int flags, struct in_addr *addr,
if (CONNECTED_PEER(ifc)) {
if (IPV4_ADDR_SAME(addr, broad))
flog_warn(
- ZEBRA_ERR_IFACE_SAME_LOCAL_AS_PEER,
+ EC_ZEBRA_IFACE_SAME_LOCAL_AS_PEER,
"warning: interface %s has same local and peer "
"address %s, routing protocols may malfunction",
ifp->name, inet_ntoa(*addr));
@@ -324,7 +324,7 @@ void connected_add_ipv4(struct interface *ifp, int flags, struct in_addr *addr,
bcalc.s_addr = ipv4_broadcast_addr(addr->s_addr,
prefixlen);
flog_warn(
- ZEBRA_ERR_BCAST_ADDR_MISMATCH,
+ EC_ZEBRA_BCAST_ADDR_MISMATCH,
"warning: interface %s broadcast addr %s/%d != "
"calculated %s, routing protocols may malfunction",
ifp->name,
diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c
index 6155e8c4e..f581ebc6b 100644
--- a/zebra/if_ioctl.c
+++ b/zebra/if_ioctl.c
@@ -58,7 +58,7 @@ static int interface_list_ioctl(void)
/* Normally SIOCGIFCONF works with AF_INET socket. */
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"Can't make AF_INET socket stream: %s",
safe_strerror(errno));
return -1;
@@ -88,7 +88,7 @@ static int interface_list_ioctl(void)
ret = ioctl(sock, SIOCGIFCONF, &ifconf);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "SIOCGIFCONF: %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "SIOCGIFCONF: %s",
safe_strerror(errno));
goto end;
}
@@ -180,7 +180,7 @@ static int if_getaddrs(void)
ret = getifaddrs(&ifap);
if (ret != 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "getifaddrs(): %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "getifaddrs(): %s",
safe_strerror(errno));
return -1;
}
@@ -188,7 +188,7 @@ static int if_getaddrs(void)
for (ifapfree = ifap; ifap; ifap = ifap->ifa_next) {
if (ifap->ifa_addr == NULL) {
flog_err(
- LIB_ERR_INTERFACE,
+ EC_LIB_INTERFACE,
"%s: nonsensical ifaddr with NULL ifa_addr, ifname %s",
__func__,
(ifap->ifa_name ? ifap->ifa_name : "(null)"));
@@ -197,9 +197,9 @@ static int if_getaddrs(void)
ifp = if_lookup_by_name(ifap->ifa_name, VRF_DEFAULT);
if (ifp == NULL) {
- flog_err(LIB_ERR_INTERFACE,
- "if_getaddrs(): Can't lookup interface %s\n",
- ifap->ifa_name);
+ flog_err(EC_LIB_INTERFACE,
+ "if_getaddrs(): Can't lookup interface %s\n",
+ ifap->ifa_name);
continue;
}
diff --git a/zebra/if_ioctl_solaris.c b/zebra/if_ioctl_solaris.c
index 1f12d4c02..1955881f2 100644
--- a/zebra/if_ioctl_solaris.c
+++ b/zebra/if_ioctl_solaris.c
@@ -65,7 +65,7 @@ static int interface_list_ioctl(int af)
}
if (sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "Can't make %s socket stream: %s",
+ flog_err_sys(EC_LIB_SOCKET, "Can't make %s socket stream: %s",
(af == AF_INET ? "AF_INET" : "AF_INET6"),
safe_strerror(errno));
return -1;
@@ -80,7 +80,7 @@ calculate_lifc_len:
}
if (ret < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"interface_list_ioctl: SIOCGLIFNUM failed %s",
safe_strerror(errno));
close(sock);
@@ -115,7 +115,7 @@ calculate_lifc_len:
if (errno == EINVAL)
goto calculate_lifc_len;
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "SIOCGLIFCONF: %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "SIOCGLIFCONF: %s",
safe_strerror(errno));
goto end;
}
@@ -207,7 +207,7 @@ static int if_get_index(struct interface *ifp)
ret = -1;
if (ret < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "SIOCGLIFINDEX(%s) failed",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "SIOCGLIFINDEX(%s) failed",
ifp->name);
return ret;
}
@@ -270,7 +270,7 @@ static int if_get_addr(struct interface *ifp, struct sockaddr *addr,
if (ret < 0) {
if (errno != EADDRNOTAVAIL) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"SIOCGLIFNETMASK (%s) fail: %s",
ifp->name, safe_strerror(errno));
return ret;
@@ -291,7 +291,7 @@ static int if_get_addr(struct interface *ifp, struct sockaddr *addr,
if (ifp->flags & IFF_POINTOPOINT)
prefixlen = IPV6_MAX_BITLEN;
else
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"SIOCGLIFSUBNET (%s) fail: %s",
ifp->name, safe_strerror(errno));
} else {
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c
index 184c5a4fa..7942069fb 100644
--- a/zebra/if_netlink.c
+++ b/zebra/if_netlink.c
@@ -82,7 +82,7 @@ static void set_ifindex(struct interface *ifp, ifindex_t ifi_index,
&& (oifp != ifp)) {
if (ifi_index == IFINDEX_INTERNAL)
flog_err(
- LIB_ERR_INTERFACE,
+ EC_LIB_INTERFACE,
"Netlink is setting interface %s ifindex to reserved internal value %u",
ifp->name, ifi_index);
else {
@@ -92,7 +92,7 @@ static void set_ifindex(struct interface *ifp, ifindex_t ifi_index,
ifi_index, oifp->name, ifp->name);
if (if_is_up(oifp))
flog_err(
- LIB_ERR_INTERFACE,
+ EC_LIB_INTERFACE,
"interface rename detected on up interface: index %d was renamed from %s to %s, results are uncertain!",
ifi_index, oifp->name, ifp->name);
if_delete_update(oifp);
@@ -313,8 +313,8 @@ static void netlink_vrf_change(struct nlmsghdr *h, struct rtattr *tb,
vrf = vrf_get((vrf_id_t)ifi->ifi_index,
name); // It would create vrf
if (!vrf) {
- flog_err(LIB_ERR_INTERFACE, "VRF %s id %u not created",
- name, ifi->ifi_index);
+ flog_err(EC_LIB_INTERFACE, "VRF %s id %u not created",
+ name, ifi->ifi_index);
return;
}
@@ -335,9 +335,9 @@ static void netlink_vrf_change(struct nlmsghdr *h, struct rtattr *tb,
/* Enable the created VRF. */
if (!vrf_enable(vrf)) {
- flog_err(LIB_ERR_INTERFACE,
- "Failed to enable VRF %s id %u", name,
- ifi->ifi_index);
+ flog_err(EC_LIB_INTERFACE,
+ "Failed to enable VRF %s id %u", name,
+ ifi->ifi_index);
return;
}
@@ -350,7 +350,7 @@ static void netlink_vrf_change(struct nlmsghdr *h, struct rtattr *tb,
vrf = vrf_lookup_by_id((vrf_id_t)ifi->ifi_index);
if (!vrf) {
- flog_warn(ZEBRA_ERR_VRF_NOT_FOUND, "%s: vrf not found",
+ flog_warn(EC_ZEBRA_VRF_NOT_FOUND, "%s: vrf not found",
__func__);
return;
}
@@ -900,7 +900,7 @@ int netlink_interface_addr(struct nlmsghdr *h, ns_id_t ns_id, int startup)
if (ifa->ifa_family != AF_INET && ifa->ifa_family != AF_INET6) {
flog_warn(
- ZEBRA_ERR_UNKNOWN_FAMILY,
+ EC_ZEBRA_UNKNOWN_FAMILY,
"Invalid address family: %u received from kernel interface addr change: %u",
ifa->ifa_family, h->nlmsg_type);
return 0;
@@ -924,7 +924,7 @@ int netlink_interface_addr(struct nlmsghdr *h, ns_id_t ns_id, int startup)
ifp = if_lookup_by_index_per_ns(zns, ifa->ifa_index);
if (ifp == NULL) {
flog_err(
- LIB_ERR_INTERFACE,
+ EC_LIB_INTERFACE,
"netlink_interface_addr can't find interface by index %d",
ifa->ifa_index);
return -1;
@@ -1081,7 +1081,7 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
if (!(ifi->ifi_family == AF_UNSPEC || ifi->ifi_family == AF_BRIDGE
|| ifi->ifi_family == AF_INET6)) {
flog_warn(
- ZEBRA_ERR_UNKNOWN_FAMILY,
+ EC_ZEBRA_UNKNOWN_FAMILY,
"Invalid address family: %u received from kernel link change: %u",
ifi->ifi_family, h->nlmsg_type);
return 0;
diff --git a/zebra/if_sysctl.c b/zebra/if_sysctl.c
index df0831a9f..3f918c361 100644
--- a/zebra/if_sysctl.c
+++ b/zebra/if_sysctl.c
@@ -53,7 +53,7 @@ void ifstat_update_sysctl(void)
/* Query buffer size. */
if (sysctl(mib, MIBSIZ, NULL, &bufsiz, NULL, 0) < 0) {
- flog_warn(ZEBRA_ERR_SYSCTL_FAILED, "sysctl() error by %s",
+ flog_warn(EC_ZEBRA_SYSCTL_FAILED, "sysctl() error by %s",
safe_strerror(errno));
return;
}
@@ -63,7 +63,7 @@ void ifstat_update_sysctl(void)
/* Fetch interface informations into allocated buffer. */
if (sysctl(mib, MIBSIZ, buf, &bufsiz, NULL, 0) < 0) {
- flog_warn(ZEBRA_ERR_SYSCTL_FAILED, "sysctl error by %s",
+ flog_warn(EC_ZEBRA_SYSCTL_FAILED, "sysctl error by %s",
safe_strerror(errno));
XFREE(MTYPE_TMP, ref);
return;
@@ -104,7 +104,7 @@ void interface_list(struct zebra_ns *zns)
/* Query buffer size. */
if (sysctl(mib, MIBSIZ, NULL, &bufsiz, NULL, 0) < 0) {
- flog_err_sys(ZEBRA_ERR_IFLIST_FAILED,
+ flog_err_sys(EC_ZEBRA_IFLIST_FAILED,
"Could not enumerate interfaces: %s",
safe_strerror(errno));
return;
@@ -115,7 +115,7 @@ void interface_list(struct zebra_ns *zns)
/* Fetch interface informations into allocated buffer. */
if (sysctl(mib, MIBSIZ, buf, &bufsiz, NULL, 0) < 0) {
- flog_err_sys(ZEBRA_ERR_IFLIST_FAILED,
+ flog_err_sys(EC_ZEBRA_IFLIST_FAILED,
"Could not enumerate interfaces: %s",
safe_strerror(errno));
return;
diff --git a/zebra/interface.c b/zebra/interface.c
index b4882edb9..ca90c18cf 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -312,7 +312,7 @@ int if_subnet_delete(struct interface *ifp, struct connected *ifc)
/* Get address derived subnet node. */
rn = route_node_lookup(zebra_if->ipv4_subnets, &cp);
if (!(rn && rn->info)) {
- flog_warn(ZEBRA_ERR_REMOVE_ADDR_UNKNOWN_SUBNET,
+ flog_warn(EC_ZEBRA_REMOVE_ADDR_UNKNOWN_SUBNET,
"Trying to remove an address from an unknown subnet."
" (please report this bug)");
return -1;
@@ -327,7 +327,7 @@ int if_subnet_delete(struct interface *ifp, struct connected *ifc)
* is unknown. */
if (!listnode_lookup(addr_list, ifc)) {
flog_warn(
- ZEBRA_ERR_REMOVE_UNREGISTERED_ADDR,
+ EC_ZEBRA_REMOVE_UNREGISTERED_ADDR,
"Trying to remove an address from a subnet where it is not"
" currently registered. (please report this bug)");
return -1;
@@ -474,7 +474,7 @@ static void if_addr_wakeup(struct interface *ifp)
ret = if_set_prefix(ifp, ifc);
if (ret < 0) {
flog_err_sys(
- ZEBRA_ERR_IFACE_ADDR_ADD_FAILED,
+ EC_ZEBRA_IFACE_ADDR_ADD_FAILED,
"Can't set interface's address: %s",
safe_strerror(errno));
continue;
@@ -497,7 +497,7 @@ static void if_addr_wakeup(struct interface *ifp)
ret = if_prefix_add_ipv6(ifp, ifc);
if (ret < 0) {
flog_err_sys(
- ZEBRA_ERR_IFACE_ADDR_ADD_FAILED,
+ EC_ZEBRA_IFACE_ADDR_ADD_FAILED,
"Can't set interface's address: %s",
safe_strerror(errno));
continue;
@@ -699,7 +699,7 @@ void if_delete_update(struct interface *ifp)
if (if_is_up(ifp)) {
flog_err(
- LIB_ERR_INTERFACE,
+ EC_LIB_INTERFACE,
"interface %s vrf %u index %d is still up while being deleted.",
ifp->name, ifp->vrf_id, ifp->ifindex);
return;
@@ -891,7 +891,7 @@ void if_up(struct interface *ifp)
/* Notify the protocol daemons. */
if (ifp->ptm_enable && (ifp->ptm_status == ZEBRA_PTM_STATUS_DOWN)) {
- flog_warn(ZEBRA_ERR_PTM_NOT_READY,
+ flog_warn(EC_ZEBRA_PTM_NOT_READY,
"%s: interface %s hasn't passed ptm check\n",
__func__, ifp->name);
return;
diff --git a/zebra/ioctl.c b/zebra/ioctl.c
index 5c2380cdd..87e98032a 100644
--- a/zebra/ioctl.c
+++ b/zebra/ioctl.c
@@ -397,7 +397,7 @@ void if_get_flags(struct interface *ifp)
ret = vrf_if_ioctl(SIOCGIFFLAGS, (caddr_t)&ifreq, ifp->vrf_id);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"vrf_if_ioctl(SIOCGIFFLAGS) failed: %s",
safe_strerror(errno));
return;
@@ -416,7 +416,7 @@ void if_get_flags(struct interface *ifp)
/* Seems not all interfaces implement this ioctl */
if (if_ioctl(SIOCGIFMEDIA, (caddr_t)&ifmr) < 0)
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"if_ioctl(SIOCGIFMEDIA) failed: %s",
safe_strerror(errno));
else if (ifmr.ifm_status & IFM_AVALID) /* Link state is valid */
diff --git a/zebra/ioctl_solaris.c b/zebra/ioctl_solaris.c
index 2f92cf256..fc554219b 100644
--- a/zebra/ioctl_solaris.c
+++ b/zebra/ioctl_solaris.c
@@ -381,7 +381,7 @@ int if_prefix_add_ipv6(struct interface *ifp, struct connected *ifc)
{
char addrbuf[PREFIX_STRLEN];
- flog_warn(LIB_ERR_DEVELOPMENT, "Can't set %s on interface %s",
+ flog_warn(EC_LIB_DEVELOPMENT, "Can't set %s on interface %s",
prefix2str(ifc->address, addrbuf, sizeof(addrbuf)),
ifp->name);
@@ -392,7 +392,7 @@ int if_prefix_delete_ipv6(struct interface *ifp, struct connected *ifc)
{
char addrbuf[PREFIX_STRLEN];
- flog_warn(LIB_ERR_DEVELOPMENT, "Can't delete %s on interface %s",
+ flog_warn(EC_LIB_DEVELOPMENT, "Can't delete %s on interface %s",
prefix2str(ifc->address, addrbuf, sizeof(addrbuf)),
ifp->name);
diff --git a/zebra/ipforward_solaris.c b/zebra/ipforward_solaris.c
index 7f372e32f..1bb743059 100644
--- a/zebra/ipforward_solaris.c
+++ b/zebra/ipforward_solaris.c
@@ -71,7 +71,7 @@ static int solaris_nd(const int cmd, const char *parameter, const int value)
else if (cmd == ND_GET)
snprintf(nd_buf, ND_BUFFER_SIZE, "%s", parameter);
else {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"internal error - inappropriate command given to "
"solaris_nd()%s:%d",
__FILE__, __LINE__);
@@ -85,14 +85,14 @@ static int solaris_nd(const int cmd, const char *parameter, const int value)
frr_elevate_privs(&zserv_privs) {
if ((fd = open(device, O_RDWR)) < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"failed to open device %s - %s", device,
safe_strerror(errno));
return -1;
}
if (ioctl(fd, I_STR, &strioctl) < 0) {
close(fd);
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"ioctl I_STR failed on device %s - %s",
device, safe_strerror(errno));
return -1;
diff --git a/zebra/ipforward_sysctl.c b/zebra/ipforward_sysctl.c
index 24ebf0a28..cc9421c27 100644
--- a/zebra/ipforward_sysctl.c
+++ b/zebra/ipforward_sysctl.c
@@ -43,7 +43,8 @@ int ipforward(void)
len = sizeof ipforwarding;
if (sysctl(mib, MIB_SIZ, &ipforwarding, &len, 0, 0) < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "Can't get ipforwarding value");
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
+ "Can't get ipforwarding value");
return -1;
}
return ipforwarding;
@@ -57,7 +58,7 @@ int ipforward_on(void)
len = sizeof ipforwarding;
frr_elevate_privs(&zserv_privs) {
if (sysctl(mib, MIB_SIZ, NULL, NULL, &ipforwarding, len) < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"Can't set ipforwarding on");
return -1;
}
@@ -73,7 +74,7 @@ int ipforward_off(void)
len = sizeof ipforwarding;
frr_elevate_privs(&zserv_privs) {
if (sysctl(mib, MIB_SIZ, NULL, NULL, &ipforwarding, len) < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"Can't set ipforwarding on");
return -1;
}
@@ -98,7 +99,7 @@ int ipforward_ipv6(void)
len = sizeof ip6forwarding;
frr_elevate_privs(&zserv_privs) {
if (sysctl(mib_ipv6, MIB_SIZ, &ip6forwarding, &len, 0, 0) < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"can't get ip6forwarding value");
return -1;
}
@@ -115,7 +116,7 @@ int ipforward_ipv6_on(void)
frr_elevate_privs(&zserv_privs) {
if (sysctl(mib_ipv6, MIB_SIZ, NULL, NULL, &ip6forwarding, len)
< 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"can't get ip6forwarding value");
return -1;
}
@@ -132,7 +133,7 @@ int ipforward_ipv6_off(void)
frr_elevate_privs(&zserv_privs) {
if (sysctl(mib_ipv6, MIB_SIZ, NULL, NULL, &ip6forwarding, len)
< 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"can't get ip6forwarding value");
return -1;
}
diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c
index cda6f0e21..5fdaae4fe 100644
--- a/zebra/irdp_interface.c
+++ b/zebra/irdp_interface.c
@@ -126,7 +126,7 @@ static int if_group(struct interface *ifp, int sock, uint32_t group,
p = irdp_get_prefix(ifp);
if (!p) {
- flog_warn(ZEBRA_ERR_NO_IFACE_ADDR,
+ flog_warn(EC_ZEBRA_NO_IFACE_ADDR,
"IRDP: can't get address for %s", ifp->name);
return 1;
}
@@ -136,7 +136,7 @@ static int if_group(struct interface *ifp, int sock, uint32_t group,
ret = setsockopt(sock, IPPROTO_IP, add_leave, (char *)&m,
sizeof(struct ip_mreq));
if (ret < 0)
- flog_err_sys(LIB_ERR_SOCKET, "IRDP: %s can't setsockopt %s: %s",
+ flog_err_sys(EC_LIB_SOCKET, "IRDP: %s can't setsockopt %s: %s",
add_leave == IP_ADD_MEMBERSHIP ? "join group"
: "leave group",
inet_2a(group, b1), safe_strerror(errno));
@@ -222,7 +222,7 @@ static void irdp_if_start(struct interface *ifp, int multicast,
return;
}
if ((irdp_sock < 0) && ((irdp_sock = irdp_sock_init()) < 0)) {
- flog_warn(ZEBRA_ERR_IRDP_CANNOT_ACTIVATE_IFACE,
+ flog_warn(EC_ZEBRA_IRDP_CANNOT_ACTIVATE_IFACE,
"IRDP: Cannot activate interface %s (cannot create "
"IRDP socket)",
ifp->name);
@@ -236,7 +236,7 @@ static void irdp_if_start(struct interface *ifp, int multicast,
if_add_update(ifp);
if (!(ifp->flags & IFF_UP)) {
- flog_warn(ZEBRA_ERR_IRDP_IFACE_DOWN,
+ flog_warn(EC_ZEBRA_IRDP_IFACE_DOWN,
"IRDP: Interface is down %s", ifp->name);
}
@@ -246,7 +246,7 @@ static void irdp_if_start(struct interface *ifp, int multicast,
if_add_group(ifp);
if (!(ifp->flags & (IFF_MULTICAST | IFF_ALLMULTI))) {
- flog_warn(ZEBRA_ERR_IRDP_IFACE_MCAST_DISABLED,
+ flog_warn(EC_ZEBRA_IRDP_IFACE_MCAST_DISABLED,
"IRDP: Interface not multicast enabled %s",
ifp->name);
}
diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c
index fe7e58e1a..9300ba603 100644
--- a/zebra/irdp_main.c
+++ b/zebra/irdp_main.c
@@ -90,8 +90,7 @@ int irdp_sock_init(void)
}
if (sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
- "IRDP: can't create irdp socket %s",
+ flog_err_sys(EC_LIB_SOCKET, "IRDP: can't create irdp socket %s",
safe_strerror(save_errno));
return sock;
};
@@ -99,7 +98,7 @@ int irdp_sock_init(void)
i = 1;
ret = setsockopt(sock, IPPROTO_IP, IP_TTL, (void *)&i, sizeof(i));
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "IRDP: can't do irdp sockopt %s",
+ flog_err_sys(EC_LIB_SOCKET, "IRDP: can't do irdp sockopt %s",
safe_strerror(errno));
close(sock);
return ret;
@@ -107,7 +106,7 @@ int irdp_sock_init(void)
ret = setsockopt_ifindex(AF_INET, sock, 1);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "IRDP: can't do irdp sockopt %s",
+ flog_err_sys(EC_LIB_SOCKET, "IRDP: can't do irdp sockopt %s",
safe_strerror(errno));
close(sock);
return ret;
diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c
index 31351b146..2b5bf04ad 100644
--- a/zebra/irdp_packet.c
+++ b/zebra/irdp_packet.c
@@ -96,15 +96,15 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
src = ip->ip_src;
if (len != iplen) {
- flog_err(ZEBRA_ERR_IRDP_LEN_MISMATCH,
- "IRDP: RX length doesnt match IP length");
+ flog_err(EC_ZEBRA_IRDP_LEN_MISMATCH,
+ "IRDP: RX length doesnt match IP length");
return;
}
if (iplen < ICMP_MINLEN) {
- flog_err(ZEBRA_ERR_IRDP_LEN_MISMATCH,
- "IRDP: RX ICMP packet too short from %s\n",
- inet_ntoa(src));
+ flog_err(EC_ZEBRA_IRDP_LEN_MISMATCH,
+ "IRDP: RX ICMP packet too short from %s\n",
+ inet_ntoa(src));
return;
}
@@ -113,9 +113,9 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
+
len of IP-header) 14+20 */
if (iplen > IRDP_RX_BUF - 34) {
- flog_err(ZEBRA_ERR_IRDP_LEN_MISMATCH,
- "IRDP: RX ICMP packet too long from %s\n",
- inet_ntoa(src));
+ flog_err(EC_ZEBRA_IRDP_LEN_MISMATCH,
+ "IRDP: RX ICMP packet too long from %s\n",
+ inet_ntoa(src));
return;
}
@@ -124,7 +124,7 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
/* check icmp checksum */
if (in_cksum(icmp, datalen) != icmp->checksum) {
flog_warn(
- ZEBRA_ERR_IRDP_BAD_CHECKSUM,
+ EC_ZEBRA_IRDP_BAD_CHECKSUM,
"IRDP: RX ICMP packet from %s. Bad checksum, silently ignored",
inet_ntoa(src));
return;
@@ -136,7 +136,7 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
return;
if (icmp->code != 0) {
- flog_warn(ZEBRA_ERR_IRDP_BAD_TYPE_CODE,
+ flog_warn(EC_ZEBRA_IRDP_BAD_TYPE_CODE,
"IRDP: RX packet type %d from %s. Bad ICMP type code,"
" silently ignored",
icmp->type, inet_ntoa(src));
@@ -148,7 +148,7 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
|| (ntohl(ip->ip_dst.s_addr) == INADDR_ALLRTRS_GROUP
&& !(irdp->flags & IF_BROADCAST))) {
flog_warn(
- ZEBRA_ERR_IRDP_BAD_RX_FLAGS,
+ EC_ZEBRA_IRDP_BAD_RX_FLAGS,
"IRDP: RX illegal from %s to %s while %s operates in %s; Please correct settings\n",
inet_ntoa(src),
ntohl(ip->ip_dst.s_addr) == INADDR_ALLRTRS_GROUP
@@ -174,7 +174,7 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
default:
flog_warn(
- ZEBRA_ERR_IRDP_BAD_TYPE,
+ EC_ZEBRA_IRDP_BAD_TYPE,
"IRDP: RX type %d from %s. Bad ICMP type, silently ignored",
icmp->type, inet_ntoa(src));
}
@@ -200,17 +200,17 @@ static int irdp_recvmsg(int sock, uint8_t *buf, int size, int *ifindex)
ret = recvmsg(sock, &msg, 0);
if (ret < 0) {
- flog_warn(LIB_ERR_SOCKET, "IRDP: recvmsg: read error %s",
+ flog_warn(EC_LIB_SOCKET, "IRDP: recvmsg: read error %s",
safe_strerror(errno));
return ret;
}
if (msg.msg_flags & MSG_TRUNC) {
- flog_warn(LIB_ERR_SOCKET, "IRDP: recvmsg: truncated message");
+ flog_warn(EC_LIB_SOCKET, "IRDP: recvmsg: truncated message");
return ret;
}
if (msg.msg_flags & MSG_CTRUNC) {
- flog_warn(LIB_ERR_SOCKET,
+ flog_warn(EC_LIB_SOCKET,
"IRDP: recvmsg: truncated control message");
return ret;
}
@@ -236,7 +236,7 @@ int irdp_read_raw(struct thread *r)
ret = irdp_recvmsg(irdp_sock, (uint8_t *)buf, IRDP_RX_BUF, &ifindex);
if (ret < 0)
- flog_warn(LIB_ERR_SOCKET, "IRDP: RX Error length = %d", ret);
+ flog_warn(EC_LIB_SOCKET, "IRDP: RX Error length = %d", ret);
ifp = if_lookup_by_index(ifindex, VRF_DEFAULT);
if (!ifp)
diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c
index 323a6c33f..1b713cc8c 100644
--- a/zebra/kernel_netlink.c
+++ b/zebra/kernel_netlink.c
@@ -163,7 +163,7 @@ static int netlink_recvbuf(struct nlsock *nl, uint32_t newsize)
ret = getsockopt(nl->sock, SOL_SOCKET, SO_RCVBUF, &oldsize, &oldlen);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"Can't get %s receive buffer size: %s", nl->name,
safe_strerror(errno));
return -1;
@@ -179,7 +179,7 @@ static int netlink_recvbuf(struct nlsock *nl, uint32_t newsize)
ret = setsockopt(nl->sock, SOL_SOCKET, SO_RCVBUF,
&nl_rcvbufsize, sizeof(nl_rcvbufsize));
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"Can't set %s receive buffer size: %s", nl->name,
safe_strerror(errno));
return -1;
@@ -187,7 +187,7 @@ static int netlink_recvbuf(struct nlsock *nl, uint32_t newsize)
ret = getsockopt(nl->sock, SOL_SOCKET, SO_RCVBUF, &newsize, &newlen);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"Can't get %s receive buffer size: %s", nl->name,
safe_strerror(errno));
return -1;
@@ -234,7 +234,7 @@ static int netlink_socket(struct nlsock *nl, unsigned long groups,
namelen = sizeof snl;
ret = getsockname(sock, (struct sockaddr *)&snl, (socklen_t *)&namelen);
if (ret < 0 || namelen != sizeof snl) {
- flog_err_sys(LIB_ERR_SOCKET, "Can't get %s socket name: %s",
+ flog_err_sys(EC_LIB_SOCKET, "Can't get %s socket name: %s",
nl->name, safe_strerror(errno));
close(sock);
return -1;
@@ -286,10 +286,10 @@ static int netlink_information_fetch(struct nlmsghdr *h, ns_id_t ns_id,
* this message type or not ask for
* it to be sent up to us
*/
- flog_err(ZEBRA_ERR_UNKNOWN_NLMSG,
- "Unknown netlink nlmsg_type %s(%d) vrf %u\n",
- nl_msg_type_to_str(h->nlmsg_type), h->nlmsg_type,
- ns_id);
+ flog_err(EC_ZEBRA_UNKNOWN_NLMSG,
+ "Unknown netlink nlmsg_type %s(%d) vrf %u\n",
+ nl_msg_type_to_str(h->nlmsg_type), h->nlmsg_type,
+ ns_id);
break;
}
return 0;
@@ -453,8 +453,7 @@ static void netlink_install_filter(int sock, __u32 pid)
if (setsockopt(sock, SOL_SOCKET, SO_ATTACH_FILTER, &prog, sizeof(prog))
< 0)
- flog_err_sys(LIB_ERR_SOCKET,
- "Can't install socket filter: %s\n",
+ flog_err_sys(EC_LIB_SOCKET, "Can't install socket filter: %s\n",
safe_strerror(errno));
}
@@ -653,7 +652,7 @@ static void netlink_parse_extended_ack(struct nlmsghdr *h)
if (is_err)
zlog_err("Extended Error: %s", msg);
else
- flog_warn(ZEBRA_ERR_NETLINK_EXTENDED_WARNING,
+ flog_warn(EC_ZEBRA_NETLINK_EXTENDED_WARNING,
"Extended Warning: %s", msg);
}
}
@@ -710,9 +709,9 @@ int netlink_parse_info(int (*filter)(struct nlmsghdr *, ns_id_t, int),
continue;
if (errno == EWOULDBLOCK || errno == EAGAIN)
break;
- flog_err(ZEBRA_ERR_RECVMSG_OVERRUN,
- "%s recvmsg overrun: %s", nl->name,
- safe_strerror(errno));
+ flog_err(EC_ZEBRA_RECVMSG_OVERRUN,
+ "%s recvmsg overrun: %s", nl->name,
+ safe_strerror(errno));
/*
* In this case we are screwed.
* There is no good way to
@@ -723,14 +722,14 @@ int netlink_parse_info(int (*filter)(struct nlmsghdr *, ns_id_t, int),
}
if (status == 0) {
- flog_err_sys(LIB_ERR_SOCKET, "%s EOF", nl->name);
+ flog_err_sys(EC_LIB_SOCKET, "%s EOF", nl->name);
return -1;
}
if (msg.msg_namelen != sizeof snl) {
- flog_err(ZEBRA_ERR_NETLINK_LENGTH_ERROR,
- "%s sender address length error: length %d",
- nl->name, msg.msg_namelen);
+ flog_err(EC_ZEBRA_NETLINK_LENGTH_ERROR,
+ "%s sender address length error: length %d",
+ nl->name, msg.msg_namelen);
return -1;
}
@@ -803,10 +802,9 @@ int netlink_parse_info(int (*filter)(struct nlmsghdr *, ns_id_t, int),
if (h->nlmsg_len
< NLMSG_LENGTH(sizeof(struct nlmsgerr))) {
- flog_err(
- ZEBRA_ERR_NETLINK_LENGTH_ERROR,
- "%s error: message truncated",
- nl->name);
+ flog_err(EC_ZEBRA_NETLINK_LENGTH_ERROR,
+ "%s error: message truncated",
+ nl->name);
return -1;
}
@@ -859,7 +857,7 @@ int netlink_parse_info(int (*filter)(struct nlmsghdr *, ns_id_t, int),
err->msg.nlmsg_pid);
} else
flog_err(
- ZEBRA_ERR_UNEXPECTED_MESSAGE,
+ EC_ZEBRA_UNEXPECTED_MESSAGE,
"%s error: %s, type=%s(%u), seq=%u, pid=%u",
nl->name,
safe_strerror(-errnum),
@@ -900,14 +898,14 @@ int netlink_parse_info(int (*filter)(struct nlmsghdr *, ns_id_t, int),
/* After error care. */
if (msg.msg_flags & MSG_TRUNC) {
- flog_err(ZEBRA_ERR_NETLINK_LENGTH_ERROR,
- "%s error: message truncated", nl->name);
+ flog_err(EC_ZEBRA_NETLINK_LENGTH_ERROR,
+ "%s error: message truncated", nl->name);
continue;
}
if (status) {
- flog_err(ZEBRA_ERR_NETLINK_LENGTH_ERROR,
- "%s error: data remnant size %d", nl->name,
- status);
+ flog_err(EC_ZEBRA_NETLINK_LENGTH_ERROR,
+ "%s error: data remnant size %d", nl->name,
+ status);
return -1;
}
}
@@ -972,7 +970,7 @@ int netlink_talk(int (*filter)(struct nlmsghdr *, ns_id_t, int startup),
}
if (status < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "netlink_talk sendmsg() error: %s",
+ flog_err_sys(EC_LIB_SOCKET, "netlink_talk sendmsg() error: %s",
safe_strerror(save_errno));
return -1;
}
@@ -995,7 +993,7 @@ int netlink_request(struct nlsock *nl, struct nlmsghdr *n)
/* Check netlink socket. */
if (nl->sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "%s socket isn't active.",
+ flog_err_sys(EC_LIB_SOCKET, "%s socket isn't active.",
nl->name);
return -1;
}
@@ -1090,7 +1088,7 @@ void kernel_init(struct zebra_ns *zns)
/* Register kernel socket. */
if (fcntl(zns->netlink.sock, F_SETFL, O_NONBLOCK) < 0)
- flog_err_sys(LIB_ERR_SOCKET, "Can't set %s socket flags: %s",
+ flog_err_sys(EC_LIB_SOCKET, "Can't set %s socket flags: %s",
zns->netlink.name, safe_strerror(errno));
if (fcntl(zns->netlink_cmd.sock, F_SETFL, O_NONBLOCK) < 0)
diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c
index 5f4158e35..8df5a3764 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -409,9 +409,9 @@ int ifm_read(struct if_msghdr *ifm)
/* paranoia: sanity check structure */
if (ifm->ifm_msglen < sizeof(struct if_msghdr)) {
- flog_err(ZEBRA_ERR_NETLINK_LENGTH_ERROR,
- "ifm_read: ifm->ifm_msglen %d too short\n",
- ifm->ifm_msglen);
+ flog_err(EC_ZEBRA_NETLINK_LENGTH_ERROR,
+ "ifm_read: ifm->ifm_msglen %d too short\n",
+ ifm->ifm_msglen);
return -1;
}
@@ -728,7 +728,7 @@ int ifam_read(struct ifa_msghdr *ifam)
ifam_read_mesg(ifam, &addr, &mask, &brd, ifname, &ifnlen);
if ((ifp = if_lookup_by_index(ifam->ifam_index, VRF_DEFAULT)) == NULL) {
- flog_warn(ZEBRA_ERR_UNKNOWN_INTERFACE,
+ flog_warn(EC_ZEBRA_UNKNOWN_INTERFACE,
"%s: no interface for ifname %s, index %d", __func__,
ifname, ifam->ifam_index);
return -1;
@@ -823,7 +823,7 @@ static int rtm_read_mesg(struct rt_msghdr *rtm, union sockunion *dest,
/* rt_msghdr version check. */
if (rtm->rtm_version != RTM_VERSION)
- flog_warn(ZEBRA_ERR_RTM_VERSION_MISMATCH,
+ flog_warn(EC_ZEBRA_RTM_VERSION_MISMATCH,
"Routing message version different %d should be %d."
"This may cause problem\n",
rtm->rtm_version, RTM_VERSION);
@@ -1184,7 +1184,7 @@ int rtm_write(int message, union sockunion *dest, union sockunion *mask,
inet_ntop(AF_INET, &mask->sin.sin_addr,
mask_buf, INET_ADDRSTRLEN);
flog_warn(
- ZEBRA_ERR_RTM_NO_GATEWAY,
+ EC_ZEBRA_RTM_NO_GATEWAY,
"%s: %s/%s: gate == NULL and no gateway found for ifindex %d",
__func__, dest_buf, mask_buf, index);
return -1;
@@ -1252,7 +1252,7 @@ int rtm_write(int message, union sockunion *dest, union sockunion *mask,
if (errno == ESRCH)
return ZEBRA_ERR_RTNOEXIST;
- flog_err_sys(LIB_ERR_SOCKET, "%s: write : %s (%d)", __func__,
+ flog_err_sys(EC_LIB_SOCKET, "%s: write : %s (%d)", __func__,
safe_strerror(errno), errno);
return ZEBRA_ERR_KERNEL;
}
@@ -1335,7 +1335,7 @@ static int kernel_read(struct thread *thread)
if (nbytes <= 0) {
if (nbytes < 0 && errno != EWOULDBLOCK && errno != EAGAIN)
- flog_err_sys(LIB_ERR_SOCKET, "routing socket error: %s",
+ flog_err_sys(EC_LIB_SOCKET, "routing socket error: %s",
safe_strerror(errno));
return 0;
}
@@ -1392,8 +1392,7 @@ static void routing_socket(struct zebra_ns *zns)
}
if (routing_sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
- "Can't init kernel routing socket");
+ flog_err_sys(EC_LIB_SOCKET, "Can't init kernel routing socket");
return;
}
diff --git a/zebra/label_manager.c b/zebra/label_manager.c
index 793d6cfa1..378a8ade4 100644
--- a/zebra/label_manager.c
+++ b/zebra/label_manager.c
@@ -83,9 +83,9 @@ static int relay_response_back(void)
ret = zclient_read_header(src, zclient->sock, &size, &marker, &version,
&vrf_id, &resp_cmd);
if (ret < 0 && errno != EAGAIN) {
- flog_err(ZEBRA_ERR_LM_RESPONSE,
- "Error reading Label Manager response: %s",
- strerror(errno));
+ flog_err(EC_ZEBRA_LM_RESPONSE,
+ "Error reading Label Manager response: %s",
+ strerror(errno));
return -1;
}
zlog_debug("Label Manager response received, %d bytes", size);
@@ -104,7 +104,7 @@ static int relay_response_back(void)
zserv = zserv_find_client(proto, instance);
if (!zserv) {
flog_err(
- ZEBRA_ERR_LM_NO_SUCH_CLIENT,
+ EC_ZEBRA_LM_NO_SUCH_CLIENT,
"Error relaying LM response: can't find client %s, instance %u",
proto_str, instance);
return -1;
@@ -119,9 +119,9 @@ static int relay_response_back(void)
/* send response back */
ret = writen(zserv->sock, dst->data, stream_get_endp(dst));
if (ret <= 0) {
- flog_err(ZEBRA_ERR_LM_RELAY_FAILED,
- "Error relaying LM response to %s instance %u: %s",
- proto_str, instance, strerror(errno));
+ flog_err(EC_ZEBRA_LM_RELAY_FAILED,
+ "Error relaying LM response to %s instance %u: %s",
+ proto_str, instance, strerror(errno));
return -1;
}
zlog_debug("Relayed LM response (%d bytes) to %s instance %u", ret,
@@ -187,8 +187,8 @@ int zread_relay_label_manager_request(int cmd, struct zserv *zserv,
unsigned short instance;
if (zclient->sock < 0) {
- flog_err(ZEBRA_ERR_LM_NO_SOCKET,
- "Unable to relay LM request: no socket");
+ flog_err(EC_ZEBRA_LM_NO_SOCKET,
+ "Unable to relay LM request: no socket");
reply_error(cmd, zserv, vrf_id);
return -1;
}
@@ -209,7 +209,7 @@ int zread_relay_label_manager_request(int cmd, struct zserv *zserv,
/* check & set client proto if unset */
if (zserv->proto && zserv->proto != proto) {
- flog_warn(ZEBRA_WARNING_LM_PROTO_MISMATCH,
+ flog_warn(EC_ZEBRAING_LM_PROTO_MISMATCH,
"Client proto(%u) != msg proto(%u)", zserv->proto,
proto);
return -1;
@@ -217,9 +217,9 @@ int zread_relay_label_manager_request(int cmd, struct zserv *zserv,
/* check & set client instance if unset */
if (zserv->instance && zserv->instance != instance) {
- flog_err(ZEBRA_ERR_LM_BAD_INSTANCE,
- "Client instance(%u) != msg instance(%u)",
- zserv->instance, instance);
+ flog_err(EC_ZEBRA_LM_BAD_INSTANCE,
+ "Client instance(%u) != msg instance(%u)",
+ zserv->instance, instance);
return -1;
}
@@ -240,9 +240,9 @@ int zread_relay_label_manager_request(int cmd, struct zserv *zserv,
/* Send request to external label manager */
ret = writen(zclient->sock, dst->data, stream_get_endp(dst));
if (ret <= 0) {
- flog_err(ZEBRA_ERR_LM_RELAY_FAILED,
- "Error relaying LM request from %s instance %u: %s",
- proto_str, instance, strerror(errno));
+ flog_err(EC_ZEBRA_LM_RELAY_FAILED,
+ "Error relaying LM request from %s instance %u: %s",
+ proto_str, instance, strerror(errno));
reply_error(cmd, zserv, vrf_id);
return -1;
}
@@ -270,8 +270,8 @@ static int lm_zclient_connect(struct thread *t)
return 0;
if (zclient_socket_connect(zclient) < 0) {
- flog_err(ZEBRA_ERR_LM_CLIENT_CONNECTION_FAILED,
- "Error connecting synchronous zclient!");
+ flog_err(EC_ZEBRA_LM_CLIENT_CONNECTION_FAILED,
+ "Error connecting synchronous zclient!");
thread_add_timer(zebrad.master, lm_zclient_connect, zclient,
CONNECTION_DELAY, &zclient->t_connect);
return -1;
@@ -400,9 +400,9 @@ struct label_manager_chunk *assign_label_chunk(uint8_t proto,
->end
+ 1;
if (lmc->start > MPLS_LABEL_UNRESERVED_MAX - size + 1) {
- flog_err(ZEBRA_ERR_LM_EXHAUSTED_LABELS,
- "Reached max labels. Start: %u, size: %u", lmc->start,
- size);
+ flog_err(EC_ZEBRA_LM_EXHAUSTED_LABELS,
+ "Reached max labels. Start: %u, size: %u", lmc->start,
+ size);
XFREE(MTYPE_LM_CHUNK, lmc);
return NULL;
}
@@ -440,8 +440,8 @@ int release_label_chunk(uint8_t proto, unsigned short instance, uint32_t start,
if (lmc->end != end)
continue;
if (lmc->proto != proto || lmc->instance != instance) {
- flog_err(ZEBRA_ERR_LM_DAEMON_MISMATCH,
- "%s: Daemon mismatch!!", __func__);
+ flog_err(EC_ZEBRA_LM_DAEMON_MISMATCH,
+ "%s: Daemon mismatch!!", __func__);
continue;
}
lmc->proto = NO_PROTO;
@@ -451,8 +451,8 @@ int release_label_chunk(uint8_t proto, unsigned short instance, uint32_t start,
break;
}
if (ret != 0)
- flog_err(ZEBRA_ERR_LM_UNRELEASED_CHUNK,
- "%s: Label chunk not released!!", __func__);
+ flog_err(EC_ZEBRA_LM_UNRELEASED_CHUNK,
+ "%s: Label chunk not released!!", __func__);
return ret;
}
diff --git a/zebra/main.c b/zebra/main.c
index 8db1c48f2..c46f8bb95 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -292,7 +292,7 @@ int main(int argc, char **argv)
if (multipath_num > MULTIPATH_NUM
|| multipath_num <= 0) {
flog_err(
- ZEBRA_ERR_BAD_MULTIPATH_NUM,
+ EC_ZEBRA_BAD_MULTIPATH_NUM,
"Multipath Number specified must be less than %d and greater than 0",
MULTIPATH_NUM);
return 1;
diff --git a/zebra/redistribute.c b/zebra/redistribute.c
index f30255355..f48fc6add 100644
--- a/zebra/redistribute.c
+++ b/zebra/redistribute.c
@@ -167,7 +167,7 @@ void redistribute_update(const struct prefix *p, const struct prefix *src_p,
afi = family2afi(p->family);
if (!afi) {
- flog_warn(ZEBRA_ERR_REDISTRIBUTE_UNKNOWN_AF,
+ flog_warn(EC_ZEBRA_REDISTRIBUTE_UNKNOWN_AF,
"%s: Unknown AFI/SAFI prefix received\n",
__FUNCTION__);
return;
@@ -238,7 +238,7 @@ void redistribute_delete(const struct prefix *p, const struct prefix *src_p,
afi = family2afi(p->family);
if (!afi) {
- flog_warn(ZEBRA_ERR_REDISTRIBUTE_UNKNOWN_AF,
+ flog_warn(EC_ZEBRA_REDISTRIBUTE_UNKNOWN_AF,
"%s: Unknown AFI/SAFI prefix received\n",
__FUNCTION__);
return;
@@ -278,7 +278,7 @@ void zebra_redistribute_add(ZAPI_HANDLER_ARGS)
zebra_route_string(type), zvrf_id(zvrf), instance);
if (afi == 0 || afi >= AFI_MAX) {
- flog_warn(ZEBRA_ERR_REDISTRIBUTE_UNKNOWN_AF,
+ flog_warn(EC_ZEBRA_REDISTRIBUTE_UNKNOWN_AF,
"%s: Specified afi %d does not exist",
__PRETTY_FUNCTION__, afi);
return;
@@ -325,7 +325,7 @@ void zebra_redistribute_delete(ZAPI_HANDLER_ARGS)
STREAM_GETW(msg, instance);
if (afi == 0 || afi >= AFI_MAX) {
- flog_warn(ZEBRA_ERR_REDISTRIBUTE_UNKNOWN_AF,
+ flog_warn(EC_ZEBRA_REDISTRIBUTE_UNKNOWN_AF,
"%s: Specified afi %d does not exist",
__PRETTY_FUNCTION__, afi);
return;
@@ -450,7 +450,7 @@ void zebra_interface_address_add_update(struct interface *ifp,
if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL))
flog_warn(
- ZEBRA_ERR_ADVERTISING_UNUSABLE_ADDR,
+ EC_ZEBRA_ADVERTISING_UNUSABLE_ADDR,
"WARNING: advertising address to clients that is not yet usable.");
zebra_vxlan_add_del_gw_macip(ifp, ifc->address, 1);
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 70bd8a784..7d4c68cc0 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -435,7 +435,7 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
if (rtm->rtm_src_len != 0) {
char buf[PREFIX_STRLEN];
flog_warn(
- ZEBRA_ERR_UNSUPPORTED_V4_SRCDEST,
+ EC_ZEBRA_UNSUPPORTED_V4_SRCDEST,
"unsupported IPv4 sourcedest route (dest %s vrf %u)",
prefix2str(&p, buf, sizeof(buf)), vrf_id);
return 0;
@@ -605,7 +605,7 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
nh_vrf_id = ifp->vrf_id;
else {
flog_warn(
- ZEBRA_ERR_UNKNOWN_INTERFACE,
+ EC_ZEBRA_UNKNOWN_INTERFACE,
"%s: Unknown interface %u specified, defaulting to VRF_DEFAULT",
__PRETTY_FUNCTION__,
index);
@@ -834,7 +834,7 @@ int netlink_route_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
if (!(rtm->rtm_family == AF_INET || rtm->rtm_family == AF_INET6)) {
flog_warn(
- ZEBRA_ERR_UNKNOWN_FAMILY,
+ EC_ZEBRA_UNKNOWN_FAMILY,
"Invalid address family: %u received from kernel route change: %u",
rtm->rtm_family, h->nlmsg_type);
return 0;
@@ -2486,7 +2486,7 @@ int netlink_neigh_change(struct nlmsghdr *h, ns_id_t ns_id)
return netlink_ipneigh_change(h, len, ns_id);
else {
flog_warn(
- ZEBRA_ERR_UNKNOWN_FAMILY,
+ EC_ZEBRA_UNKNOWN_FAMILY,
"Invalid address family: %u received from kernel neighbor change: %u",
ndm->ndm_family, h->nlmsg_type);
return 0;
diff --git a/zebra/rt_socket.c b/zebra/rt_socket.c
index 2ee450dd9..a6de84d56 100644
--- a/zebra/rt_socket.c
+++ b/zebra/rt_socket.c
@@ -73,7 +73,7 @@ static int kernel_rtm_add_labels(struct mpls_label_stack *nh_label,
struct sockaddr_mpls *smpls)
{
if (nh_label->num_labels > 1) {
- flog_warn(ZEBRA_ERR_MAX_LABELS_PUSH,
+ flog_warn(EC_ZEBRA_MAX_LABELS_PUSH,
"%s: can't push %u labels at "
"once (maximum is 1)",
__func__, nh_label->num_labels);
@@ -214,7 +214,7 @@ static int kernel_rtm_ipv4(int cmd, const struct prefix *p,
case ZEBRA_ERR_RTEXIST:
if (cmd != RTM_ADD)
flog_err(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"%s: rtm_write() returned %d for command %d",
__func__, error, cmd);
continue;
@@ -228,7 +228,7 @@ static int kernel_rtm_ipv4(int cmd, const struct prefix *p,
case ZEBRA_ERR_RTUNREACH:
default:
flog_err(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"%s: %s: rtm_write() unexpectedly returned %d for command %s",
__func__,
prefix2str(p, prefix_buf,
@@ -400,7 +400,7 @@ enum dp_req_result kernel_route_rib(struct route_node *rn,
int route = 0;
if (src_p && src_p->prefixlen) {
- flog_warn(ZEBRA_ERR_UNSUPPORTED_V6_SRCDEST,
+ flog_warn(EC_ZEBRA_UNSUPPORTED_V6_SRCDEST,
"%s: IPv6 sourcedest routes unsupported!", __func__);
return DP_REQUEST_FAILURE;
}
diff --git a/zebra/rtadv.c b/zebra/rtadv.c
index 696190492..f9bd5ad1b 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -375,7 +375,7 @@ static void rtadv_send_packet(int sock, struct interface *ifp)
ret = sendmsg(sock, &msg, 0);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s(%u): Tx RA failed, socket %u error %d (%s)",
ifp->name, ifp->ifindex, sock, errno,
safe_strerror(errno));
@@ -485,7 +485,7 @@ static void rtadv_process_advert(uint8_t *msg, unsigned int len,
if ((radvert->nd_ra_curhoplimit && zif->rtadv.AdvCurHopLimit)
&& (radvert->nd_ra_curhoplimit != zif->rtadv.AdvCurHopLimit)) {
flog_warn(
- ZEBRA_ERR_RA_PARAM_MISMATCH,
+ EC_ZEBRA_RA_PARAM_MISMATCH,
"%s(%u): Rx RA - our AdvCurHopLimit doesn't agree with %s",
ifp->name, ifp->ifindex, addr_str);
}
@@ -493,7 +493,7 @@ static void rtadv_process_advert(uint8_t *msg, unsigned int len,
if ((radvert->nd_ra_flags_reserved & ND_RA_FLAG_MANAGED)
&& !zif->rtadv.AdvManagedFlag) {
flog_warn(
- ZEBRA_ERR_RA_PARAM_MISMATCH,
+ EC_ZEBRA_RA_PARAM_MISMATCH,
"%s(%u): Rx RA - our AdvManagedFlag doesn't agree with %s",
ifp->name, ifp->ifindex, addr_str);
}
@@ -501,7 +501,7 @@ static void rtadv_process_advert(uint8_t *msg, unsigned int len,
if ((radvert->nd_ra_flags_reserved & ND_RA_FLAG_OTHER)
&& !zif->rtadv.AdvOtherConfigFlag) {
flog_warn(
- ZEBRA_ERR_RA_PARAM_MISMATCH,
+ EC_ZEBRA_RA_PARAM_MISMATCH,
"%s(%u): Rx RA - our AdvOtherConfigFlag doesn't agree with %s",
ifp->name, ifp->ifindex, addr_str);
}
@@ -510,7 +510,7 @@ static void rtadv_process_advert(uint8_t *msg, unsigned int len,
&& (ntohl(radvert->nd_ra_reachable)
!= zif->rtadv.AdvReachableTime)) {
flog_warn(
- ZEBRA_ERR_RA_PARAM_MISMATCH,
+ EC_ZEBRA_RA_PARAM_MISMATCH,
"%s(%u): Rx RA - our AdvReachableTime doesn't agree with %s",
ifp->name, ifp->ifindex, addr_str);
}
@@ -519,7 +519,7 @@ static void rtadv_process_advert(uint8_t *msg, unsigned int len,
&& (ntohl(radvert->nd_ra_retransmit)
!= (unsigned int)zif->rtadv.AdvRetransTimer)) {
flog_warn(
- ZEBRA_ERR_RA_PARAM_MISMATCH,
+ EC_ZEBRA_RA_PARAM_MISMATCH,
"%s(%u): Rx RA - our AdvRetransTimer doesn't agree with %s",
ifp->name, ifp->ifindex, addr_str);
}
@@ -549,7 +549,7 @@ static void rtadv_process_packet(uint8_t *buf, unsigned int len,
/* Interface search. */
ifp = if_lookup_by_index_per_ns(zns, ifindex);
if (ifp == NULL) {
- flog_warn(ZEBRA_ERR_UNKNOWN_INTERFACE,
+ flog_warn(EC_ZEBRA_UNKNOWN_INTERFACE,
"RA/RS received on unknown IF %u from %s", ifindex,
addr_str);
return;
@@ -621,7 +621,7 @@ static int rtadv_read(struct thread *thread)
&hoplimit);
if (len < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"RA/RS recv failed, socket %u error %s", sock,
safe_strerror(errno));
return len;
@@ -830,7 +830,7 @@ static void zebra_interface_radv_set(ZAPI_HANDLER_ARGS, int enable)
/* Locate interface and check VRF match. */
ifp = if_lookup_by_index_per_ns(zebra_ns_lookup(NS_DEFAULT), ifindex);
if (!ifp) {
- flog_warn(ZEBRA_ERR_UNKNOWN_INTERFACE,
+ flog_warn(EC_ZEBRA_UNKNOWN_INTERFACE,
"%u: IF %u RA %s client %s - interface unknown",
zvrf_id(zvrf), ifindex, enable ? "enable" : "disable",
zebra_route_string(client->proto));
@@ -1767,7 +1767,7 @@ static int if_join_all_router(int sock, struct interface *ifp)
ret = setsockopt(sock, IPPROTO_IPV6, IPV6_JOIN_GROUP, (char *)&mreq,
sizeof mreq);
if (ret < 0)
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s(%u): Failed to join group, socket %u error %s",
ifp->name, ifp->ifindex, sock,
safe_strerror(errno));
@@ -1794,7 +1794,7 @@ static int if_leave_all_router(int sock, struct interface *ifp)
sizeof mreq);
if (ret < 0)
flog_err_sys(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%s(%u): Failed to leave group, socket %u error %s",
ifp->name, ifp->ifindex, sock, safe_strerror(errno));
diff --git a/zebra/rtread_getmsg.c b/zebra/rtread_getmsg.c
index 40982639c..c1bd68f9d 100644
--- a/zebra/rtread_getmsg.c
+++ b/zebra/rtread_getmsg.c
@@ -121,7 +121,7 @@ void route_read(struct zebra_ns *zns)
int flags, dev, retval, process;
if ((dev = open(_PATH_GETMSG_ROUTE, O_RDWR)) == -1) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "can't open %s: %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "can't open %s: %s",
_PATH_GETMSG_ROUTE, safe_strerror(errno));
return;
}
@@ -143,7 +143,7 @@ void route_read(struct zebra_ns *zns)
flags = 0;
if (putmsg(dev, &msgdata, NULL, flags) == -1) {
- flog_err_sys(LIB_ERR_SOCKET, "putmsg failed: %s",
+ flog_err_sys(EC_LIB_SOCKET, "putmsg failed: %s",
safe_strerror(errno));
goto exit;
}
@@ -156,7 +156,7 @@ void route_read(struct zebra_ns *zns)
retval = getmsg(dev, &msgdata, NULL, &flags);
if (retval == -1) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"getmsg(ctl) failed: %s",
safe_strerror(errno));
goto exit;
@@ -215,7 +215,7 @@ void route_read(struct zebra_ns *zns)
retval = getmsg(dev, NULL, &msgdata, &flags);
if (retval == -1) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"getmsg(data) failed: %s",
safe_strerror(errno));
goto exit;
diff --git a/zebra/rtread_sysctl.c b/zebra/rtread_sysctl.c
index 5f6b62df2..f88586a6e 100644
--- a/zebra/rtread_sysctl.c
+++ b/zebra/rtread_sysctl.c
@@ -48,7 +48,7 @@ void route_read(struct zebra_ns *zns)
/* Get buffer size. */
if (sysctl(mib, MIBSIZ, NULL, &bufsiz, NULL, 0) < 0) {
- flog_warn(ZEBRA_ERR_SYSCTL_FAILED, "sysctl fail: %s",
+ flog_warn(EC_ZEBRA_SYSCTL_FAILED, "sysctl fail: %s",
safe_strerror(errno));
return;
}
@@ -58,7 +58,7 @@ void route_read(struct zebra_ns *zns)
/* Read routing table information by calling sysctl(). */
if (sysctl(mib, MIBSIZ, buf, &bufsiz, NULL, 0) < 0) {
- flog_warn(ZEBRA_ERR_SYSCTL_FAILED, "sysctl() fail by %s",
+ flog_warn(EC_ZEBRA_SYSCTL_FAILED, "sysctl() fail by %s",
safe_strerror(errno));
XFREE(MTYPE_TMP, ref);
return;
diff --git a/zebra/rule_netlink.c b/zebra/rule_netlink.c
index 4244a9af8..518d81dd6 100644
--- a/zebra/rule_netlink.c
+++ b/zebra/rule_netlink.c
@@ -207,7 +207,7 @@ int netlink_rule_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
frh = NLMSG_DATA(h);
if (frh->family != AF_INET && frh->family != AF_INET6) {
flog_warn(
- ZEBRA_ERR_NETLINK_INVALID_AF,
+ EC_ZEBRA_NETLINK_INVALID_AF,
"Invalid address family: %u received from kernel rule change: %u",
frh->family, h->nlmsg_type);
return 0;
diff --git a/zebra/rule_socket.c b/zebra/rule_socket.c
index 8faca1bbc..11d9e00eb 100644
--- a/zebra/rule_socket.c
+++ b/zebra/rule_socket.c
@@ -45,15 +45,15 @@
enum dp_req_result kernel_add_pbr_rule(struct zebra_pbr_rule *rule)
{
- flog_err(LIB_ERR_UNAVAILABLE, "%s not Implemented for this platform",
- __PRETTY_FUNCTION__);
+ flog_err(EC_LIB_UNAVAILABLE, "%s not Implemented for this platform",
+ __PRETTY_FUNCTION__);
return DP_REQUEST_FAILURE;
}
enum dp_req_result kernel_del_pbr_rule(struct zebra_pbr_rule *rule)
{
- flog_err(LIB_ERR_UNAVAILABLE, "%s not Implemented for this platform",
- __PRETTY_FUNCTION__);
+ flog_err(EC_LIB_UNAVAILABLE, "%s not Implemented for this platform",
+ __PRETTY_FUNCTION__);
return DP_REQUEST_FAILURE;
}
diff --git a/zebra/table_manager.c b/zebra/table_manager.c
index 43b5c7d59..91b45f3f0 100644
--- a/zebra/table_manager.c
+++ b/zebra/table_manager.c
@@ -147,9 +147,8 @@ struct table_manager_chunk *assign_table_chunk(uint8_t proto, uint16_t instance,
#endif /* SUNOS_5 */
tmc->start = start;
if (RT_TABLE_ID_UNRESERVED_MAX - size + 1 < start) {
- flog_err(ZEBRA_ERR_TM_EXHAUSTED_IDS,
- "Reached max table id. Start/Size %u/%u", start,
- size);
+ flog_err(EC_ZEBRA_TM_EXHAUSTED_IDS,
+ "Reached max table id. Start/Size %u/%u", start, size);
XFREE(MTYPE_TM_CHUNK, tmc);
return NULL;
}
@@ -186,8 +185,8 @@ int release_table_chunk(uint8_t proto, uint16_t instance, uint32_t start,
if (tmc->end != end)
continue;
if (tmc->proto != proto || tmc->instance != instance) {
- flog_err(ZEBRA_ERR_TM_DAEMON_MISMATCH,
- "%s: Daemon mismatch!!", __func__);
+ flog_err(EC_ZEBRA_TM_DAEMON_MISMATCH,
+ "%s: Daemon mismatch!!", __func__);
continue;
}
tmc->proto = NO_PROTO;
@@ -196,8 +195,8 @@ int release_table_chunk(uint8_t proto, uint16_t instance, uint32_t start,
break;
}
if (ret != 0)
- flog_err(ZEBRA_ERR_TM_UNRELEASED_CHUNK,
- "%s: Table chunk not released!!", __func__);
+ flog_err(EC_ZEBRA_TM_UNRELEASED_CHUNK,
+ "%s: Table chunk not released!!", __func__);
return ret;
}
diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c
index e4fbb7362..55c5b934f 100644
--- a/zebra/zapi_msg.c
+++ b/zebra/zapi_msg.c
@@ -1061,7 +1061,7 @@ static void zread_rnh_register(ZAPI_HANDLER_ARGS)
l += IPV6_MAX_BYTELEN;
} else {
flog_err(
- ZEBRA_ERR_UNKNOWN_FAMILY,
+ EC_ZEBRA_UNKNOWN_FAMILY,
"rnh_register: Received unknown family type %d\n",
p.family);
return;
@@ -1145,7 +1145,7 @@ static void zread_rnh_unregister(ZAPI_HANDLER_ARGS)
l += IPV6_MAX_BYTELEN;
} else {
flog_err(
- ZEBRA_ERR_UNKNOWN_FAMILY,
+ EC_ZEBRA_UNKNOWN_FAMILY,
"rnh_register: Received unknown family type %d\n",
p.family);
return;
@@ -1182,7 +1182,7 @@ static void zread_fec_register(ZAPI_HANDLER_ARGS)
*/
if (hdr->length < ZEBRA_MIN_FEC_LENGTH) {
flog_err(
- ZEBRA_ERR_IRDP_LEN_MISMATCH,
+ EC_ZEBRA_IRDP_LEN_MISMATCH,
"fec_register: Received a fec register of hdr->length %d, it is of insufficient size to properly decode",
hdr->length);
return;
@@ -1194,7 +1194,7 @@ static void zread_fec_register(ZAPI_HANDLER_ARGS)
STREAM_GETW(s, p.family);
if (p.family != AF_INET && p.family != AF_INET6) {
flog_err(
- ZEBRA_ERR_UNKNOWN_FAMILY,
+ EC_ZEBRA_UNKNOWN_FAMILY,
"fec_register: Received unknown family type %d\n",
p.family);
return;
@@ -1242,7 +1242,7 @@ static void zread_fec_unregister(ZAPI_HANDLER_ARGS)
*/
if (hdr->length < ZEBRA_MIN_FEC_LENGTH) {
flog_err(
- ZEBRA_ERR_IRDP_LEN_MISMATCH,
+ EC_ZEBRA_IRDP_LEN_MISMATCH,
"fec_unregister: Received a fec unregister of hdr->length %d, it is of insufficient size to properly decode",
hdr->length);
return;
@@ -1257,7 +1257,7 @@ static void zread_fec_unregister(ZAPI_HANDLER_ARGS)
STREAM_GETW(s, p.family);
if (p.family != AF_INET && p.family != AF_INET6) {
flog_err(
- ZEBRA_ERR_UNKNOWN_FAMILY,
+ EC_ZEBRA_UNKNOWN_FAMILY,
"fec_unregister: Received unknown family type %d\n",
p.family);
return;
@@ -1320,7 +1320,7 @@ void zserv_nexthop_num_warn(const char *caller, const struct prefix *p,
prefix2str(p, buff, sizeof(buff));
flog_warn(
- ZEBRA_ERR_MORE_NH_THAN_MULTIPATH,
+ EC_ZEBRA_MORE_NH_THAN_MULTIPATH,
"%s: Prefix %s has %d nexthops, but we can only use the first %d",
caller, buff, nexthop_num, multipath_num);
}
@@ -1484,7 +1484,7 @@ static void zread_route_add(ZAPI_HANDLER_ARGS)
if (!nexthop) {
flog_warn(
- ZEBRA_ERR_NEXTHOP_CREATION_FAILED,
+ EC_ZEBRA_NEXTHOP_CREATION_FAILED,
"%s: Nexthops Specified: %d but we failed to properly create one",
__PRETTY_FUNCTION__, api.nexthop_num);
nexthops_free(re->ng.nexthop);
@@ -1524,7 +1524,7 @@ static void zread_route_add(ZAPI_HANDLER_ARGS)
afi = family2afi(api.prefix.family);
if (afi != AFI_IP6 && CHECK_FLAG(api.message, ZAPI_MESSAGE_SRCPFX)) {
- flog_warn(ZEBRA_ERR_RX_SRCDEST_WRONG_AFI,
+ flog_warn(EC_ZEBRA_RX_SRCDEST_WRONG_AFI,
"%s: Received SRC Prefix but afi is not v6",
__PRETTY_FUNCTION__);
nexthops_free(re->ng.nexthop);
@@ -1567,7 +1567,7 @@ static void zread_route_del(ZAPI_HANDLER_ARGS)
afi = family2afi(api.prefix.family);
if (afi != AFI_IP6 && CHECK_FLAG(api.message, ZAPI_MESSAGE_SRCPFX)) {
- flog_warn(ZEBRA_ERR_RX_SRCDEST_WRONG_AFI,
+ flog_warn(EC_ZEBRA_RX_SRCDEST_WRONG_AFI,
"%s: Received a src prefix while afi is not v6",
__PRETTY_FUNCTION__);
return;
@@ -1786,9 +1786,9 @@ static void zread_table_manager_connect(struct zserv *client,
/* accept only dynamic routing protocols */
if ((proto >= ZEBRA_ROUTE_MAX) || (proto <= ZEBRA_ROUTE_STATIC)) {
- flog_err(ZEBRA_ERR_TM_WRONG_PROTO,
- "client %d has wrong protocol %s", client->sock,
- zebra_route_string(proto));
+ flog_err(EC_ZEBRA_TM_WRONG_PROTO,
+ "client %d has wrong protocol %s", client->sock,
+ zebra_route_string(proto));
zsend_table_manager_connect_response(client, vrf_id, 1);
return;
}
@@ -1826,9 +1826,9 @@ static void zread_label_manager_connect(struct zserv *client,
/* accept only dynamic routing protocols */
if ((proto >= ZEBRA_ROUTE_MAX) || (proto <= ZEBRA_ROUTE_STATIC)) {
- flog_err(ZEBRA_ERR_TM_WRONG_PROTO,
- "client %d has wrong protocol %s", client->sock,
- zebra_route_string(proto));
+ flog_err(EC_ZEBRA_TM_WRONG_PROTO,
+ "client %d has wrong protocol %s", client->sock,
+ zebra_route_string(proto));
zsend_label_manager_connect_response(client, vrf_id, 1);
return;
}
@@ -1856,16 +1856,16 @@ static int msg_client_id_mismatch(const char *op, struct zserv *client,
uint8_t proto, unsigned int instance)
{
if (proto != client->proto) {
- flog_err(ZEBRA_ERR_PROTO_OR_INSTANCE_MISMATCH,
- "%s: msg vs client proto mismatch, client=%u msg=%u",
- op, client->proto, proto);
+ flog_err(EC_ZEBRA_PROTO_OR_INSTANCE_MISMATCH,
+ "%s: msg vs client proto mismatch, client=%u msg=%u",
+ op, client->proto, proto);
/* TODO: fail when BGP sets proto and instance */
/* return 1; */
}
if (instance != client->instance) {
flog_err(
- ZEBRA_ERR_PROTO_OR_INSTANCE_MISMATCH,
+ EC_ZEBRA_PROTO_OR_INSTANCE_MISMATCH,
"%s: msg vs client instance mismatch, client=%u msg=%u",
op, client->instance, instance);
/* TODO: fail when BGP sets proto and instance */
@@ -1901,7 +1901,7 @@ static void zread_get_label_chunk(struct zserv *client, struct stream *msg,
lmc = assign_label_chunk(client->proto, client->instance, keep, size);
if (!lmc)
flog_err(
- ZEBRA_ERR_LM_CANNOT_ASSIGN_CHUNK,
+ EC_ZEBRA_LM_CANNOT_ASSIGN_CHUNK,
"Unable to assign Label Chunk of size %u to %s instance %u",
size, zebra_route_string(client->proto),
client->instance);
@@ -1960,7 +1960,7 @@ static void zread_label_manager_request(ZAPI_HANDLER_ARGS)
/* Sanity: don't allow 'unidentified' requests */
if (!client->proto) {
flog_err(
- ZEBRA_ERR_LM_ALIENS,
+ EC_ZEBRA_LM_ALIENS,
"Got label request from an unidentified client");
return;
}
@@ -1988,9 +1988,9 @@ static void zread_get_table_chunk(struct zserv *client, struct stream *msg,
tmc = assign_table_chunk(client->proto, client->instance, size);
if (!tmc)
- flog_err(ZEBRA_ERR_TM_CANNOT_ASSIGN_CHUNK,
- "%s: Unable to assign Table Chunk of size %u",
- __func__, size);
+ flog_err(EC_ZEBRA_TM_CANNOT_ASSIGN_CHUNK,
+ "%s: Unable to assign Table Chunk of size %u",
+ __func__, size);
else
zlog_debug("Assigned Table Chunk %u - %u", tmc->start,
tmc->end);
@@ -2028,7 +2028,7 @@ static void zread_table_manager_request(ZAPI_HANDLER_ARGS)
/* Sanity: don't allow 'unidentified' requests */
if (!client->proto) {
flog_err(
- ZEBRA_ERR_TM_ALIENS,
+ EC_ZEBRA_TM_ALIENS,
"Got table request from an unidentified client");
return;
}
@@ -2082,7 +2082,7 @@ static void zread_pseudowire(ZAPI_HANDLER_ARGS)
switch (hdr->command) {
case ZEBRA_PW_ADD:
if (pw) {
- flog_warn(ZEBRA_ERR_PSEUDOWIRE_EXISTS,
+ flog_warn(EC_ZEBRA_PSEUDOWIRE_EXISTS,
"%s: pseudowire %s already exists [%s]",
__func__, ifname,
zserv_command_string(hdr->command));
@@ -2093,7 +2093,7 @@ static void zread_pseudowire(ZAPI_HANDLER_ARGS)
break;
case ZEBRA_PW_DELETE:
if (!pw) {
- flog_warn(ZEBRA_ERR_PSEUDOWIRE_NONEXISTENT,
+ flog_warn(EC_ZEBRA_PSEUDOWIRE_NONEXISTENT,
"%s: pseudowire %s not found [%s]", __func__,
ifname, zserv_command_string(hdr->command));
return;
@@ -2104,7 +2104,7 @@ static void zread_pseudowire(ZAPI_HANDLER_ARGS)
case ZEBRA_PW_SET:
case ZEBRA_PW_UNSET:
if (!pw) {
- flog_warn(ZEBRA_ERR_PSEUDOWIRE_NONEXISTENT,
+ flog_warn(EC_ZEBRA_PSEUDOWIRE_NONEXISTENT,
"%s: pseudowire %s not found [%s]", __func__,
ifname, zserv_command_string(hdr->command));
return;
diff --git a/zebra/zebra_errors.c b/zebra/zebra_errors.c
index 79d9caf11..17163e218 100644
--- a/zebra/zebra_errors.c
+++ b/zebra/zebra_errors.c
@@ -26,260 +26,260 @@
/* clang-format off */
static struct log_ref ferr_zebra_err[] = {
{
- .code = ZEBRA_ERR_LM_RESPONSE,
+ .code = EC_ZEBRA_LM_RESPONSE,
.title = "Error reading response from label manager",
.description = "Zebra could not read the ZAPI header from the label manager",
.suggestion = "Wait for the error to resolve on its own. If it does not resolve, restart Zebra.",
},
{
- .code = ZEBRA_ERR_LM_NO_SUCH_CLIENT,
+ .code = EC_ZEBRA_LM_NO_SUCH_CLIENT,
.title = "Label manager could not find ZAPI client",
.description = "Zebra was unable to find a ZAPI client matching the given protocol and instance number.",
.suggestion = "Ensure clients which use the label manager are properly configured and running.",
},
{
- .code = ZEBRA_ERR_LM_RELAY_FAILED,
+ .code = EC_ZEBRA_LM_RELAY_FAILED,
.title = "Zebra could not relay label manager response",
.description = "Zebra found the client and instance to relay the label manager response or request to, but was not able to do so, possibly because the connection was closed.",
.suggestion = "Ensure clients which use the label manager are properly configured and running.",
},
{
- .code = ZEBRA_ERR_LM_BAD_INSTANCE,
+ .code = EC_ZEBRA_LM_BAD_INSTANCE,
.title = "Mismatch between ZAPI instance and encoded message instance",
.description = "While relaying a request to the external label manager, Zebra noticed that the instance number encoded in the message did not match the client instance number.",
.suggestion = "Notify a developer.",
},
{
- .code = ZEBRA_ERR_LM_EXHAUSTED_LABELS,
+ .code = EC_ZEBRA_LM_EXHAUSTED_LABELS,
.title = "Zebra label manager used all available labels",
.description = "Zebra is unable to assign additional label chunks because it has exhausted its assigned label range.",
.suggestion = "Make the label range bigger and restart Zebra.",
},
{
- .code = ZEBRA_ERR_LM_DAEMON_MISMATCH,
+ .code = EC_ZEBRA_LM_DAEMON_MISMATCH,
.title = "Daemon mismatch when releasing label chunks",
.description = "Zebra noticed a mismatch between a label chunk and a protocol daemon number or instance when releasing unused label chunks.",
.suggestion = "Ignore this error.",
},
{
- .code = ZEBRA_ERR_LM_UNRELEASED_CHUNK,
+ .code = EC_ZEBRA_LM_UNRELEASED_CHUNK,
.title = "Zebra did not free any label chunks",
.description = "Zebra's chunk cleanup procedure ran, but no label chunks were released.",
.suggestion = "Ignore this error.",
},
{
- .code = ZEBRA_ERR_DP_INVALID_RC,
+ .code = EC_ZEBRA_DP_INVALID_RC,
.title = "Dataplane returned invalid status code",
.description = "The underlying dataplane responded to a Zebra message or other interaction with an unrecognized, unknown or invalid status code.",
.suggestion = "Notify a developer.",
},
{
- .code = ZEBRA_ERR_WQ_NONEXISTENT,
+ .code = EC_ZEBRA_WQ_NONEXISTENT,
.title = "A necessary work queue does not exist.",
.description = "A necessary work queue does not exist.",
.suggestion = "Notify a developer.",
},
{
- .code = ZEBRA_ERR_FEC_ADD_FAILED,
+ .code = EC_ZEBRA_FEC_ADD_FAILED,
.title = "Failed to add FEC for MPLS client",
.description = "A client requested a label binding for a new FEC, but Zebra was unable to add the FEC to its internal table.",
.suggestion = "Notify a developer.",
},
{
- .code = ZEBRA_ERR_FEC_RM_FAILED,
+ .code = EC_ZEBRA_FEC_RM_FAILED,
.title = "Failed to remove FEC for MPLS client",
.description = "Zebra was unable to find and remove a FEC in its internal table.",
.suggestion = "Notify a developer.",
},
{
- .code = ZEBRA_ERR_IRDP_LEN_MISMATCH,
+ .code = EC_ZEBRA_IRDP_LEN_MISMATCH,
.title = "IRDP message length mismatch",
.description = "The length encoded in the IP TLV does not match the length of the packet received.",
.suggestion = "Notify a developer.",
},
{
- .code = ZEBRA_ERR_RNH_UNKNOWN_FAMILY,
+ .code = EC_ZEBRA_RNH_UNKNOWN_FAMILY,
.title = "Attempted to perform nexthop update for unknown address family",
.description = "Zebra attempted to perform a nexthop update for unknown address family",
.suggestion = "Notify a developer.",
},
{
- .code = ZEBRA_ERR_DP_INSTALL_FAIL,
+ .code = EC_ZEBRA_DP_INSTALL_FAIL,
.title = "Dataplane installation failure",
.description = "Installation of routes to underlying dataplane failed.",
.suggestion = "Check all configuration parameters for correctness.",
},
{
- .code = ZEBRA_ERR_DP_DELETE_FAIL,
+ .code = EC_ZEBRA_DP_DELETE_FAIL,
.title = "Dataplane deletion failure",
.description = "Deletion of routes from underlying dataplane failed.",
.suggestion = "Check all configuration parameters for correctness.",
},
{
- .code = ZEBRA_ERR_TABLE_LOOKUP_FAILED,
+ .code = EC_ZEBRA_TABLE_LOOKUP_FAILED,
.title = "Zebra table lookup failed",
.description = "Zebra attempted to look up a table for a particular address family and subsequent address family, but didn't find anything.",
.suggestion = "If you entered a command to trigger this error, make sure you entered the arguments correctly. Check your config file for any potential errors. If these look correct, seek help.",
},
{
- .code = ZEBRA_ERR_NETLINK_NOT_AVAILABLE,
+ .code = EC_ZEBRA_NETLINK_NOT_AVAILABLE,
.title = "Netlink backend not available",
.description = "FRR was not compiled with support for Netlink. Any operations that require Netlink will fail.",
.suggestion = "Recompile FRR with Netlink, or install a package that supports this feature.",
},
{
- .code = ZEBRA_ERR_PROTOBUF_NOT_AVAILABLE,
+ .code = EC_ZEBRA_PROTOBUF_NOT_AVAILABLE,
.title = "Protocol Buffers backend not available",
.description = "FRR was not compiled with support for Protocol Buffers. Any operations that require Protobuf will fail.",
.suggestion = "Recompile FRR with Protobuf support, or install a package that supports this feature.",
},
{
- .code = ZEBRA_ERR_TM_EXHAUSTED_IDS,
+ .code = EC_ZEBRA_TM_EXHAUSTED_IDS,
.title = "Table manager used all available IDs",
.description = "Zebra's table manager used up all IDs available to it and can't assign any more.",
.suggestion = "Reconfigure Zebra with a larger range of table IDs.",
},
{
- .code = ZEBRA_ERR_TM_DAEMON_MISMATCH,
+ .code = EC_ZEBRA_TM_DAEMON_MISMATCH,
.title = "Daemon mismatch when releasing table chunks",
.description = "Zebra noticed a mismatch between a table ID chunk and a protocol daemon number instance when releasing unused table chunks.",
.suggestion = "Ignore this error.",
},
{
- .code = ZEBRA_ERR_TM_UNRELEASED_CHUNK,
+ .code = EC_ZEBRA_TM_UNRELEASED_CHUNK,
.title = "Zebra did not free any table chunks",
.description = "Zebra's table chunk cleanup procedure ran, but no table chunks were released.",
.suggestion = "Ignore this error.",
},
{
- .code = ZEBRA_ERR_UNKNOWN_FAMILY,
+ .code = EC_ZEBRA_UNKNOWN_FAMILY,
.title = "Address family specifier unrecognized",
.description = "Zebra attempted to process information from somewhere that included an address family specifier, but did not recognize the provided specifier.",
.suggestion = "Ensure that your configuration is correct. If it is, notify a developer.",
},
{
- .code = ZEBRA_ERR_TM_WRONG_PROTO,
+ .code = EC_ZEBRA_TM_WRONG_PROTO,
.title = "Incorrect protocol for table manager client",
.description = "Zebra's table manager only accepts connections from daemons managing dynamic routing protocols, but received a connection attempt from a daemon that does not meet this criterion.",
.suggestion = "Notify a developer.",
},
{
- .code = ZEBRA_ERR_PROTO_OR_INSTANCE_MISMATCH,
+ .code = EC_ZEBRA_PROTO_OR_INSTANCE_MISMATCH,
.title = "Mismatch between message and client protocol and/or instance",
.description = "Zebra detected a mismatch between a client's protocol and/or instance numbers versus those stored in a message transiting its socket.",
.suggestion = "Notify a developer.",
},
{
- .code = ZEBRA_ERR_LM_CANNOT_ASSIGN_CHUNK,
+ .code = EC_ZEBRA_LM_CANNOT_ASSIGN_CHUNK,
.title = "Label manager unable to assign label chunk",
.description = "Zebra's label manager was unable to assign a label chunk to client.",
.suggestion = "Ensure that Zebra has a sufficient label range available and that there is not a range collision.",
},
{
- .code = ZEBRA_ERR_LM_ALIENS,
+ .code = EC_ZEBRA_LM_ALIENS,
.title = "Label request from unidentified client",
.description = "Zebra's label manager received a label request from an unidentified client.",
.suggestion = "Notify a developer.",
},
{
- .code = ZEBRA_ERR_TM_CANNOT_ASSIGN_CHUNK,
+ .code = EC_ZEBRA_TM_CANNOT_ASSIGN_CHUNK,
.title = "Table manager unable to assign table chunk",
.description = "Zebra's table manager was unable to assign a table chunk to a client.",
.suggestion = "Ensure that Zebra has sufficient table ID range available and that there is not a range collision.",
},
{
- .code = ZEBRA_ERR_TM_ALIENS,
+ .code = EC_ZEBRA_TM_ALIENS,
.title = "Table request from unidentified client",
.description = "Zebra's table manager received a table request from an unidentified client.",
.suggestion = "Notify a developer.",
},
{
- .code = ZEBRA_ERR_RECVBUF,
+ .code = EC_ZEBRA_RECVBUF,
.title = "Cannot set receive buffer size",
.description = "Socket receive buffer size could not be set in the kernel",
.suggestion = "Ignore this error.",
},
{
- .code = ZEBRA_ERR_UNKNOWN_NLMSG,
+ .code = EC_ZEBRA_UNKNOWN_NLMSG,
.title = "Unknown Netlink message type",
.description = "Zebra received a Netlink message with an unrecognized type field.",
.suggestion = "Verify that you are running the latest version of FRR to ensure kernel compatibility. If the problem persists, notify a developer.",
},
{
- .code = ZEBRA_ERR_RECVMSG_OVERRUN,
+ .code = EC_ZEBRA_RECVMSG_OVERRUN,
.title = "Receive buffer overrun",
.description = "The kernel's buffer for a socket has been overrun, rendering the socket invalid.",
.suggestion = "Zebra will restart itself. Notify a developer if this issue shows up frequently.",
},
{
- .code = ZEBRA_ERR_NETLINK_LENGTH_ERROR,
+ .code = EC_ZEBRA_NETLINK_LENGTH_ERROR,
.title = "Netlink message length mismatch",
.description = "Zebra received a Netlink message with incorrect length fields.",
.suggestion = "Notify a developer.",
},
{
- .code = ZEBRA_ERR_NETLINK_LENGTH_ERROR,
+ .code = EC_ZEBRA_NETLINK_LENGTH_ERROR,
.title = "Netlink message length mismatch",
.description = "Zebra received a Netlink message with incorrect length fields.",
.suggestion = "Notify a developer.",
},
{
- .code = ZEBRA_ERR_UNEXPECTED_MESSAGE,
+ .code = EC_ZEBRA_UNEXPECTED_MESSAGE,
.title = "Received unexpected response from kernel",
.description = "Received unexpected response from the kernel via Netlink.",
.suggestion = "Notify a developer.",
},
{
- .code = ZEBRA_ERR_NETLINK_BAD_SEQUENCE,
+ .code = EC_ZEBRA_NETLINK_BAD_SEQUENCE,
.title = "Bad sequence number in Netlink message",
.description = "Zebra received a Netlink message with a bad sequence number.",
.suggestion = "Notify a developer.",
},
{
- .code = ZEBRA_ERR_BAD_MULTIPATH_NUM,
+ .code = EC_ZEBRA_BAD_MULTIPATH_NUM,
.title = "Multipath number was out of valid range",
.description = "Multipath number specified to Zebra must be in the appropriate range",
.suggestion = "Provide a multipath number that is within its accepted range",
},
{
- .code = ZEBRA_ERR_PREFIX_PARSE_ERROR,
+ .code = EC_ZEBRA_PREFIX_PARSE_ERROR,
.title = "String could not be parsed as IP prefix",
.description = "There was an attempt to parse a string as an IPv4 or IPv6 prefix, but the string could not be parsed and this operation failed.",
.suggestion = "Notify a developer.",
},
{
- .code = ZEBRA_ERR_MAC_ADD_FAILED,
+ .code = EC_ZEBRA_MAC_ADD_FAILED,
.title = "Failed to add MAC address to interface",
.description = "Zebra attempted to assign a MAC address to a vxlan interface but failed",
.suggestion = "Notify a developer.",
},
{
- .code = ZEBRA_ERR_VNI_DEL_FAILED,
+ .code = EC_ZEBRA_VNI_DEL_FAILED,
.title = "Failed to delete VNI",
.description = "Zebra attempted to delete a VNI entry and failed",
.suggestion = "Notify a developer.",
},
{
- .code = ZEBRA_ERR_VTEP_ADD_FAILED,
+ .code = EC_ZEBRA_VTEP_ADD_FAILED,
.title = "Adding remote VTEP failed",
.description = "Zebra attempted to add a remote VTEP and failed.",
.suggestion = "Notify a developer.",
},
{
- .code = ZEBRA_ERR_VNI_ADD_FAILED,
+ .code = EC_ZEBRA_VNI_ADD_FAILED,
.title = "Adding VNI failed",
.description = "Zebra attempted to add a VNI hash to an interface and failed",
.suggestion = "Notify a developer.",
},
{
- .code = ZEBRA_ERR_NS_NOTIFY_READ,
+ .code = EC_ZEBRA_NS_NOTIFY_READ,
.title = "Zebra failed to read namespace inotify information",
.description = "Zebra received an event from inotify, but failed to read what it was.",
.suggestion = "Notify a developer.",
},
/* Warnings */
{
- .code = ZEBRA_WARNING_LM_PROTO_MISMATCH,
+ .code = EC_ZEBRAING_LM_PROTO_MISMATCH,
.title =
"Zebra label manager received malformed label request",
.description =
@@ -288,7 +288,7 @@ static struct log_ref ferr_zebra_err[] = {
"This is a bug. Please report it.",
},
{
- .code = ZEBRA_ERR_LSP_INSTALL_FAILURE,
+ .code = EC_ZEBRA_LSP_INSTALL_FAILURE,
.title =
"Zebra failed to install LSP into the kernel",
.description =
@@ -297,7 +297,7 @@ static struct log_ref ferr_zebra_err[] = {
"Wait for Zebra to reattempt installation.",
},
{
- .code = ZEBRA_ERR_LSP_DELETE_FAILURE,
+ .code = EC_ZEBRA_LSP_DELETE_FAILURE,
.title =
"Zebra failed to remove LSP from the kernel",
.description =
@@ -306,7 +306,7 @@ static struct log_ref ferr_zebra_err[] = {
"Wait for Zebra to reattempt deletion.",
},
{
- .code = ZEBRA_ERR_MPLS_SUPPORT_DISABLED,
+ .code = EC_ZEBRA_MPLS_SUPPORT_DISABLED,
.title =
"Zebra will not run with MPLS support",
.description =
@@ -315,7 +315,7 @@ static struct log_ref ferr_zebra_err[] = {
"If you want MPLS support, upgrade the kernel to a version that provides MPLS support.",
},
{
- .code = ZEBRA_ERR_SYSCTL_FAILED,
+ .code = EC_ZEBRA_SYSCTL_FAILED,
.title = "A call to sysctl() failed",
.description =
"sysctl() returned a nonzero exit code, indicating an error.",
@@ -323,7 +323,7 @@ static struct log_ref ferr_zebra_err[] = {
"The log message should contain further details on the specific error that occurred; investigate the reported error.",
},
{
- .code = ZEBRA_ERR_NS_VRF_CREATION_FAILED,
+ .code = EC_ZEBRA_NS_VRF_CREATION_FAILED,
.title =
"Zebra failed to create namespace VRF",
.description =
@@ -331,7 +331,7 @@ static struct log_ref ferr_zebra_err[] = {
.suggestion = "",
},
{
- .code = ZEBRA_ERR_NS_DELETION_FAILED_NO_VRF,
+ .code = EC_ZEBRA_NS_DELETION_FAILED_NO_VRF,
.title =
"Zebra attempted to delete nonexistent namespace",
.description =
@@ -339,7 +339,7 @@ static struct log_ref ferr_zebra_err[] = {
.suggestion = "Please report this bug.",
},
{
- .code = ZEBRA_ERR_IFLIST_FAILED,
+ .code = EC_ZEBRA_IFLIST_FAILED,
.title =
"Zebra interface listing failed",
.description =
@@ -348,7 +348,7 @@ static struct log_ref ferr_zebra_err[] = {
"Check that Zebra is running with the appropriate permissions. If it is, please report this as a bug.",
},
{
- .code = ZEBRA_ERR_IRDP_BAD_CHECKSUM,
+ .code = EC_ZEBRA_IRDP_BAD_CHECKSUM,
.title =
"Zebra received ICMP packet with invalid checksum",
.description =
@@ -357,7 +357,7 @@ static struct log_ref ferr_zebra_err[] = {
"If the problem continues to occur, investigate the source of the bad ICMP packets.",
},
{
- .code = ZEBRA_ERR_IRDP_BAD_TYPE_CODE,
+ .code = EC_ZEBRA_IRDP_BAD_TYPE_CODE,
.title =
"Zebra received ICMP packet with bad type code",
.description =
@@ -366,7 +366,7 @@ static struct log_ref ferr_zebra_err[] = {
"If the problem continues to occur, investigate the source of the bad ICMP packets.",
},
{
- .code = ZEBRA_ERR_IRDP_BAD_RX_FLAGS,
+ .code = EC_ZEBRA_IRDP_BAD_RX_FLAGS,
.title =
"Zebra received IRDP packet while operating in wrong mode",
.description =
@@ -375,7 +375,7 @@ static struct log_ref ferr_zebra_err[] = {
"If you wish to receive the messages, change your IRDP settings accordingly.",
},
{
- .code = ZEBRA_ERR_IRDP_BAD_TYPE,
+ .code = EC_ZEBRA_IRDP_BAD_TYPE,
.title =
"Zebra received IRDP packet with bad type",
.description =
@@ -383,7 +383,7 @@ static struct log_ref ferr_zebra_err[] = {
.suggestion = "asdf",
},
{
- .code = ZEBRA_ERR_RNH_NO_TABLE,
+ .code = EC_ZEBRA_RNH_NO_TABLE,
.title =
"Zebra could not find table for next hop",
.description =
@@ -391,7 +391,7 @@ static struct log_ref ferr_zebra_err[] = {
.suggestion = "Please report this bug.",
},
{
- .code = ZEBRA_ERR_FPM_FORMAT_UNKNOWN,
+ .code = EC_ZEBRA_FPM_FORMAT_UNKNOWN,
.title =
"Unknown message format for Zebra's FPM module",
.description =
@@ -400,7 +400,7 @@ static struct log_ref ferr_zebra_err[] = {
"Provide or correct the module argument to provide a valid format. See documentation for further information.",
},
{
- .code = ZEBRA_ERR_CLIENT_IO_ERROR,
+ .code = EC_ZEBRA_CLIENT_IO_ERROR,
.title =
"Zebra client connection failed",
.description =
@@ -409,7 +409,7 @@ static struct log_ref ferr_zebra_err[] = {
"Ignore this warning, it is mostly informational.",
},
{
- .code = ZEBRA_ERR_CLIENT_WRITE_FAILED,
+ .code = EC_ZEBRA_CLIENT_WRITE_FAILED,
.title =
"Zebra failed to send message to client",
.description =
@@ -418,7 +418,7 @@ static struct log_ref ferr_zebra_err[] = {
"Ignore this warning, it is mostly informational.",
},
{
- .code = ZEBRA_ERR_NETLINK_INVALID_AF,
+ .code = EC_ZEBRA_NETLINK_INVALID_AF,
.title =
"Zebra received Netlink message with invalid family",
.description =
@@ -427,7 +427,7 @@ static struct log_ref ferr_zebra_err[] = {
"Inspect the logged address family and submit it with a bug report.",
},
{
- .code = ZEBRA_ERR_REMOVE_ADDR_UNKNOWN_SUBNET,
+ .code = EC_ZEBRA_REMOVE_ADDR_UNKNOWN_SUBNET,
.title =
"Zebra tried to remove address from unknown subnet",
.description =
@@ -436,7 +436,7 @@ static struct log_ref ferr_zebra_err[] = {
"This is a bug, please report it.",
},
{
- .code = ZEBRA_ERR_REMOVE_UNREGISTERED_ADDR,
+ .code = EC_ZEBRA_REMOVE_UNREGISTERED_ADDR,
.title =
"Zebra tried to remove unregistered address",
.description =
@@ -445,7 +445,7 @@ static struct log_ref ferr_zebra_err[] = {
"This is a bug, please report it.",
},
{
- .code = ZEBRA_ERR_PTM_NOT_READY,
+ .code = EC_ZEBRA_PTM_NOT_READY,
.title =
"Interface is up but PTM check has not completed",
.description =
@@ -454,7 +454,7 @@ static struct log_ref ferr_zebra_err[] = {
"If the problem persists, ensure that the interface is actually up and that PTM is functioning properly.",
},
{
- .code = ZEBRA_ERR_UNSUPPORTED_V4_SRCDEST,
+ .code = EC_ZEBRA_UNSUPPORTED_V4_SRCDEST,
.title =
"Kernel rejected sourcedest route",
.description =
@@ -463,7 +463,7 @@ static struct log_ref ferr_zebra_err[] = {
"Check configuration values for correctness",
},
{
- .code = ZEBRA_ERR_UNKNOWN_INTERFACE,
+ .code = EC_ZEBRA_UNKNOWN_INTERFACE,
.title =
"Zebra encountered an unknown interface specifier",
.description =
@@ -472,7 +472,7 @@ static struct log_ref ferr_zebra_err[] = {
"Check configuration values for correctness.",
},
{
- .code = ZEBRA_ERR_VRF_NOT_FOUND,
+ .code = EC_ZEBRA_VRF_NOT_FOUND,
.title =
"Zebra could not find the specified VRF",
.description =
@@ -481,7 +481,7 @@ static struct log_ref ferr_zebra_err[] = {
"Check configuration values for correctness. If values are correct, please file a bug report.",
},
{
- .code = ZEBRA_ERR_MORE_NH_THAN_MULTIPATH,
+ .code = EC_ZEBRA_MORE_NH_THAN_MULTIPATH,
.title =
"More nexthops were provided than the configured multipath limit",
.description =
@@ -490,7 +490,7 @@ static struct log_ref ferr_zebra_err[] = {
"Reduce the number of nexthops, or increase the multipath limit.",
},
{
- .code = ZEBRA_ERR_NEXTHOP_CREATION_FAILED,
+ .code = EC_ZEBRA_NEXTHOP_CREATION_FAILED,
.title =
"Zebra failed to create one or more nexthops",
.description =
@@ -499,7 +499,7 @@ static struct log_ref ferr_zebra_err[] = {
"Check configuration values for correctness. If they are correct, report this as a bug.",
},
{
- .code = ZEBRA_ERR_RX_SRCDEST_WRONG_AFI,
+ .code = EC_ZEBRA_RX_SRCDEST_WRONG_AFI,
.title =
"Zebra received sourcedest route install without IPv6 address family",
.description =
@@ -508,7 +508,7 @@ static struct log_ref ferr_zebra_err[] = {
"This is a bug; please report it.",
},
{
- .code = ZEBRA_ERR_PSEUDOWIRE_EXISTS,
+ .code = EC_ZEBRA_PSEUDOWIRE_EXISTS,
.title =
"Zebra received an installation / creation request for a pseudowire that already exists",
.description =
@@ -517,7 +517,7 @@ static struct log_ref ferr_zebra_err[] = {
"This message is informational.",
},
{
- .code = ZEBRA_ERR_PSEUDOWIRE_NONEXISTENT,
+ .code = EC_ZEBRA_PSEUDOWIRE_NONEXISTENT,
.title =
"Zebra received an uninstallation / deletion request for a pseudowire that already exists",
.description =
@@ -526,7 +526,7 @@ static struct log_ref ferr_zebra_err[] = {
"This message is informational.",
},
{
- .code = ZEBRA_ERR_PSEUDOWIRE_UNINSTALL_NOT_FOUND,
+ .code = EC_ZEBRA_PSEUDOWIRE_UNINSTALL_NOT_FOUND,
.title =
"Zebra received uninstall request for a pseudowire that doesn't exist",
.description =
@@ -535,7 +535,7 @@ static struct log_ref ferr_zebra_err[] = {
"This message is informational.",
},
{
- .code = ZEBRA_ERR_NO_IFACE_ADDR,
+ .code = EC_ZEBRA_NO_IFACE_ADDR,
.title = "No address on interface",
.description =
"Zebra attempted to retrieve a connected address for an interface, but the interface had no connected addresses.",
@@ -543,7 +543,7 @@ static struct log_ref ferr_zebra_err[] = {
"This warning is situational; it is usually informative but can indicate a misconfiguration.",
},
{
- .code = ZEBRA_ERR_IFACE_ADDR_ADD_FAILED,
+ .code = EC_ZEBRA_IFACE_ADDR_ADD_FAILED,
.title =
"Zebra failed to add address to interface",
.description =
@@ -552,7 +552,7 @@ static struct log_ref ferr_zebra_err[] = {
"Check configuration values for correctness.",
},
{
- .code = ZEBRA_ERR_IRDP_CANNOT_ACTIVATE_IFACE,
+ .code = EC_ZEBRA_IRDP_CANNOT_ACTIVATE_IFACE,
.title =
"Zebra could not enable IRDP on interface",
.description =
@@ -561,7 +561,7 @@ static struct log_ref ferr_zebra_err[] = {
"Verify that Zebra has the appropriate privileges and that the system has sufficient socket resources.",
},
{
- .code = ZEBRA_ERR_IRDP_IFACE_DOWN,
+ .code = EC_ZEBRA_IRDP_IFACE_DOWN,
.title =
"Zebra attempted to enable IRDP on an interface, but the interface was down",
.description = "Zebra attempted to enable IRDP on an interface, but the interface was down.",
@@ -569,7 +569,7 @@ static struct log_ref ferr_zebra_err[] = {
"Bring up the interface that IRDP is desired on.",
},
{
- .code = ZEBRA_ERR_IRDP_IFACE_MCAST_DISABLED,
+ .code = EC_ZEBRA_IRDP_IFACE_MCAST_DISABLED,
.title =
"Zebra cannot enable IRDP on interface because multicast is disabled",
.description =
@@ -578,7 +578,7 @@ static struct log_ref ferr_zebra_err[] = {
"Enable multicast on the interface.",
},
{
- .code = ZEBRA_ERR_NETLINK_EXTENDED_WARNING,
+ .code = EC_ZEBRA_NETLINK_EXTENDED_WARNING,
.title =
"Zebra received warning message from Netlink",
.description =
@@ -587,7 +587,7 @@ static struct log_ref ferr_zebra_err[] = {
"This message is informational. See the Netlink error message for details.",
},
{
- .code = ZEBRA_ERR_NAMESPACE_DIR_INACCESSIBLE,
+ .code = EC_ZEBRA_NAMESPACE_DIR_INACCESSIBLE,
.title =
"Zebra could not access /var/run/netns",
.description =
@@ -596,7 +596,7 @@ static struct log_ref ferr_zebra_err[] = {
"Ensure that Zebra has the proper privileges to access this directory.",
},
{
- .code = ZEBRA_ERR_CONNECTED_AFI_UNKNOWN,
+ .code = EC_ZEBRA_CONNECTED_AFI_UNKNOWN,
.title =
"Zebra received unknown address family on interface",
.description =
@@ -605,7 +605,7 @@ static struct log_ref ferr_zebra_err[] = {
"This message is informational.",
},
{
- .code = ZEBRA_ERR_IFACE_SAME_LOCAL_AS_PEER,
+ .code = EC_ZEBRA_IFACE_SAME_LOCAL_AS_PEER,
.title =
"Zebra route has same destination address as local interface",
.description =
@@ -614,7 +614,7 @@ static struct log_ref ferr_zebra_err[] = {
"Investigate the source of the route to determine why the destination and interface addresses are the same.",
},
{
- .code = ZEBRA_ERR_BCAST_ADDR_MISMATCH,
+ .code = EC_ZEBRA_BCAST_ADDR_MISMATCH,
.title =
"Zebra broadcast address sanity check failed",
.description =
@@ -623,7 +623,7 @@ static struct log_ref ferr_zebra_err[] = {
"Investigate the source of the broadcast address to determine why it does not match the computed address.",
},
{
- .code = ZEBRA_ERR_REDISTRIBUTE_UNKNOWN_AF,
+ .code = EC_ZEBRA_REDISTRIBUTE_UNKNOWN_AF,
.title =
"Zebra encountered unknown address family during redistribution",
.description =
@@ -632,7 +632,7 @@ static struct log_ref ferr_zebra_err[] = {
"This warning can be ignored; the redistribution operation will skip the unknown address family.",
},
{
- .code = ZEBRA_ERR_ADVERTISING_UNUSABLE_ADDR,
+ .code = EC_ZEBRA_ADVERTISING_UNUSABLE_ADDR,
.title =
"Zebra advertising unusable interface address",
.description =
@@ -641,7 +641,7 @@ static struct log_ref ferr_zebra_err[] = {
"This message is informational. The address should show up on the interface shortly after advertisement.",
},
{
- .code = ZEBRA_ERR_RA_PARAM_MISMATCH,
+ .code = EC_ZEBRA_RA_PARAM_MISMATCH,
.title =
"Zebra received route advertisement with parameter mismatch",
.description =
@@ -650,7 +650,7 @@ static struct log_ref ferr_zebra_err[] = {
"This message is informational; the route advertisement will be processed as normal. If issues arise due to the parameter mismatch, check Zebra's router advertisement configuration.",
},
{
- .code = ZEBRA_ERR_RTM_VERSION_MISMATCH,
+ .code = EC_ZEBRA_RTM_VERSION_MISMATCH,
.title =
"Zebra received kernel message with uknown version",
.description =
@@ -659,7 +659,7 @@ static struct log_ref ferr_zebra_err[] = {
"If issues arise, check if there is a version of FRR available for your kernel version.",
},
{
- .code = ZEBRA_ERR_RTM_NO_GATEWAY,
+ .code = EC_ZEBRA_RTM_NO_GATEWAY,
.title =
"Zebra could not determine proper gateway for kernel route",
.description =
@@ -668,7 +668,7 @@ static struct log_ref ferr_zebra_err[] = {
"Check configuration values for correctness.",
},
{
- .code = ZEBRA_ERR_MAX_LABELS_PUSH,
+ .code = EC_ZEBRA_MAX_LABELS_PUSH,
.title =
"Zebra exceeded maximum LSP labels for a single rtmsg",
.description =
@@ -677,7 +677,7 @@ static struct log_ref ferr_zebra_err[] = {
"This message is informational.",
},
{
- .code = ZEBRA_ERR_STICKY_MAC_ALREADY_LEARNT,
+ .code = EC_ZEBRA_STICKY_MAC_ALREADY_LEARNT,
.title =
"EVPN MAC already learnt as remote sticky MAC",
.description =
@@ -686,7 +686,7 @@ static struct log_ref ferr_zebra_err[] = {
"Check configuration values for correctness.",
},
{
- .code = ZEBRA_ERR_UNSUPPORTED_V6_SRCDEST,
+ .code = EC_ZEBRA_UNSUPPORTED_V6_SRCDEST,
.title =
"Kernel does not support IPv6 sourcedest routes",
.description =
diff --git a/zebra/zebra_errors.h b/zebra/zebra_errors.h
index 650f74871..43e37c6e5 100644
--- a/zebra/zebra_errors.h
+++ b/zebra/zebra_errors.h
@@ -18,107 +18,107 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef __ZEBRA_ERRORS_H__
-#define __ZEBRA_ERRORS_H__
+#ifndef __EC_ZEBRAORS_H__
+#define __EC_ZEBRAORS_H__
#include "lib/ferr.h"
enum zebra_log_refs {
- ZEBRA_ERR_LM_RESPONSE = ZEBRA_FERR_START,
- ZEBRA_ERR_LM_NO_SUCH_CLIENT,
- ZEBRA_ERR_LM_RELAY_FAILED,
- ZEBRA_ERR_LM_NO_SOCKET,
- ZEBRA_ERR_LM_BAD_INSTANCE,
- ZEBRA_ERR_LM_RELAY_REQUEST_FAILED,
- ZEBRA_ERR_LM_CLIENT_CONNECTION_FAILED,
- ZEBRA_ERR_LM_EXHAUSTED_LABELS,
- ZEBRA_ERR_LM_DAEMON_MISMATCH,
- ZEBRA_ERR_LM_UNRELEASED_CHUNK,
- ZEBRA_ERR_DP_INVALID_RC,
- ZEBRA_ERR_WQ_NONEXISTENT,
- ZEBRA_ERR_FEC_ADD_FAILED,
- ZEBRA_ERR_FEC_RM_FAILED,
- ZEBRA_ERR_IRDP_LEN_MISMATCH,
- ZEBRA_ERR_RNH_UNKNOWN_FAMILY,
- ZEBRA_ERR_DP_INSTALL_FAIL,
- ZEBRA_ERR_DP_DELETE_FAIL,
- ZEBRA_ERR_TABLE_LOOKUP_FAILED,
- ZEBRA_ERR_NETLINK_NOT_AVAILABLE,
- ZEBRA_ERR_PROTOBUF_NOT_AVAILABLE,
- ZEBRA_ERR_TM_EXHAUSTED_IDS,
- ZEBRA_ERR_TM_DAEMON_MISMATCH,
- ZEBRA_ERR_TM_UNRELEASED_CHUNK,
- ZEBRA_ERR_UNKNOWN_FAMILY,
- ZEBRA_ERR_TM_WRONG_PROTO,
- ZEBRA_ERR_PROTO_OR_INSTANCE_MISMATCH,
- ZEBRA_ERR_LM_CANNOT_ASSIGN_CHUNK,
- ZEBRA_ERR_LM_ALIENS,
- ZEBRA_ERR_TM_CANNOT_ASSIGN_CHUNK,
- ZEBRA_ERR_TM_ALIENS,
- ZEBRA_ERR_RECVBUF,
- ZEBRA_ERR_UNKNOWN_NLMSG,
- ZEBRA_ERR_RECVMSG_OVERRUN,
- ZEBRA_ERR_NETLINK_LENGTH_ERROR,
- ZEBRA_ERR_UNEXPECTED_MESSAGE,
- ZEBRA_ERR_NETLINK_BAD_SEQUENCE,
- ZEBRA_ERR_BAD_MULTIPATH_NUM,
- ZEBRA_ERR_PREFIX_PARSE_ERROR,
- ZEBRA_ERR_MAC_ADD_FAILED,
- ZEBRA_ERR_VNI_DEL_FAILED,
- ZEBRA_ERR_VTEP_ADD_FAILED,
- ZEBRA_ERR_VNI_ADD_FAILED,
+ EC_ZEBRA_LM_RESPONSE = ZEBRA_FERR_START,
+ EC_ZEBRA_LM_NO_SUCH_CLIENT,
+ EC_ZEBRA_LM_RELAY_FAILED,
+ EC_ZEBRA_LM_NO_SOCKET,
+ EC_ZEBRA_LM_BAD_INSTANCE,
+ EC_ZEBRA_LM_RELAY_REQUEST_FAILED,
+ EC_ZEBRA_LM_CLIENT_CONNECTION_FAILED,
+ EC_ZEBRA_LM_EXHAUSTED_LABELS,
+ EC_ZEBRA_LM_DAEMON_MISMATCH,
+ EC_ZEBRA_LM_UNRELEASED_CHUNK,
+ EC_ZEBRA_DP_INVALID_RC,
+ EC_ZEBRA_WQ_NONEXISTENT,
+ EC_ZEBRA_FEC_ADD_FAILED,
+ EC_ZEBRA_FEC_RM_FAILED,
+ EC_ZEBRA_IRDP_LEN_MISMATCH,
+ EC_ZEBRA_RNH_UNKNOWN_FAMILY,
+ EC_ZEBRA_DP_INSTALL_FAIL,
+ EC_ZEBRA_DP_DELETE_FAIL,
+ EC_ZEBRA_TABLE_LOOKUP_FAILED,
+ EC_ZEBRA_NETLINK_NOT_AVAILABLE,
+ EC_ZEBRA_PROTOBUF_NOT_AVAILABLE,
+ EC_ZEBRA_TM_EXHAUSTED_IDS,
+ EC_ZEBRA_TM_DAEMON_MISMATCH,
+ EC_ZEBRA_TM_UNRELEASED_CHUNK,
+ EC_ZEBRA_UNKNOWN_FAMILY,
+ EC_ZEBRA_TM_WRONG_PROTO,
+ EC_ZEBRA_PROTO_OR_INSTANCE_MISMATCH,
+ EC_ZEBRA_LM_CANNOT_ASSIGN_CHUNK,
+ EC_ZEBRA_LM_ALIENS,
+ EC_ZEBRA_TM_CANNOT_ASSIGN_CHUNK,
+ EC_ZEBRA_TM_ALIENS,
+ EC_ZEBRA_RECVBUF,
+ EC_ZEBRA_UNKNOWN_NLMSG,
+ EC_ZEBRA_RECVMSG_OVERRUN,
+ EC_ZEBRA_NETLINK_LENGTH_ERROR,
+ EC_ZEBRA_UNEXPECTED_MESSAGE,
+ EC_ZEBRA_NETLINK_BAD_SEQUENCE,
+ EC_ZEBRA_BAD_MULTIPATH_NUM,
+ EC_ZEBRA_PREFIX_PARSE_ERROR,
+ EC_ZEBRA_MAC_ADD_FAILED,
+ EC_ZEBRA_VNI_DEL_FAILED,
+ EC_ZEBRA_VTEP_ADD_FAILED,
+ EC_ZEBRA_VNI_ADD_FAILED,
/* warnings */
- ZEBRA_ERR_NS_NOTIFY_READ,
- ZEBRA_WARNING_LM_PROTO_MISMATCH,
- ZEBRA_ERR_LSP_INSTALL_FAILURE,
- ZEBRA_ERR_LSP_DELETE_FAILURE,
- ZEBRA_ERR_MPLS_SUPPORT_DISABLED,
- ZEBRA_ERR_SYSCTL_FAILED,
- ZEBRA_ERR_CONVERT_TO_DEBUG,
- ZEBRA_ERR_NS_VRF_CREATION_FAILED,
- ZEBRA_ERR_NS_DELETION_FAILED_NO_VRF,
- ZEBRA_ERR_IRDP_BAD_CHECKSUM,
- ZEBRA_ERR_IRDP_BAD_TYPE_CODE,
- ZEBRA_ERR_IRDP_BAD_RX_FLAGS,
- ZEBRA_ERR_IRDP_BAD_TYPE,
- ZEBRA_ERR_RNH_NO_TABLE,
- ZEBRA_ERR_IFLIST_FAILED,
- ZEBRA_ERR_FPM_FORMAT_UNKNOWN,
- ZEBRA_ERR_CLIENT_IO_ERROR,
- ZEBRA_ERR_CLIENT_WRITE_FAILED,
- ZEBRA_ERR_NETLINK_INVALID_AF,
- ZEBRA_ERR_REMOVE_ADDR_UNKNOWN_SUBNET,
- ZEBRA_ERR_REMOVE_UNREGISTERED_ADDR,
- ZEBRA_ERR_PTM_NOT_READY,
- ZEBRA_ERR_UNSUPPORTED_V4_SRCDEST,
- ZEBRA_ERR_UNKNOWN_INTERFACE,
- ZEBRA_ERR_VRF_NOT_FOUND,
- ZEBRA_ERR_MORE_NH_THAN_MULTIPATH,
- ZEBRA_ERR_NEXTHOP_CREATION_FAILED,
- ZEBRA_ERR_RX_SRCDEST_WRONG_AFI,
- ZEBRA_ERR_PSEUDOWIRE_EXISTS,
- ZEBRA_ERR_PSEUDOWIRE_UNINSTALL_NOT_FOUND,
- ZEBRA_ERR_PSEUDOWIRE_NONEXISTENT,
- ZEBRA_ERR_NO_IFACE_ADDR,
- ZEBRA_ERR_IFACE_ADDR_ADD_FAILED,
- ZEBRA_ERR_IRDP_CANNOT_ACTIVATE_IFACE,
- ZEBRA_ERR_IRDP_IFACE_DOWN,
- ZEBRA_ERR_IRDP_IFACE_MCAST_DISABLED,
- ZEBRA_ERR_NETLINK_EXTENDED_WARNING,
- ZEBRA_ERR_NAMESPACE_DIR_INACCESSIBLE,
- ZEBRA_ERR_CONNECTED_AFI_UNKNOWN,
- ZEBRA_ERR_IFACE_SAME_LOCAL_AS_PEER,
- ZEBRA_ERR_BCAST_ADDR_MISMATCH,
- ZEBRA_ERR_REDISTRIBUTE_UNKNOWN_AF,
- ZEBRA_ERR_ADVERTISING_UNUSABLE_ADDR,
- ZEBRA_ERR_RA_PARAM_MISMATCH,
- ZEBRA_ERR_RTM_VERSION_MISMATCH,
- ZEBRA_ERR_RTM_NO_GATEWAY,
- ZEBRA_ERR_MAX_LABELS_PUSH,
- ZEBRA_ERR_STICKY_MAC_ALREADY_LEARNT,
- ZEBRA_ERR_UNSUPPORTED_V6_SRCDEST,
+ EC_ZEBRA_NS_NOTIFY_READ,
+ EC_ZEBRAING_LM_PROTO_MISMATCH,
+ EC_ZEBRA_LSP_INSTALL_FAILURE,
+ EC_ZEBRA_LSP_DELETE_FAILURE,
+ EC_ZEBRA_MPLS_SUPPORT_DISABLED,
+ EC_ZEBRA_SYSCTL_FAILED,
+ EC_ZEBRA_CONVERT_TO_DEBUG,
+ EC_ZEBRA_NS_VRF_CREATION_FAILED,
+ EC_ZEBRA_NS_DELETION_FAILED_NO_VRF,
+ EC_ZEBRA_IRDP_BAD_CHECKSUM,
+ EC_ZEBRA_IRDP_BAD_TYPE_CODE,
+ EC_ZEBRA_IRDP_BAD_RX_FLAGS,
+ EC_ZEBRA_IRDP_BAD_TYPE,
+ EC_ZEBRA_RNH_NO_TABLE,
+ EC_ZEBRA_IFLIST_FAILED,
+ EC_ZEBRA_FPM_FORMAT_UNKNOWN,
+ EC_ZEBRA_CLIENT_IO_ERROR,
+ EC_ZEBRA_CLIENT_WRITE_FAILED,
+ EC_ZEBRA_NETLINK_INVALID_AF,
+ EC_ZEBRA_REMOVE_ADDR_UNKNOWN_SUBNET,
+ EC_ZEBRA_REMOVE_UNREGISTERED_ADDR,
+ EC_ZEBRA_PTM_NOT_READY,
+ EC_ZEBRA_UNSUPPORTED_V4_SRCDEST,
+ EC_ZEBRA_UNKNOWN_INTERFACE,
+ EC_ZEBRA_VRF_NOT_FOUND,
+ EC_ZEBRA_MORE_NH_THAN_MULTIPATH,
+ EC_ZEBRA_NEXTHOP_CREATION_FAILED,
+ EC_ZEBRA_RX_SRCDEST_WRONG_AFI,
+ EC_ZEBRA_PSEUDOWIRE_EXISTS,
+ EC_ZEBRA_PSEUDOWIRE_UNINSTALL_NOT_FOUND,
+ EC_ZEBRA_PSEUDOWIRE_NONEXISTENT,
+ EC_ZEBRA_NO_IFACE_ADDR,
+ EC_ZEBRA_IFACE_ADDR_ADD_FAILED,
+ EC_ZEBRA_IRDP_CANNOT_ACTIVATE_IFACE,
+ EC_ZEBRA_IRDP_IFACE_DOWN,
+ EC_ZEBRA_IRDP_IFACE_MCAST_DISABLED,
+ EC_ZEBRA_NETLINK_EXTENDED_WARNING,
+ EC_ZEBRA_NAMESPACE_DIR_INACCESSIBLE,
+ EC_ZEBRA_CONNECTED_AFI_UNKNOWN,
+ EC_ZEBRA_IFACE_SAME_LOCAL_AS_PEER,
+ EC_ZEBRA_BCAST_ADDR_MISMATCH,
+ EC_ZEBRA_REDISTRIBUTE_UNKNOWN_AF,
+ EC_ZEBRA_ADVERTISING_UNUSABLE_ADDR,
+ EC_ZEBRA_RA_PARAM_MISMATCH,
+ EC_ZEBRA_RTM_VERSION_MISMATCH,
+ EC_ZEBRA_RTM_NO_GATEWAY,
+ EC_ZEBRA_MAX_LABELS_PUSH,
+ EC_ZEBRA_STICKY_MAC_ALREADY_LEARNT,
+ EC_ZEBRA_UNSUPPORTED_V6_SRCDEST,
};
void zebra_error_init(void);
-#endif /* __ZEBRA_ERRORS_H__ */
+#endif /* __EC_ZEBRAORS_H__ */
diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c
index dae37cbd3..35a5d69ee 100644
--- a/zebra/zebra_fpm.c
+++ b/zebra/zebra_fpm.c
@@ -1518,9 +1518,8 @@ static inline void zfpm_init_message_format(const char *format)
if (!strcmp("netlink", format)) {
if (!have_netlink) {
- flog_err(
- ZEBRA_ERR_NETLINK_NOT_AVAILABLE,
- "FPM netlink message format is not available");
+ flog_err(EC_ZEBRA_NETLINK_NOT_AVAILABLE,
+ "FPM netlink message format is not available");
return;
}
zfpm_g->message_format = ZFPM_MSG_FORMAT_NETLINK;
@@ -1530,7 +1529,7 @@ static inline void zfpm_init_message_format(const char *format)
if (!strcmp("protobuf", format)) {
if (!have_protobuf) {
flog_err(
- ZEBRA_ERR_PROTOBUF_NOT_AVAILABLE,
+ EC_ZEBRA_PROTOBUF_NOT_AVAILABLE,
"FPM protobuf message format is not available");
return;
}
@@ -1538,7 +1537,7 @@ static inline void zfpm_init_message_format(const char *format)
return;
}
- flog_warn(ZEBRA_ERR_FPM_FORMAT_UNKNOWN, "Unknown fpm format '%s'",
+ flog_warn(EC_ZEBRA_FPM_FORMAT_UNKNOWN, "Unknown fpm format '%s'",
format);
}
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c
index 9a76408bb..c19aeb626 100644
--- a/zebra/zebra_mpls.c
+++ b/zebra/zebra_mpls.c
@@ -919,7 +919,7 @@ static wq_item_status lsp_process(struct work_queue *wq, void *data)
switch (kernel_add_lsp(lsp)) {
case DP_REQUEST_QUEUED:
flog_err(
- ZEBRA_ERR_DP_INVALID_RC,
+ EC_ZEBRA_DP_INVALID_RC,
"No current DataPlane interfaces can return this, please fix");
break;
case DP_REQUEST_FAILURE:
@@ -936,7 +936,7 @@ static wq_item_status lsp_process(struct work_queue *wq, void *data)
switch (kernel_del_lsp(lsp)) {
case DP_REQUEST_QUEUED:
flog_err(
- ZEBRA_ERR_DP_INVALID_RC,
+ EC_ZEBRA_DP_INVALID_RC,
"No current DataPlane interfaces can return this, please fix");
break;
case DP_REQUEST_FAILURE:
@@ -976,7 +976,7 @@ static wq_item_status lsp_process(struct work_queue *wq, void *data)
switch (kernel_upd_lsp(lsp)) {
case DP_REQUEST_QUEUED:
flog_err(
- ZEBRA_ERR_DP_INVALID_RC,
+ EC_ZEBRA_DP_INVALID_RC,
"No current DataPlane interfaces can return this, please fix");
break;
case DP_REQUEST_FAILURE:
@@ -1055,8 +1055,8 @@ static int lsp_processq_add(zebra_lsp_t *lsp)
return 0;
if (zebrad.lsp_process_q == NULL) {
- flog_err(ZEBRA_ERR_WQ_NONEXISTENT,
- "%s: work_queue does not exist!", __func__);
+ flog_err(EC_ZEBRA_WQ_NONEXISTENT,
+ "%s: work_queue does not exist!", __func__);
return -1;
}
@@ -1698,8 +1698,8 @@ static int mpls_processq_init(struct zebra_t *zebra)
{
zebra->lsp_process_q = work_queue_new(zebra->master, "LSP processing");
if (!zebra->lsp_process_q) {
- flog_err(ZEBRA_ERR_WQ_NONEXISTENT,
- "%s: could not initialise work queue!", __func__);
+ flog_err(EC_ZEBRA_WQ_NONEXISTENT,
+ "%s: could not initialise work queue!", __func__);
return -1;
}
@@ -1728,7 +1728,7 @@ void kernel_lsp_pass_fail(zebra_lsp_t *lsp, enum dp_results res)
case DP_INSTALL_FAILURE:
UNSET_FLAG(lsp->flags, LSP_FLAG_INSTALLED);
clear_nhlfe_installed(lsp);
- flog_warn(ZEBRA_ERR_LSP_INSTALL_FAILURE,
+ flog_warn(EC_ZEBRA_LSP_INSTALL_FAILURE,
"LSP Install Failure: %u", lsp->ile.in_label);
break;
case DP_INSTALL_SUCCESS:
@@ -1747,7 +1747,7 @@ void kernel_lsp_pass_fail(zebra_lsp_t *lsp, enum dp_results res)
clear_nhlfe_installed(lsp);
break;
case DP_DELETE_FAILURE:
- flog_warn(ZEBRA_ERR_LSP_DELETE_FAILURE,
+ flog_warn(EC_ZEBRA_LSP_DELETE_FAILURE,
"LSP Deletion Failure: %u", lsp->ile.in_label);
break;
}
@@ -1837,7 +1837,7 @@ int zebra_mpls_fec_register(struct zebra_vrf *zvrf, struct prefix *p,
if (!fec) {
prefix2str(p, buf, BUFSIZ);
flog_err(
- ZEBRA_ERR_FEC_ADD_FAILED,
+ EC_ZEBRA_FEC_ADD_FAILED,
"Failed to add FEC %s upon register, client %s",
buf, zebra_route_string(client->proto));
return -1;
@@ -1917,9 +1917,9 @@ int zebra_mpls_fec_unregister(struct zebra_vrf *zvrf, struct prefix *p,
fec = fec_find(table, p);
if (!fec) {
prefix2str(p, buf, BUFSIZ);
- flog_err(ZEBRA_ERR_FEC_RM_FAILED,
- "Failed to find FEC %s upon unregister, client %s",
- buf, zebra_route_string(client->proto));
+ flog_err(EC_ZEBRA_FEC_RM_FAILED,
+ "Failed to find FEC %s upon unregister, client %s",
+ buf, zebra_route_string(client->proto));
return -1;
}
@@ -2049,8 +2049,8 @@ int zebra_mpls_static_fec_add(struct zebra_vrf *zvrf, struct prefix *p,
MPLS_INVALID_LABEL_INDEX);
if (!fec) {
prefix2str(p, buf, BUFSIZ);
- flog_err(ZEBRA_ERR_FEC_ADD_FAILED,
- "Failed to add FEC %s upon config", buf);
+ flog_err(EC_ZEBRA_FEC_ADD_FAILED,
+ "Failed to add FEC %s upon config", buf);
return -1;
}
@@ -2097,8 +2097,8 @@ int zebra_mpls_static_fec_del(struct zebra_vrf *zvrf, struct prefix *p)
fec = fec_find(table, p);
if (!fec) {
prefix2str(p, buf, BUFSIZ);
- flog_err(ZEBRA_ERR_FEC_RM_FAILED,
- "Failed to find FEC %s upon delete", buf);
+ flog_err(EC_ZEBRA_FEC_RM_FAILED,
+ "Failed to find FEC %s upon delete", buf);
return -1;
}
@@ -2947,7 +2947,7 @@ void zebra_mpls_init(void)
mpls_enabled = 0;
if (mpls_kernel_init() < 0) {
- flog_warn(ZEBRA_ERR_MPLS_SUPPORT_DISABLED,
+ flog_warn(EC_ZEBRA_MPLS_SUPPORT_DISABLED,
"Disabling MPLS support (no kernel support)");
return;
}
diff --git a/zebra/zebra_mpls_openbsd.c b/zebra/zebra_mpls_openbsd.c
index b42cf3243..71679f26d 100644
--- a/zebra/zebra_mpls_openbsd.c
+++ b/zebra/zebra_mpls_openbsd.c
@@ -123,7 +123,7 @@ static int kernel_send_rtmsg_v4(int action, mpls_label_t in_label,
}
if (ret == -1)
- flog_err_sys(LIB_ERR_SOCKET, "%s: %s", __func__,
+ flog_err_sys(EC_LIB_SOCKET, "%s: %s", __func__,
safe_strerror(errno));
return ret;
@@ -230,7 +230,7 @@ static int kernel_send_rtmsg_v6(int action, mpls_label_t in_label,
}
if (ret == -1)
- flog_err_sys(LIB_ERR_SOCKET, "%s: %s", __func__,
+ flog_err_sys(EC_LIB_SOCKET, "%s: %s", __func__,
safe_strerror(errno));
return ret;
@@ -257,7 +257,7 @@ static int kernel_lsp_cmd(int action, zebra_lsp_t *lsp)
&& (CHECK_FLAG(nhlfe->flags, NHLFE_FLAG_INSTALLED)
&& CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB)))) {
if (nhlfe->nexthop->nh_label->num_labels > 1) {
- flog_warn(ZEBRA_ERR_MAX_LABELS_PUSH,
+ flog_warn(EC_ZEBRA_MAX_LABELS_PUSH,
"%s: can't push %u labels at once "
"(maximum is 1)",
__func__,
@@ -398,7 +398,7 @@ static int kmpw_install(struct zebra_pw *pw)
strlcpy(ifr.ifr_name, pw->ifname, sizeof(ifr.ifr_name));
ifr.ifr_data = (caddr_t)&imr;
if (ioctl(kr_state.ioctl_fd, SIOCSETMPWCFG, &ifr) == -1) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "ioctl SIOCSETMPWCFG: %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "ioctl SIOCSETMPWCFG: %s",
safe_strerror(errno));
return -1;
}
@@ -416,7 +416,7 @@ static int kmpw_uninstall(struct zebra_pw *pw)
strlcpy(ifr.ifr_name, pw->ifname, sizeof(ifr.ifr_name));
ifr.ifr_data = (caddr_t)&imr;
if (ioctl(kr_state.ioctl_fd, SIOCSETMPWCFG, &ifr) == -1) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "ioctl SIOCSETMPWCFG: %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "ioctl SIOCSETMPWCFG: %s",
safe_strerror(errno));
return -1;
}
@@ -431,13 +431,13 @@ int mpls_kernel_init(void)
socklen_t optlen;
if ((kr_state.fd = socket(AF_ROUTE, SOCK_RAW, 0)) == -1) {
- flog_err_sys(LIB_ERR_SOCKET, "%s: socket", __func__);
+ flog_err_sys(EC_LIB_SOCKET, "%s: socket", __func__);
return -1;
}
if ((kr_state.ioctl_fd = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0))
== -1) {
- flog_err_sys(LIB_ERR_SOCKET, "%s: ioctl socket", __func__);
+ flog_err_sys(EC_LIB_SOCKET, "%s: ioctl socket", __func__);
return -1;
}
@@ -446,7 +446,7 @@ int mpls_kernel_init(void)
if (getsockopt(kr_state.fd, SOL_SOCKET, SO_RCVBUF, &default_rcvbuf,
&optlen)
== -1)
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"kr_init getsockopt SOL_SOCKET SO_RCVBUF");
else
for (rcvbuf = MAX_RTSOCK_BUF;
diff --git a/zebra/zebra_netns_id.c b/zebra/zebra_netns_id.c
index 9921ce017..b26c0515f 100644
--- a/zebra/zebra_netns_id.c
+++ b/zebra/zebra_netns_id.c
@@ -88,7 +88,7 @@ static int send_receive(int sock, struct nlmsghdr *nlh, unsigned int seq,
ret = sendto(sock, (const void *)nlh, (size_t)nlh->nlmsg_len, 0,
(struct sockaddr *)&snl, (socklen_t)sizeof(snl));
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "netlink( %u) sendmsg() error: %s",
+ flog_err_sys(EC_LIB_SOCKET, "netlink( %u) sendmsg() error: %s",
sock, safe_strerror(errno));
return -1;
}
@@ -109,20 +109,20 @@ static int send_receive(int sock, struct nlmsghdr *nlh, unsigned int seq,
};
ret = recvmsg(sock, &msg, 0);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"netlink recvmsg: error %d (errno %u)", ret,
errno);
return -1;
}
if (msg.msg_flags & MSG_TRUNC) {
- flog_err(ZEBRA_ERR_NETLINK_LENGTH_ERROR,
- "netlink recvmsg : error message truncated");
+ flog_err(EC_ZEBRA_NETLINK_LENGTH_ERROR,
+ "netlink recvmsg : error message truncated");
return -1;
}
/* nlh already points to buf */
if (nlh->nlmsg_seq != seq) {
flog_err(
- ZEBRA_ERR_NETLINK_BAD_SEQUENCE,
+ EC_ZEBRA_NETLINK_BAD_SEQUENCE,
"netlink recvmsg: bad sequence number %x (expected %x)",
seq, nlh->nlmsg_seq);
return -1;
@@ -176,7 +176,7 @@ ns_id_t zebra_ns_id_get(const char *netnspath)
/* netlink socket */
sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if (sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "netlink( %u) socket() error: %s",
+ flog_err_sys(EC_LIB_SOCKET, "netlink( %u) socket() error: %s",
sock, safe_strerror(errno));
close(fd);
return NS_UNKNOWN;
@@ -187,7 +187,7 @@ ns_id_t zebra_ns_id_get(const char *netnspath)
snl.nl_pid = 0; /* AUTO PID */
ret = bind(sock, (struct sockaddr *)&snl, sizeof(snl));
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"netlink( %u) socket() bind error: %s", sock,
safe_strerror(errno));
close(sock);
@@ -263,7 +263,7 @@ ns_id_t zebra_ns_id_get(const char *netnspath)
if (ret <= 0) {
if (errno != EEXIST && ret != 0) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"netlink( %u) recvfrom() error 2 when reading: %s",
fd, safe_strerror(errno));
close(sock);
@@ -337,7 +337,7 @@ static void zebra_ns_create_netns_directory(void)
/* S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH */
if (mkdir(NS_RUN_DIR, 0755)) {
if (errno != EEXIST) {
- flog_warn(ZEBRA_ERR_NAMESPACE_DIR_INACCESSIBLE,
+ flog_warn(EC_ZEBRA_NAMESPACE_DIR_INACCESSIBLE,
"NS check: failed to access %s", NS_RUN_DIR);
return;
}
diff --git a/zebra/zebra_netns_notify.c b/zebra/zebra_netns_notify.c
index be36dc96b..2608ffd7a 100644
--- a/zebra/zebra_netns_notify.c
+++ b/zebra/zebra_netns_notify.c
@@ -92,7 +92,7 @@ static void zebra_ns_notify_create_context_from_entry_name(const char *name)
return;
}
if (vrf_handler_create(NULL, name, &vrf) != CMD_SUCCESS) {
- flog_warn(ZEBRA_ERR_NS_VRF_CREATION_FAILED,
+ flog_warn(EC_ZEBRA_NS_VRF_CREATION_FAILED,
"NS notify : failed to create VRF %s", name);
ns_map_nsid_with_external(ns_id, false);
return;
@@ -102,7 +102,7 @@ static void zebra_ns_notify_create_context_from_entry_name(const char *name)
ns_id_external, ns_id);
}
if (ret != CMD_SUCCESS) {
- flog_warn(ZEBRA_ERR_NS_VRF_CREATION_FAILED,
+ flog_warn(EC_ZEBRA_NS_VRF_CREATION_FAILED,
"NS notify : failed to create NS %s", netnspath);
ns_map_nsid_with_external(ns_id, false);
vrf_delete(vrf);
@@ -133,7 +133,7 @@ static int zebra_ns_delete(char *name)
struct ns *ns;
if (!vrf) {
- flog_warn(ZEBRA_ERR_NS_DELETION_FAILED_NO_VRF,
+ flog_warn(EC_ZEBRA_NS_DELETION_FAILED_NO_VRF,
"NS notify : no VRF found using NS %s", name);
return 0;
}
@@ -239,7 +239,7 @@ static int zebra_ns_notify_read(struct thread *t)
zebrad.master, zebra_ns_notify_read, NULL, fd_monitor, NULL);
len = read(fd_monitor, buf, sizeof(buf));
if (len < 0) {
- flog_err_sys(ZEBRA_ERR_NS_NOTIFY_READ,
+ flog_err_sys(EC_ZEBRA_NS_NOTIFY_READ,
"NS notify read: failed to read (%s)",
safe_strerror(errno));
return 0;
@@ -257,13 +257,13 @@ static int zebra_ns_notify_read(struct thread *t)
if (offsetof(struct inotify_event, name) + event->len
>= sizeof(buf)) {
- flog_err(ZEBRA_ERR_NS_NOTIFY_READ,
+ flog_err(EC_ZEBRA_NS_NOTIFY_READ,
"NS notify read: buffer underflow");
break;
}
if (strnlen(event->name, event->len) == event->len) {
- flog_err(ZEBRA_ERR_NS_NOTIFY_READ,
+ flog_err(EC_ZEBRA_NS_NOTIFY_READ,
"NS notify error: bad event name");
break;
}
@@ -288,7 +288,7 @@ void zebra_ns_notify_parse(void)
DIR *srcdir = opendir(NS_RUN_DIR);
if (srcdir == NULL) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"NS parsing init: failed to parse %s", NS_RUN_DIR);
return;
}
@@ -300,7 +300,7 @@ void zebra_ns_notify_parse(void)
continue;
if (fstatat(dirfd(srcdir), dent->d_name, &st, 0) < 0) {
flog_err_sys(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"NS parsing init: failed to parse entry %s",
dent->d_name);
continue;
@@ -330,13 +330,13 @@ void zebra_ns_notify_init(void)
fd_monitor = inotify_init();
if (fd_monitor < 0) {
flog_err_sys(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"NS notify init: failed to initialize inotify (%s)",
safe_strerror(errno));
}
if (inotify_add_watch(fd_monitor, NS_RUN_DIR,
IN_CREATE | IN_DELETE) < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"NS notify watch: failed to add watch (%s)",
safe_strerror(errno));
}
diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c
index 7f9b70b0a..b71124161 100644
--- a/zebra/zebra_ptm.c
+++ b/zebra/zebra_ptm.c
@@ -181,8 +181,8 @@ static int zebra_ptm_flush_messages(struct thread *thread)
switch (buffer_flush_available(ptm_cb.wb, ptm_cb.ptm_sock)) {
case BUFFER_ERROR:
- flog_err_sys(LIB_ERR_SOCKET, "%s ptm socket error: %s",
- __func__, safe_strerror(errno));
+ flog_err_sys(EC_LIB_SOCKET, "%s ptm socket error: %s", __func__,
+ safe_strerror(errno));
close(ptm_cb.ptm_sock);
ptm_cb.ptm_sock = -1;
zebra_ptm_reset_status(0);
@@ -207,8 +207,8 @@ static int zebra_ptm_send_message(char *data, int size)
errno = 0;
switch (buffer_write(ptm_cb.wb, ptm_cb.ptm_sock, data, size)) {
case BUFFER_ERROR:
- flog_err_sys(LIB_ERR_SOCKET, "%s ptm socket error: %s",
- __func__, safe_strerror(errno));
+ flog_err_sys(EC_LIB_SOCKET, "%s ptm socket error: %s", __func__,
+ safe_strerror(errno));
close(ptm_cb.ptm_sock);
ptm_cb.ptm_sock = -1;
zebra_ptm_reset_status(0);
@@ -505,17 +505,17 @@ static int zebra_ptm_handle_bfd_msg(void *arg, void *in_ctxt,
dest_str, src_str);
if (str2prefix(dest_str, &dest_prefix) == 0) {
- flog_err(ZEBRA_ERR_PREFIX_PARSE_ERROR,
- "%s: Peer addr %s not found", __func__, dest_str);
+ flog_err(EC_ZEBRA_PREFIX_PARSE_ERROR,
+ "%s: Peer addr %s not found", __func__, dest_str);
return -1;
}
memset(&src_prefix, 0, sizeof(struct prefix));
if (strcmp(ZEBRA_PTM_INVALID_SRC_IP, src_str)) {
if (str2prefix(src_str, &src_prefix) == 0) {
- flog_err(ZEBRA_ERR_PREFIX_PARSE_ERROR,
- "%s: Local addr %s not found", __func__,
- src_str);
+ flog_err(EC_ZEBRA_PREFIX_PARSE_ERROR,
+ "%s: Local addr %s not found", __func__,
+ src_str);
return -1;
}
}
@@ -609,7 +609,7 @@ static int zebra_ptm_handle_msg_cb(void *arg, void *in_ctxt)
ifp = if_lookup_by_name_all_vrf(port_str);
if (!ifp) {
- flog_warn(ZEBRA_ERR_UNKNOWN_INTERFACE,
+ flog_warn(EC_ZEBRA_UNKNOWN_INTERFACE,
"%s: %s not found in interface list",
__func__, port_str);
return -1;
@@ -649,7 +649,7 @@ int zebra_ptm_sock_read(struct thread *thread)
if (((rc == 0) && !errno)
|| (errno && (errno != EWOULDBLOCK) && (errno != EAGAIN))) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s routing socket error: %s(%d) bytes %d",
__func__, safe_strerror(errno), errno, rc);
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 2eb789d74..5853bdd46 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -1091,7 +1091,7 @@ void kernel_route_rib_pass_fail(struct route_node *rn, const struct prefix *p,
dest->selected_fib = re;
zsend_route_notify_owner(re, p, ZAPI_ROUTE_FAIL_INSTALL);
- flog_err(ZEBRA_ERR_DP_INSTALL_FAIL,
+ flog_err(EC_ZEBRA_DP_INSTALL_FAIL,
"%u:%s: Route install failed", re->vrf_id,
prefix2str(p, buf, sizeof(buf)));
break;
@@ -1116,7 +1116,7 @@ void kernel_route_rib_pass_fail(struct route_node *rn, const struct prefix *p,
* delete fails?
*/
dest->selected_fib = NULL;
- flog_err(ZEBRA_ERR_DP_DELETE_FAIL,
+ flog_err(EC_ZEBRA_DP_DELETE_FAIL,
"%u:%s: Route Deletion failure", re->vrf_id,
prefix2str(p, buf, sizeof(buf)));
@@ -1174,12 +1174,12 @@ void rib_install_kernel(struct route_node *rn, struct route_entry *re,
switch (kernel_route_rib(rn, p, src_p, old, re)) {
case DP_REQUEST_QUEUED:
flog_err(
- ZEBRA_ERR_DP_INVALID_RC,
+ EC_ZEBRA_DP_INVALID_RC,
"No current known DataPlane interfaces can return this, please fix");
break;
case DP_REQUEST_FAILURE:
flog_err(
- ZEBRA_ERR_DP_INSTALL_FAIL,
+ EC_ZEBRA_DP_INSTALL_FAIL,
"No current known Rib Install Failure cases, please fix");
break;
case DP_REQUEST_SUCCESS:
@@ -1214,12 +1214,12 @@ void rib_uninstall_kernel(struct route_node *rn, struct route_entry *re)
switch (kernel_route_rib(rn, p, src_p, re, NULL)) {
case DP_REQUEST_QUEUED:
flog_err(
- ZEBRA_ERR_DP_INVALID_RC,
+ EC_ZEBRA_DP_INVALID_RC,
"No current known DataPlane interfaces can return this, please fix");
break;
case DP_REQUEST_FAILURE:
flog_err(
- ZEBRA_ERR_DP_INSTALL_FAIL,
+ EC_ZEBRA_DP_INSTALL_FAIL,
"No current known RIB Install Failure cases, please fix");
break;
case DP_REQUEST_SUCCESS:
@@ -2012,8 +2012,8 @@ void rib_queue_add(struct route_node *rn)
}
if (zebrad.ribq == NULL) {
- flog_err(ZEBRA_ERR_WQ_NONEXISTENT,
- "%s: work_queue does not exist!", __func__);
+ flog_err(EC_ZEBRA_WQ_NONEXISTENT,
+ "%s: work_queue does not exist!", __func__);
return;
}
@@ -2068,8 +2068,8 @@ static void rib_queue_init(struct zebra_t *zebra)
if (!(zebra->ribq =
work_queue_new(zebra->master, "route_node processing"))) {
- flog_err(ZEBRA_ERR_WQ_NONEXISTENT,
- "%s: could not initialise work queue!", __func__);
+ flog_err(EC_ZEBRA_WQ_NONEXISTENT,
+ "%s: could not initialise work queue!", __func__);
return;
}
@@ -2082,8 +2082,8 @@ static void rib_queue_init(struct zebra_t *zebra)
zebra->ribq->spec.hold = ZEBRA_RIB_PROCESS_HOLD_TIME;
if (!(zebra->mq = meta_queue_new())) {
- flog_err(ZEBRA_ERR_WQ_NONEXISTENT,
- "%s: could not initialise meta queue!", __func__);
+ flog_err(EC_ZEBRA_WQ_NONEXISTENT,
+ "%s: could not initialise meta queue!", __func__);
return;
}
return;
@@ -2333,9 +2333,9 @@ void rib_lookup_and_dump(struct prefix_ipv4 *p, vrf_id_t vrf_id)
/* Lookup table. */
table = zebra_vrf_table(AFI_IP, SAFI_UNICAST, vrf_id);
if (!table) {
- flog_err(ZEBRA_ERR_TABLE_LOOKUP_FAILED,
- "%s:%u zebra_vrf_table() returned NULL", __func__,
- vrf_id);
+ flog_err(EC_ZEBRA_TABLE_LOOKUP_FAILED,
+ "%s:%u zebra_vrf_table() returned NULL", __func__,
+ vrf_id);
return;
}
@@ -2381,9 +2381,9 @@ void rib_lookup_and_pushup(struct prefix_ipv4 *p, vrf_id_t vrf_id)
rib_dest_t *dest;
if (NULL == (table = zebra_vrf_table(AFI_IP, SAFI_UNICAST, vrf_id))) {
- flog_err(ZEBRA_ERR_TABLE_LOOKUP_FAILED,
- "%s:%u zebra_vrf_table() returned NULL", __func__,
- vrf_id);
+ flog_err(EC_ZEBRA_TABLE_LOOKUP_FAILED,
+ "%s:%u zebra_vrf_table() returned NULL", __func__,
+ vrf_id);
return;
}
diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c
index e9c2a4d7f..30062a072 100644
--- a/zebra/zebra_rnh.c
+++ b/zebra/zebra_rnh.c
@@ -118,7 +118,7 @@ struct rnh *zebra_add_rnh(struct prefix *p, vrf_id_t vrfid, rnh_type_t type,
table = get_rnh_table(vrfid, PREFIX_FAMILY(p), type);
if (!table) {
prefix2str(p, buf, sizeof(buf));
- flog_warn(ZEBRA_ERR_RNH_NO_TABLE,
+ flog_warn(EC_ZEBRA_RNH_NO_TABLE,
"%u: Add RNH %s type %d - table not found", vrfid,
buf, type);
exists = false;
@@ -871,9 +871,9 @@ static int send_client(struct rnh *rnh, struct zserv *client, rnh_type_t type,
stream_put(s, &rn->p.u.prefix6, IPV6_MAX_BYTELEN);
break;
default:
- flog_err(ZEBRA_ERR_RNH_UNKNOWN_FAMILY,
- "%s: Unknown family (%d) notification attempted\n",
- __FUNCTION__, rn->p.family);
+ flog_err(EC_ZEBRA_RNH_UNKNOWN_FAMILY,
+ "%s: Unknown family (%d) notification attempted\n",
+ __FUNCTION__, rn->p.family);
break;
}
if (re) {
diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c
index a0a90ac28..a8c035f87 100644
--- a/zebra/zebra_vxlan.c
+++ b/zebra/zebra_vxlan.c
@@ -1772,10 +1772,10 @@ static int zvni_gw_macip_add(struct interface *ifp, zebra_vni_t *zvni,
if (!mac) {
mac = zvni_mac_add(zvni, macaddr);
if (!mac) {
- flog_err(ZEBRA_ERR_MAC_ADD_FAILED,
- "Failed to add MAC %s intf %s(%u) VID %u",
- prefix_mac2str(macaddr, buf, sizeof(buf)),
- ifp->name, ifp->ifindex, vxl->access_vlan);
+ flog_err(EC_ZEBRA_MAC_ADD_FAILED,
+ "Failed to add MAC %s intf %s(%u) VID %u",
+ prefix_mac2str(macaddr, buf, sizeof(buf)),
+ ifp->name, ifp->ifindex, vxl->access_vlan);
return -1;
}
}
@@ -1793,7 +1793,7 @@ static int zvni_gw_macip_add(struct interface *ifp, zebra_vni_t *zvni,
n = zvni_neigh_add(zvni, ip, macaddr);
if (!n) {
flog_err(
- ZEBRA_ERR_MAC_ADD_FAILED,
+ EC_ZEBRA_MAC_ADD_FAILED,
"Failed to add neighbor %s MAC %s intf %s(%u) -> VNI %u",
ipaddr2str(ip, buf2, sizeof(buf2)),
prefix_mac2str(macaddr, buf, sizeof(buf)),
@@ -2014,7 +2014,7 @@ static int zvni_local_neigh_update(zebra_vni_t *zvni,
n = zvni_neigh_add(zvni, ip, macaddr);
if (!n) {
flog_err(
- ZEBRA_ERR_MAC_ADD_FAILED,
+ EC_ZEBRA_MAC_ADD_FAILED,
"Failed to add neighbor %s MAC %s intf %s(%u) -> VNI %u",
ipaddr2str(ip, buf2, sizeof(buf2)),
prefix_mac2str(macaddr, buf, sizeof(buf)),
@@ -3933,9 +3933,9 @@ static int zebra_vxlan_handle_vni_transition(struct zebra_vrf *zvrf, vni_t vni,
/* Delete the hash entry. */
if (zvni_del(zvni)) {
- flog_err(ZEBRA_ERR_VNI_DEL_FAILED,
- "Failed to del VNI hash %p, VNI %u", zvni,
- zvni->vni);
+ flog_err(EC_ZEBRA_VNI_DEL_FAILED,
+ "Failed to del VNI hash %p, VNI %u", zvni,
+ zvni->vni);
return -1;
}
} else {
@@ -4076,7 +4076,7 @@ static void process_remote_macip_add(vni_t vni,
if (!zvtep) {
if (zvni_vtep_add(zvni, &vtep_ip) == NULL) {
flog_err(
- ZEBRA_ERR_VTEP_ADD_FAILED,
+ EC_ZEBRA_VTEP_ADD_FAILED,
"Failed to add remote VTEP, VNI %u zvni %p upon remote MACIP ADD",
vni, zvni);
return;
@@ -5777,7 +5777,7 @@ int zebra_vxlan_local_mac_add_update(struct interface *ifp,
mac = zvni_mac_add(zvni, macaddr);
if (!mac) {
flog_err(
- ZEBRA_ERR_MAC_ADD_FAILED,
+ EC_ZEBRA_MAC_ADD_FAILED,
"Failed to add MAC %s intf %s(%u) VID %u VNI %u",
prefix_mac2str(macaddr, buf, sizeof(buf)),
ifp->name, ifp->ifindex, vid, zvni->vni);
@@ -5846,7 +5846,7 @@ int zebra_vxlan_local_mac_add_update(struct interface *ifp,
*/
if (CHECK_FLAG(mac->flags, ZEBRA_MAC_STICKY)) {
flog_warn(
- ZEBRA_ERR_STICKY_MAC_ALREADY_LEARNT,
+ EC_ZEBRA_STICKY_MAC_ALREADY_LEARNT,
"MAC %s already learnt as remote sticky MAC behind VTEP %s VNI %u",
prefix_mac2str(macaddr, buf,
sizeof(buf)),
@@ -6021,7 +6021,7 @@ void zebra_vxlan_remote_vtep_add(ZAPI_HANDLER_ARGS)
zvni = zvni_lookup(vni);
if (!zvni) {
flog_err(
- ZEBRA_ERR_VTEP_ADD_FAILED,
+ EC_ZEBRA_VTEP_ADD_FAILED,
"Failed to locate VNI hash upon remote VTEP ADD, VNI %u",
vni);
continue;
@@ -6030,7 +6030,7 @@ void zebra_vxlan_remote_vtep_add(ZAPI_HANDLER_ARGS)
ifp = zvni->vxlan_if;
if (!ifp) {
flog_err(
- ZEBRA_ERR_VTEP_ADD_FAILED,
+ EC_ZEBRA_VTEP_ADD_FAILED,
"VNI %u hash %p doesn't have intf upon remote VTEP ADD",
zvni->vni, zvni);
continue;
@@ -6048,9 +6048,9 @@ void zebra_vxlan_remote_vtep_add(ZAPI_HANDLER_ARGS)
continue;
if (zvni_vtep_add(zvni, &vtep_ip) == NULL) {
- flog_err(ZEBRA_ERR_VTEP_ADD_FAILED,
- "Failed to add remote VTEP, VNI %u zvni %p",
- vni, zvni);
+ flog_err(EC_ZEBRA_VTEP_ADD_FAILED,
+ "Failed to add remote VTEP, VNI %u zvni %p",
+ vni, zvni);
continue;
}
@@ -6469,9 +6469,9 @@ int zebra_vxlan_if_del(struct interface *ifp)
/* Delete the hash entry. */
if (zvni_del(zvni)) {
- flog_err(ZEBRA_ERR_VNI_DEL_FAILED,
- "Failed to del VNI hash %p, IF %s(%u) VNI %u",
- zvni, ifp->name, ifp->ifindex, zvni->vni);
+ flog_err(EC_ZEBRA_VNI_DEL_FAILED,
+ "Failed to del VNI hash %p, IF %s(%u) VNI %u",
+ zvni, ifp->name, ifp->ifindex, zvni->vni);
return -1;
}
}
@@ -6686,7 +6686,7 @@ int zebra_vxlan_if_add(struct interface *ifp)
zvni = zvni_add(vni);
if (!zvni) {
flog_err(
- ZEBRA_ERR_VNI_ADD_FAILED,
+ EC_ZEBRA_VNI_ADD_FAILED,
"Failed to add VNI hash, IF %s(%u) VNI %u",
ifp->name, ifp->ifindex, vni);
return -1;
diff --git a/zebra/zserv.c b/zebra/zserv.c
index d1d6a2d3f..2f4bb22ff 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -172,7 +172,7 @@ static void zserv_log_message(const char *errmsg, struct stream *msg,
*/
static void zserv_client_fail(struct zserv *client)
{
- flog_warn(ZEBRA_ERR_CLIENT_IO_ERROR,
+ flog_warn(EC_ZEBRA_CLIENT_IO_ERROR,
"Client '%s' encountered an error and is shutting down.",
zebra_route_string(client->proto));
@@ -272,7 +272,7 @@ static int zserv_write(struct thread *thread)
return 0;
zwrite_fail:
- flog_warn(ZEBRA_ERR_CLIENT_WRITE_FAILED,
+ flog_warn(EC_ZEBRA_CLIENT_WRITE_FAILED,
"%s: could not write to %s [fd = %d], closing.", __func__,
zebra_route_string(client->proto), client->sock);
zserv_client_fail(client);
@@ -744,7 +744,7 @@ static int zserv_accept(struct thread *thread)
client_sock = accept(accept_sock, (struct sockaddr *)&client, &len);
if (client_sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "Can't accept zebra socket: %s",
+ flog_err_sys(EC_LIB_SOCKET, "Can't accept zebra socket: %s",
safe_strerror(errno));
return -1;
}
@@ -775,7 +775,7 @@ void zserv_start(char *path)
/* Make UNIX domain socket. */
zebrad.sock = socket(sa.ss_family, SOCK_STREAM, 0);
if (zebrad.sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "Can't create zserv socket: %s",
+ flog_err_sys(EC_LIB_SOCKET, "Can't create zserv socket: %s",
safe_strerror(errno));
return;
}
@@ -798,9 +798,8 @@ void zserv_start(char *path)
ret = bind(zebrad.sock, (struct sockaddr *)&sa, sa_len);
}
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
- "Can't bind zserv socket on %s: %s", path,
- safe_strerror(errno));
+ flog_err_sys(EC_LIB_SOCKET, "Can't bind zserv socket on %s: %s",
+ path, safe_strerror(errno));
close(zebrad.sock);
zebrad.sock = -1;
return;
@@ -808,7 +807,7 @@ void zserv_start(char *path)
ret = listen(zebrad.sock, 5);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"Can't listen to zserv socket %s: %s", path,
safe_strerror(errno));
close(zebrad.sock);