Convert Zebra to user error subsystem.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
#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)
#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;
}
/* 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));
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,
} 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);
/* 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);
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);
}
}
/* 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;
}
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. */
}
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;
}
}
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;
}
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;
}
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;
}
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;
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;
}
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);
#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;
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]),
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;
}
/* 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))
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;
/* 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;
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;
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;
} 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;
}
/* 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;
}
/* 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;
}
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;
}
/* 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;
}
#include "zebra/rt_netlink.h"
#include "zebra/interface.h"
#include "zebra/zebra_vxlan.h"
+#include "zebra/zebra_errors.h"
#define ZEBRA_PTM_SUPPORT
/* 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);
* 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;
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;
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;
/* 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;
}
{
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);
{
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);
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);
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;
#include "privs.h"
#include "zebra/ipforward.h"
+#include "zebra/zebra_errors.h"
#include "log.h"
#include "lib_errors.h"
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;
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
#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"
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;
}
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;
}
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;
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? */
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);
}
}
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;
}
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;
}
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;
}
}
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;
};
#include "thread.h"
#include "vty.h"
#include "zclient.h"
+#include "lib_errors.h"
#include "zebra_memory.h"
#include "zebra/interface.h"
/* 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;
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;
}
&& (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;
}
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));
}
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;
}
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)
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) {
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)
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); */
}
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,
* 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);
}
}
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);
}
}
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;
}
}
* 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;
}
*/
{
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,
/* 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. */
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;
}
/* 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));
/* 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;
}
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;
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;
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;
}
* 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;
}
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;
}
/* 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;
}
}
/* 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;
}
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;
}
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;
}
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;
}
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;
}
}
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);
* 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;
}
* 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;
}
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;
}
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);
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;
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;
}
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,
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;
}
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;
}
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),
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;
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;
}
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;
}
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);
}
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;
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);
}
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);
}
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);
}
/* 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;
}
/* 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;
}
/* 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;
}
&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;
}
/* 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;
}
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(
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(
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;
}
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;
}
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;
}
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;
}
|| 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;
}
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);
/* 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;
}
/* 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;
}
#include "zebra/kernel_netlink.h"
#include "zebra/rule_netlink.h"
#include "zebra/zebra_pbr.h"
+#include "zebra/zebra_errors.h"
/* definitions */
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;
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;
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;
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;
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;
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;
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;
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);
}
}
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);
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);
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;
}
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;
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;
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);
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;
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;
}
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;
}
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;
}
.description = "Installation of routes to underlying dataplane failed.",
.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 add a VNI hash to an interface and failed",
.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,
}
ZEBRA_ERR_IRDP_LEN_MISMATCH,
ZEBRA_ERR_RNH_UNKNOWN_FAMILY,
ZEBRA_ERR_DP_INSTALL_FAIL,
+ ZEBRA_ERR_DP_DELETE_FAIL,
ZEBRA_ERR_TABLE_LOOKUP_FAILED,
ZEBRA_ERR_NETLINK_NOT_AVAILABLE,
ZEBRA_ERR_PROTOBUF_NOT_AVAILABLE,
ZEBRA_ERR_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);
return;
}
- zlog_warn("Unknown fpm format '%s'", format);
+ flog_warn(ZEBRA_ERR_FPM_FORMAT_UNKNOWN, "Unknown fpm format '%s'",
+ format);
}
/**
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);
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;
}
}
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;
}
&& (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;
}
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;
}
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,
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;
}
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
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;
/* 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;
}
}
#include "zebra_netns_notify.h"
#include "zebra_netns_id.h"
+#include "zebra_errors.h"
#ifdef HAVE_NETLINK
/* 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;
}
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;
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. */
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];
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;
}
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) {
|| 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)) {
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);
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)
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 {
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)
}
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__);
}
/*
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;
}
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);
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);
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;
}
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;
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;
/* 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;
}
/* 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;
}
}
/* 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;
}
/* 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;
}
}
/* 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;
}
*/
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;
}
*/
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;
}
&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;
}
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;
}
}
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:
/*
* 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;
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;
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;
}
}
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;
}
}
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;
}
/* 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;
}
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;
}
*/
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)),
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;
}
/* 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;
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;
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;
}
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);
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,
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)),
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;
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)),
zebra_route_string(client->proto));
process_remote_macip_del(vni, &macaddr, ipa_len, &ip, vtep_ip);
-
}
stream_failure:
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;
}
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;
}
}
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;
}
* 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),
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;
}
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;
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;
}
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;
}
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;
}
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;
/* 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;
/* 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;
/* 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;
/* 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;
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;
}
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;
}
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;
}
*/
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,
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;
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;
}
/* 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;
}
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;
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;