summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--zebra/connected.c19
-rw-r--r--zebra/if_ioctl.c8
-rw-r--r--zebra/if_ioctl_solaris.c29
-rw-r--r--zebra/if_netlink.c31
-rw-r--r--zebra/if_sysctl.c16
-rw-r--r--zebra/interface.c19
-rw-r--r--zebra/ioctl_solaris.c4
-rw-r--r--zebra/ipforward_solaris.c13
-rw-r--r--zebra/ipforward_sysctl.c18
-rw-r--r--zebra/irdp_interface.c37
-rw-r--r--zebra/irdp_main.c13
-rw-r--r--zebra/irdp_packet.c38
-rw-r--r--zebra/kernel_netlink.c15
-rw-r--r--zebra/kernel_socket.c37
-rw-r--r--zebra/label_manager.c7
-rw-r--r--zebra/redistribute.c23
-rw-r--r--zebra/rt_netlink.c62
-rw-r--r--zebra/rt_socket.c11
-rw-r--r--zebra/rtadv.c65
-rw-r--r--zebra/rtread_getmsg.c31
-rw-r--r--zebra/rtread_sysctl.c6
-rw-r--r--zebra/rule_netlink.c4
-rw-r--r--zebra/zapi_msg.c45
-rw-r--r--zebra/zebra_errors.c429
-rw-r--r--zebra/zebra_errors.h51
-rw-r--r--zebra/zebra_fpm.c3
-rw-r--r--zebra/zebra_mpls.c9
-rw-r--r--zebra/zebra_mpls_openbsd.c25
-rw-r--r--zebra/zebra_netns_id.c5
-rw-r--r--zebra/zebra_netns_notify.c49
-rw-r--r--zebra/zebra_pbr.c17
-rw-r--r--zebra/zebra_ptm.c38
-rw-r--r--zebra/zebra_pw.c8
-rw-r--r--zebra/zebra_rib.c10
-rw-r--r--zebra/zebra_rnh.c5
-rw-r--r--zebra/zebra_vxlan.c105
-rw-r--r--zebra/zserv.c30
37 files changed, 965 insertions, 370 deletions
diff --git a/zebra/connected.c b/zebra/connected.c
index 57bfcc4d1..ff9c82883 100644
--- a/zebra/connected.c
+++ b/zebra/connected.c
@@ -40,6 +40,7 @@
#include "zebra/rtadv.h"
#include "zebra/zebra_mpls.h"
#include "zebra/debug.h"
+#include "zebra/zebra_errors.h"
/* communicate the withdrawal of a connected address */
static void connected_withdraw(struct connected *ifc)
@@ -236,7 +237,8 @@ void connected_up(struct interface *ifp, struct connected *ifc)
#endif
break;
default:
- zlog_warn("Received unknown AFI: %s", afi2str(afi));
+ flog_warn(ZEBRA_ERR_CONNECTED_AFI_UNKNOWN,
+ "Received unknown AFI: %s", afi2str(afi));
return;
break;
}
@@ -309,7 +311,8 @@ void connected_add_ipv4(struct interface *ifp, int flags, struct in_addr *addr,
/* validate the destination address */
if (CONNECTED_PEER(ifc)) {
if (IPV4_ADDR_SAME(addr, broad))
- zlog_warn(
+ flog_warn(
+ ZEBRA_ERR_IFACE_SAME_LOCAL_AS_PEER,
"warning: interface %s has same local and peer "
"address %s, routing protocols may malfunction",
ifp->name, inet_ntoa(*addr));
@@ -320,7 +323,8 @@ void connected_add_ipv4(struct interface *ifp, int flags, struct in_addr *addr,
struct in_addr bcalc;
bcalc.s_addr = ipv4_broadcast_addr(addr->s_addr,
prefixlen);
- zlog_warn(
+ flog_warn(
+ ZEBRA_ERR_BCAST_ADDR_MISMATCH,
"warning: interface %s broadcast addr %s/%d != "
"calculated %s, routing protocols may malfunction",
ifp->name,
@@ -334,7 +338,7 @@ void connected_add_ipv4(struct interface *ifp, int flags, struct in_addr *addr,
} else {
if (CHECK_FLAG(ifc->flags, ZEBRA_IFA_PEER)) {
- zlog_warn(
+ zlog_debug(
"warning: %s called for interface %s "
"with peer flag set, but no peer address supplied",
__func__, ifp->name);
@@ -343,7 +347,7 @@ void connected_add_ipv4(struct interface *ifp, int flags, struct in_addr *addr,
/* no broadcast or destination address was supplied */
if ((prefixlen == IPV4_MAX_PREFIXLEN) && if_is_pointopoint(ifp))
- zlog_warn(
+ zlog_debug(
"warning: PtP interface %s with addr %s/%d needs a "
"peer address",
ifp->name, inet_ntoa(*addr), prefixlen);
@@ -527,8 +531,9 @@ void connected_add_ipv6(struct interface *ifp, int flags, struct in6_addr *addr,
ifc->destination = (struct prefix *)p;
} else {
if (CHECK_FLAG(ifc->flags, ZEBRA_IFA_PEER)) {
- zlog_warn("warning: %s called for interface %s with peer flag set, but no peer address supplied",
- __func__, ifp->name);
+ zlog_debug(
+ "warning: %s called for interface %s with peer flag set, but no peer address supplied",
+ __func__, ifp->name);
UNSET_FLAG(ifc->flags, ZEBRA_IFA_PEER);
}
}
diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c
index 176bb2bba..8b5830fa1 100644
--- a/zebra/if_ioctl.c
+++ b/zebra/if_ioctl.c
@@ -57,8 +57,9 @@ static int interface_list_ioctl(void)
/* Normally SIOCGIFCONF works with AF_INET socket. */
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0) {
- zlog_warn("Can't make AF_INET socket stream: %s",
- safe_strerror(errno));
+ flog_err_sys(LIB_ERR_SOCKET,
+ "Can't make AF_INET socket stream: %s",
+ safe_strerror(errno));
return -1;
}
@@ -86,7 +87,8 @@ static int interface_list_ioctl(void)
ret = ioctl(sock, SIOCGIFCONF, &ifconf);
if (ret < 0) {
- zlog_warn("SIOCGIFCONF: %s", safe_strerror(errno));
+ flog_err_sys(LIB_ERR_SYSTEM_CALL, "SIOCGIFCONF: %s",
+ safe_strerror(errno));
goto end;
}
/* Repeatedly get info til buffer fails to grow. */
diff --git a/zebra/if_ioctl_solaris.c b/zebra/if_ioctl_solaris.c
index 5a58fe175..1449925aa 100644
--- a/zebra/if_ioctl_solaris.c
+++ b/zebra/if_ioctl_solaris.c
@@ -64,9 +64,9 @@ static int interface_list_ioctl(int af)
}
if (sock < 0) {
- zlog_warn("Can't make %s socket stream: %s",
- (af == AF_INET ? "AF_INET" : "AF_INET6"),
- safe_strerror(errno));
+ flog_err_sys(LIB_ERR_SOCKET, "Can't make %s socket stream: %s",
+ (af == AF_INET ? "AF_INET" : "AF_INET6"),
+ safe_strerror(errno));
return -1;
}
@@ -81,8 +81,9 @@ calculate_lifc_len:
}
if (ret < 0) {
- zlog_warn("interface_list_ioctl: SIOCGLIFNUM failed %s",
- safe_strerror(save_errno));
+ flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ "interface_list_ioctl: SIOCGLIFNUM failed %s",
+ safe_strerror(save_errno));
close(sock);
return -1;
}
@@ -115,7 +116,8 @@ calculate_lifc_len:
if (errno == EINVAL)
goto calculate_lifc_len;
- zlog_warn("SIOCGLIFCONF: %s", safe_strerror(errno));
+ flog_err_sys(LIB_ERR_SYSTEM_CALL, "SIOCGLIFCONF: %s",
+ safe_strerror(errno));
goto end;
}
@@ -206,7 +208,8 @@ static int if_get_index(struct interface *ifp)
ret = -1;
if (ret < 0) {
- zlog_warn("SIOCGLIFINDEX(%s) failed", ifp->name);
+ flog_err_sys(LIB_ERR_SYSTEM_CALL, "SIOCGLIFINDEX(%s) failed",
+ ifp->name);
return ret;
}
@@ -268,8 +271,9 @@ static int if_get_addr(struct interface *ifp, struct sockaddr *addr,
if (ret < 0) {
if (errno != EADDRNOTAVAIL) {
- zlog_warn("SIOCGLIFNETMASK (%s) fail: %s",
- ifp->name, safe_strerror(errno));
+ flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ "SIOCGLIFNETMASK (%s) fail: %s",
+ ifp->name, safe_strerror(errno));
return ret;
}
return 0;
@@ -288,8 +292,9 @@ static int if_get_addr(struct interface *ifp, struct sockaddr *addr,
if (ifp->flags & IFF_POINTOPOINT)
prefixlen = IPV6_MAX_BITLEN;
else
- zlog_warn("SIOCGLIFSUBNET (%s) fail: %s",
- ifp->name, safe_strerror(errno));
+ flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ "SIOCGLIFSUBNET (%s) fail: %s",
+ ifp->name, safe_strerror(errno));
} else {
prefixlen = lifreq.lifr_addrlen;
}
@@ -319,7 +324,7 @@ static void interface_info_ioctl(struct interface *ifp)
void interface_list(struct zebra_ns *zns)
{
if (zns->ns_id != NS_DEFAULT) {
- zlog_warn("interface_list: ignore NS %u", zns->ns_id);
+ zlog_debug("interface_list: ignore NS %u", zns->ns_id);
return;
}
interface_list_ioctl(AF_INET);
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c
index 0dcf5082a..588f1259c 100644
--- a/zebra/if_netlink.c
+++ b/zebra/if_netlink.c
@@ -67,6 +67,7 @@
#include "zebra/zebra_mpls.h"
#include "zebra/kernel_netlink.h"
#include "zebra/if_netlink.h"
+#include "zebra/zebra_errors.h"
extern struct zebra_privs_t zserv_privs;
@@ -112,8 +113,8 @@ static void netlink_interface_update_hw_addr(struct rtattr **tb,
hw_addr_len = RTA_PAYLOAD(tb[IFLA_ADDRESS]);
if (hw_addr_len > INTERFACE_HWADDR_MAX)
- zlog_warn("Hardware address is too large: %d",
- hw_addr_len);
+ zlog_debug("Hardware address is too large: %d",
+ hw_addr_len);
else {
ifp->hw_addr_len = hw_addr_len;
memcpy(ifp->hw_addr, RTA_DATA(tb[IFLA_ADDRESS]),
@@ -349,7 +350,8 @@ static void netlink_vrf_change(struct nlmsghdr *h, struct rtattr *tb,
vrf = vrf_lookup_by_id((vrf_id_t)ifi->ifi_index);
if (!vrf) {
- zlog_warn("%s: vrf not found", __func__);
+ flog_warn(ZEBRA_ERR_VRF_NOT_FOUND, "%s: vrf not found",
+ __func__);
return;
}
@@ -531,7 +533,8 @@ static int netlink_bridge_interface(struct nlmsghdr *h, int len, ns_id_t ns_id,
/* The interface should already be known, if not discard. */
ifp = if_lookup_by_index_per_ns(zebra_ns_lookup(ns_id), ifi->ifi_index);
if (!ifp) {
- zlog_warn("Cannot find bridge IF %s(%u)", name, ifi->ifi_index);
+ zlog_debug("Cannot find bridge IF %s(%u)", name,
+ ifi->ifi_index);
return 0;
}
if (!IS_ZEBRA_IF_VXLAN(ifp))
@@ -896,7 +899,8 @@ int netlink_interface_addr(struct nlmsghdr *h, ns_id_t ns_id, int startup)
ifa = NLMSG_DATA(h);
if (ifa->ifa_family != AF_INET && ifa->ifa_family != AF_INET6) {
- zlog_warn(
+ flog_warn(
+ ZEBRA_ERR_UNKNOWN_FAMILY,
"Invalid address family: %u received from kernel interface addr change: %u",
ifa->ifa_family, h->nlmsg_type);
return 0;
@@ -1130,14 +1134,15 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
/* assume if not default zns, then new VRF */
if (!(h->nlmsg_type == RTM_NEWLINK || h->nlmsg_type == RTM_DELLINK)) {
/* If this is not link add/delete message so print warning. */
- zlog_warn("netlink_link_change: wrong kernel message %d",
- h->nlmsg_type);
+ zlog_debug("netlink_link_change: wrong kernel message %d",
+ h->nlmsg_type);
return 0;
}
if (!(ifi->ifi_family == AF_UNSPEC || ifi->ifi_family == AF_BRIDGE
|| ifi->ifi_family == AF_INET6)) {
- zlog_warn(
+ flog_warn(
+ ZEBRA_ERR_UNKNOWN_FAMILY,
"Invalid address family: %u received from kernel link change: %u",
ifi->ifi_family, h->nlmsg_type);
return 0;
@@ -1248,7 +1253,7 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
set_ifindex(ifp, ifi->ifi_index, zns);
ifp->flags = ifi->ifi_flags & 0x0000fffff;
if (!tb[IFLA_MTU]) {
- zlog_warn(
+ zlog_debug(
"RTM_NEWLINK for interface %s(%u) without MTU set",
name, ifi->ifi_index);
return 0;
@@ -1303,7 +1308,7 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
set_ifindex(ifp, ifi->ifi_index, zns);
if (!tb[IFLA_MTU]) {
- zlog_warn(
+ zlog_debug(
"RTM_NEWLINK for interface %s(%u) without MTU set",
name, ifi->ifi_index);
return 0;
@@ -1359,8 +1364,10 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
} else {
/* Delete interface notification from kernel */
if (ifp == NULL) {
- zlog_warn("RTM_DELLINK for unknown interface %s(%u)",
- name, ifi->ifi_index);
+ if (IS_ZEBRA_DEBUG_KERNEL)
+ zlog_debug(
+ "RTM_DELLINK for unknown interface %s(%u)",
+ name, ifi->ifi_index);
return 0;
}
diff --git a/zebra/if_sysctl.c b/zebra/if_sysctl.c
index 39b7204e8..f4b552f28 100644
--- a/zebra/if_sysctl.c
+++ b/zebra/if_sysctl.c
@@ -52,7 +52,8 @@ void ifstat_update_sysctl(void)
/* Query buffer size. */
if (sysctl(mib, MIBSIZ, NULL, &bufsiz, NULL, 0) < 0) {
- zlog_warn("sysctl() error by %s", safe_strerror(errno));
+ flog_warn(ZEBRA_ERR_SYSCTL_FAILED, "sysctl() error by %s",
+ safe_strerror(errno));
return;
}
@@ -61,7 +62,8 @@ void ifstat_update_sysctl(void)
/* Fetch interface informations into allocated buffer. */
if (sysctl(mib, MIBSIZ, buf, &bufsiz, NULL, 0) < 0) {
- zlog_warn("sysctl error by %s", safe_strerror(errno));
+ flog_warn(ZEBRA_ERR_SYSCTL_FAILED, "sysctl error by %s",
+ safe_strerror(errno));
XFREE(MTYPE_TMP, ref);
return;
}
@@ -95,13 +97,15 @@ void interface_list(struct zebra_ns *zns)
NET_RT_IFLIST, 0};
if (zns->ns_id != NS_DEFAULT) {
- zlog_warn("interface_list: ignore NS %u", zns->ns_id);
+ zlog_debug("interface_list: ignore NS %u", zns->ns_id);
return;
}
/* Query buffer size. */
if (sysctl(mib, MIBSIZ, NULL, &bufsiz, NULL, 0) < 0) {
- zlog_warn("sysctl() error by %s", safe_strerror(errno));
+ flog_err_sys(ZEBRA_ERR_IFLIST_FAILED,
+ "Could not enumerate interfaces: %s",
+ safe_strerror(errno));
return;
}
@@ -110,7 +114,9 @@ void interface_list(struct zebra_ns *zns)
/* Fetch interface informations into allocated buffer. */
if (sysctl(mib, MIBSIZ, buf, &bufsiz, NULL, 0) < 0) {
- zlog_warn("sysctl error by %s", safe_strerror(errno));
+ flog_err_sys(ZEBRA_ERR_IFLIST_FAILED,
+ "Could not enumerate interfaces: %s",
+ safe_strerror(errno));
return;
}
diff --git a/zebra/interface.c b/zebra/interface.c
index 32ee1a566..eabf0638a 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -49,6 +49,7 @@
#include "zebra/rt_netlink.h"
#include "zebra/interface.h"
#include "zebra/zebra_vxlan.h"
+#include "zebra/zebra_errors.h"
#define ZEBRA_PTM_SUPPORT
@@ -336,9 +337,9 @@ 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)) {
- zlog_warn(
- "Trying to remove an address from an unknown subnet."
- " (please report this bug)");
+ flog_warn(ZEBRA_ERR_REMOVE_ADDR_UNKNOWN_SUBNET,
+ "Trying to remove an address from an unknown subnet."
+ " (please report this bug)");
return -1;
}
route_unlock_node(rn);
@@ -350,7 +351,8 @@ int if_subnet_delete(struct interface *ifp, struct connected *ifc)
* In any case, we shouldn't decrement the lock counter if the address
* is unknown. */
if (!listnode_lookup(addr_list, ifc)) {
- zlog_warn(
+ flog_warn(
+ ZEBRA_ERR_REMOVE_UNREGISTERED_ADDR,
"Trying to remove an address from a subnet where it is not"
" currently registered. (please report this bug)");
return -1;
@@ -496,7 +498,8 @@ static void if_addr_wakeup(struct interface *ifp)
ret = if_set_prefix(ifp, ifc);
if (ret < 0) {
- zlog_warn(
+ flog_err_sys(
+ ZEBRA_ERR_IFACE_ADDR_ADD_FAILED,
"Can't set interface's address: %s",
safe_strerror(errno));
continue;
@@ -518,7 +521,8 @@ static void if_addr_wakeup(struct interface *ifp)
ret = if_prefix_add_ipv6(ifp, ifc);
if (ret < 0) {
- zlog_warn(
+ flog_err_sys(
+ ZEBRA_ERR_IFACE_ADDR_ADD_FAILED,
"Can't set interface's address: %s",
safe_strerror(errno));
continue;
@@ -908,7 +912,8 @@ void if_up(struct interface *ifp)
/* Notify the protocol daemons. */
if (ifp->ptm_enable && (ifp->ptm_status == ZEBRA_PTM_STATUS_DOWN)) {
- zlog_warn("%s: interface %s hasn't passed ptm check\n",
+ flog_warn(ZEBRA_ERR_PTM_NOT_READY,
+ "%s: interface %s hasn't passed ptm check\n",
__func__, ifp->name);
return;
}
diff --git a/zebra/ioctl_solaris.c b/zebra/ioctl_solaris.c
index 260911ce6..74a82e749 100644
--- a/zebra/ioctl_solaris.c
+++ b/zebra/ioctl_solaris.c
@@ -380,7 +380,7 @@ int if_prefix_add_ipv6(struct interface *ifp, struct connected *ifc)
{
char addrbuf[PREFIX_STRLEN];
- zlog_warn("Can't set %s on interface %s",
+ flog_warn(LIB_ERR_DEVELOPMENT, "Can't set %s on interface %s",
prefix2str(ifc->address, addrbuf, sizeof(addrbuf)),
ifp->name);
@@ -391,7 +391,7 @@ int if_prefix_delete_ipv6(struct interface *ifp, struct connected *ifc)
{
char addrbuf[PREFIX_STRLEN];
- zlog_warn("Can't delete %s on interface %s",
+ flog_warn(LIB_ERR_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 b06baa04a..4a3966ca2 100644
--- a/zebra/ipforward_solaris.c
+++ b/zebra/ipforward_solaris.c
@@ -84,15 +84,16 @@ 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) {
- zlog_warn("failed to open device %s - %s", device,
- safe_strerror(errno));
+ flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ "failed to open device %s - %s", device,
+ safe_strerror(errno));
return -1;
}
if (ioctl(fd, I_STR, &strioctl) < 0) {
close(fd);
- zlog_warn("ioctl I_STR failed on device %s - %s",
- device,
- safe_strerror(errno));
+ flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ "ioctl I_STR failed on device %s - %s",
+ device, safe_strerror(errno));
return -1;
}
close(fd);
@@ -102,7 +103,7 @@ static int solaris_nd(const int cmd, const char *parameter, const int value)
errno = 0;
retval = atoi(nd_buf);
if (errno) {
- zlog_warn(
+ zlog_debug(
"failed to convert returned value to integer - %s",
safe_strerror(errno));
retval = -1;
diff --git a/zebra/ipforward_sysctl.c b/zebra/ipforward_sysctl.c
index 74a178e59..e5974412d 100644
--- a/zebra/ipforward_sysctl.c
+++ b/zebra/ipforward_sysctl.c
@@ -24,6 +24,7 @@
#include "privs.h"
#include "zebra/ipforward.h"
+#include "zebra/zebra_errors.h"
#include "log.h"
#include "lib_errors.h"
@@ -42,7 +43,7 @@ int ipforward(void)
len = sizeof ipforwarding;
if (sysctl(mib, MIB_SIZ, &ipforwarding, &len, 0, 0) < 0) {
- zlog_warn("Can't get ipforwarding value");
+ flog_err_sys(LIB_ERR_SYSCALL, "Can't get ipforwarding value");
return -1;
}
return ipforwarding;
@@ -56,7 +57,8 @@ int ipforward_on(void)
len = sizeof ipforwarding;
frr_elevate_privs(&zserv_privs) {
if (sysctl(mib, MIB_SIZ, NULL, NULL, &ipforwarding, len) < 0) {
- zlog_warn("Can't set ipforwarding on");
+ flog_err_sys(LIB_ERR_SYSCALL,
+ "Can't set ipforwarding on");
return -1;
}
}
@@ -71,7 +73,8 @@ int ipforward_off(void)
len = sizeof ipforwarding;
frr_elevate_privs(&zserv_privs) {
if (sysctl(mib, MIB_SIZ, NULL, NULL, &ipforwarding, len) < 0) {
- zlog_warn("Can't set ipforwarding on");
+ flog_err_sys(LIB_ERR_SYSCALL,
+ "Can't set ipforwarding on");
return -1;
}
}
@@ -95,7 +98,8 @@ int ipforward_ipv6(void)
len = sizeof ip6forwarding;
frr_elevate_privs(&zserv_privs) {
if (sysctl(mib_ipv6, MIB_SIZ, &ip6forwarding, &len, 0, 0) < 0) {
- zlog_warn("can't get ip6forwarding value");
+ flog_err_sys(_LIB_ERR_SYSCALL,
+ "can't get ip6forwarding value");
return -1;
}
}
@@ -111,7 +115,8 @@ int ipforward_ipv6_on(void)
frr_elevate_privs(&zserv_privs) {
if (sysctl(mib_ipv6, MIB_SIZ, NULL, NULL, &ip6forwarding, len)
< 0) {
- zlog_warn("can't get ip6forwarding value");
+ flog_err_sys(LIB_ERR_SYSCALL,
+ "can't get ip6forwarding value");
return -1;
}
}
@@ -127,7 +132,8 @@ int ipforward_ipv6_off(void)
frr_elevate_privs(&zserv_privs) {
if (sysctl(mib_ipv6, MIB_SIZ, NULL, NULL, &ip6forwarding, len)
< 0) {
- zlog_warn("can't get ip6forwarding value");
+ flog_err_sys(LIB_ERR_SYSCALL,
+ "can't get ip6forwarding value");
return -1;
}
}
diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c
index f02ba1fa2..cda6f0e21 100644
--- a/zebra/irdp_interface.c
+++ b/zebra/irdp_interface.c
@@ -41,12 +41,14 @@
#include "log.h"
#include "zclient.h"
#include "thread.h"
+#include "lib_errors.h"
#include "zebra/interface.h"
#include "zebra/rtadv.h"
#include "zebra/rib.h"
#include "zebra/zserv.h"
#include "zebra/redistribute.h"
#include "zebra/irdp.h"
+#include "zebra/zebra_errors.h"
#include <netinet/ip_icmp.h>
#include "if.h"
#include "sockunion.h"
@@ -124,7 +126,8 @@ static int if_group(struct interface *ifp, int sock, uint32_t group,
p = irdp_get_prefix(ifp);
if (!p) {
- zlog_warn("IRDP: can't get address for %s", ifp->name);
+ flog_warn(ZEBRA_ERR_NO_IFACE_ADDR,
+ "IRDP: can't get address for %s", ifp->name);
return 1;
}
@@ -133,10 +136,10 @@ 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)
- zlog_warn("IRDP: %s can't setsockopt %s: %s",
- add_leave == IP_ADD_MEMBERSHIP ? "join group"
- : "leave group",
- inet_2a(group, b1), safe_strerror(errno));
+ flog_err_sys(LIB_ERR_SOCKET, "IRDP: %s can't setsockopt %s: %s",
+ add_leave == IP_ADD_MEMBERSHIP ? "join group"
+ : "leave group",
+ inet_2a(group, b1), safe_strerror(errno));
return ret;
}
@@ -215,14 +218,14 @@ static void irdp_if_start(struct interface *ifp, int multicast,
irdp->started = true;
if (irdp->flags & IF_ACTIVE) {
- zlog_warn("IRDP: Interface is already active %s", ifp->name);
+ zlog_debug("IRDP: Interface is already active %s", ifp->name);
return;
}
if ((irdp_sock < 0) && ((irdp_sock = irdp_sock_init()) < 0)) {
- zlog_warn(
- "IRDP: Cannot activate interface %s (cannot create "
- "IRDP socket)",
- ifp->name);
+ flog_warn(ZEBRA_ERR_IRDP_CANNOT_ACTIVATE_IFACE,
+ "IRDP: Cannot activate interface %s (cannot create "
+ "IRDP socket)",
+ ifp->name);
return;
}
irdp->flags |= IF_ACTIVE;
@@ -233,7 +236,8 @@ static void irdp_if_start(struct interface *ifp, int multicast,
if_add_update(ifp);
if (!(ifp->flags & IFF_UP)) {
- zlog_warn("IRDP: Interface is down %s", ifp->name);
+ flog_warn(ZEBRA_ERR_IRDP_IFACE_DOWN,
+ "IRDP: Interface is down %s", ifp->name);
}
/* Shall we cancel if_start if if_add_group fails? */
@@ -242,7 +246,8 @@ static void irdp_if_start(struct interface *ifp, int multicast,
if_add_group(ifp);
if (!(ifp->flags & (IFF_MULTICAST | IFF_ALLMULTI))) {
- zlog_warn("IRDP: Interface not multicast enabled %s",
+ flog_warn(ZEBRA_ERR_IRDP_IFACE_MCAST_DISABLED,
+ "IRDP: Interface not multicast enabled %s",
ifp->name);
}
}
@@ -290,12 +295,12 @@ static void irdp_if_stop(struct interface *ifp)
struct irdp_interface *irdp = zi->irdp;
if (irdp == NULL) {
- zlog_warn("Interface %s structure is NULL", ifp->name);
+ zlog_debug("Interface %s structure is NULL", ifp->name);
return;
}
if (!(irdp->flags & IF_ACTIVE)) {
- zlog_warn("Interface is not active %s", ifp->name);
+ zlog_debug("Interface is not active %s", ifp->name);
return;
}
@@ -319,7 +324,7 @@ static void irdp_if_shutdown(struct interface *ifp)
return;
if (irdp->flags & IF_SHUTDOWN) {
- zlog_warn("IRDP: Interface is already shutdown %s", ifp->name);
+ zlog_debug("IRDP: Interface is already shutdown %s", ifp->name);
return;
}
@@ -341,7 +346,7 @@ static void irdp_if_no_shutdown(struct interface *ifp)
return;
if (!(irdp->flags & IF_SHUTDOWN)) {
- zlog_warn("IRDP: Interface is not shutdown %s", ifp->name);
+ zlog_debug("IRDP: Interface is not shutdown %s", ifp->name);
return;
}
diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c
index 771ae796e..b96405f9e 100644
--- a/zebra/irdp_main.c
+++ b/zebra/irdp_main.c
@@ -89,24 +89,25 @@ int irdp_sock_init(void)
}
if (sock < 0) {
- zlog_warn("IRDP: can't create irdp socket %s",
- safe_strerror(save_errno));
+ flog_err_sys(LIB_ERR_SOCKET,
+ "IRDP: can't create irdp socket %s",
+ safe_strerror(save_errno));
return sock;
};
i = 1;
ret = setsockopt(sock, IPPROTO_IP, IP_TTL, (void *)&i, sizeof(i));
if (ret < 0) {
- zlog_warn("IRDP: can't do irdp sockopt %s",
- safe_strerror(errno));
+ flog_err_sys(LIB_ERR_SOCKET, "IRDP: can't do irdp sockopt %s",
+ safe_strerror(errno));
close(sock);
return ret;
};
ret = setsockopt_ifindex(AF_INET, sock, 1);
if (ret < 0) {
- zlog_warn("IRDP: can't do irdp sockopt %s",
- safe_strerror(errno));
+ flog_err_sys(LIB_ERR_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 c36c95897..31351b146 100644
--- a/zebra/irdp_packet.c
+++ b/zebra/irdp_packet.c
@@ -52,6 +52,7 @@
#include "thread.h"
#include "vty.h"
#include "zclient.h"
+#include "lib_errors.h"
#include "zebra_memory.h"
#include "zebra/interface.h"
@@ -122,7 +123,8 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
/* check icmp checksum */
if (in_cksum(icmp, datalen) != icmp->checksum) {
- zlog_warn(
+ flog_warn(
+ ZEBRA_ERR_IRDP_BAD_CHECKSUM,
"IRDP: RX ICMP packet from %s. Bad checksum, silently ignored",
inet_ntoa(src));
return;
@@ -134,10 +136,10 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
return;
if (icmp->code != 0) {
- zlog_warn(
- "IRDP: RX packet type %d from %s. Bad ICMP type code,"
- " silently ignored",
- icmp->type, inet_ntoa(src));
+ flog_warn(ZEBRA_ERR_IRDP_BAD_TYPE_CODE,
+ "IRDP: RX packet type %d from %s. Bad ICMP type code,"
+ " silently ignored",
+ icmp->type, inet_ntoa(src));
return;
}
@@ -145,16 +147,15 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
&& (irdp->flags & IF_BROADCAST))
|| (ntohl(ip->ip_dst.s_addr) == INADDR_ALLRTRS_GROUP
&& !(irdp->flags & IF_BROADCAST))) {
- zlog_warn(
- "IRDP: RX illegal from %s to %s while %s operates in %s\n",
+ flog_warn(
+ ZEBRA_ERR_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
? "multicast"
: inet_ntoa(ip->ip_dst),
ifp->name,
irdp->flags & IF_BROADCAST ? "broadcast" : "multicast");
-
- zlog_warn("IRDP: Please correct settings\n");
return;
}
@@ -172,7 +173,8 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
break;
default:
- zlog_warn(
+ flog_warn(
+ ZEBRA_ERR_IRDP_BAD_TYPE,
"IRDP: RX type %d from %s. Bad ICMP type, silently ignored",
icmp->type, inet_ntoa(src));
}
@@ -198,16 +200,18 @@ static int irdp_recvmsg(int sock, uint8_t *buf, int size, int *ifindex)
ret = recvmsg(sock, &msg, 0);
if (ret < 0) {
- zlog_warn("IRDP: recvmsg: read error %s", safe_strerror(errno));
+ flog_warn(LIB_ERR_SOCKET, "IRDP: recvmsg: read error %s",
+ safe_strerror(errno));
return ret;
}
if (msg.msg_flags & MSG_TRUNC) {
- zlog_warn("IRDP: recvmsg: truncated message");
+ flog_warn(LIB_ERR_SOCKET, "IRDP: recvmsg: truncated message");
return ret;
}
if (msg.msg_flags & MSG_CTRUNC) {
- zlog_warn("IRDP: recvmsg: truncated control message");
+ flog_warn(LIB_ERR_SOCKET,
+ "IRDP: recvmsg: truncated control message");
return ret;
}
@@ -232,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)
- zlog_warn("IRDP: RX Error length = %d", ret);
+ flog_warn(LIB_ERR_SOCKET, "IRDP: RX Error length = %d", ret);
ifp = if_lookup_by_index(ifindex, VRF_DEFAULT);
if (!ifp)
@@ -311,7 +315,7 @@ void send_packet(struct interface *ifp, struct stream *s, uint32_t dst,
if (setsockopt(irdp_sock, IPPROTO_IP, IP_HDRINCL, (char *)&on,
sizeof(on))
< 0)
- zlog_warn("sendto %s", safe_strerror(errno));
+ zlog_debug("sendto %s", safe_strerror(errno));
if (dst == INADDR_BROADCAST) {
@@ -319,7 +323,7 @@ void send_packet(struct interface *ifp, struct stream *s, uint32_t dst,
if (setsockopt(irdp_sock, SOL_SOCKET, SO_BROADCAST, (char *)&on,
sizeof(on))
< 0)
- zlog_warn("sendto %s", safe_strerror(errno));
+ zlog_debug("sendto %s", safe_strerror(errno));
}
if (dst != INADDR_BROADCAST)
@@ -351,7 +355,7 @@ void send_packet(struct interface *ifp, struct stream *s, uint32_t dst,
sockopt_iphdrincl_swab_htosys(ip);
if (sendmsg(irdp_sock, msg, 0) < 0) {
- zlog_warn("sendto %s", safe_strerror(errno));
+ zlog_debug("sendto %s", safe_strerror(errno));
}
/* printf("TX on %s idx %d\n", ifp->name, ifp->ifindex); */
}
diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c
index 545b4d9d6..323a6c33f 100644
--- a/zebra/kernel_netlink.c
+++ b/zebra/kernel_netlink.c
@@ -453,8 +453,9 @@ static void netlink_install_filter(int sock, __u32 pid)
if (setsockopt(sock, SOL_SOCKET, SO_ATTACH_FILTER, &prog, sizeof(prog))
< 0)
- zlog_warn("Can't install socket filter: %s\n",
- safe_strerror(errno));
+ flog_err_sys(LIB_ERR_SOCKET,
+ "Can't install socket filter: %s\n",
+ safe_strerror(errno));
}
void netlink_parse_rtattr(struct rtattr **tb, int max, struct rtattr *rta,
@@ -641,8 +642,8 @@ static void netlink_parse_extended_ack(struct nlmsghdr *h)
* but noticing it for later.
*/
err_nlh = &err->msg;
- zlog_warn("%s: Received %d extended Ack",
- __PRETTY_FUNCTION__, err_nlh->nlmsg_type);
+ zlog_debug("%s: Received %d extended Ack",
+ __PRETTY_FUNCTION__, err_nlh->nlmsg_type);
}
}
@@ -652,7 +653,8 @@ static void netlink_parse_extended_ack(struct nlmsghdr *h)
if (is_err)
zlog_err("Extended Error: %s", msg);
else
- zlog_warn("Extended Warning: %s", msg);
+ flog_warn(ZEBRA_ERR_NETLINK_EXTENDED_WARNING,
+ "Extended Warning: %s", msg);
}
}
@@ -890,7 +892,8 @@ int netlink_parse_info(int (*filter)(struct nlmsghdr *, ns_id_t, int),
error = (*filter)(h, zns->ns_id, startup);
if (error < 0) {
- zlog_warn("%s filter function error", nl->name);
+ zlog_debug("%s filter function error",
+ nl->name);
ret = error;
}
}
diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c
index 78e25e762..5f4158e35 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -502,8 +502,8 @@ int ifm_read(struct if_msghdr *ifm)
* RTA_IFP) is required.
*/
if (!ifnlen) {
- zlog_warn("Interface index %d (new) missing ifname\n",
- ifm->ifm_index);
+ zlog_debug("Interface index %d (new) missing ifname\n",
+ ifm->ifm_index);
return -1;
}
@@ -586,7 +586,7 @@ int ifm_read(struct if_msghdr *ifm)
*/
{
if (ifp->ifindex != ifm->ifm_index) {
- zlog_warn(
+ zlog_debug(
"%s: index mismatch, ifname %s, ifp index %d, "
"ifm index %d",
__func__, ifp->name, ifp->ifindex,
@@ -709,7 +709,7 @@ static void ifam_read_mesg(struct ifa_msghdr *ifm, union sockunion *addr,
/* Assert read up end point matches to end point */
if (pnt != end)
- zlog_warn("ifam_read() doesn't read all socket data");
+ zlog_debug("ifam_read() doesn't read all socket data");
}
/* Interface's address information get. */
@@ -728,7 +728,8 @@ 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) {
- zlog_warn("%s: no interface for ifname %s, index %d", __func__,
+ flog_warn(ZEBRA_ERR_UNKNOWN_INTERFACE,
+ "%s: no interface for ifname %s, index %d", __func__,
ifname, ifam->ifam_index);
return -1;
}
@@ -822,10 +823,10 @@ static int rtm_read_mesg(struct rt_msghdr *rtm, union sockunion *dest,
/* rt_msghdr version check. */
if (rtm->rtm_version != RTM_VERSION)
- zlog_warn(
- "Routing message version different %d should be %d."
- "This may cause problem\n",
- rtm->rtm_version, RTM_VERSION);
+ flog_warn(ZEBRA_ERR_RTM_VERSION_MISMATCH,
+ "Routing message version different %d should be %d."
+ "This may cause problem\n",
+ rtm->rtm_version, RTM_VERSION);
/* Be sure structure is cleared */
memset(dest, 0, sizeof(union sockunion));
@@ -860,7 +861,7 @@ static int rtm_read_mesg(struct rt_msghdr *rtm, union sockunion *dest,
/* Assert read up to the end of pointer. */
if (pnt != end)
- zlog_warn("rtm_read() doesn't read all socket data.");
+ zlog_debug("rtm_read() doesn't read all socket data.");
return rtm->rtm_flags;
}
@@ -1182,7 +1183,8 @@ int rtm_write(int message, union sockunion *dest, union sockunion *mask,
if (mask)
inet_ntop(AF_INET, &mask->sin.sin_addr,
mask_buf, INET_ADDRSTRLEN);
- zlog_warn(
+ flog_warn(
+ ZEBRA_ERR_RTM_NO_GATEWAY,
"%s: %s/%s: gate == NULL and no gateway found for ifindex %d",
__func__, dest_buf, mask_buf, index);
return -1;
@@ -1250,8 +1252,8 @@ int rtm_write(int message, union sockunion *dest, union sockunion *mask,
if (errno == ESRCH)
return ZEBRA_ERR_RTNOEXIST;
- zlog_warn("%s: write : %s (%d)", __func__, safe_strerror(errno),
- errno);
+ flog_err_sys(LIB_ERR_SOCKET, "%s: write : %s (%d)", __func__,
+ safe_strerror(errno), errno);
return ZEBRA_ERR_KERNEL;
}
return ZEBRA_ERR_NOERROR;
@@ -1333,8 +1335,8 @@ static int kernel_read(struct thread *thread)
if (nbytes <= 0) {
if (nbytes < 0 && errno != EWOULDBLOCK && errno != EAGAIN)
- zlog_warn("routing socket error: %s",
- safe_strerror(errno));
+ flog_err_sys(LIB_ERR_SOCKET, "routing socket error: %s",
+ safe_strerror(errno));
return 0;
}
@@ -1350,7 +1352,7 @@ static int kernel_read(struct thread *thread)
* can assume they have the whole message.
*/
if (rtm->rtm_msglen != nbytes) {
- zlog_warn(
+ zlog_debug(
"kernel_read: rtm->rtm_msglen %d, nbytes %d, type %d\n",
rtm->rtm_msglen, nbytes, rtm->rtm_type);
return -1;
@@ -1390,7 +1392,8 @@ static void routing_socket(struct zebra_ns *zns)
}
if (routing_sock < 0) {
- zlog_warn("Can't init kernel routing socket");
+ flog_err_sys(LIB_ERR_SOCKET,
+ "Can't init kernel routing socket");
return;
}
diff --git a/zebra/label_manager.c b/zebra/label_manager.c
index e53764c77..793d6cfa1 100644
--- a/zebra/label_manager.c
+++ b/zebra/label_manager.c
@@ -209,7 +209,8 @@ int zread_relay_label_manager_request(int cmd, struct zserv *zserv,
/* check & set client proto if unset */
if (zserv->proto && zserv->proto != proto) {
- zlog_warn("Client proto(%u) != msg proto(%u)", zserv->proto,
+ flog_warn(ZEBRA_WARNING_LM_PROTO_MISMATCH,
+ "Client proto(%u) != msg proto(%u)", zserv->proto,
proto);
return -1;
}
@@ -277,9 +278,7 @@ static int lm_zclient_connect(struct thread *t)
}
/* make socket non-blocking */
- if (set_nonblocking(zclient->sock) < 0)
- zlog_warn("%s: set_nonblocking(%d) failed", __func__,
- zclient->sock);
+ (void)set_nonblocking(zclient->sock);
return 0;
}
diff --git a/zebra/redistribute.c b/zebra/redistribute.c
index 640d58e17..7450dc372 100644
--- a/zebra/redistribute.c
+++ b/zebra/redistribute.c
@@ -166,7 +166,8 @@ void redistribute_update(const struct prefix *p, const struct prefix *src_p,
afi = family2afi(p->family);
if (!afi) {
- zlog_warn("%s: Unknown AFI/SAFI prefix received\n",
+ flog_warn(ZEBRA_ERR_REDISTRIBUTE_UNKNOWN_AF,
+ "%s: Unknown AFI/SAFI prefix received\n",
__FUNCTION__);
return;
}
@@ -236,7 +237,8 @@ void redistribute_delete(const struct prefix *p, const struct prefix *src_p,
afi = family2afi(p->family);
if (!afi) {
- zlog_warn("%s: Unknown AFI/SAFI prefix received\n",
+ flog_warn(ZEBRA_ERR_REDISTRIBUTE_UNKNOWN_AF,
+ "%s: Unknown AFI/SAFI prefix received\n",
__FUNCTION__);
return;
}
@@ -275,14 +277,15 @@ void zebra_redistribute_add(ZAPI_HANDLER_ARGS)
zebra_route_string(type), zvrf_id(zvrf), instance);
if (afi == 0 || afi >= AFI_MAX) {
- zlog_warn("%s: Specified afi %d does not exist",
+ flog_warn(ZEBRA_ERR_REDISTRIBUTE_UNKNOWN_AF,
+ "%s: Specified afi %d does not exist",
__PRETTY_FUNCTION__, afi);
return;
}
if (type == 0 || type >= ZEBRA_ROUTE_MAX) {
- zlog_warn("%s: Specified Route Type %d does not exist",
- __PRETTY_FUNCTION__, type);
+ zlog_debug("%s: Specified Route Type %d does not exist",
+ __PRETTY_FUNCTION__, type);
return;
}
@@ -321,14 +324,15 @@ void zebra_redistribute_delete(ZAPI_HANDLER_ARGS)
STREAM_GETW(msg, instance);
if (afi == 0 || afi >= AFI_MAX) {
- zlog_warn("%s: Specified afi %d does not exist",
+ flog_warn(ZEBRA_ERR_REDISTRIBUTE_UNKNOWN_AF,
+ "%s: Specified afi %d does not exist",
__PRETTY_FUNCTION__, afi);
return;
}
if (type == 0 || type >= ZEBRA_ROUTE_MAX) {
- zlog_warn("%s: Specified Route Type %d does not exist",
- __PRETTY_FUNCTION__, type);
+ zlog_debug("%s: Specified Route Type %d does not exist",
+ __PRETTY_FUNCTION__, type);
return;
}
@@ -444,7 +448,8 @@ void zebra_interface_address_add_update(struct interface *ifp,
}
if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL))
- zlog_warn(
+ flog_warn(
+ ZEBRA_ERR_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 3683596b4..7f475fe7d 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -153,8 +153,9 @@ static inline int zebra2proto(int proto)
* is intentionally a warn because we should see
* this as part of development of a new protocol
*/
- zlog_warn("%s: Please add this protocol(%d) to proper rt_netlink.c handling",
- __PRETTY_FUNCTION__, proto);
+ zlog_debug(
+ "%s: Please add this protocol(%d) to proper rt_netlink.c handling",
+ __PRETTY_FUNCTION__, proto);
proto = RTPROT_ZEBRA;
break;
}
@@ -210,9 +211,9 @@ static inline int proto2zebra(int proto, int family)
* is intentionally a warn because we should see
* this as part of development of a new protocol
*/
- zlog_warn("%s: Please add this protocol(%d) to proper rt_netlink.c handling",
- __PRETTY_FUNCTION__,
- proto);
+ zlog_debug(
+ "%s: Please add this protocol(%d) to proper rt_netlink.c handling",
+ __PRETTY_FUNCTION__, proto);
proto = ZEBRA_ROUTE_KERNEL;
break;
}
@@ -426,8 +427,10 @@ 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];
- zlog_warn("unsupported IPv4 sourcedest route (dest %s vrf %u)",
- prefix2str(&p, buf, sizeof(buf)), vrf_id);
+ flog_warn(
+ ZEBRA_ERR_UNSUPPORTED_V4_SRCDEST,
+ "unsupported IPv4 sourcedest route (dest %s vrf %u)",
+ prefix2str(&p, buf, sizeof(buf)), vrf_id);
return 0;
}
@@ -594,7 +597,8 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
if (ifp)
nh_vrf_id = ifp->vrf_id;
else {
- zlog_warn(
+ flog_warn(
+ ZEBRA_ERR_UNKNOWN_INTERFACE,
"%s: Unknown interface %u specified, defaulting to VRF_DEFAULT",
__PRETTY_FUNCTION__,
index);
@@ -817,12 +821,13 @@ int netlink_route_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
if (!(h->nlmsg_type == RTM_NEWROUTE || h->nlmsg_type == RTM_DELROUTE)) {
/* If this is not route add/delete message print warning. */
- zlog_warn("Kernel message: %d NS %u\n", h->nlmsg_type, ns_id);
+ zlog_debug("Kernel message: %d NS %u\n", h->nlmsg_type, ns_id);
return 0;
}
if (!(rtm->rtm_family == AF_INET || rtm->rtm_family == AF_INET6)) {
- zlog_warn(
+ flog_warn(
+ ZEBRA_ERR_UNKNOWN_FAMILY,
"Invalid address family: %u received from kernel route change: %u",
rtm->rtm_family, h->nlmsg_type);
return 0;
@@ -1951,10 +1956,10 @@ static int netlink_macfdb_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
zif = (struct zebra_if *)ifp->info;
if ((br_if = zif->brslave_info.br_if) == NULL) {
- zlog_warn("%s family %s IF %s(%u) brIF %u - no bridge master",
- nl_msg_type_to_str(h->nlmsg_type),
- nl_family_to_str(ndm->ndm_family), ifp->name,
- ndm->ndm_ifindex, zif->brslave_info.bridge_ifindex);
+ zlog_debug("%s family %s IF %s(%u) brIF %u - no bridge master",
+ nl_msg_type_to_str(h->nlmsg_type),
+ nl_family_to_str(ndm->ndm_family), ifp->name,
+ ndm->ndm_ifindex, zif->brslave_info.bridge_ifindex);
return 0;
}
@@ -1963,15 +1968,15 @@ static int netlink_macfdb_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
netlink_parse_rtattr(tb, NDA_MAX, NDA_RTA(ndm), len);
if (!tb[NDA_LLADDR]) {
- zlog_warn("%s family %s IF %s(%u) brIF %u - no LLADDR",
- nl_msg_type_to_str(h->nlmsg_type),
- nl_family_to_str(ndm->ndm_family), ifp->name,
- ndm->ndm_ifindex, zif->brslave_info.bridge_ifindex);
+ zlog_debug("%s family %s IF %s(%u) brIF %u - no LLADDR",
+ nl_msg_type_to_str(h->nlmsg_type),
+ nl_family_to_str(ndm->ndm_family), ifp->name,
+ ndm->ndm_ifindex, zif->brslave_info.bridge_ifindex);
return 0;
}
if (RTA_PAYLOAD(tb[NDA_LLADDR]) != ETH_ALEN) {
- zlog_warn(
+ zlog_debug(
"%s family %s IF %s(%u) brIF %u - LLADDR is not MAC, len %lu",
nl_msg_type_to_str(h->nlmsg_type),
nl_family_to_str(ndm->ndm_family), ifp->name,
@@ -2167,9 +2172,9 @@ static int netlink_macfdb_update(struct interface *ifp, vlanid_t vid,
zns = zvrf->zns;
zif = ifp->info;
if ((br_if = zif->brslave_info.br_if) == NULL) {
- zlog_warn("MAC %s on IF %s(%u) - no mapping to bridge",
- (cmd == RTM_NEWNEIGH) ? "add" : "del", ifp->name,
- ifp->ifindex);
+ zlog_debug("MAC %s on IF %s(%u) - no mapping to bridge",
+ (cmd == RTM_NEWNEIGH) ? "add" : "del", ifp->name,
+ ifp->ifindex);
return -1;
}
@@ -2252,10 +2257,10 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
netlink_parse_rtattr(tb, NDA_MAX, NDA_RTA(ndm), len);
if (!tb[NDA_DST]) {
- zlog_warn("%s family %s IF %s(%u) - no DST",
- nl_msg_type_to_str(h->nlmsg_type),
- nl_family_to_str(ndm->ndm_family), ifp->name,
- ndm->ndm_ifindex);
+ zlog_debug("%s family %s IF %s(%u) - no DST",
+ nl_msg_type_to_str(h->nlmsg_type),
+ nl_family_to_str(ndm->ndm_family), ifp->name,
+ ndm->ndm_ifindex);
return 0;
}
@@ -2311,7 +2316,7 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
if (h->nlmsg_type == RTM_NEWNEIGH) {
if (tb[NDA_LLADDR]) {
if (RTA_PAYLOAD(tb[NDA_LLADDR]) != ETH_ALEN) {
- zlog_warn(
+ zlog_debug(
"%s family %s IF %s(%u) - LLADDR is not MAC, len %lu",
nl_msg_type_to_str(h->nlmsg_type),
nl_family_to_str(ndm->ndm_family),
@@ -2473,7 +2478,8 @@ int netlink_neigh_change(struct nlmsghdr *h, ns_id_t ns_id)
if (ndm->ndm_family == AF_INET || ndm->ndm_family == AF_INET6)
return netlink_ipneigh_change(h, len, ns_id);
else {
- zlog_warn(
+ flog_warn(
+ ZEBRA_ERR_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 c0ad87ce3..1e51a4820 100644
--- a/zebra/rt_socket.c
+++ b/zebra/rt_socket.c
@@ -72,10 +72,10 @@ static int kernel_rtm_add_labels(struct mpls_label_stack *nh_label,
struct sockaddr_mpls *smpls)
{
if (nh_label->num_labels > 1) {
- zlog_warn(
- "%s: can't push %u labels at "
- "once (maximum is 1)",
- __func__, nh_label->num_labels);
+ flog_warn(ZEBRA_ERR_MAX_LABELS_PUSH,
+ "%s: can't push %u labels at "
+ "once (maximum is 1)",
+ __func__, nh_label->num_labels);
return -1;
}
@@ -399,7 +399,8 @@ enum dp_req_result kernel_route_rib(struct route_node *rn,
int route = 0;
if (src_p && src_p->prefixlen) {
- zlog_warn("%s: IPv6 sourcedest routes unsupported!", __func__);
+ flog_warn(ZEBRA_ERR_UNSUPPORTED_V6_SRCDEST,
+ "%s: IPv6 sourcedest routes unsupported!", __func__);
return DP_REQUEST_FAILURE;
}
diff --git a/zebra/rtadv.c b/zebra/rtadv.c
index 43dfca10e..61b4caa0b 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -181,7 +181,7 @@ static void rtadv_send_packet(int sock, struct interface *ifp)
adata = calloc(1, CMSG_SPACE(sizeof(struct in6_pktinfo)));
if (adata == NULL) {
- zlog_warn(
+ zlog_debug(
"rtadv_send_packet: can't malloc control data");
exit(-1);
}
@@ -468,12 +468,12 @@ static void rtadv_process_advert(uint8_t *msg, unsigned int len,
inet_ntop(AF_INET6, &addr->sin6_addr, addr_str, INET6_ADDRSTRLEN);
if (len < sizeof(struct nd_router_advert)) {
- zlog_warn("%s(%u): Rx RA with invalid length %d from %s",
- ifp->name, ifp->ifindex, len, addr_str);
+ zlog_debug("%s(%u): Rx RA with invalid length %d from %s",
+ ifp->name, ifp->ifindex, len, addr_str);
return;
}
if (!IN6_IS_ADDR_LINKLOCAL(&addr->sin6_addr)) {
- zlog_warn(
+ zlog_debug(
"%s(%u): Rx RA with non-linklocal source address from %s",
ifp->name, ifp->ifindex, addr_str);
return;
@@ -483,21 +483,24 @@ 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)) {
- zlog_warn(
+ flog_warn(
+ ZEBRA_ERR_RA_PARAM_MISMATCH,
"%s(%u): Rx RA - our AdvCurHopLimit doesn't agree with %s",
ifp->name, ifp->ifindex, addr_str);
}
if ((radvert->nd_ra_flags_reserved & ND_RA_FLAG_MANAGED)
&& !zif->rtadv.AdvManagedFlag) {
- zlog_warn(
+ flog_warn(
+ ZEBRA_ERR_RA_PARAM_MISMATCH,
"%s(%u): Rx RA - our AdvManagedFlag doesn't agree with %s",
ifp->name, ifp->ifindex, addr_str);
}
if ((radvert->nd_ra_flags_reserved & ND_RA_FLAG_OTHER)
&& !zif->rtadv.AdvOtherConfigFlag) {
- zlog_warn(
+ flog_warn(
+ ZEBRA_ERR_RA_PARAM_MISMATCH,
"%s(%u): Rx RA - our AdvOtherConfigFlag doesn't agree with %s",
ifp->name, ifp->ifindex, addr_str);
}
@@ -505,7 +508,8 @@ static void rtadv_process_advert(uint8_t *msg, unsigned int len,
if ((radvert->nd_ra_reachable && zif->rtadv.AdvReachableTime)
&& (ntohl(radvert->nd_ra_reachable)
!= zif->rtadv.AdvReachableTime)) {
- zlog_warn(
+ flog_warn(
+ ZEBRA_ERR_RA_PARAM_MISMATCH,
"%s(%u): Rx RA - our AdvReachableTime doesn't agree with %s",
ifp->name, ifp->ifindex, addr_str);
}
@@ -513,7 +517,8 @@ static void rtadv_process_advert(uint8_t *msg, unsigned int len,
if ((radvert->nd_ra_retransmit && zif->rtadv.AdvRetransTimer)
&& (ntohl(radvert->nd_ra_retransmit)
!= (unsigned int)zif->rtadv.AdvRetransTimer)) {
- zlog_warn(
+ flog_warn(
+ ZEBRA_ERR_RA_PARAM_MISMATCH,
"%s(%u): Rx RA - our AdvRetransTimer doesn't agree with %s",
ifp->name, ifp->ifindex, addr_str);
}
@@ -543,7 +548,8 @@ 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) {
- zlog_warn("RA/RS received on unknown IF %u from %s", ifindex,
+ flog_warn(ZEBRA_ERR_UNKNOWN_INTERFACE,
+ "RA/RS received on unknown IF %u from %s", ifindex,
addr_str);
return;
}
@@ -563,8 +569,8 @@ static void rtadv_process_packet(uint8_t *buf, unsigned int len,
/* ICMP message length check. */
if (len < sizeof(struct icmp6_hdr)) {
- zlog_warn("%s(%u): Rx RA with Invalid ICMPV6 packet length %d",
- ifp->name, ifp->ifindex, len);
+ zlog_debug("%s(%u): Rx RA with Invalid ICMPV6 packet length %d",
+ ifp->name, ifp->ifindex, len);
return;
}
@@ -573,15 +579,15 @@ static void rtadv_process_packet(uint8_t *buf, unsigned int len,
/* ICMP message type check. */
if (icmph->icmp6_type != ND_ROUTER_SOLICIT
&& icmph->icmp6_type != ND_ROUTER_ADVERT) {
- zlog_warn("%s(%u): Rx RA - Unwanted ICMPV6 message type %d",
- ifp->name, ifp->ifindex, icmph->icmp6_type);
+ zlog_debug("%s(%u): Rx RA - Unwanted ICMPV6 message type %d",
+ ifp->name, ifp->ifindex, icmph->icmp6_type);
return;
}
/* Hoplimit check. */
if (hoplimit >= 0 && hoplimit != 255) {
- zlog_warn("%s(%u): Rx RA - Invalid hoplimit %d", ifp->name,
- ifp->ifindex, hoplimit);
+ zlog_debug("%s(%u): Rx RA - Invalid hoplimit %d", ifp->name,
+ ifp->ifindex, hoplimit);
return;
}
@@ -614,8 +620,9 @@ static int rtadv_read(struct thread *thread)
&hoplimit);
if (len < 0) {
- zlog_warn("RA/RS recv failed, socket %u error %s", sock,
- safe_strerror(errno));
+ flog_err_sys(LIB_ERR_SOCKET,
+ "RA/RS recv failed, socket %u error %s", sock,
+ safe_strerror(errno));
return len;
}
@@ -822,15 +829,17 @@ 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) {
- zlog_warn("%u: IF %u RA %s client %s - interface unknown",
+ flog_warn(ZEBRA_ERR_UNKNOWN_INTERFACE,
+ "%u: IF %u RA %s client %s - interface unknown",
zvrf_id(zvrf), ifindex, enable ? "enable" : "disable",
zebra_route_string(client->proto));
return;
}
if (ifp->vrf_id != zvrf_id(zvrf)) {
- zlog_warn("%u: IF %u RA %s client %s - VRF mismatch, IF VRF %u",
- zvrf_id(zvrf), ifindex, enable ? "enable" : "disable",
- zebra_route_string(client->proto), ifp->vrf_id);
+ zlog_debug(
+ "%u: IF %u RA %s client %s - VRF mismatch, IF VRF %u",
+ zvrf_id(zvrf), ifindex, enable ? "enable" : "disable",
+ zebra_route_string(client->proto), ifp->vrf_id);
return;
}
@@ -1757,8 +1766,10 @@ 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)
- zlog_warn("%s(%u): Failed to join group, socket %u error %s",
- ifp->name, ifp->ifindex, sock, safe_strerror(errno));
+ flog_err_sys(LIB_ERR_SOCKET,
+ "%s(%u): Failed to join group, socket %u error %s",
+ ifp->name, ifp->ifindex, sock,
+ safe_strerror(errno));
if (IS_ZEBRA_DEBUG_EVENT)
zlog_debug(
@@ -1781,8 +1792,10 @@ static int if_leave_all_router(int sock, struct interface *ifp)
ret = setsockopt(sock, IPPROTO_IPV6, IPV6_LEAVE_GROUP, (char *)&mreq,
sizeof mreq);
if (ret < 0)
- zlog_warn("%s(%u): Failed to leave group, socket %u error %s",
- ifp->name, ifp->ifindex, sock, safe_strerror(errno));
+ flog_err_sys(
+ LIB_ERR_SOCKET,
+ "%s(%u): Failed to leave group, socket %u error %s",
+ ifp->name, ifp->ifindex, sock, safe_strerror(errno));
if (IS_ZEBRA_DEBUG_EVENT)
zlog_debug(
diff --git a/zebra/rtread_getmsg.c b/zebra/rtread_getmsg.c
index b3aeaf2f7..1363fafec 100644
--- a/zebra/rtread_getmsg.c
+++ b/zebra/rtread_getmsg.c
@@ -118,8 +118,8 @@ void route_read(struct zebra_ns *zns)
int flags, dev, retval, process;
if ((dev = open(_PATH_GETMSG_ROUTE, O_RDWR)) == -1) {
- zlog_warn("can't open %s: %s", _PATH_GETMSG_ROUTE,
- safe_strerror(errno));
+ flog_err_sys(LIB_ERR_SYSTEM_CALL, "can't open %s: %s",
+ _PATH_GETMSG_ROUTE, safe_strerror(errno));
return;
}
@@ -140,7 +140,8 @@ void route_read(struct zebra_ns *zns)
flags = 0;
if (putmsg(dev, &msgdata, NULL, flags) == -1) {
- zlog_warn("putmsg failed: %s", safe_strerror(errno));
+ flog_err_sys(LIB_ERR_SOCKET, "putmsg failed: %s",
+ safe_strerror(errno));
goto exit;
}
@@ -152,8 +153,9 @@ void route_read(struct zebra_ns *zns)
retval = getmsg(dev, &msgdata, NULL, &flags);
if (retval == -1) {
- zlog_warn("getmsg(ctl) failed: %s",
- safe_strerror(errno));
+ flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ "getmsg(ctl) failed: %s",
+ safe_strerror(errno));
goto exit;
}
@@ -166,10 +168,10 @@ void route_read(struct zebra_ns *zns)
if ((size_t)msgdata.len >= sizeof(struct T_error_ack)
&& TLIerr->PRIM_type == T_ERROR_ACK) {
- zlog_warn("getmsg(ctl) returned T_ERROR_ACK: %s",
- safe_strerror((TLIerr->TLI_error == TSYSERR)
- ? TLIerr->UNIX_error
- : EPROTO));
+ zlog_debug("getmsg(ctl) returned T_ERROR_ACK: %s",
+ safe_strerror((TLIerr->TLI_error == TSYSERR)
+ ? TLIerr->UNIX_error
+ : EPROTO));
break;
}
@@ -181,7 +183,7 @@ void route_read(struct zebra_ns *zns)
|| TLIack->PRIM_type != T_OPTMGMT_ACK
|| TLIack->MGMT_flags != T_SUCCESS) {
errno = ENOMSG;
- zlog_warn("getmsg(ctl) returned bizarreness");
+ zlog_debug("getmsg(ctl) returned bizarreness");
break;
}
@@ -210,20 +212,21 @@ void route_read(struct zebra_ns *zns)
retval = getmsg(dev, NULL, &msgdata, &flags);
if (retval == -1) {
- zlog_warn("getmsg(data) failed: %s",
- safe_strerror(errno));
+ flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ "getmsg(data) failed: %s",
+ safe_strerror(errno));
goto exit;
}
if (!(retval == 0 || retval == MOREDATA)) {
- zlog_warn("getmsg(data) returned %d", retval);
+ zlog_debug("getmsg(data) returned %d", retval);
goto exit;
}
if (process) {
if (msgdata.len % sizeof(mib2_ipRouteEntry_t)
!= 0) {
- zlog_warn(
+ zlog_debug(
"getmsg(data) returned "
"msgdata.len = %d (%% sizeof (mib2_ipRouteEntry_t) != 0)",
msgdata.len);
diff --git a/zebra/rtread_sysctl.c b/zebra/rtread_sysctl.c
index fba67e3d0..ca3ff2dc6 100644
--- a/zebra/rtread_sysctl.c
+++ b/zebra/rtread_sysctl.c
@@ -47,7 +47,8 @@ void route_read(struct zebra_ns *zns)
/* Get buffer size. */
if (sysctl(mib, MIBSIZ, NULL, &bufsiz, NULL, 0) < 0) {
- zlog_warn("sysctl fail: %s", safe_strerror(errno));
+ flog_warn(ZEBRA_ERR_ZEBRA_ERR_SYSCTL_FAILED, "sysctl fail: %s",
+ safe_strerror(errno));
return;
}
@@ -56,7 +57,8 @@ void route_read(struct zebra_ns *zns)
/* Read routing table information by calling sysctl(). */
if (sysctl(mib, MIBSIZ, buf, &bufsiz, NULL, 0) < 0) {
- zlog_warn("sysctl() fail by %s", safe_strerror(errno));
+ flog_warn(ZEBRA_ERR_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 87d3769a5..4244a9af8 100644
--- a/zebra/rule_netlink.c
+++ b/zebra/rule_netlink.c
@@ -40,6 +40,7 @@
#include "zebra/kernel_netlink.h"
#include "zebra/rule_netlink.h"
#include "zebra/zebra_pbr.h"
+#include "zebra/zebra_errors.h"
/* definitions */
@@ -205,7 +206,8 @@ 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) {
- zlog_warn(
+ flog_warn(
+ ZEBRA_ERR_NETLINK_INVALID_AF,
"Invalid address family: %u received from kernel rule change: %u",
frh->family, h->nlmsg_type);
return 0;
diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c
index d95f78109..c8c3dc2e4 100644
--- a/zebra/zapi_msg.c
+++ b/zebra/zapi_msg.c
@@ -1042,7 +1042,7 @@ static void zread_rnh_register(ZAPI_HANDLER_ARGS)
l += 4;
if (p.family == AF_INET) {
if (p.prefixlen > IPV4_MAX_BITLEN) {
- zlog_warn(
+ zlog_debug(
"%s: Specified prefix hdr->length %d is too large for a v4 address",
__PRETTY_FUNCTION__, p.prefixlen);
return;
@@ -1051,7 +1051,7 @@ static void zread_rnh_register(ZAPI_HANDLER_ARGS)
l += IPV4_MAX_BYTELEN;
} else if (p.family == AF_INET6) {
if (p.prefixlen > IPV6_MAX_BITLEN) {
- zlog_warn(
+ zlog_debug(
"%s: Specified prefix hdr->length %d is to large for a v6 address",
__PRETTY_FUNCTION__, p.prefixlen);
return;
@@ -1126,7 +1126,7 @@ static void zread_rnh_unregister(ZAPI_HANDLER_ARGS)
l += 4;
if (p.family == AF_INET) {
if (p.prefixlen > IPV4_MAX_BITLEN) {
- zlog_warn(
+ zlog_debug(
"%s: Specified prefix hdr->length %d is to large for a v4 address",
__PRETTY_FUNCTION__, p.prefixlen);
return;
@@ -1135,7 +1135,7 @@ static void zread_rnh_unregister(ZAPI_HANDLER_ARGS)
l += IPV4_MAX_BYTELEN;
} else if (p.family == AF_INET6) {
if (p.prefixlen > IPV6_MAX_BITLEN) {
- zlog_warn(
+ zlog_debug(
"%s: Specified prefix hdr->length %d is to large for a v6 address",
__PRETTY_FUNCTION__, p.prefixlen);
return;
@@ -1202,7 +1202,7 @@ static void zread_fec_register(ZAPI_HANDLER_ARGS)
if ((p.family == AF_INET && p.prefixlen > IPV4_MAX_BITLEN)
|| (p.family == AF_INET6
&& p.prefixlen > IPV6_MAX_BITLEN)) {
- zlog_warn(
+ zlog_debug(
"%s: Specified prefix hdr->length: %d is to long for %d",
__PRETTY_FUNCTION__, p.prefixlen, p.family);
return;
@@ -1265,7 +1265,7 @@ static void zread_fec_unregister(ZAPI_HANDLER_ARGS)
if ((p.family == AF_INET && p.prefixlen > IPV4_MAX_BITLEN)
|| (p.family == AF_INET6
&& p.prefixlen > IPV6_MAX_BITLEN)) {
- zlog_warn(
+ zlog_debug(
"%s: Received prefix hdr->length %d which is greater than %d can support",
__PRETTY_FUNCTION__, p.prefixlen, p.family);
return;
@@ -1318,7 +1318,8 @@ void zserv_nexthop_num_warn(const char *caller, const struct prefix *p,
char buff[PREFIX2STR_BUFFER];
prefix2str(p, buff, sizeof(buff));
- zlog_warn(
+ flog_warn(
+ ZEBRA_ERR_MORE_NH_THAN_MULTIPATH,
"%s: Prefix %s has %d nexthops, but we can only use the first %d",
caller, buff, nexthop_num, multipath_num);
}
@@ -1481,7 +1482,8 @@ static void zread_route_add(ZAPI_HANDLER_ARGS)
}
if (!nexthop) {
- zlog_warn(
+ flog_warn(
+ ZEBRA_ERR_NEXTHOP_CREATION_FAILED,
"%s: Nexthops Specified: %d but we failed to properly create one",
__PRETTY_FUNCTION__, api.nexthop_num);
nexthops_free(re->ng.nexthop);
@@ -1521,7 +1523,8 @@ static void zread_route_add(ZAPI_HANDLER_ARGS)
afi = family2afi(api.prefix.family);
if (afi != AFI_IP6 && CHECK_FLAG(api.message, ZAPI_MESSAGE_SRCPFX)) {
- zlog_warn("%s: Received SRC Prefix but afi is not v6",
+ flog_warn(ZEBRA_ERR_RX_SRCDEST_WRONG_AFI,
+ "%s: Received SRC Prefix but afi is not v6",
__PRETTY_FUNCTION__);
nexthops_free(re->ng.nexthop);
XFREE(MTYPE_RE, re);
@@ -1563,7 +1566,8 @@ static void zread_route_del(ZAPI_HANDLER_ARGS)
afi = family2afi(api.prefix.family);
if (afi != AFI_IP6 && CHECK_FLAG(api.message, ZAPI_MESSAGE_SRCPFX)) {
- zlog_warn("%s: Received a src prefix while afi is not v6",
+ flog_warn(ZEBRA_ERR_RX_SRCDEST_WRONG_AFI,
+ "%s: Received a src prefix while afi is not v6",
__PRETTY_FUNCTION__);
return;
}
@@ -1703,7 +1707,7 @@ static void zread_mpls_labels(ZAPI_HANDLER_ARGS)
STREAM_GET(&prefix.u.prefix4.s_addr, s, IPV4_MAX_BYTELEN);
STREAM_GETC(s, prefix.prefixlen);
if (prefix.prefixlen > IPV4_MAX_BITLEN) {
- zlog_warn(
+ zlog_debug(
"%s: Specified prefix length %d is greater than a v4 address can support",
__PRETTY_FUNCTION__, prefix.prefixlen);
return;
@@ -1714,7 +1718,7 @@ static void zread_mpls_labels(ZAPI_HANDLER_ARGS)
STREAM_GET(&prefix.u.prefix6, s, 16);
STREAM_GETC(s, prefix.prefixlen);
if (prefix.prefixlen > IPV6_MAX_BITLEN) {
- zlog_warn(
+ zlog_debug(
"%s: Specified prefix length %d is greater than a v6 address can support",
__PRETTY_FUNCTION__, prefix.prefixlen);
return;
@@ -1722,8 +1726,8 @@ static void zread_mpls_labels(ZAPI_HANDLER_ARGS)
STREAM_GET(&gate.ipv6, s, 16);
break;
default:
- zlog_warn("%s: Specified AF %d is not supported for this call",
- __PRETTY_FUNCTION__, prefix.family);
+ zlog_debug("%s: Specified AF %d is not supported for this call",
+ __PRETTY_FUNCTION__, prefix.family);
return;
}
STREAM_GETL(s, ifindex);
@@ -2077,7 +2081,8 @@ static void zread_pseudowire(ZAPI_HANDLER_ARGS)
switch (hdr->command) {
case ZEBRA_PW_ADD:
if (pw) {
- zlog_warn("%s: pseudowire %s already exists [%s]",
+ flog_warn(ZEBRA_ERR_PSEUDOWIRE_EXISTS,
+ "%s: pseudowire %s already exists [%s]",
__func__, ifname,
zserv_command_string(hdr->command));
return;
@@ -2087,7 +2092,8 @@ static void zread_pseudowire(ZAPI_HANDLER_ARGS)
break;
case ZEBRA_PW_DELETE:
if (!pw) {
- zlog_warn("%s: pseudowire %s not found [%s]", __func__,
+ flog_warn(ZEBRA_ERR_PSEUDOWIRE_NONEXISTENT,
+ "%s: pseudowire %s not found [%s]", __func__,
ifname, zserv_command_string(hdr->command));
return;
}
@@ -2097,7 +2103,8 @@ static void zread_pseudowire(ZAPI_HANDLER_ARGS)
case ZEBRA_PW_SET:
case ZEBRA_PW_UNSET:
if (!pw) {
- zlog_warn("%s: pseudowire %s not found [%s]", __func__,
+ flog_warn(ZEBRA_ERR_PSEUDOWIRE_NONEXISTENT,
+ "%s: pseudowire %s not found [%s]", __func__,
ifname, zserv_command_string(hdr->command));
return;
}
@@ -2509,8 +2516,8 @@ void zserv_handle_commands(struct zserv *client, struct stream *msg)
zvrf = zebra_vrf_lookup_by_id(hdr.vrf_id);
if (!zvrf) {
if (IS_ZEBRA_DEBUG_PACKET && IS_ZEBRA_DEBUG_RECV)
- zlog_warn("ZAPI message specifies unknown VRF: %d",
- hdr.vrf_id);
+ zlog_debug("ZAPI message specifies unknown VRF: %d",
+ hdr.vrf_id);
return;
}
diff --git a/zebra/zebra_errors.c b/zebra/zebra_errors.c
index 198e1cce2..79d9caf11 100644
--- a/zebra/zebra_errors.c
+++ b/zebra/zebra_errors.c
@@ -110,6 +110,12 @@ static struct log_ref ferr_zebra_err[] = {
.suggestion = "Check all configuration parameters for correctness.",
},
{
+ .code = ZEBRA_ERR_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,
.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.",
@@ -266,6 +272,429 @@ static struct log_ref ferr_zebra_err[] = {
.suggestion = "Notify a developer.",
},
{
+ .code = ZEBRA_ERR_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,
+ .title =
+ "Zebra label manager received malformed label request",
+ .description =
+ "Zebra's label manager received a label request from a client whose protocol type does not match the protocol field received in the message.",
+ .suggestion =
+ "This is a bug. Please report it.",
+ },
+ {
+ .code = ZEBRA_ERR_LSP_INSTALL_FAILURE,
+ .title =
+ "Zebra failed to install LSP into the kernel",
+ .description =
+ "Zebra made an attempt to install a label switched path, but the kernel indicated that the installation was not successful.",
+ .suggestion =
+ "Wait for Zebra to reattempt installation.",
+ },
+ {
+ .code = ZEBRA_ERR_LSP_DELETE_FAILURE,
+ .title =
+ "Zebra failed to remove LSP from the kernel",
+ .description =
+ "Zebra made an attempt to remove a label switched path, but the kernel indicated that the deletion was not successful.",
+ .suggestion =
+ "Wait for Zebra to reattempt deletion.",
+ },
+ {
+ .code = ZEBRA_ERR_MPLS_SUPPORT_DISABLED,
+ .title =
+ "Zebra will not run with MPLS support",
+ .description =
+ "Zebra noticed that the running kernel does not support MPLS, so it disabled MPLS support.",
+ .suggestion =
+ "If you want MPLS support, upgrade the kernel to a version that provides MPLS support.",
+ },
+ {
+ .code = ZEBRA_ERR_SYSCTL_FAILED,
+ .title = "A call to sysctl() failed",
+ .description =
+ "sysctl() returned a nonzero exit code, indicating an error.",
+ .suggestion =
+ "The log message should contain further details on the specific error that occurred; investigate the reported error.",
+ },
+ {
+ .code = ZEBRA_ERR_NS_VRF_CREATION_FAILED,
+ .title =
+ "Zebra failed to create namespace VRF",
+ .description =
+ "Zebra failed to create namespace VRF",
+ .suggestion = "",
+ },
+ {
+ .code = ZEBRA_ERR_NS_DELETION_FAILED_NO_VRF,
+ .title =
+ "Zebra attempted to delete nonexistent namespace",
+ .description =
+ "Zebra attempted to delete a particular namespace, but no VRF associated with that namespace could be found to delete.",
+ .suggestion = "Please report this bug.",
+ },
+ {
+ .code = ZEBRA_ERR_IFLIST_FAILED,
+ .title =
+ "Zebra interface listing failed",
+ .description =
+ "Zebra encountered an error attempting to query sysctl for a list of interfaces on the system.",
+ .suggestion =
+ "Check that Zebra is running with the appropriate permissions. If it is, please report this as a bug.",
+ },
+ {
+ .code = ZEBRA_ERR_IRDP_BAD_CHECKSUM,
+ .title =
+ "Zebra received ICMP packet with invalid checksum",
+ .description =
+ "Zebra received an ICMP packet with a bad checksum and has silently ignored it.",
+ .suggestion =
+ "If the problem continues to occur, investigate the source of the bad ICMP packets.",
+ },
+ {
+ .code = ZEBRA_ERR_IRDP_BAD_TYPE_CODE,
+ .title =
+ "Zebra received ICMP packet with bad type code",
+ .description =
+ "Zebra received an ICMP packet with a bad code for the message type and has silently ignored it.",
+ .suggestion =
+ "If the problem continues to occur, investigate the source of the bad ICMP packets.",
+ },
+ {
+ .code = ZEBRA_ERR_IRDP_BAD_RX_FLAGS,
+ .title =
+ "Zebra received IRDP packet while operating in wrong mode",
+ .description =
+ "Zebra received a multicast IRDP packet while operating in unicast mode, or vice versa.",
+ .suggestion =
+ "If you wish to receive the messages, change your IRDP settings accordingly.",
+ },
+ {
+ .code = ZEBRA_ERR_IRDP_BAD_TYPE,
+ .title =
+ "Zebra received IRDP packet with bad type",
+ .description =
+ "THIS IS BULLSHIT REMOVE ME",
+ .suggestion = "asdf",
+ },
+ {
+ .code = ZEBRA_ERR_RNH_NO_TABLE,
+ .title =
+ "Zebra could not find table for next hop",
+ .description =
+ "Zebra attempted to add a next hop but could not find the appropriate table to install it in.",
+ .suggestion = "Please report this bug.",
+ },
+ {
+ .code = ZEBRA_ERR_FPM_FORMAT_UNKNOWN,
+ .title =
+ "Unknown message format for Zebra's FPM module",
+ .description =
+ "Zebra's FPM module takes an argument which specifies the message format to use, but the format was either not provided or was not a valid format. The FPM interface will be disabled.",
+ .suggestion =
+ "Provide or correct the module argument to provide a valid format. See documentation for further information.",
+ },
+ {
+ .code = ZEBRA_ERR_CLIENT_IO_ERROR,
+ .title =
+ "Zebra client connection failed",
+ .description =
+ "A Zebra client encountered an I/O error and is shutting down. This can occur under normal circumstances, such as when FRR is restarting or shutting down; it can also happen if the daemon crashed. Usually this warning can be ignored.",
+ .suggestion =
+ "Ignore this warning, it is mostly informational.",
+ },
+ {
+ .code = ZEBRA_ERR_CLIENT_WRITE_FAILED,
+ .title =
+ "Zebra failed to send message to client",
+ .description =
+ "Zebra attempted to send a message to one of its clients, but the write operation failed. The connection will be closed.",
+ .suggestion =
+ "Ignore this warning, it is mostly informational.",
+ },
+ {
+ .code = ZEBRA_ERR_NETLINK_INVALID_AF,
+ .title =
+ "Zebra received Netlink message with invalid family",
+ .description =
+ "Zebra received a Netlink message with an invalid address family.",
+ .suggestion =
+ "Inspect the logged address family and submit it with a bug report.",
+ },
+ {
+ .code = ZEBRA_ERR_REMOVE_ADDR_UNKNOWN_SUBNET,
+ .title =
+ "Zebra tried to remove address from unknown subnet",
+ .description =
+ "Zebra attempted to remove an address from an unknown subnet.",
+ .suggestion =
+ "This is a bug, please report it.",
+ },
+ {
+ .code = ZEBRA_ERR_REMOVE_UNREGISTERED_ADDR,
+ .title =
+ "Zebra tried to remove unregistered address",
+ .description =
+ "Zebra attempted to remove an address from a subnet it was not registered on.",
+ .suggestion =
+ "This is a bug, please report it.",
+ },
+ {
+ .code = ZEBRA_ERR_PTM_NOT_READY,
+ .title =
+ "Interface is up but PTM check has not completed",
+ .description =
+ "Zebra noticed that an interface came up and attempted to perform its usual setup procedures, but the PTM check failed and the operation was aborted.",
+ .suggestion =
+ "If the problem persists, ensure that the interface is actually up and that PTM is functioning properly.",
+ },
+ {
+ .code = ZEBRA_ERR_UNSUPPORTED_V4_SRCDEST,
+ .title =
+ "Kernel rejected sourcedest route",
+ .description =
+ "Zebra attempted to install a sourcedest route into the kernel, but the kernel did not acknowledge its installation. The route is unsupported.",
+ .suggestion =
+ "Check configuration values for correctness",
+ },
+ {
+ .code = ZEBRA_ERR_UNKNOWN_INTERFACE,
+ .title =
+ "Zebra encountered an unknown interface specifier",
+ .description =
+ "Zebra was asked to look up an interface with a given name or index, but could not find the interface corresponding to the given name or index.",
+ .suggestion =
+ "Check configuration values for correctness.",
+ },
+ {
+ .code = ZEBRA_ERR_VRF_NOT_FOUND,
+ .title =
+ "Zebra could not find the specified VRF",
+ .description =
+ "Zebra tried to look up a VRF, either by name or ID, and could not find it. This could be due to internal inconsistency (a bug) or a configuration error.",
+ .suggestion =
+ "Check configuration values for correctness. If values are correct, please file a bug report.",
+ },
+ {
+ .code = ZEBRA_ERR_MORE_NH_THAN_MULTIPATH,
+ .title =
+ "More nexthops were provided than the configured multipath limit",
+ .description =
+ "A route with multiple nexthops was given, but the number of nexthops exceeded the configured multipath limit.",
+ .suggestion =
+ "Reduce the number of nexthops, or increase the multipath limit.",
+ },
+ {
+ .code = ZEBRA_ERR_NEXTHOP_CREATION_FAILED,
+ .title =
+ "Zebra failed to create one or more nexthops",
+ .description =
+ "While attempting to create nexthops for a route installation operation, Zebra found that it was unable to create one or more of the given nexthops.",
+ .suggestion =
+ "Check configuration values for correctness. If they are correct, report this as a bug.",
+ },
+ {
+ .code = ZEBRA_ERR_RX_SRCDEST_WRONG_AFI,
+ .title =
+ "Zebra received sourcedest route install without IPv6 address family",
+ .description =
+ "Zebra received a message from a client requesting a sourcedest route installation, but the address family was not set to IPv6. Only IPv6 is supported for sourcedest routing.",
+ .suggestion =
+ "This is a bug; please report it.",
+ },
+ {
+ .code = ZEBRA_ERR_PSEUDOWIRE_EXISTS,
+ .title =
+ "Zebra received an installation / creation request for a pseudowire that already exists",
+ .description =
+ "Zebra received an installation or creation request for a pseudowire that already exists, so the installation / creation has been skipped.",
+ .suggestion =
+ "This message is informational.",
+ },
+ {
+ .code = ZEBRA_ERR_PSEUDOWIRE_NONEXISTENT,
+ .title =
+ "Zebra received an uninstallation / deletion request for a pseudowire that already exists",
+ .description =
+ "Zebra received an uninstallation / deletion request for a pseudowire that doesn't exist, so the uninstallation / deletion has been skipped.",
+ .suggestion =
+ "This message is informational.",
+ },
+ {
+ .code = ZEBRA_ERR_PSEUDOWIRE_UNINSTALL_NOT_FOUND,
+ .title =
+ "Zebra received uninstall request for a pseudowire that doesn't exist",
+ .description =
+ "Zebra received an uninstall request for a pseudowire that doesn't exist, so the uninstallation has been skipped.",
+ .suggestion =
+ "This message is informational.",
+ },
+ {
+ .code = ZEBRA_ERR_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.",
+ .suggestion =
+ "This warning is situational; it is usually informative but can indicate a misconfiguration.",
+ },
+ {
+ .code = ZEBRA_ERR_IFACE_ADDR_ADD_FAILED,
+ .title =
+ "Zebra failed to add address to interface",
+ .description =
+ "Zebra attempted to add an address to an interface but was unsuccessful.",
+ .suggestion =
+ "Check configuration values for correctness.",
+ },
+ {
+ .code = ZEBRA_ERR_IRDP_CANNOT_ACTIVATE_IFACE,
+ .title =
+ "Zebra could not enable IRDP on interface",
+ .description =
+ "Zebra attempted to enable IRDP on an interface, but could not create the IRDP socket. The system may be out of socket resources, or privilege elevation may have failed.",
+ .suggestion =
+ "Verify that Zebra has the appropriate privileges and that the system has sufficient socket resources.",
+ },
+ {
+ .code = ZEBRA_ERR_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.",
+ .suggestion =
+ "Bring up the interface that IRDP is desired on.",
+ },
+ {
+ .code = ZEBRA_ERR_IRDP_IFACE_MCAST_DISABLED,
+ .title =
+ "Zebra cannot enable IRDP on interface because multicast is disabled",
+ .description =
+ "Zebra attempted to enable IRDP on an interface, but multicast functionality was not enabled on the interface.",
+ .suggestion =
+ "Enable multicast on the interface.",
+ },
+ {
+ .code = ZEBRA_ERR_NETLINK_EXTENDED_WARNING,
+ .title =
+ "Zebra received warning message from Netlink",
+ .description =
+ "Zebra received a warning message from Netlink",
+ .suggestion =
+ "This message is informational. See the Netlink error message for details.",
+ },
+ {
+ .code = ZEBRA_ERR_NAMESPACE_DIR_INACCESSIBLE,
+ .title =
+ "Zebra could not access /var/run/netns",
+ .description =
+ "Zebra tried to verify that the run directory for Linux network namespaces existed, but this test failed.",
+ .suggestion =
+ "Ensure that Zebra has the proper privileges to access this directory.",
+ },
+ {
+ .code = ZEBRA_ERR_CONNECTED_AFI_UNKNOWN,
+ .title =
+ "Zebra received unknown address family on interface",
+ .description =
+ "Zebra received a notification of a connected prefix on an interface but did not recognize the address family as IPv4 or IPv6",
+ .suggestion =
+ "This message is informational.",
+ },
+ {
+ .code = ZEBRA_ERR_IFACE_SAME_LOCAL_AS_PEER,
+ .title =
+ "Zebra route has same destination address as local interface",
+ .description =
+ "Zebra noticed that a route on an interface has the same destination address as an address on the interface itself, which may cause issues with routing protocols.",
+ .suggestion =
+ "Investigate the source of the route to determine why the destination and interface addresses are the same.",
+ },
+ {
+ .code = ZEBRA_ERR_BCAST_ADDR_MISMATCH,
+ .title =
+ "Zebra broadcast address sanity check failed",
+ .description =
+ "Zebra computed the broadcast address for a connected prefix based on the netmask and found that it did not match the broadcast address it received for the prefix on that interface",
+ .suggestion =
+ "Investigate the source of the broadcast address to determine why it does not match the computed address.",
+ },
+ {
+ .code = ZEBRA_ERR_REDISTRIBUTE_UNKNOWN_AF,
+ .title =
+ "Zebra encountered unknown address family during redistribution",
+ .description =
+ "During a redistribution operation Zebra encountered an unknown address family.",
+ .suggestion =
+ "This warning can be ignored; the redistribution operation will skip the unknown address family.",
+ },
+ {
+ .code = ZEBRA_ERR_ADVERTISING_UNUSABLE_ADDR,
+ .title =
+ "Zebra advertising unusable interface address",
+ .description =
+ "Zebra is advertising an address on an interface that is not yet fully installed on the interface.",
+ .suggestion =
+ "This message is informational. The address should show up on the interface shortly after advertisement.",
+ },
+ {
+ .code = ZEBRA_ERR_RA_PARAM_MISMATCH,
+ .title =
+ "Zebra received route advertisement with parameter mismatch",
+ .description =
+ "Zebra received a router advertisement, but one of the non-critical parameters (AdvCurHopLimit, AdvManagedFlag, AdvOtherConfigFlag, AdvReachableTime or AdvRetransTimer) does not match Zebra's local settings.",
+ .suggestion =
+ "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,
+ .title =
+ "Zebra received kernel message with uknown version",
+ .description =
+ "Zebra received a message from the kernel with a message version that does not match Zebra's internal version. Depending on version compatibility, this may cause issues sending and receiving messages to the kernel.",
+ .suggestion =
+ "If issues arise, check if there is a version of FRR available for your kernel version.",
+ },
+ {
+ .code = ZEBRA_ERR_RTM_NO_GATEWAY,
+ .title =
+ "Zebra could not determine proper gateway for kernel route",
+ .description =
+ "Zebra attempted to install a route into the kernel, but noticed it had no gateway and no interface with a gateway could be located.",
+ .suggestion =
+ "Check configuration values for correctness.",
+ },
+ {
+ .code = ZEBRA_ERR_MAX_LABELS_PUSH,
+ .title =
+ "Zebra exceeded maximum LSP labels for a single rtmsg",
+ .description =
+ "Zebra attempted to push more than one label into the kernel; the maximum on OpenBSD is 1 label.",
+ .suggestion =
+ "This message is informational.",
+ },
+ {
+ .code = ZEBRA_ERR_STICKY_MAC_ALREADY_LEARNT,
+ .title =
+ "EVPN MAC already learnt as remote sticky MAC",
+ .description =
+ "Zebra tried to handle a local MAC addition but noticed that it had already learnt the MAC from a remote peer.",
+ .suggestion =
+ "Check configuration values for correctness.",
+ },
+ {
+ .code = ZEBRA_ERR_UNSUPPORTED_V6_SRCDEST,
+ .title =
+ "Kernel does not support IPv6 sourcedest routes",
+ .description =
+ "Zebra attempted to install a sourcedest route into the kernel, but IPv6 sourcedest routes are not supported on the current kernel.",
+ .suggestion =
+ "Do not use v6 sourcedest routes, or upgrade your kernel.",
+ },
+ {
.code = END_FERR,
}
};
diff --git a/zebra/zebra_errors.h b/zebra/zebra_errors.h
index f8a00bce0..650f74871 100644
--- a/zebra/zebra_errors.h
+++ b/zebra/zebra_errors.h
@@ -41,6 +41,7 @@ enum zebra_log_refs {
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,
@@ -66,6 +67,56 @@ enum zebra_log_refs {
ZEBRA_ERR_VNI_DEL_FAILED,
ZEBRA_ERR_VTEP_ADD_FAILED,
ZEBRA_ERR_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,
};
void zebra_error_init(void);
diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c
index 1cb14abbf..dae37cbd3 100644
--- a/zebra/zebra_fpm.c
+++ b/zebra/zebra_fpm.c
@@ -1538,7 +1538,8 @@ static inline void zfpm_init_message_format(const char *format)
return;
}
- zlog_warn("Unknown fpm format '%s'", format);
+ flog_warn(ZEBRA_ERR_FPM_FORMAT_UNKNOWN, "Unknown fpm format '%s'",
+ format);
}
/**
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c
index 8f48cc519..9a76408bb 100644
--- a/zebra/zebra_mpls.c
+++ b/zebra/zebra_mpls.c
@@ -1728,7 +1728,8 @@ 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);
- zlog_warn("LSP Install Failure: %u", lsp->ile.in_label);
+ flog_warn(ZEBRA_ERR_LSP_INSTALL_FAILURE,
+ "LSP Install Failure: %u", lsp->ile.in_label);
break;
case DP_INSTALL_SUCCESS:
SET_FLAG(lsp->flags, LSP_FLAG_INSTALLED);
@@ -1746,7 +1747,8 @@ void kernel_lsp_pass_fail(zebra_lsp_t *lsp, enum dp_results res)
clear_nhlfe_installed(lsp);
break;
case DP_DELETE_FAILURE:
- zlog_warn("LSP Deletion Failure: %u", lsp->ile.in_label);
+ flog_warn(ZEBRA_ERR_LSP_DELETE_FAILURE,
+ "LSP Deletion Failure: %u", lsp->ile.in_label);
break;
}
}
@@ -2945,7 +2947,8 @@ void zebra_mpls_init(void)
mpls_enabled = 0;
if (mpls_kernel_init() < 0) {
- zlog_warn("Disabling MPLS support (no kernel support)");
+ flog_warn(ZEBRA_ERR_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 542de27e8..44eb64cbd 100644
--- a/zebra/zebra_mpls_openbsd.c
+++ b/zebra/zebra_mpls_openbsd.c
@@ -256,11 +256,11 @@ 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) {
- zlog_warn(
- "%s: can't push %u labels at once "
- "(maximum is 1)",
- __func__,
- nhlfe->nexthop->nh_label->num_labels);
+ flog_warn(ZEBRA_ERR_MAX_LABELS_PUSH,
+ "%s: can't push %u labels at once "
+ "(maximum is 1)",
+ __func__,
+ nhlfe->nexthop->nh_label->num_labels);
continue;
}
@@ -359,8 +359,8 @@ static int kmpw_install(struct zebra_pw *pw)
imr.imr_type = IMR_TYPE_ETHERNET_TAGGED;
break;
default:
- zlog_warn("%s: unhandled pseudowire type (%#X)", __func__,
- pw->type);
+ zlog_debug("%s: unhandled pseudowire type (%#X)", __func__,
+ pw->type);
return -1;
}
@@ -381,8 +381,8 @@ static int kmpw_install(struct zebra_pw *pw)
sa_in6->sin6_addr = pw->nexthop.ipv6;
break;
default:
- zlog_warn("%s: unhandled pseudowire address-family (%u)",
- __func__, pw->af);
+ zlog_debug("%s: unhandled pseudowire address-family (%u)",
+ __func__, pw->af);
return -1;
}
memcpy(&imr.imr_nexthop, (struct sockaddr *)&ss,
@@ -430,13 +430,13 @@ int mpls_kernel_init(void)
socklen_t optlen;
if ((kr_state.fd = socket(AF_ROUTE, SOCK_RAW, 0)) == -1) {
- zlog_warn("%s: socket", __func__);
+ flog_err_sys(LIB_ERR_SOCKET, "%s: socket", __func__);
return -1;
}
if ((kr_state.ioctl_fd = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0))
== -1) {
- zlog_warn("%s: ioctl socket", __func__);
+ flog_err_sys(LIB_ERR_SOCKET, "%s: ioctl socket", __func__);
return -1;
}
@@ -445,7 +445,8 @@ int mpls_kernel_init(void)
if (getsockopt(kr_state.fd, SOL_SOCKET, SO_RCVBUF, &default_rcvbuf,
&optlen)
== -1)
- zlog_warn("kr_init getsockopt SOL_SOCKET SO_RCVBUF");
+ flog_err_sys(LIB_ERR_SOCKET,
+ "kr_init getsockopt SOL_SOCKET SO_RCVBUF");
else
for (rcvbuf = MAX_RTSOCK_BUF;
rcvbuf > default_rcvbuf
diff --git a/zebra/zebra_netns_id.c b/zebra/zebra_netns_id.c
index a3278c478..9921ce017 100644
--- a/zebra/zebra_netns_id.c
+++ b/zebra/zebra_netns_id.c
@@ -269,7 +269,7 @@ ns_id_t zebra_ns_id_get(const char *netnspath)
close(sock);
close(fd);
if (errno == ENOTSUP) {
- zlog_warn("NEWNSID locally generated");
+ zlog_debug("NEWNSID locally generated");
return zebra_ns_id_get_fallback(netnspath);
}
return NS_UNKNOWN;
@@ -337,7 +337,8 @@ 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) {
- zlog_warn("NS check: failed to access %s", NS_RUN_DIR);
+ flog_warn(ZEBRA_ERR_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 12207805d..be36dc96b 100644
--- a/zebra/zebra_netns_notify.c
+++ b/zebra/zebra_netns_notify.c
@@ -42,6 +42,7 @@
#include "zebra_netns_notify.h"
#include "zebra_netns_id.h"
+#include "zebra_errors.h"
#ifdef HAVE_NETLINK
@@ -85,13 +86,14 @@ static void zebra_ns_notify_create_context_from_entry_name(const char *name)
/* if VRF with NS ID already present */
vrf = vrf_lookup_by_id((vrf_id_t)ns_id_external);
if (vrf) {
- zlog_warn(
+ zlog_debug(
"NS notify : same NSID used by VRF %s. Ignore NS %s creation",
vrf->name, netnspath);
return;
}
if (vrf_handler_create(NULL, name, &vrf) != CMD_SUCCESS) {
- zlog_warn("NS notify : failed to create VRF %s", name);
+ flog_warn(ZEBRA_ERR_NS_VRF_CREATION_FAILED,
+ "NS notify : failed to create VRF %s", name);
ns_map_nsid_with_external(ns_id, false);
return;
}
@@ -100,7 +102,8 @@ static void zebra_ns_notify_create_context_from_entry_name(const char *name)
ns_id_external, ns_id);
}
if (ret != CMD_SUCCESS) {
- zlog_warn("NS notify : failed to create NS %s", netnspath);
+ flog_warn(ZEBRA_ERR_NS_VRF_CREATION_FAILED,
+ "NS notify : failed to create NS %s", netnspath);
ns_map_nsid_with_external(ns_id, false);
vrf_delete(vrf);
return;
@@ -130,9 +133,8 @@ static int zebra_ns_delete(char *name)
struct ns *ns;
if (!vrf) {
- zlog_warn(
- "NS notify : no VRF found using NS %s",
- name);
+ flog_warn(ZEBRA_ERR_NS_DELETION_FAILED_NO_VRF,
+ "NS notify : no VRF found using NS %s", name);
return 0;
}
/* Clear configured flag and invoke delete. */
@@ -237,8 +239,9 @@ 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) {
- zlog_warn("NS notify read: failed to read (%s)",
- safe_strerror(errno));
+ flog_err_sys(ZEBRA_ERR_NS_NOTIFY_READ,
+ "NS notify read: failed to read (%s)",
+ safe_strerror(errno));
return 0;
}
for (event = (struct inotify_event *)buf; (char *)event < &buf[len];
@@ -254,12 +257,14 @@ static int zebra_ns_notify_read(struct thread *t)
if (offsetof(struct inotify_event, name) + event->len
>= sizeof(buf)) {
- zlog_err("NS notify read: buffer underflow");
+ flog_err(ZEBRA_ERR_NS_NOTIFY_READ,
+ "NS notify read: buffer underflow");
break;
}
if (strnlen(event->name, event->len) == event->len) {
- zlog_err("NS notify error: bad event name");
+ flog_err(ZEBRA_ERR_NS_NOTIFY_READ,
+ "NS notify error: bad event name");
break;
}
@@ -283,7 +288,8 @@ void zebra_ns_notify_parse(void)
DIR *srcdir = opendir(NS_RUN_DIR);
if (srcdir == NULL) {
- zlog_warn("NS parsing init: failed to parse %s", NS_RUN_DIR);
+ flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ "NS parsing init: failed to parse %s", NS_RUN_DIR);
return;
}
while ((dent = readdir(srcdir)) != NULL) {
@@ -293,13 +299,15 @@ void zebra_ns_notify_parse(void)
|| strcmp(dent->d_name, "..") == 0)
continue;
if (fstatat(dirfd(srcdir), dent->d_name, &st, 0) < 0) {
- zlog_warn("NS parsing init: failed to parse entry %s",
- dent->d_name);
+ flog_err_sys(
+ LIB_ERR_SYSTEM_CALL,
+ "NS parsing init: failed to parse entry %s",
+ dent->d_name);
continue;
}
if (S_ISDIR(st.st_mode)) {
- zlog_warn("NS parsing init: %s is not a NS",
- dent->d_name);
+ zlog_debug("NS parsing init: %s is not a NS",
+ dent->d_name);
continue;
}
if (zebra_ns_notify_is_default_netns(dent->d_name)) {
@@ -321,13 +329,16 @@ void zebra_ns_notify_init(void)
zebra_netns_notify_current = NULL;
fd_monitor = inotify_init();
if (fd_monitor < 0) {
- zlog_warn("NS notify init: failed to initialize inotify (%s)",
- safe_strerror(errno));
+ flog_err_sys(
+ LIB_ERR_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) {
- zlog_warn("NS notify watch: failed to add watch (%s)",
- safe_strerror(errno));
+ flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ "NS notify watch: failed to add watch (%s)",
+ safe_strerror(errno));
}
zebra_netns_notify_current = thread_add_read(
zebrad.master, zebra_ns_notify_read, NULL, fd_monitor, NULL);
diff --git a/zebra/zebra_pbr.c b/zebra/zebra_pbr.c
index e2217a5d2..275e045d4 100644
--- a/zebra/zebra_pbr.c
+++ b/zebra/zebra_pbr.c
@@ -464,8 +464,8 @@ void zebra_pbr_del_rule(struct zebra_ns *zns, struct zebra_pbr_rule *rule)
hash_release(zns->rules_hash, lookup);
XFREE(MTYPE_TMP, lookup);
} else
- zlog_warn("%s: Rule being deleted we know nothing about",
- __PRETTY_FUNCTION__);
+ zlog_debug("%s: Rule being deleted we know nothing about",
+ __PRETTY_FUNCTION__);
}
static void zebra_pbr_cleanup_rules(struct hash_backet *b, void *data)
@@ -581,8 +581,9 @@ void zebra_pbr_destroy_ipset(struct zebra_ns *zns,
hash_release(zns->ipset_hash, lookup);
XFREE(MTYPE_TMP, lookup);
} else
- zlog_warn("%s: IPSet Entry being deleted we know nothing about",
- __PRETTY_FUNCTION__);
+ zlog_debug(
+ "%s: IPSet Entry being deleted we know nothing about",
+ __PRETTY_FUNCTION__);
}
struct pbr_ipset_name_lookup {
@@ -665,8 +666,8 @@ void zebra_pbr_del_ipset_entry(struct zebra_ns *zns,
hash_release(zns->ipset_entry_hash, lookup);
XFREE(MTYPE_TMP, lookup);
} else
- zlog_warn("%s: IPSet being deleted we know nothing about",
- __PRETTY_FUNCTION__);
+ zlog_debug("%s: IPSet being deleted we know nothing about",
+ __PRETTY_FUNCTION__);
}
static void *pbr_iptable_alloc_intern(void *arg)
@@ -716,8 +717,8 @@ void zebra_pbr_del_iptable(struct zebra_ns *zns,
}
XFREE(MTYPE_TMP, lookup);
} else
- zlog_warn("%s: IPTable being deleted we know nothing about",
- __PRETTY_FUNCTION__);
+ zlog_debug("%s: IPTable being deleted we know nothing about",
+ __PRETTY_FUNCTION__);
}
/*
diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c
index 39cb073b7..5bbb8ec59 100644
--- a/zebra/zebra_ptm.c
+++ b/zebra/zebra_ptm.c
@@ -116,13 +116,13 @@ void zebra_ptm_init(void)
ptm_cb.out_data = calloc(1, ZEBRA_PTM_SEND_MAX_SOCKBUF);
if (!ptm_cb.out_data) {
- zlog_warn("%s: Allocation of send data failed", __func__);
+ zlog_debug("%s: Allocation of send data failed", __func__);
return;
}
ptm_cb.in_data = calloc(1, ZEBRA_PTM_MAX_SOCKBUF);
if (!ptm_cb.in_data) {
- zlog_warn("%s: Allocation of recv data failed", __func__);
+ zlog_debug("%s: Allocation of recv data failed", __func__);
free(ptm_cb.out_data);
return;
}
@@ -180,8 +180,8 @@ static int zebra_ptm_flush_messages(struct thread *thread)
switch (buffer_flush_available(ptm_cb.wb, ptm_cb.ptm_sock)) {
case BUFFER_ERROR:
- zlog_warn("%s ptm socket error: %s", __func__,
- safe_strerror(errno));
+ flog_err_sys(LIB_ERR_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);
@@ -206,8 +206,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:
- zlog_warn("%s ptm socket error: %s", __func__,
- safe_strerror(errno));
+ flog_err_sys(LIB_ERR_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);
@@ -608,7 +608,8 @@ static int zebra_ptm_handle_msg_cb(void *arg, void *in_ctxt)
ifp = if_lookup_by_name_all_vrf(port_str);
if (!ifp) {
- zlog_warn("%s: %s not found in interface list",
+ flog_warn(ZEBRA_ERR_UNKNOWN_INTERFACE,
+ "%s: %s not found in interface list",
__func__, port_str);
return -1;
}
@@ -647,8 +648,9 @@ int zebra_ptm_sock_read(struct thread *thread)
if (((rc == 0) && !errno)
|| (errno && (errno != EWOULDBLOCK) && (errno != EAGAIN))) {
- zlog_warn("%s routing socket error: %s(%d) bytes %d",
- __func__, safe_strerror(errno), errno, rc);
+ flog_err_sys(LIB_ERR_SOCKET,
+ "%s routing socket error: %s(%d) bytes %d",
+ __func__, safe_strerror(errno), errno, rc);
close(ptm_cb.ptm_sock);
ptm_cb.ptm_sock = -1;
@@ -1032,8 +1034,8 @@ int zebra_ptm_bfd_client_deregister(struct zserv *client)
return 0;
if (IS_ZEBRA_DEBUG_EVENT)
- zlog_warn("bfd_client_deregister msg for client %s",
- zebra_route_string(proto));
+ zlog_debug("bfd_client_deregister msg for client %s",
+ zebra_route_string(proto));
if (ptm_cb.ptm_sock == -1) {
ptm_cb.t_timer = NULL;
@@ -1269,7 +1271,7 @@ static void zebra_ptm_send_bfdd(struct stream *msg)
/* Create copy for replication. */
msgc = stream_dup(msg);
if (msgc == NULL) {
- zlog_warn("%s: not enough memory", __func__);
+ zlog_debug("%s: not enough memory", __func__);
return;
}
@@ -1283,7 +1285,7 @@ static void zebra_ptm_send_bfdd(struct stream *msg)
/* Allocate more messages. */
msg = stream_dup(msgc);
if (msg == NULL) {
- zlog_warn("%s: not enough memory", __func__);
+ zlog_debug("%s: not enough memory", __func__);
return;
}
}
@@ -1301,7 +1303,7 @@ static void zebra_ptm_send_clients(struct stream *msg)
/* Create copy for replication. */
msgc = stream_dup(msg);
if (msgc == NULL) {
- zlog_warn("%s: not enough memory", __func__);
+ zlog_debug("%s: not enough memory", __func__);
return;
}
@@ -1324,7 +1326,7 @@ static void zebra_ptm_send_clients(struct stream *msg)
/* Allocate more messages. */
msg = stream_dup(msgc);
if (msg == NULL) {
- zlog_warn("%s: not enough memory", __func__);
+ zlog_debug("%s: not enough memory", __func__);
return;
}
}
@@ -1366,7 +1368,7 @@ static int _zebra_ptm_bfd_client_deregister(struct zserv *zs)
/* Generate, send message and free() daemon related data. */
msg = stream_new(ZEBRA_MAX_PACKET_SIZ);
if (msg == NULL) {
- zlog_warn("%s: not enough memory", __func__);
+ zlog_debug("%s: not enough memory", __func__);
return 0;
}
@@ -1429,7 +1431,7 @@ static void _zebra_ptm_reroute(struct zserv *zs, struct stream *msg,
*/
msgc = stream_new(ZEBRA_MAX_PACKET_SIZ);
if (msgc == NULL) {
- zlog_warn("%s: not enough memory", __func__);
+ zlog_debug("%s: not enough memory", __func__);
return;
}
@@ -1528,7 +1530,7 @@ void zebra_ptm_bfd_dst_replay(ZAPI_HANDLER_ARGS)
*/
msgc = stream_new(ZEBRA_MAX_PACKET_SIZ);
if (msgc == NULL) {
- zlog_warn("%s: not enough memory", __func__);
+ zlog_debug("%s: not enough memory", __func__);
return;
}
diff --git a/zebra/zebra_pw.c b/zebra/zebra_pw.c
index c6db1463f..fb9a40fe3 100644
--- a/zebra/zebra_pw.c
+++ b/zebra/zebra_pw.c
@@ -248,8 +248,8 @@ static int zebra_pw_check_reachability(struct zebra_pw *pw)
&pw->nexthop, NULL);
if (!re) {
if (IS_ZEBRA_DEBUG_PW)
- zlog_warn("%s: no route found for %s", __func__,
- pw->ifname);
+ zlog_debug("%s: no route found for %s", __func__,
+ pw->ifname);
return -1;
}
@@ -260,8 +260,8 @@ static int zebra_pw_check_reachability(struct zebra_pw *pw)
for (ALL_NEXTHOPS(re->ng, nexthop)) {
if (!nexthop->nh_label) {
if (IS_ZEBRA_DEBUG_PW)
- zlog_warn("%s: unlabeled route for %s",
- __func__, pw->ifname);
+ zlog_debug("%s: unlabeled route for %s",
+ __func__, pw->ifname);
return -1;
}
}
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 49d2f2694..5a0c722e3 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -1046,8 +1046,9 @@ 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);
- zlog_warn("%u:%s: Route install failed", re->vrf_id,
- prefix2str(p, buf, sizeof(buf)));
+ flog_err(ZEBRA_ERR_DP_INSTALL_FAIL,
+ "%u:%s: Route install failed", re->vrf_id,
+ prefix2str(p, buf, sizeof(buf)));
break;
case DP_DELETE_SUCCESS:
/*
@@ -1070,8 +1071,9 @@ void kernel_route_rib_pass_fail(struct route_node *rn, const struct prefix *p,
* delete fails?
*/
dest->selected_fib = NULL;
- zlog_warn("%u:%s: Route Deletion failure", re->vrf_id,
- prefix2str(p, buf, sizeof(buf)));
+ flog_err(ZEBRA_ERR_DP_DELETE_FAIL,
+ "%u:%s: Route Deletion failure", re->vrf_id,
+ prefix2str(p, buf, sizeof(buf)));
zsend_route_notify_owner(re, p, ZAPI_ROUTE_REMOVE_FAIL);
break;
diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c
index 0b585af6a..e9c2a4d7f 100644
--- a/zebra/zebra_rnh.c
+++ b/zebra/zebra_rnh.c
@@ -118,7 +118,8 @@ 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));
- zlog_warn("%u: Add RNH %s type %d - table not found", vrfid,
+ flog_warn(ZEBRA_ERR_RNH_NO_TABLE,
+ "%u: Add RNH %s type %d - table not found", vrfid,
buf, type);
exists = false;
return NULL;
@@ -249,7 +250,7 @@ static void addr2hostprefix(int af, const union g_addr *addr,
break;
default:
memset(prefix, 0, sizeof(*prefix));
- zlog_warn("%s: unknown address family %d", __func__, af);
+ zlog_debug("%s: unknown address family %d", __func__, af);
break;
}
}
diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c
index 33d0bcd23..1570edcad 100644
--- a/zebra/zebra_vxlan.c
+++ b/zebra/zebra_vxlan.c
@@ -208,8 +208,8 @@ static int host_rb_entry_compare(const struct host_rb_entry *hle1,
return 0;
} else {
- zlog_warn("%s: Unexpected family type: %d", __PRETTY_FUNCTION__,
- hle1->p.family);
+ zlog_debug("%s: Unexpected family type: %d",
+ __PRETTY_FUNCTION__, hle1->p.family);
return 0;
}
}
@@ -1594,8 +1594,8 @@ static int zvni_neigh_uninstall(zebra_vni_t *zvni, zebra_neigh_t *n)
return 0;
if (!zvni->vxlan_if) {
- zlog_warn("VNI %u hash %p couldn't be uninstalled - no intf",
- zvni->vni, zvni);
+ zlog_debug("VNI %u hash %p couldn't be uninstalled - no intf",
+ zvni->vni, zvni);
return -1;
}
@@ -1845,9 +1845,9 @@ static int zvni_gw_macip_del(struct interface *ifp, zebra_vni_t *zvni,
/* mac entry should be present */
mac = zvni_mac_lookup(zvni, &n->emac);
if (!mac) {
- zlog_warn("MAC %s doesnt exists for neigh %s on VNI %u",
- prefix_mac2str(&n->emac, buf1, sizeof(buf1)),
- ipaddr2str(ip, buf2, sizeof(buf2)), zvni->vni);
+ zlog_debug("MAC %s doesnt exists for neigh %s on VNI %u",
+ prefix_mac2str(&n->emac, buf1, sizeof(buf1)),
+ ipaddr2str(ip, buf2, sizeof(buf2)), zvni->vni);
return -1;
}
@@ -1982,9 +1982,9 @@ static int zvni_local_neigh_update(zebra_vni_t *zvni,
zmac = zvni_mac_add(zvni, macaddr);
if (!zmac) {
- zlog_warn("Failed to add MAC %s VNI %u",
- prefix_mac2str(macaddr, buf, sizeof(buf)),
- zvni->vni);
+ zlog_debug("Failed to add MAC %s VNI %u",
+ prefix_mac2str(macaddr, buf, sizeof(buf)),
+ zvni->vni);
return -1;
}
@@ -2189,7 +2189,7 @@ static int zvni_remote_neigh_update(zebra_vni_t *zvni,
*/
zmac = zvni_mac_lookup(zvni, macaddr);
if (!zmac || !CHECK_FLAG(zmac->flags, ZEBRA_MAC_REMOTE)) {
- zlog_warn(
+ zlog_debug(
"Ignore remote neigh %s (MAC %s) on L2-VNI %u - MAC unknown or local",
ipaddr2str(&n->ip, buf2, sizeof(buf2)),
prefix_mac2str(macaddr, buf, sizeof(buf)),
@@ -2622,8 +2622,8 @@ static int zvni_mac_uninstall(zebra_vni_t *zvni, zebra_mac_t *mac, int local)
return 0;
if (!zvni->vxlan_if) {
- zlog_warn("VNI %u hash %p couldn't be uninstalled - no intf",
- zvni->vni, zvni);
+ zlog_debug("VNI %u hash %p couldn't be uninstalled - no intf",
+ zvni->vni, zvni);
return -1;
}
@@ -2950,7 +2950,7 @@ static void zvni_build_hash_table()
/* VNI hash entry is not expected to exist. */
zvni = zvni_lookup(vni);
if (zvni) {
- zlog_warn(
+ zlog_debug(
"VNI hash already present for IF %s(%u) L2-VNI %u",
ifp->name, ifp->ifindex, vni);
continue;
@@ -2958,7 +2958,7 @@ static void zvni_build_hash_table()
zvni = zvni_add(vni);
if (!zvni) {
- zlog_warn(
+ zlog_debug(
"Failed to add VNI hash, IF %s(%u) L2-VNI %u",
ifp->name, ifp->ifindex, vni);
return;
@@ -3081,8 +3081,8 @@ static int zvni_vtep_install(zebra_vni_t *zvni, struct in_addr *vtep_ip)
static int zvni_vtep_uninstall(zebra_vni_t *zvni, struct in_addr *vtep_ip)
{
if (!zvni->vxlan_if) {
- zlog_warn("VNI %u hash %p couldn't be uninstalled - no intf",
- zvni->vni, zvni);
+ zlog_debug("VNI %u hash %p couldn't be uninstalled - no intf",
+ zvni->vni, zvni);
return -1;
}
@@ -3272,7 +3272,7 @@ static int zl3vni_rmac_uninstall(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac)
return 0;
if (!zl3vni->vxlan_if) {
- zlog_warn(
+ zlog_debug(
"RMAC %s on L3-VNI %u hash %p couldn't be uninstalled - no vxlan_if",
prefix_mac2str(&zrmac->macaddr, buf, sizeof(buf)),
zl3vni->vni, zl3vni);
@@ -3303,7 +3303,7 @@ static int zl3vni_remote_rmac_add(zebra_l3vni_t *zl3vni, struct ethaddr *rmac,
zrmac = zl3vni_rmac_add(zl3vni, rmac);
if (!zrmac) {
- zlog_warn(
+ zlog_debug(
"Failed to add RMAC %s L3VNI %u Remote VTEP %s",
prefix_mac2str(rmac, buf, sizeof(buf)),
zl3vni->vni,
@@ -3467,7 +3467,7 @@ static int zl3vni_remote_nh_add(zebra_l3vni_t *zl3vni, struct ipaddr *vtep_ip,
nh = zl3vni_nh_add(zl3vni, vtep_ip, rmac);
if (!nh) {
- zlog_warn(
+ zlog_debug(
"Failed to add NH as Neigh (IP %s MAC %s L3-VNI %u)",
ipaddr2str(vtep_ip, buf1, sizeof(buf1)),
prefix_mac2str(rmac, buf, sizeof(buf)),
@@ -5322,7 +5322,7 @@ int zebra_vxlan_handle_kernel_neigh_del(struct interface *ifp,
return 0;
if (!zvni->vxlan_if) {
- zlog_warn(
+ zlog_debug(
"VNI %u hash %p doesn't have intf upon local neighbor DEL",
zvni->vni, zvni);
return -1;
@@ -5341,7 +5341,7 @@ int zebra_vxlan_handle_kernel_neigh_del(struct interface *ifp,
zmac = zvni_mac_lookup(zvni, &n->emac);
if (!zmac) {
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_warn(
+ zlog_debug(
"Trying to del a neigh %s without a mac %s on VNI %u",
ipaddr2str(ip, buf, sizeof(buf)),
prefix_mac2str(&n->emac, buf2, sizeof(buf2)),
@@ -5474,7 +5474,6 @@ void zebra_vxlan_remote_macip_del(ZAPI_HANDLER_ARGS)
zebra_route_string(client->proto));
process_remote_macip_del(vni, &macaddr, ipa_len, &ip, vtep_ip);
-
}
stream_failure:
@@ -5504,7 +5503,7 @@ void zebra_vxlan_remote_macip_add(ZAPI_HANDLER_ARGS)
memset(&vtep_ip, 0, sizeof(struct in_addr));
if (!EVPN_ENABLED(zvrf)) {
- zlog_warn("EVPN not enabled, ignoring remote MACIP ADD");
+ zlog_debug("EVPN not enabled, ignoring remote MACIP ADD");
return;
}
@@ -5686,8 +5685,9 @@ int zebra_vxlan_local_mac_del(struct interface *ifp, struct interface *br_if,
if (!zvni)
return 0;
if (!zvni->vxlan_if) {
- zlog_warn("VNI %u hash %p doesn't have intf upon local MAC DEL",
- zvni->vni, zvni);
+ zlog_debug(
+ "VNI %u hash %p doesn't have intf upon local MAC DEL",
+ zvni->vni, zvni);
return -1;
}
@@ -5755,8 +5755,9 @@ int zebra_vxlan_local_mac_add_update(struct interface *ifp,
}
if (!zvni->vxlan_if) {
- zlog_warn("VNI %u hash %p doesn't have intf upon local MAC ADD",
- zvni->vni, zvni);
+ zlog_debug(
+ "VNI %u hash %p doesn't have intf upon local MAC ADD",
+ zvni->vni, zvni);
return -1;
}
@@ -5841,8 +5842,9 @@ int zebra_vxlan_local_mac_add_update(struct interface *ifp,
* operator error.
*/
if (CHECK_FLAG(mac->flags, ZEBRA_MAC_STICKY)) {
- zlog_warn(
- "MAC %s already learnt as remote sticky behind VTEP %s VNI %u",
+ flog_warn(
+ ZEBRA_ERR_STICKY_MAC_ALREADY_LEARNT,
+ "MAC %s already learnt as remote sticky MAC behind VTEP %s VNI %u",
prefix_mac2str(macaddr, buf,
sizeof(buf)),
inet_ntoa(mac->fwd_info.r_vtep_ip),
@@ -5902,15 +5904,15 @@ void zebra_vxlan_remote_vtep_del(ZAPI_HANDLER_ARGS)
struct zebra_if *zif;
if (!is_evpn_enabled()) {
- zlog_warn(
+ zlog_debug(
"%s: EVPN is not enabled yet we have received a vtep del command",
__PRETTY_FUNCTION__);
return;
}
if (zvrf_id(zvrf) != VRF_DEFAULT) {
- zlog_warn("Recv MACIP DEL for non-default VRF %u",
- zvrf_id(zvrf));
+ zlog_debug("Recv MACIP DEL for non-default VRF %u",
+ zvrf_id(zvrf));
return;
}
@@ -5941,7 +5943,7 @@ void zebra_vxlan_remote_vtep_del(ZAPI_HANDLER_ARGS)
ifp = zvni->vxlan_if;
if (!ifp) {
- zlog_warn(
+ zlog_debug(
"VNI %u hash %p doesn't have intf upon remote VTEP DEL",
zvni->vni, zvni);
continue;
@@ -5986,15 +5988,15 @@ void zebra_vxlan_remote_vtep_add(ZAPI_HANDLER_ARGS)
struct zebra_if *zif;
if (!is_evpn_enabled()) {
- zlog_warn(
+ zlog_debug(
"%s: EVPN not enabled yet we received a vtep_add zapi call",
__PRETTY_FUNCTION__);
return;
}
if (zvrf_id(zvrf) != VRF_DEFAULT) {
- zlog_warn("Recv MACIP ADD for non-default VRF %u",
- zvrf_id(zvrf));
+ zlog_debug("Recv MACIP ADD for non-default VRF %u",
+ zvrf_id(zvrf));
return;
}
@@ -6096,8 +6098,8 @@ int zebra_vxlan_add_del_gw_macip(struct interface *ifp, struct prefix *p,
svi_if = if_lookup_by_index_per_ns(zebra_ns_lookup(NS_DEFAULT),
ifp_zif->link_ifindex);
if (!svi_if) {
- zlog_warn("MACVLAN %s(%u) without link information",
- ifp->name, ifp->ifindex);
+ zlog_debug("MACVLAN %s(%u) without link information",
+ ifp->name, ifp->ifindex);
return -1;
}
@@ -6144,8 +6146,8 @@ int zebra_vxlan_add_del_gw_macip(struct interface *ifp, struct prefix *p,
return 0;
if (!zvni->vxlan_if) {
- zlog_warn("VNI %u hash %p doesn't have intf upon MACVLAN up",
- zvni->vni, zvni);
+ zlog_debug("VNI %u hash %p doesn't have intf upon MACVLAN up",
+ zvni->vni, zvni);
return -1;
}
@@ -6241,7 +6243,7 @@ int zebra_vxlan_svi_up(struct interface *ifp, struct interface *link_if)
return 0;
if (!zvni->vxlan_if) {
- zlog_warn(
+ zlog_debug(
"VNI %u hash %p doesn't have intf upon SVI up",
zvni->vni, zvni);
return -1;
@@ -6304,7 +6306,7 @@ int zebra_vxlan_if_down(struct interface *ifp)
/* Locate hash entry; it is expected to exist. */
zvni = zvni_lookup(vni);
if (!zvni) {
- zlog_warn(
+ zlog_debug(
"Failed to locate VNI hash at DOWN, IF %s(%u) VNI %u",
ifp->name, ifp->ifindex, vni);
return -1;
@@ -6370,7 +6372,7 @@ int zebra_vxlan_if_up(struct interface *ifp)
/* Locate hash entry; it is expected to exist. */
zvni = zvni_lookup(vni);
if (!zvni) {
- zlog_warn(
+ zlog_debug(
"Failed to locate VNI hash at UP, IF %s(%u) VNI %u",
ifp->name, ifp->ifindex, vni);
return -1;
@@ -6441,7 +6443,7 @@ int zebra_vxlan_if_del(struct interface *ifp)
/* Locate hash entry; it is expected to exist. */
zvni = zvni_lookup(vni);
if (!zvni) {
- zlog_warn(
+ zlog_debug(
"Failed to locate VNI hash at del, IF %s(%u) VNI %u",
ifp->name, ifp->ifindex, vni);
return 0;
@@ -6552,7 +6554,7 @@ int zebra_vxlan_if_update(struct interface *ifp, uint16_t chgflags)
/* Update VNI hash. */
zvni = zvni_lookup(vni);
if (!zvni) {
- zlog_warn(
+ zlog_debug(
"Failed to find L2-VNI hash on update, IF %s(%u) VNI %u",
ifp->name, ifp->ifindex, vni);
return -1;
@@ -6884,8 +6886,8 @@ void zebra_vxlan_advertise_subnet(ZAPI_HANDLER_ARGS)
struct interface *vlan_if = NULL;
if (zvrf_id(zvrf) != VRF_DEFAULT) {
- zlog_warn("EVPN GW-MACIP Adv for non-default VRF %u",
- zvrf_id(zvrf));
+ zlog_debug("EVPN GW-MACIP Adv for non-default VRF %u",
+ zvrf_id(zvrf));
return;
}
@@ -6947,8 +6949,8 @@ void zebra_vxlan_advertise_gw_macip(ZAPI_HANDLER_ARGS)
struct interface *ifp = NULL;
if (zvrf_id(zvrf) != VRF_DEFAULT) {
- zlog_warn("EVPN GW-MACIP Adv for non-default VRF %u",
- zvrf_id(zvrf));
+ zlog_debug("EVPN GW-MACIP Adv for non-default VRF %u",
+ zvrf_id(zvrf));
return;
}
@@ -7052,7 +7054,8 @@ void zebra_vxlan_advertise_all_vni(ZAPI_HANDLER_ARGS)
struct zebra_ns *zns = NULL;
if (zvrf_id(zvrf) != VRF_DEFAULT) {
- zlog_warn("EVPN VNI Adv for non-default VRF %u", zvrf_id(zvrf));
+ zlog_debug("EVPN VNI Adv for non-default VRF %u",
+ zvrf_id(zvrf));
return;
}
diff --git a/zebra/zserv.c b/zebra/zserv.c
index 4a341bfe1..cd4872bd0 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -171,7 +171,8 @@ static void zserv_log_message(const char *errmsg, struct stream *msg,
*/
static void zserv_client_fail(struct zserv *client)
{
- zlog_warn("Client '%s' encountered an error and is shutting down.",
+ flog_warn(ZEBRA_ERR_CLIENT_IO_ERROR,
+ "Client '%s' encountered an error and is shutting down.",
zebra_route_string(client->proto));
atomic_store_explicit(&client->pthread->running, false,
@@ -270,7 +271,8 @@ static int zserv_write(struct thread *thread)
return 0;
zwrite_fail:
- zlog_warn("%s: could not write to %s [fd = %d], closing.", __func__,
+ flog_warn(ZEBRA_ERR_CLIENT_WRITE_FAILED,
+ "%s: could not write to %s [fd = %d], closing.", __func__,
zebra_route_string(client->proto), client->sock);
zserv_client_fail(client);
return 0;
@@ -741,8 +743,8 @@ static int zserv_accept(struct thread *thread)
client_sock = accept(accept_sock, (struct sockaddr *)&client, &len);
if (client_sock < 0) {
- zlog_warn("Can't accept zebra socket: %s",
- safe_strerror(errno));
+ flog_err_sys(LIB_ERR_SOCKET, "Can't accept zebra socket: %s",
+ safe_strerror(errno));
return -1;
}
@@ -772,10 +774,8 @@ void zserv_start(char *path)
/* Make UNIX domain socket. */
zebrad.sock = socket(sa.ss_family, SOCK_STREAM, 0);
if (zebrad.sock < 0) {
- zlog_warn("Can't create zserv socket: %s",
- safe_strerror(errno));
- zlog_warn(
- "zebra can't provide full functionality due to above error");
+ flog_err_sys(LIB_ERR_SOCKET, "Can't create zserv socket: %s",
+ safe_strerror(errno));
return;
}
@@ -797,10 +797,9 @@ void zserv_start(char *path)
ret = bind(zebrad.sock, (struct sockaddr *)&sa, sa_len);
}
if (ret < 0) {
- zlog_warn("Can't bind zserv socket on %s: %s", path,
- safe_strerror(errno));
- zlog_warn(
- "zebra can't provide full functionality due to above error");
+ flog_err_sys(LIB_ERR_SOCKET,
+ "Can't bind zserv socket on %s: %s", path,
+ safe_strerror(errno));
close(zebrad.sock);
zebrad.sock = -1;
return;
@@ -808,10 +807,9 @@ void zserv_start(char *path)
ret = listen(zebrad.sock, 5);
if (ret < 0) {
- zlog_warn("Can't listen to zserv socket %s: %s", path,
- safe_strerror(errno));
- zlog_warn(
- "zebra can't provide full functionality due to above error");
+ flog_err_sys(LIB_ERR_SOCKET,
+ "Can't listen to zserv socket %s: %s", path,
+ safe_strerror(errno));
close(zebrad.sock);
zebrad.sock = -1;
return;