#define _ZEBRA_BFD_H
#include "lib/json.h"
+#include "lib/zclient.h"
#define BFD_DEF_MIN_RX 300
#define BFD_MIN_MIN_RX 50
#include <zebra.h>
#include <lib_errors.h>
+/* clang-format off */
static struct ferr_ref ferr_lib_err[] = {
{
.code = LIB_ERR_PRIVILEGES,
.description = "FRR has detected an issue with the Zero MQ subsystem and ZeroMQ\nis not working properly now",
.suggestion = "Open an Issue with all relevant log files and restart FRR"
},
+ {
+ .code = LIB_ERR_UNAVAILABLE,
+ .title = "Feature or system unavailable",
+ .description = "FRR was not compiled with support for a particular feature, or it is not available on the current platform",
+ .suggestion = "Recompile FRR with the feature enabled, or find out what platforms support the feature"
+ },
{
.code = END_FERR,
}
};
+/* clang-format on */
void lib_error_init(void)
{
LIB_ERR_NS,
LIB_ERR_DEVELOPMENT,
LIB_ERR_ZMQ,
+ LIB_ERR_UNAVAILABLE,
};
extern void lib_error_init(void);
#ifndef _QUAGGA_MPLS_H
#define _QUAGGA_MPLS_H
+#include <zebra.h>
#include <arpa/inet.h>
#ifdef MPLS_LABEL_MAX
#ifndef _ZEBRA_CONNECTED_H
#define _ZEBRA_CONNECTED_H
+#include <zebra.h>
+#include <stdint.h>
+
+#include "lib/if.h"
+#include "lib/prefix.h"
+
extern struct connected *connected_check(struct interface *ifp,
union prefixconstptr p);
extern struct connected *connected_check_ptp(struct interface *ifp,
#ifndef _ZEBRA_DEBUG_H
#define _ZEBRA_DEBUG_H
+#include "lib/vty.h"
+
/* Debug flags. */
#define ZEBRA_DEBUG_EVENT 0x01
#include "log.h"
#include "vrf.h"
#include "vty.h"
+#include "lib_errors.h"
#include "zebra/interface.h"
#include "zebra/rib.h"
ret = getifaddrs(&ifap);
if (ret != 0) {
- zlog_err("getifaddrs(): %s", safe_strerror(errno));
+ zlog_ferr(LIB_ERR_SYSTEM_CALL, "getifaddrs(): %s",
+ safe_strerror(errno));
return -1;
}
if (zserv_privs.change(ZPRIVS_LOWER))
zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges");
- zlog_err("Cannot create UDP socket: %s",
- safe_strerror(save_errno));
+ zlog_ferr(LIB_ERR_SOCKET, "Cannot create UDP socket: %s",
+ safe_strerror(save_errno));
exit(1);
}
if ((ret = ioctl(sock, request, buffer)) < 0)
if (zserv_privs.change(ZPRIVS_LOWER))
zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges");
- zlog_err("Cannot create UDP socket: %s",
- safe_strerror(save_errno));
+ zlog_ferr(LIB_ERR_SOCKET, "Cannot create UDP socket: %s",
+ safe_strerror(save_errno));
exit(1);
}
ret = vrf_ioctl(vrf_id, sock, request, buffer);
if (zserv_privs.change(ZPRIVS_LOWER))
zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges");
- zlog_err("Cannot create IPv6 datagram socket: %s",
- safe_strerror(save_errno));
+ zlog_ferr(LIB_ERR_SOCKET,
+ "Cannot create IPv6 datagram socket: %s",
+ safe_strerror(save_errno));
exit(1);
}
ret = vrf_if_ioctl(SIOCGIFFLAGS, (caddr_t)&ifreq, ifp->vrf_id);
if (ret < 0) {
- zlog_err("vrf_if_ioctl(SIOCGIFFLAGS) failed: %s",
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_SYSTEM_CALL,
+ "vrf_if_ioctl(SIOCGIFFLAGS) failed: %s",
+ safe_strerror(errno));
return;
}
#ifdef HAVE_BSD_LINK_DETECT /* Detect BSD link-state at start-up */
/* Seems not all interfaces implement this ioctl */
if (if_ioctl(SIOCGIFMEDIA, (caddr_t)&ifmr) < 0)
- zlog_err("if_ioctl(SIOCGIFMEDIA) failed: %s",
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_SYSTEM_CALL,
+ "if_ioctl(SIOCGIFMEDIA) failed: %s",
+ safe_strerror(errno));
else if (ifmr.ifm_status & IFM_AVALID) /* Link state is valid */
{
if (ifmr.ifm_status & IFM_ACTIVE)
int save_errno = errno;
if (zserv_privs.change(ZPRIVS_LOWER))
zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges");
- zlog_err("Cannot create UDP socket: %s",
- safe_strerror(save_errno));
+ zlog_ferr(LIB_ERR_SOCKET, "Cannot create UDP socket: %s",
+ safe_strerror(save_errno));
exit(1);
}
int save_errno = errno;
if (zserv_privs.change(ZPRIVS_LOWER))
zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges");
- zlog_err("Cannot create IPv6 datagram socket: %s",
- safe_strerror(save_errno));
+ zlog_ferr(LIB_ERR_SOCKET,
+ "Cannot create IPv6 datagram socket: %s",
+ safe_strerror(save_errno));
exit(1);
}
else if (cmd == ND_GET)
snprintf(nd_buf, ND_BUFFER_SIZE, "%s", parameter);
else {
- zlog_err(
- "internal error - inappropriate command given to "
- "solaris_nd()%s:%d",
- __FILE__, __LINE__);
+ zlog_ferr(LIB_ERR_SYSTEM_CALL,
+ "internal error - inappropriate command given to "
+ "solaris_nd()%s:%d",
+ __FILE__, __LINE__);
return -1;
}
/*
*
- * Copyright (C) 2000 Robert Olsson.
- * Swedish University of Agricultural Sciences
+ * Copyright (C) 1997, 2000
+ * Portions:
+ * Swedish University of Agricultural Sciences
+ * Robert Olsson
+ * Kunihiro Ishiguro
+ *
+ * Thanks to Jens Laas at Swedish University of Agricultural Sciences
+ * for reviewing and tests.
*
* This file is part of GNU Zebra.
*
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*
- * This work includes work with the following copywrite:
- *
- * Copyright (C) 1997, 2000 Kunihiro Ishiguro
- *
- */
-
-/*
- * Thanks to Jens Låås at Swedish University of Agricultural Sciences
- * for reviewing and tests.
- */
-
-
#include <zebra.h>
#include "if.h"
*/
/*
- * Thanks to Jens Låås at Swedish University of Agricultural Sciences
+ * Thanks to Jens Laas at Swedish University of Agricultural Sciences
* for reviewing and tests.
*/
#include "thread.h"
#include "privs.h"
#include "libfrr.h"
+#include "lib_errors.h"
#include "version.h"
#include "zebra/interface.h"
#include "zebra/rtadv.h"
int sock;
if (zserv_privs.change(ZPRIVS_RAISE))
- zlog_err("irdp_sock_init: could not raise privs, %s",
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_PRIVILEGES,
+ "irdp_sock_init: could not raise privs, %s",
+ safe_strerror(errno));
sock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
save_errno = errno;
if (zserv_privs.change(ZPRIVS_LOWER))
- zlog_err("irdp_sock_init: could not lower privs, %s",
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_PRIVILEGES,
+ "irdp_sock_init: could not lower privs, %s",
+ safe_strerror(errno));
if (sock < 0) {
zlog_warn("IRDP: can't create irdp socket %s",
*/
/*
- * Thanks to Jens Låås at Swedish University of Agricultural Sciences
+ * Thanks to Jens Laas at Swedish University of Agricultural Sciences
* for reviewing and tests.
*/
#include <zebra.h>
+#include <netinet/ip_icmp.h>
-
-#include "if.h"
-#include "vty.h"
-#include "sockunion.h"
-#include "prefix.h"
+#include "checksum.h"
#include "command.h"
-#include "memory.h"
-#include "zebra_memory.h"
-#include "stream.h"
-#include "ioctl.h"
#include "connected.h"
+#include "if.h"
+#include "ioctl.h"
#include "log.h"
-#include "zclient.h"
+#include "log.h"
+#include "memory.h"
+#include "prefix.h"
+#include "sockopt.h"
+#include "sockunion.h"
+#include "sockunion.h"
+#include "stream.h"
#include "thread.h"
+#include "vty.h"
+#include "zclient.h"
+
+#include "zebra_memory.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 <netinet/ip_icmp.h>
-#include "if.h"
-#include "checksum.h"
-#include "sockunion.h"
-#include "log.h"
-#include "sockopt.h"
+#include "zebra/zebra_errors.h"
/* GLOBAL VARS */
src = ip->ip_src;
if (len != iplen) {
- zlog_err("IRDP: RX length doesnt match IP length");
+ zlog_ferr(ZEBRA_ERR_IRDP_LEN_MISMATCH,
+ "IRDP: RX length doesnt match IP length");
return;
}
if (iplen < ICMP_MINLEN) {
- zlog_err("IRDP: RX ICMP packet too short from %s\n",
- inet_ntoa(src));
+ zlog_ferr(ZEBRA_ERR_IRDP_LEN_MISMATCH,
+ "IRDP: RX ICMP packet too short from %s\n",
+ inet_ntoa(src));
return;
}
+
len of IP-header) 14+20 */
if (iplen > IRDP_RX_BUF - 34) {
- zlog_err("IRDP: RX ICMP packet too long from %s\n",
- inet_ntoa(src));
+ zlog_ferr(ZEBRA_ERR_IRDP_LEN_MISMATCH,
+ "IRDP: RX ICMP packet too long from %s\n",
+ inet_ntoa(src));
return;
}
#include "zebra/rt_netlink.h"
#include "zebra/if_netlink.h"
#include "zebra/rule_netlink.h"
+#include "zebra/zebra_errors.h"
#ifndef SO_RCVBUFFORCE
#define SO_RCVBUFFORCE (33)
* received some other message in an unexpected
* way.
*/
- zlog_err("%s: ignoring message type 0x%04x(%s) NS %u",
- __PRETTY_FUNCTION__, h->nlmsg_type,
- nl_msg_type_to_str(h->nlmsg_type), ns_id);
+ zlog_debug("%s: ignoring message type 0x%04x(%s) NS %u", __func__,
+ h->nlmsg_type, nl_msg_type_to_str(h->nlmsg_type), ns_id);
return 0;
}
ret = getsockopt(nl->sock, SOL_SOCKET, SO_RCVBUF, &oldsize, &oldlen);
if (ret < 0) {
- zlog_err("Can't get %s receive buffer size: %s", nl->name,
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_SOCKET,
+ "Can't get %s receive buffer size: %s", nl->name,
+ safe_strerror(errno));
return -1;
}
ret = setsockopt(nl->sock, SOL_SOCKET, SO_RCVBUF,
&nl_rcvbufsize, sizeof(nl_rcvbufsize));
if (ret < 0) {
- zlog_err("Can't set %s receive buffer size: %s", nl->name,
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_SOCKET,
+ "Can't set %s receive buffer size: %s", nl->name,
+ safe_strerror(errno));
return -1;
}
ret = getsockopt(nl->sock, SOL_SOCKET, SO_RCVBUF, &newsize, &newlen);
if (ret < 0) {
- zlog_err("Can't get %s receive buffer size: %s", nl->name,
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_SOCKET,
+ "Can't get %s receive buffer size: %s", nl->name,
+ safe_strerror(errno));
return -1;
}
sock = ns_socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE, ns_id);
if (sock < 0) {
- zlog_err("Can't open %s socket: %s", nl->name,
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_SOCKET, "Can't open %s socket: %s", nl->name,
+ safe_strerror(errno));
return -1;
}
zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges");
if (ret < 0) {
- zlog_err("Can't bind %s socket to group 0x%x: %s", nl->name,
- snl.nl_groups, safe_strerror(save_errno));
+ zlog_ferr(LIB_ERR_SOCKET,
+ "Can't bind %s socket to group 0x%x: %s", nl->name,
+ snl.nl_groups, safe_strerror(save_errno));
close(sock);
return -1;
}
namelen = sizeof snl;
ret = getsockname(sock, (struct sockaddr *)&snl, (socklen_t *)&namelen);
if (ret < 0 || namelen != sizeof snl) {
- zlog_err("Can't get %s socket name: %s", nl->name,
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_SOCKET, "Can't get %s socket name: %s",
+ nl->name, safe_strerror(errno));
close(sock);
return -1;
}
* this message type or not ask for
* it to be sent up to us
*/
- zlog_err("Unknown netlink nlmsg_type %s(%d) vrf %u\n",
- nl_msg_type_to_str(h->nlmsg_type), h->nlmsg_type,
- ns_id);
+ zlog_ferr(ZEBRA_ERR_UNKNOWN_NLMSG,
+ "Unknown netlink nlmsg_type %s(%d) vrf %u\n",
+ nl_msg_type_to_str(h->nlmsg_type), h->nlmsg_type,
+ ns_id);
break;
}
return 0;
continue;
if (errno == EWOULDBLOCK || errno == EAGAIN)
break;
- zlog_err("%s recvmsg overrun: %s", nl->name,
- safe_strerror(errno));
+ zlog_ferr(ZEBRA_ERR_RECVMSG_OVERRUN,
+ "%s recvmsg overrun: %s", nl->name,
+ safe_strerror(errno));
/*
* In this case we are screwed.
* There is no good way to
}
if (status == 0) {
- zlog_err("%s EOF", nl->name);
+ zlog_ferr(LIB_ERR_SOCKET, "%s EOF", nl->name);
return -1;
}
if (msg.msg_namelen != sizeof snl) {
- zlog_err("%s sender address length error: length %d",
- nl->name, msg.msg_namelen);
+ zlog_ferr(ZEBRA_ERR_NETLINK_LENGTH_ERROR,
+ "%s sender address length error: length %d",
+ nl->name, msg.msg_namelen);
return -1;
}
continue;
}
+ if (h->nlmsg_len
+ < NLMSG_LENGTH(sizeof(struct nlmsgerr))) {
+ zlog_ferr(
+ ZEBRA_ERR_NETLINK_LENGTH_ERROR,
+ "%s error: message truncated",
+ nl->name);
+ return -1;
+ }
+
/* Deal with errors that occur because of races
* in link handling */
if (nl == &zns->netlink_cmd
err->msg.nlmsg_seq,
err->msg.nlmsg_pid);
} else
- zlog_err(
+ zlog_ferr(
+ ZEBRA_ERR_UNEXPECTED_MESSAGE,
"%s error: %s, type=%s(%u), seq=%u, pid=%u",
nl->name,
safe_strerror(-errnum),
* other actors besides the kernel
*/
if (snl.nl_pid != 0) {
- zlog_err("Ignoring message from pid %u",
- snl.nl_pid);
+ zlog_debug("Ignoring message from pid %u",
+ snl.nl_pid);
continue;
}
error = (*filter)(h, zns->ns_id, startup);
if (error < 0) {
- zlog_err("%s filter function error", nl->name);
- zlog_backtrace(LOG_ERR);
+ zlog_warn("%s filter function error", nl->name);
ret = error;
}
}
/* After error care. */
if (msg.msg_flags & MSG_TRUNC) {
- zlog_err("%s error: message truncated", nl->name);
+ zlog_ferr(ZEBRA_ERR_NETLINK_LENGTH_ERROR,
+ "%s error: message truncated", nl->name);
continue;
}
if (status) {
- zlog_err("%s error: data remnant size %d", nl->name,
- status);
+ zlog_ferr(ZEBRA_ERR_NETLINK_LENGTH_ERROR,
+ "%s error: data remnant size %d", nl->name,
+ status);
return -1;
}
}
}
if (status < 0) {
- zlog_err("netlink_talk sendmsg() error: %s",
- safe_strerror(save_errno));
+ zlog_ferr(LIB_ERR_SOCKET, "netlink_talk sendmsg() error: %s",
+ safe_strerror(save_errno));
return -1;
}
/* Check netlink socket. */
if (nl->sock < 0) {
- zlog_err("%s socket isn't active.", nl->name);
+ zlog_ferr(LIB_ERR_SOCKET, "%s socket isn't active.", nl->name);
return -1;
}
zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges");
if (ret < 0) {
- zlog_err("%s sendto failed: %s", nl->name,
- safe_strerror(save_errno));
+ zlog_ferr(LIB_ERR_SOCKET, "%s sendto failed: %s", nl->name,
+ safe_strerror(save_errno));
return -1;
}
/* Register kernel socket. */
if (fcntl(zns->netlink.sock, F_SETFL, O_NONBLOCK) < 0)
- zlog_err("Can't set %s socket error: %s(%d)",
- zns->netlink.name, safe_strerror(errno), errno);
+ zlog_ferr(LIB_ERR_SOCKET, "Can't set %s socket flags: %s",
+ zns->netlink.name, safe_strerror(errno));
if (fcntl(zns->netlink_cmd.sock, F_SETFL, O_NONBLOCK) < 0)
zlog_err("Can't set %s socket error: %s(%d)",
/* paranoia: sanity check structure */
if (ifm->ifm_msglen < sizeof(struct if_msghdr)) {
- zlog_err("ifm_read: ifm->ifm_msglen %d too short\n",
- ifm->ifm_msglen);
+ zlog_ferr(ZEBRA_ERR_NETLINK_LENGTH_ERROR,
+ "ifm_read: ifm->ifm_msglen %d too short\n",
+ ifm->ifm_msglen);
return -1;
}
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <zebra.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
-#include "zebra.h"
-#include "zserv.h"
#include "lib/log.h"
#include "lib/memory.h"
#include "lib/mpls.h"
#include "lib/zclient.h"
#include "lib/libfrr.h"
-#include "label_manager.h"
+#include "zebra/zserv.h"
+#include "zebra/label_manager.h"
+#include "zebra/zebra_errors.h"
#define CONNECTION_DELAY 5
ret = zclient_read_header(src, zclient->sock, &size, &marker, &version,
&vrf_id, &resp_cmd);
if (ret < 0 && errno != EAGAIN) {
- zlog_err("Error reading Label Manager response: %s",
- strerror(errno));
+ zlog_ferr(ZEBRA_ERR_LM_RESPONSE,
+ "Error reading Label Manager response: %s",
+ strerror(errno));
return -1;
}
zlog_debug("Label Manager response received, %d bytes", size);
/* lookup the client to relay the msg to */
zserv = zserv_find_client(proto, instance);
if (!zserv) {
- zlog_err(
+ zlog_ferr(
+ ZEBRA_ERR_LM_NO_SUCH_CLIENT,
"Error relaying LM response: can't find client %s, instance %u",
proto_str, instance);
return -1;
/* send response back */
ret = writen(zserv->sock, dst->data, stream_get_endp(dst));
if (ret <= 0) {
- zlog_err("Error relaying LM response to %s instance %u: %s",
- proto_str, instance, strerror(errno));
+ zlog_ferr(ZEBRA_ERR_LM_RELAY_FAILED,
+ "Error relaying LM response to %s instance %u: %s",
+ proto_str, instance, strerror(errno));
return -1;
}
zlog_debug("Relayed LM response (%d bytes) to %s instance %u", ret,
unsigned short instance;
if (zclient->sock < 0) {
- zlog_err("Unable to relay LM request: no socket");
+ zlog_ferr(ZEBRA_ERR_LM_NO_SOCKET,
+ "Unable to relay LM request: no socket");
reply_error(cmd, zserv, vrf_id);
return -1;
}
/* check & set client instance if unset */
if (zserv->instance && zserv->instance != instance) {
- zlog_err("Client instance(%u) != msg instance(%u)",
- zserv->instance, instance);
+ zlog_ferr(ZEBRA_ERR_LM_BAD_INSTANCE,
+ "Client instance(%u) != msg instance(%u)",
+ zserv->instance, instance);
return -1;
}
/* Send request to external label manager */
ret = writen(zclient->sock, dst->data, stream_get_endp(dst));
if (ret <= 0) {
- zlog_err("Error relaying LM request from %s instance %u: %s",
- proto_str, instance, strerror(errno));
+ zlog_ferr(ZEBRA_ERR_LM_RELAY_FAILED,
+ "Error relaying LM request from %s instance %u: %s",
+ proto_str, instance, strerror(errno));
reply_error(cmd, zserv, vrf_id);
return -1;
}
return 0;
if (zclient_socket_connect(zclient) < 0) {
- zlog_err("Error connecting synchronous zclient!");
+ zlog_ferr(ZEBRA_ERR_LM_CLIENT_CONNECTION_FAILED,
+ "Error connecting synchronous zclient!");
thread_add_timer(zebrad.master, lm_zclient_connect, zclient,
CONNECTION_DELAY, &zclient->t_connect);
return -1;
->end
+ 1;
if (lmc->start > MPLS_LABEL_UNRESERVED_MAX - size + 1) {
- zlog_err("Reached max labels. Start: %u, size: %u", lmc->start,
- size);
+ zlog_ferr(ZEBRA_ERR_LM_EXHAUSTED_LABELS,
+ "Reached max labels. Start: %u, size: %u", lmc->start,
+ size);
XFREE(MTYPE_LM_CHUNK, lmc);
return NULL;
}
if (lmc->end != end)
continue;
if (lmc->proto != proto || lmc->instance != instance) {
- zlog_err("%s: Daemon mismatch!!", __func__);
+ zlog_ferr(ZEBRA_ERR_LM_DAEMON_MISMATCH,
+ "%s: Daemon mismatch!!", __func__);
continue;
}
lmc->proto = NO_PROTO;
break;
}
if (ret != 0)
- zlog_err("%s: Label chunk not released!!", __func__);
+ zlog_ferr(ZEBRA_ERR_LM_UNRELEASED_CHUNK,
+ "%s: Label chunk not released!!", __func__);
return ret;
}
#include "routemap.h"
#include "frr_pthread.h"
+#include "zebra/zebra_errors.h"
#include "zebra/rib.h"
#include "zebra/zserv.h"
#include "zebra/debug.h"
multipath_num = atoi(optarg);
if (multipath_num > MULTIPATH_NUM
|| multipath_num <= 0) {
- zlog_err(
+ zlog_ferr(
+ ZEBRA_ERR_BAD_MULTIPATH_NUM,
"Multipath Number specified must be less than %d and greater than 0",
MULTIPATH_NUM);
return 1;
*/
case ZEBRA_ERR_RTEXIST:
if (cmd != RTM_ADD)
- zlog_err(
+ zlog_ferr(
+ LIB_ERR_SYSTEM_CALL,
"%s: rtm_write() returned %d for command %d",
__func__, error, cmd);
continue;
case ZEBRA_ERR_RTNOEXIST:
case ZEBRA_ERR_RTUNREACH:
default:
- zlog_err(
+ zlog_ferr(
+ LIB_ERR_SYSTEM_CALL,
"%s: %s: rtm_write() unexpectedly returned %d for command %s",
__func__,
prefix2str(p, prefix_buf,
int route = 0;
if (src_p && src_p->prefixlen) {
- zlog_err("route add: IPv6 sourcedest routes unsupported!");
+ zlog_warn("%s: IPv6 sourcedest routes unsupported!", __func__);
return DP_REQUEST_FAILURE;
}
#include "privs.h"
#include "vrf.h"
#include "ns.h"
+#include "lib_errors.h"
#include "zebra/interface.h"
#include "zebra/rtadv.h"
adata = calloc(1, CMSG_SPACE(sizeof(struct in6_pktinfo)));
if (adata == NULL) {
- zlog_err(
+ zlog_warn(
"rtadv_send_packet: can't malloc control data");
exit(-1);
}
ret = sendmsg(sock, &msg, 0);
if (ret < 0) {
- zlog_err("%s(%u): Tx RA failed, socket %u error %d (%s)",
- ifp->name, ifp->ifindex, sock, errno,
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_SOCKET,
+ "%s(%u): Tx RA failed, socket %u error %d (%s)",
+ ifp->name, ifp->ifindex, sock, errno,
+ safe_strerror(errno));
} else
zif->ra_sent++;
}
struct icmp6_filter filter;
if (zserv_privs.change(ZPRIVS_RAISE))
- zlog_err("rtadv_make_socket: could not raise privs, %s",
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_PRIVILEGES,
+ "rtadv_make_socket: could not raise privs, %s",
+ safe_strerror(errno));
sock = ns_socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6, ns_id);
if (zserv_privs.change(ZPRIVS_LOWER))
- zlog_err("rtadv_make_socket: could not lower privs, %s",
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_PRIVILEGES,
+ "rtadv_make_socket: could not lower privs, %s",
+ safe_strerror(errno));
if (sock < 0) {
return -1;
enum dp_req_result kernel_add_pbr_rule(struct zebra_pbr_rule *rule)
{
- zlog_err("%s not Implemented for this platform", __PRETTY_FUNCTION__);
+ zlog_ferr(LIB_ERR_UNAVAILABLE, "%s not Implemented for this platform",
+ __PRETTY_FUNCTION__);
return DP_REQUEST_FAILURE;
}
enum dp_req_result kernel_del_pbr_rule(struct zebra_pbr_rule *rule)
{
- zlog_err("%s not Implemented for this platform", __PRETTY_FUNCTION__);
+ zlog_ferr(LIB_ERR_UNAVAILABLE, "%s not Implemented for this platform",
+ __PRETTY_FUNCTION__);
return DP_REQUEST_FAILURE;
}
zebra/zebra_netns_notify.c \
zebra/table_manager.c \
zebra/zapi_msg.c \
+ zebra/zebra_errors.c \
# end
zebra/zebra_vty_clippy.c: $(CLIPPY_DEPS)
zebra/zebra_netns_notify.h \
zebra/table_manager.h \
zebra/zapi_msg.h \
+ zebra/zebra_errors.h \
# end
zebra_zebra_irdp_la_SOURCES = \
#include "zebra/zebra_vrf.h"
#include "zebra/label_manager.h" /* for NO_PROTO */
#include "zebra/table_manager.h"
+#include "zebra/zebra_errors.h"
/* routing table identifiers
*
#endif /* SUNOS_5 */
tmc->start = start;
if (RT_TABLE_ID_UNRESERVED_MAX - size + 1 < start) {
- zlog_err("Reached max table id. Start/Size %u/%u",
- start, size);
+ zlog_ferr(ZEBRA_ERR_TM_EXHAUSTED_IDS,
+ "Reached max table id. Start/Size %u/%u", start,
+ size);
XFREE(MTYPE_TM_CHUNK, tmc);
return NULL;
}
if (tmc->end != end)
continue;
if (tmc->proto != proto || tmc->instance != instance) {
- zlog_err("%s: Daemon mismatch!!", __func__);
+ zlog_ferr(ZEBRA_ERR_TM_DAEMON_MISMATCH,
+ "%s: Daemon mismatch!!", __func__);
continue;
}
tmc->proto = NO_PROTO;
break;
}
if (ret != 0)
- zlog_err("%s: Table chunk not released!!", __func__);
+ zlog_ferr(ZEBRA_ERR_TM_UNRELEASED_CHUNK,
+ "%s: Table chunk not released!!", __func__);
return ret;
}
STREAM_GET(&p.u.prefix6, s, IPV6_MAX_BYTELEN);
l += IPV6_MAX_BYTELEN;
} else {
- zlog_err(
+ zlog_ferr(
+ ZEBRA_ERR_UNKNOWN_FAMILY,
"rnh_register: Received unknown family type %d\n",
p.family);
return;
STREAM_GET(&p.u.prefix6, s, IPV6_MAX_BYTELEN);
l += IPV6_MAX_BYTELEN;
} else {
- zlog_err(
+ zlog_ferr(
+ ZEBRA_ERR_UNKNOWN_FAMILY,
"rnh_register: Received unknown family type %d\n",
p.family);
return;
* registration
*/
if (hdr->length < ZEBRA_MIN_FEC_LENGTH) {
- zlog_err(
+ zlog_ferr(
+ ZEBRA_ERR_IRDP_LEN_MISMATCH,
"fec_register: Received a fec register of hdr->length %d, it is of insufficient size to properly decode",
hdr->length);
return;
memset(&p, 0, sizeof(p));
STREAM_GETW(s, p.family);
if (p.family != AF_INET && p.family != AF_INET6) {
- zlog_err(
+ zlog_ferr(
+ ZEBRA_ERR_UNKNOWN_FAMILY,
"fec_register: Received unknown family type %d\n",
p.family);
return;
* fec unregistration
*/
if (hdr->length < ZEBRA_MIN_FEC_LENGTH) {
- zlog_err(
+ zlog_ferr(
+ ZEBRA_ERR_IRDP_LEN_MISMATCH,
"fec_unregister: Received a fec unregister of hdr->length %d, it is of insufficient size to properly decode",
hdr->length);
return;
memset(&p, 0, sizeof(p));
STREAM_GETW(s, p.family);
if (p.family != AF_INET && p.family != AF_INET6) {
- zlog_err(
+ zlog_ferr(
+ ZEBRA_ERR_UNKNOWN_FAMILY,
"fec_unregister: Received unknown family type %d\n",
p.family);
return;
/* accept only dynamic routing protocols */
if ((proto >= ZEBRA_ROUTE_MAX) || (proto <= ZEBRA_ROUTE_STATIC)) {
- zlog_err("client %d has wrong protocol %s", client->sock,
- zebra_route_string(proto));
+ zlog_ferr(ZEBRA_ERR_TM_WRONG_PROTO,
+ "client %d has wrong protocol %s", client->sock,
+ zebra_route_string(proto));
zsend_table_manager_connect_response(client, vrf_id, 1);
return;
}
/* accept only dynamic routing protocols */
if ((proto >= ZEBRA_ROUTE_MAX) || (proto <= ZEBRA_ROUTE_STATIC)) {
- zlog_err("client %d has wrong protocol %s", client->sock,
- zebra_route_string(proto));
+ zlog_ferr(ZEBRA_ERR_TM_WRONG_PROTO,
+ "client %d has wrong protocol %s", client->sock,
+ zebra_route_string(proto));
zsend_label_manager_connect_response(client, vrf_id, 1);
return;
}
uint8_t proto, unsigned int instance)
{
if (proto != client->proto) {
- zlog_err("%s: msg vs client proto mismatch, client=%u msg=%u",
- op, client->proto, proto);
+ zlog_ferr(ZEBRA_ERR_PROTO_OR_INSTANCE_MISMATCH,
+ "%s: msg vs client proto mismatch, client=%u msg=%u",
+ op, client->proto, proto);
/* TODO: fail when BGP sets proto and instance */
/* return 1; */
}
if (instance != client->instance) {
- zlog_err(
+ zlog_ferr(
+ ZEBRA_ERR_PROTO_OR_INSTANCE_MISMATCH,
"%s: msg vs client instance mismatch, client=%u msg=%u",
op, client->instance, instance);
/* TODO: fail when BGP sets proto and instance */
lmc = assign_label_chunk(client->proto, client->instance, keep, size);
if (!lmc)
- zlog_err(
+ zlog_ferr(
+ ZEBRA_ERR_LM_CANNOT_ASSIGN_CHUNK,
"Unable to assign Label Chunk of size %u to %s instance %u",
size, zebra_route_string(client->proto),
client->instance);
else {
/* Sanity: don't allow 'unidentified' requests */
if (!client->proto) {
- zlog_err(
+ zlog_ferr(
+ ZEBRA_ERR_LM_ALIENS,
"Got label request from an unidentified client");
return;
}
tmc = assign_table_chunk(client->proto, client->instance, size);
if (!tmc)
- zlog_err("%s: Unable to assign Table Chunk of size %u",
- __func__, size);
+ zlog_ferr(ZEBRA_ERR_TM_CANNOT_ASSIGN_CHUNK,
+ "%s: Unable to assign Table Chunk of size %u",
+ __func__, size);
else
zlog_debug("Assigned Table Chunk %u - %u", tmc->start,
tmc->end);
else {
/* Sanity: don't allow 'unidentified' requests */
if (!client->proto) {
- zlog_err(
+ zlog_ferr(
+ ZEBRA_ERR_TM_ALIENS,
"Got table request from an unidentified client");
return;
}
#include "zebra/rib.h"
#include "zebra/zserv.h"
#include "zebra/zebra_pbr.h"
+#include "zebra/zebra_errors.h"
/*
* This is called to process inbound ZAPI messages.
--- /dev/null
+/*
+ * Zebra-specific error messages.
+ * Copyright (C) 2018 Cumulus Networks, Inc.
+ * Quentin Young
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <zebra.h>
+#include "zebra_errors.h"
+#include "ferr.h"
+
+/* clang-format off */
+static struct ferr_ref ferr_zebra_err[] = {
+ {
+ .code = ZEBRA_ERR_LM_RESPONSE,
+ .title = "Error reading response from label manager",
+ .description = "Zebra could not read the ZAPI header from the label manager",
+ .suggestion = "Wait for the error to resolve on its own. If it does not resolve, restart Zebra.",
+ },
+ {
+ .code = ZEBRA_ERR_LM_NO_SUCH_CLIENT,
+ .title = "Label manager could not find ZAPI client",
+ .description = "Zebra was unable to find a ZAPI client matching the given protocol and instance number.",
+ .suggestion = "Ensure clients which use the label manager are properly configured and running.",
+ },
+ {
+ .code = ZEBRA_ERR_LM_RELAY_FAILED,
+ .title = "Zebra could not relay label manager response",
+ .description = "Zebra found the client and instance to relay the label manager response or request to, but was not able to do so, possibly because the connection was closed.",
+ .suggestion = "Ensure clients which use the label manager are properly configured and running.",
+ },
+ {
+ .code = ZEBRA_ERR_LM_BAD_INSTANCE,
+ .title = "Mismatch between ZAPI instance and encoded message instance",
+ .description = "While relaying a request to the external label manager, Zebra noticed that the instance number encoded in the message did not match the client instance number.",
+ .suggestion = "Notify a developer.",
+ },
+ {
+ .code = ZEBRA_ERR_LM_EXHAUSTED_LABELS,
+ .title = "Zebra label manager used all available labels",
+ .description = "Zebra is unable to assign additional label chunks because it has exhausted its assigned label range.",
+ .suggestion = "Make the label range bigger and restart Zebra.",
+ },
+ {
+ .code = ZEBRA_ERR_LM_DAEMON_MISMATCH,
+ .title = "Daemon mismatch when releasing label chunks",
+ .description = "Zebra noticed a mismatch between a label chunk and a protocol daemon number or instance when releasing unused label chunks.",
+ .suggestion = "Ignore this error.",
+ },
+ {
+ .code = ZEBRA_ERR_LM_UNRELEASED_CHUNK,
+ .title = "Zebra did not free any label chunks",
+ .description = "Zebra's chunk cleanup procedure ran, but no label chunks were released.",
+ .suggestion = "Ignore this error.",
+ },
+ {
+ .code = ZEBRA_ERR_DP_INVALID_RC,
+ .title = "Dataplane returned invalid status code",
+ .description = "The underlying dataplane responded to a Zebra message or other interaction with an unrecognized, unknown or invalid status code.",
+ .suggestion = "Notify a developer.",
+ },
+ {
+ .code = ZEBRA_ERR_WQ_NONEXISTENT,
+ .title = "A necessary work queue does not exist.",
+ .description = "A necessary work queue does not exist.",
+ .suggestion = "Notify a developer.",
+ },
+ {
+ .code = ZEBRA_ERR_FEC_ADD_FAILED,
+ .title = "Failed to add FEC for MPLS client",
+ .description = "A client requested a label binding for a new FEC, but Zebra was unable to add the FEC to its internal table.",
+ .suggestion = "Notify a developer.",
+ },
+ {
+ .code = ZEBRA_ERR_FEC_RM_FAILED,
+ .title = "Failed to remove FEC for MPLS client",
+ .description = "Zebra was unable to find and remove a FEC in its internal table.",
+ .suggestion = "Notify a developer.",
+ },
+ {
+ .code = ZEBRA_ERR_IRDP_LEN_MISMATCH,
+ .title = "IRDP message length mismatch",
+ .description = "The length encoded in the IP TLV does not match the length of the packet received.",
+ .suggestion = "Notify a developer.",
+ },
+ {
+ .code = ZEBRA_ERR_RNH_UNKNOWN_FAMILY,
+ .title = "Attempted to perform nexthop update for unknown address family",
+ .description = "Zebra attempted to perform a nexthop update for unknown address family",
+ .suggestion = "Notify a developer.",
+ },
+ {
+ .code = ZEBRA_ERR_DP_INSTALL_FAIL,
+ .title = "Dataplane installation failure",
+ .description = "Installation of routes to 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.",
+ .suggestion = "If you entered a command to trigger this error, make sure you entered the arguments correctly. Check your config file for any potential errors. If these look correct, seek help.",
+ },
+ {
+ .code = ZEBRA_ERR_NETLINK_NOT_AVAILABLE,
+ .title = "Netlink backend not available",
+ .description = "FRR was not compiled with support for Netlink. Any operations that require Netlink will fail.",
+ .suggestion = "Recompile FRR with Netlink, or install a package that supports this feature.",
+ },
+ {
+ .code = ZEBRA_ERR_PROTOBUF_NOT_AVAILABLE,
+ .title = "Protocol Buffers backend not available",
+ .description = "FRR was not compiled with support for Protocol Buffers. Any operations that require Protobuf will fail.",
+ .suggestion = "Recompile FRR with Protobuf support, or install a package that supports this feature.",
+ },
+ {
+ .code = ZEBRA_ERR_TM_EXHAUSTED_IDS,
+ .title = "Table manager used all available IDs",
+ .description = "Zebra's table manager used up all IDs available to it and can't assign any more.",
+ .suggestion = "Reconfigure Zebra with a larger range of table IDs.",
+ },
+ {
+ .code = ZEBRA_ERR_TM_DAEMON_MISMATCH,
+ .title = "Daemon mismatch when releasing table chunks",
+ .description = "Zebra noticed a mismatch between a table ID chunk and a protocol daemon number instance when releasing unused table chunks.",
+ .suggestion = "Ignore this error.",
+ },
+ {
+ .code = ZEBRA_ERR_TM_UNRELEASED_CHUNK,
+ .title = "Zebra did not free any table chunks",
+ .description = "Zebra's table chunk cleanup procedure ran, but no table chunks were released.",
+ .suggestion = "Ignore this error.",
+ },
+ {
+ .code = ZEBRA_ERR_UNKNOWN_FAMILY,
+ .title = "Address family specifier unrecognized",
+ .description = "Zebra attempted to process information from somewhere that included an address family specifier, but did not recognize the provided specifier.",
+ .suggestion = "Ensure that your configuration is correct. If it is, notify a developer.",
+ },
+ {
+ .code = ZEBRA_ERR_TM_WRONG_PROTO,
+ .title = "Incorrect protocol for table manager client",
+ .description = "Zebra's table manager only accepts connections from daemons managing dynamic routing protocols, but received a connection attempt from a daemon that does not meet this criterion.",
+ .suggestion = "Notify a developer.",
+ },
+ {
+ .code = ZEBRA_ERR_PROTO_OR_INSTANCE_MISMATCH,
+ .title = "Mismatch between message and client protocol and/or instance",
+ .description = "Zebra detected a mismatch between a client's protocol and/or instance numbers versus those stored in a message transiting its socket.",
+ .suggestion = "Notify a developer.",
+ },
+ {
+ .code = ZEBRA_ERR_LM_CANNOT_ASSIGN_CHUNK,
+ .title = "Label manager unable to assign label chunk",
+ .description = "Zebra's label manager was unable to assign a label chunk to client.",
+ .suggestion = "Ensure that Zebra has a sufficient label range available and that there is not a range collision.",
+ },
+ {
+ .code = ZEBRA_ERR_LM_ALIENS,
+ .title = "Label request from unidentified client",
+ .description = "Zebra's label manager received a label request from an unidentified client.",
+ .suggestion = "Notify a developer.",
+ },
+ {
+ .code = ZEBRA_ERR_TM_CANNOT_ASSIGN_CHUNK,
+ .title = "Table manager unable to assign table chunk",
+ .description = "Zebra's table manager was unable to assign a table chunk to a client.",
+ .suggestion = "Ensure that Zebra has sufficient table ID range available and that there is not a range collision.",
+ },
+ {
+ .code = ZEBRA_ERR_TM_ALIENS,
+ .title = "Table request from unidentified client",
+ .description = "Zebra's table manager received a table request from an unidentified client.",
+ .suggestion = "Notify a developer.",
+ },
+ {
+ .code = ZEBRA_ERR_RECVBUF,
+ .title = "Cannot set receive buffer size",
+ .description = "Socket receive buffer size could not be set in the kernel",
+ .suggestion = "Ignore this error.",
+ },
+ {
+ .code = ZEBRA_ERR_UNKNOWN_NLMSG,
+ .title = "Unknown Netlink message type",
+ .description = "Zebra received a Netlink message with an unrecognized type field.",
+ .suggestion = "Verify that you are running the latest version of FRR to ensure kernel compatibility. If the problem persists, notify a developer.",
+ },
+ {
+ .code = ZEBRA_ERR_RECVMSG_OVERRUN,
+ .title = "Receive buffer overrun",
+ .description = "The kernel's buffer for a socket has been overrun, rendering the socket invalid.",
+ .suggestion = "Zebra will restart itself. Notify a developer if this issue shows up frequently.",
+ },
+ {
+ .code = ZEBRA_ERR_NETLINK_LENGTH_ERROR,
+ .title = "Netlink message length mismatch",
+ .description = "Zebra received a Netlink message with incorrect length fields.",
+ .suggestion = "Notify a developer.",
+ },
+ {
+ .code = ZEBRA_ERR_NETLINK_LENGTH_ERROR,
+ .title = "Netlink message length mismatch",
+ .description = "Zebra received a Netlink message with incorrect length fields.",
+ .suggestion = "Notify a developer.",
+ },
+ {
+ .code = ZEBRA_ERR_UNEXPECTED_MESSAGE,
+ .title = "Received unexpected response from kernel",
+ .description = "Received unexpected response from the kernel via Netlink.",
+ .suggestion = "Notify a developer.",
+ },
+ {
+ .code = ZEBRA_ERR_NETLINK_BAD_SEQUENCE,
+ .title = "Bad sequence number in Netlink message",
+ .description = "Zebra received a Netlink message with a bad sequence number.",
+ .suggestion = "Notify a developer.",
+ },
+ {
+ .code = ZEBRA_ERR_BAD_MULTIPATH_NUM,
+ .title = "Multipath number was out of valid range",
+ .description = "Multipath number specified to Zebra must be in the appropriate range",
+ .suggestion = "Provide a multipath number that is within its accepted range",
+ },
+ {
+ .code = ZEBRA_ERR_PREFIX_PARSE_ERROR,
+ .title = "String could not be parsed as IP prefix",
+ .description = "There was an attempt to parse a string as an IPv4 or IPv6 prefix, but the string could not be parsed and this operation failed.",
+ .suggestion = "Notify a developer.",
+ },
+ {
+ .code = ZEBRA_ERR_MAC_ADD_FAILED,
+ .title = "Failed to add MAC address to interface",
+ .description = "Zebra attempted to assign a MAC address to a vxlan interface but failed",
+ .suggestion = "Notify a developer.",
+ },
+ {
+ .code = ZEBRA_ERR_VNI_DEL_FAILED,
+ .title = "Failed to delete VNI",
+ .description = "Zebra attempted to delete a VNI entry and failed",
+ .suggestion = "Notify a developer.",
+ },
+ {
+ .code = ZEBRA_ERR_VTEP_ADD_FAILED,
+ .title = "Adding remote VTEP failed",
+ .description = "Zebra attempted to add a remote VTEP and failed.",
+ .suggestion = "Notify a developer.",
+ },
+ {
+ .code = ZEBRA_ERR_VNI_ADD_FAILED,
+ .title = "Adding VNI failed",
+ .description = "Zebra attempted to add a VNI hash to an interface and failed",
+ .suggestion = "Notify a developer.",
+ },
+};
+/* clang-format on */
+
+
+void zebra_error_init(void)
+{
+ ferr_ref_init();
+
+ ferr_ref_add(ferr_zebra_err);
+}
--- /dev/null
+/*
+ * Zebra-specific error messages.
+ * Copyright (C) 2018 Cumulus Networks, Inc.
+ * Quentin Young
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __ZEBRA_ERRORS_H__
+#define __ZEBRA_ERRORS_H__
+
+#include <zebra.h>
+#include "ferr.h"
+
+enum zebra_ferr_refs {
+ ZEBRA_ERR_LM_RESPONSE,
+ ZEBRA_ERR_LM_NO_SUCH_CLIENT,
+ ZEBRA_ERR_LM_RELAY_FAILED,
+ ZEBRA_ERR_LM_NO_SOCKET,
+ ZEBRA_ERR_LM_BAD_INSTANCE,
+ ZEBRA_ERR_LM_RELAY_REQUEST_FAILED,
+ ZEBRA_ERR_LM_CLIENT_CONNECTION_FAILED,
+ ZEBRA_ERR_LM_EXHAUSTED_LABELS,
+ ZEBRA_ERR_LM_DAEMON_MISMATCH,
+ ZEBRA_ERR_LM_UNRELEASED_CHUNK,
+ ZEBRA_ERR_DP_INVALID_RC,
+ ZEBRA_ERR_WQ_NONEXISTENT,
+ ZEBRA_ERR_FEC_ADD_FAILED,
+ ZEBRA_ERR_FEC_RM_FAILED,
+ ZEBRA_ERR_IRDP_LEN_MISMATCH,
+ ZEBRA_ERR_RNH_UNKNOWN_FAMILY,
+ ZEBRA_ERR_DP_INSTALL_FAIL,
+ ZEBRA_ERR_TABLE_LOOKUP_FAILED,
+ ZEBRA_ERR_NETLINK_NOT_AVAILABLE,
+ ZEBRA_ERR_PROTOBUF_NOT_AVAILABLE,
+ ZEBRA_ERR_TM_EXHAUSTED_IDS,
+ ZEBRA_ERR_TM_DAEMON_MISMATCH,
+ ZEBRA_ERR_TM_UNRELEASED_CHUNK,
+ ZEBRA_ERR_UNKNOWN_FAMILY,
+ ZEBRA_ERR_TM_WRONG_PROTO,
+ ZEBRA_ERR_PROTO_OR_INSTANCE_MISMATCH,
+ ZEBRA_ERR_LM_CANNOT_ASSIGN_CHUNK,
+ ZEBRA_ERR_LM_ALIENS,
+ ZEBRA_ERR_TM_CANNOT_ASSIGN_CHUNK,
+ ZEBRA_ERR_TM_ALIENS,
+ ZEBRA_ERR_RECVBUF,
+ ZEBRA_ERR_UNKNOWN_NLMSG,
+ ZEBRA_ERR_RECVMSG_OVERRUN,
+ ZEBRA_ERR_NETLINK_LENGTH_ERROR,
+ ZEBRA_ERR_UNEXPECTED_MESSAGE,
+ ZEBRA_ERR_NETLINK_BAD_SEQUENCE,
+ ZEBRA_ERR_BAD_MULTIPATH_NUM,
+ ZEBRA_ERR_PREFIX_PARSE_ERROR,
+ ZEBRA_ERR_MAC_ADD_FAILED,
+ ZEBRA_ERR_VNI_DEL_FAILED,
+ ZEBRA_ERR_VTEP_ADD_FAILED,
+ ZEBRA_ERR_VNI_ADD_FAILED,
+};
+
+void zebra_error_init(void);
+
+#endif /* __ZEBRA_ERRORS_H__ */
if (!strcmp("netlink", format)) {
if (!have_netlink) {
- zlog_err("FPM netlink message format is not available");
+ zlog_ferr(
+ ZEBRA_ERR_NETLINK_NOT_AVAILABLE,
+ "FPM netlink message format is not available");
return;
}
zfpm_g->message_format = ZFPM_MSG_FORMAT_NETLINK;
if (!strcmp("protobuf", format)) {
if (!have_protobuf) {
- zlog_err(
+ zlog_ferr(
+ ZEBRA_ERR_PROTOBUF_NOT_AVAILABLE,
"FPM protobuf message format is not available");
return;
}
#include "zebra/zebra_memory.h"
#include "zebra/zebra_vrf.h"
#include "zebra/zebra_mpls.h"
+#include "zebra/zebra_errors.h"
DEFINE_MTYPE_STATIC(ZEBRA, LSP, "MPLS LSP object")
DEFINE_MTYPE_STATIC(ZEBRA, FEC, "MPLS FEC object")
UNSET_FLAG(lsp->flags, LSP_FLAG_CHANGED);
switch (kernel_add_lsp(lsp)) {
case DP_REQUEST_QUEUED:
- zlog_err("No current DataPlane interfaces can return this, please fix");
+ zlog_ferr(
+ ZEBRA_ERR_DP_INVALID_RC,
+ "No current DataPlane interfaces can return this, please fix");
break;
case DP_REQUEST_FAILURE:
break;
switch (kernel_del_lsp(lsp)) {
case DP_REQUEST_QUEUED:
- zlog_err("No current DataPlane interfaces can return this, please fix");
+ zlog_ferr(
+ ZEBRA_ERR_DP_INVALID_RC,
+ "No current DataPlane interfaces can return this, please fix");
break;
case DP_REQUEST_FAILURE:
break;
switch (kernel_upd_lsp(lsp)) {
case DP_REQUEST_QUEUED:
- zlog_err("No current DataPlane interfaces can return this, please fix");
+ zlog_ferr(
+ ZEBRA_ERR_DP_INVALID_RC,
+ "No current DataPlane interfaces can return this, please fix");
break;
case DP_REQUEST_FAILURE:
break;
return 0;
if (zebrad.lsp_process_q == NULL) {
- zlog_err("%s: work_queue does not exist!", __func__);
+ zlog_ferr(ZEBRA_ERR_WQ_NONEXISTENT,
+ "%s: work_queue does not exist!", __func__);
return -1;
}
{
zebra->lsp_process_q = work_queue_new(zebra->master, "LSP processing");
if (!zebra->lsp_process_q) {
- zlog_err("%s: could not initialise work queue!", __func__);
+ zlog_ferr(ZEBRA_ERR_WQ_NONEXISTENT,
+ "%s: could not initialise work queue!", __func__);
return -1;
}
fec = fec_add(table, p, MPLS_INVALID_LABEL, 0, label_index);
if (!fec) {
prefix2str(p, buf, BUFSIZ);
- zlog_err(
+ zlog_ferr(
+ ZEBRA_ERR_FEC_ADD_FAILED,
"Failed to add FEC %s upon register, client %s",
buf, zebra_route_string(client->proto));
return -1;
fec = fec_find(table, p);
if (!fec) {
prefix2str(p, buf, BUFSIZ);
- zlog_err("Failed to find FEC %s upon unregister, client %s",
- buf, zebra_route_string(client->proto));
+ zlog_ferr(ZEBRA_ERR_FEC_RM_FAILED,
+ "Failed to find FEC %s upon unregister, client %s",
+ buf, zebra_route_string(client->proto));
return -1;
}
MPLS_INVALID_LABEL_INDEX);
if (!fec) {
prefix2str(p, buf, BUFSIZ);
- zlog_err("Failed to add FEC %s upon config", buf);
+ zlog_ferr(ZEBRA_ERR_FEC_ADD_FAILED,
+ "Failed to add FEC %s upon config", buf);
return -1;
}
fec = fec_find(table, p);
if (!fec) {
prefix2str(p, buf, BUFSIZ);
- zlog_err("Failed to find FEC %s upon delete", buf);
+ zlog_ferr(ZEBRA_ERR_FEC_RM_FAILED,
+ "Failed to find FEC %s upon delete", buf);
return -1;
}
zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges");
if (ret == -1)
- zlog_err("%s: %s", __func__, safe_strerror(errno));
+ zlog_ferr(LIB_ERR_SOCKET, "%s: %s", __func__,
+ safe_strerror(errno));
return ret;
}
zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges");
if (ret == -1)
- zlog_err("%s: %s", __func__, safe_strerror(errno));
+ zlog_ferr(LIB_ERR_SOCKET, "%s: %s", __func__,
+ safe_strerror(errno));
return ret;
}
imr.imr_type = IMR_TYPE_ETHERNET_TAGGED;
break;
default:
- zlog_err("%s: unhandled pseudowire type (%#X)", __func__,
- pw->type);
+ zlog_warn("%s: unhandled pseudowire type (%#X)", __func__,
+ pw->type);
return -1;
}
sa_in6->sin6_addr = pw->nexthop.ipv6;
break;
default:
- zlog_err("%s: unhandled pseudowire address-family (%u)",
- __func__, pw->af);
+ zlog_warn("%s: unhandled pseudowire address-family (%u)",
+ __func__, pw->af);
return -1;
}
memcpy(&imr.imr_nexthop, (struct sockaddr *)&ss,
strlcpy(ifr.ifr_name, pw->ifname, sizeof(ifr.ifr_name));
ifr.ifr_data = (caddr_t)&imr;
if (ioctl(kr_state.ioctl_fd, SIOCSETMPWCFG, &ifr) == -1) {
- zlog_err("ioctl SIOCSETMPWCFG: %s", safe_strerror(errno));
+ zlog_ferr(LIB_ERR_SYSTEM_CALL, "ioctl SIOCSETMPWCFG: %s",
+ safe_strerror(errno));
return -1;
}
strlcpy(ifr.ifr_name, pw->ifname, sizeof(ifr.ifr_name));
ifr.ifr_data = (caddr_t)&imr;
if (ioctl(kr_state.ioctl_fd, SIOCSETMPWCFG, &ifr) == -1) {
- zlog_err("ioctl SIOCSETMPWCFG: %s", safe_strerror(errno));
+ zlog_ferr(LIB_ERR_SYSTEM_CALL, "ioctl SIOCSETMPWCFG: %s",
+ safe_strerror(errno));
return -1;
}
#include "ns.h"
#include "vrf.h"
#include "log.h"
+#include "lib_errors.h"
#if defined(HAVE_NETLINK)
#include "kernel_netlink.h"
#endif /* defined(HAVE_NETLINK) */
-#include "zebra_netns_id.h"
+#include "zebra/zebra_netns_id.h"
+#include "zebra/zebra_errors.h"
/* default NS ID value used when VRF backend is not NETNS */
#define NS_DEFAULT_INTERNAL 0
ret = sendto(sock, (const void *)nlh, (size_t)nlh->nlmsg_len, 0,
(struct sockaddr *)&snl, (socklen_t)sizeof(snl));
if (ret < 0) {
- zlog_err("netlink( %u) sendmsg() error: %s", sock,
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_SOCKET, "netlink( %u) sendmsg() error: %s",
+ sock, safe_strerror(errno));
return -1;
}
};
ret = recvmsg(sock, &msg, 0);
if (ret < 0) {
- zlog_err("netlink recvmsg: error %d (errno %u)", ret, errno);
+ zlog_ferr(LIB_ERR_SOCKET,
+ "netlink recvmsg: error %d (errno %u)", ret, errno);
return -1;
}
if (msg.msg_flags & MSG_TRUNC) {
- zlog_err("netlink recvmsg : error message truncated");
+ zlog_ferr(ZEBRA_ERR_NETLINK_LENGTH_ERROR,
+ "netlink recvmsg : error message truncated");
return -1;
}
/* nlh already points to buf */
if (nlh->nlmsg_seq != seq) {
- zlog_err(
+ zlog_ferr(
+ ZEBRA_ERR_NETLINK_BAD_SEQUENCE,
"netlink recvmsg: bad sequence number %x (expected %x)",
seq, nlh->nlmsg_seq);
return -1;
/* netlink socket */
sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if (sock < 0) {
- zlog_err("netlink( %u) socket() error: %s", sock,
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_SOCKET, "netlink( %u) socket() error: %s",
+ sock, safe_strerror(errno));
close(fd);
return NS_UNKNOWN;
}
snl.nl_pid = 0; /* AUTO PID */
ret = bind(sock, (struct sockaddr *)&snl, sizeof(snl));
if (ret < 0) {
- zlog_err("netlink( %u) socket() bind error: %s", sock,
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_SOCKET,
+ "netlink( %u) socket() bind error: %s", sock,
+ safe_strerror(errno));
close(sock);
close(fd);
return NS_UNKNOWN;
if (ret <= 0) {
if (errno != EEXIST && ret != 0) {
- zlog_err(
+ zlog_ferr(
+ LIB_ERR_SOCKET,
"netlink( %u) recvfrom() error 2 when reading: %s",
fd, safe_strerror(errno));
close(sock);
*/
#include <zebra.h>
+
#include <sys/un.h> /* for sockaddr_un */
#include <net/if.h>
+
+#include "bfd.h"
+#include "buffer.h"
+#include "command.h"
+#include "if.h"
+#include "network.h"
+#include "ptm_lib.h"
+#include "rib.h"
+#include "stream.h"
+#include "version.h"
+#include "vrf.h"
#include "vty.h"
-#include "zebra/zserv.h"
-#include "zebra/interface.h"
+
#include "zebra/debug.h"
+#include "zebra/interface.h"
+#include "zebra/zebra_errors.h"
#include "zebra/zebra_ptm.h"
-#include "if.h"
-#include "command.h"
-#include "stream.h"
-#include "ptm_lib.h"
-#include "network.h"
-#include "buffer.h"
#include "zebra/zebra_ptm_redistribute.h"
-#include "bfd.h"
-#include "vrf.h"
-#include "rib.h"
+#include "zebra/zserv.h"
#include "zebra_vrf.h"
-#include "version.h"
/*
* Choose the BFD implementation that we'll use.
dest_str, src_str);
if (str2prefix(dest_str, &dest_prefix) == 0) {
- zlog_err("%s: Peer addr %s not found", __func__, dest_str);
+ zlog_ferr(ZEBRA_ERR_PREFIX_PARSE_ERROR,
+ "%s: Peer addr %s not found", __func__, dest_str);
return -1;
}
memset(&src_prefix, 0, sizeof(struct prefix));
if (strcmp(ZEBRA_PTM_INVALID_SRC_IP, src_str)) {
if (str2prefix(src_str, &src_prefix) == 0) {
- zlog_err("%s: Local addr %s not found", __func__,
- src_str);
+ zlog_ferr(ZEBRA_ERR_PREFIX_PARSE_ERROR,
+ "%s: Local addr %s not found", __func__,
+ src_str);
return -1;
}
}
ifp = if_lookup_by_name_all_vrf(port_str);
if (!ifp) {
- zlog_err("%s: %s not found in interface list", __func__,
- port_str);
+ zlog_warn("%s: %s not found in interface list",
+ __func__, port_str);
return -1;
}
}
return 0;
if (IS_ZEBRA_DEBUG_EVENT)
- zlog_err("bfd_client_deregister msg for client %s",
- zebra_route_string(proto));
+ zlog_warn("bfd_client_deregister msg for client %s",
+ zebra_route_string(proto));
if (ptm_cb.ptm_sock == -1) {
ptm_cb.t_timer = NULL;
#include <zebra.h>
-#include "if.h"
-#include "prefix.h"
-#include "table.h"
-#include "memory.h"
-#include "zebra_memory.h"
#include "command.h"
+#include "if.h"
+#include "linklist.h"
#include "log.h"
#include "log_int.h"
-#include "sockunion.h"
-#include "linklist.h"
-#include "thread.h"
-#include "workqueue.h"
+#include "memory.h"
+#include "mpls.h"
+#include "nexthop.h"
+#include "prefix.h"
#include "prefix.h"
#include "routemap.h"
-#include "nexthop.h"
-#include "vrf.h"
-#include "mpls.h"
+#include "sockunion.h"
#include "srcdest_table.h"
+#include "table.h"
+#include "thread.h"
+#include "vrf.h"
+#include "workqueue.h"
+#include "zebra/connected.h"
+#include "zebra/debug.h"
+#include "zebra/interface.h"
+#include "zebra/redistribute.h"
#include "zebra/rib.h"
#include "zebra/rt.h"
+#include "zebra/zapi_msg.h"
+#include "zebra/zebra_errors.h"
+#include "zebra/zebra_memory.h"
#include "zebra/zebra_ns.h"
-#include "zebra/zebra_vrf.h"
-#include "zebra/redistribute.h"
-#include "zebra/zebra_routemap.h"
-#include "zebra/debug.h"
#include "zebra/zebra_rnh.h"
-#include "zebra/interface.h"
-#include "zebra/connected.h"
+#include "zebra/zebra_routemap.h"
+#include "zebra/zebra_vrf.h"
#include "zebra/zebra_vxlan.h"
-#include "zebra/zapi_msg.h"
DEFINE_HOOK(rib_update, (struct route_node * rn, const char *reason),
(rn, reason))
hook_call(rib_update, rn, "installing in kernel");
switch (kernel_route_rib(rn, p, src_p, old, re)) {
case DP_REQUEST_QUEUED:
- zlog_err("No current known DataPlane interfaces can return this, please fix");
+ zlog_ferr(
+ ZEBRA_ERR_DP_INVALID_RC,
+ "No current known DataPlane interfaces can return this, please fix");
break;
case DP_REQUEST_FAILURE:
- zlog_err("No current known Rib Install Failure cases, please fix");
+ zlog_ferr(
+ ZEBRA_ERR_DP_INSTALL_FAIL,
+ "No current known Rib Install Failure cases, please fix");
break;
case DP_REQUEST_SUCCESS:
zvrf->installs++;
hook_call(rib_update, rn, "uninstalling from kernel");
switch (kernel_route_rib(rn, p, src_p, re, NULL)) {
case DP_REQUEST_QUEUED:
- zlog_err("No current known DataPlane interfaces can return this, please fix");
+ zlog_ferr(
+ ZEBRA_ERR_DP_INVALID_RC,
+ "No current known DataPlane interfaces can return this, please fix");
break;
case DP_REQUEST_FAILURE:
- zlog_err("No current known RIB Install Failure cases, please fix");
+ zlog_ferr(
+ ZEBRA_ERR_DP_INSTALL_FAIL,
+ "No current known RIB Install Failure cases, please fix");
break;
case DP_REQUEST_SUCCESS:
if (zvrf)
}
if (zebrad.ribq == NULL) {
- zlog_err("%s: work_queue does not exist!", __func__);
+ zlog_ferr(ZEBRA_ERR_WQ_NONEXISTENT,
+ "%s: work_queue does not exist!", __func__);
return;
}
if (!(zebra->ribq =
work_queue_new(zebra->master, "route_node processing"))) {
- zlog_err("%s: could not initialise work queue!", __func__);
+ zlog_ferr(ZEBRA_ERR_WQ_NONEXISTENT,
+ "%s: could not initialise work queue!", __func__);
return;
}
zebra->ribq->spec.hold = ZEBRA_RIB_PROCESS_HOLD_TIME;
if (!(zebra->mq = meta_queue_new())) {
- zlog_err("%s: could not initialise meta queue!", __func__);
+ zlog_ferr(ZEBRA_ERR_WQ_NONEXISTENT,
+ "%s: could not initialise meta queue!", __func__);
return;
}
return;
/* Lookup table. */
table = zebra_vrf_table(AFI_IP, SAFI_UNICAST, vrf_id);
if (!table) {
- zlog_err("%s:%u zebra_vrf_table() returned NULL",
- __func__, vrf_id);
+ zlog_ferr(ZEBRA_ERR_TABLE_LOOKUP_FAILED,
+ "%s:%u zebra_vrf_table() returned NULL", __func__,
+ vrf_id);
return;
}
rib_dest_t *dest;
if (NULL == (table = zebra_vrf_table(AFI_IP, SAFI_UNICAST, vrf_id))) {
- zlog_err("%s:%u zebra_vrf_table() returned NULL",
- __func__, vrf_id);
+ zlog_ferr(ZEBRA_ERR_TABLE_LOOKUP_FAILED,
+ "%s:%u zebra_vrf_table() returned NULL", __func__,
+ vrf_id);
return;
}
#include "zebra/zebra_routemap.h"
#include "zebra/interface.h"
#include "zebra/zebra_memory.h"
+#include "zebra/zebra_errors.h"
static void free_state(vrf_id_t vrf_id, struct route_entry *re,
struct route_node *rn);
stream_put(s, &rn->p.u.prefix6, IPV6_MAX_BYTELEN);
break;
default:
- zlog_err("%s: Unknown family (%d) notification attempted\n",
- __FUNCTION__, rn->p.family);
+ zlog_ferr(ZEBRA_ERR_RNH_UNKNOWN_FAMILY,
+ "%s: Unknown family (%d) notification attempted\n",
+ __FUNCTION__, rn->p.family);
break;
}
if (re) {
#include <zebra.h>
+#include "hash.h"
#include "if.h"
-#include "prefix.h"
-#include "table.h"
-#include "memory.h"
-#include "log.h"
+#include "jhash.h"
#include "linklist.h"
+#include "log.h"
+#include "memory.h"
+#include "prefix.h"
#include "stream.h"
-#include "hash.h"
-#include "jhash.h"
+#include "table.h"
#include "vlan.h"
#include "vxlan.h"
#ifdef GNU_LINUX
#include <linux/neighbour.h>
#endif
+#include "zebra/debug.h"
+#include "zebra/interface.h"
#include "zebra/rib.h"
#include "zebra/rt.h"
+#include "zebra/rt_netlink.h"
+#include "zebra/zebra_errors.h"
+#include "zebra/zebra_l2.h"
+#include "zebra/zebra_memory.h"
#include "zebra/zebra_ns.h"
-#include "zebra/zserv.h"
-#include "zebra/debug.h"
-#include "zebra/interface.h"
#include "zebra/zebra_vrf.h"
-#include "zebra/rt_netlink.h"
-#include "zebra/zebra_vxlan_private.h"
#include "zebra/zebra_vxlan.h"
-#include "zebra/zebra_memory.h"
-#include "zebra/zebra_l2.h"
+#include "zebra/zebra_vxlan_private.h"
+#include "zebra/zserv.h"
DEFINE_MTYPE_STATIC(ZEBRA, HOST_PREFIX, "host prefix");
DEFINE_MTYPE_STATIC(ZEBRA, ZVNI, "VNI hash");
zvni_neigh_send_del_to_client(zvni->vni, &n->ip,
&n->emac, 0);
}
- } else if (CHECK_FLAG(n->flags, ZEBRA_NEIGH_REMOTE)) {
- if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_err(
- "local MAC %s getting deleted on VNI %u has remote neigh %s",
- prefix_mac2str(&n->emac, buf,
- sizeof(buf)),
- zvni->vni,
- ipaddr2str(&n->ip, buf2, sizeof(buf2)));
+ } else if (CHECK_FLAG(n->flags, ZEBRA_NEIGH_REMOTE)
+ && IS_ZEBRA_DEBUG_VXLAN) {
+ zlog_debug(
+ "local MAC %s getting deleted on VNI %u has remote neigh %s",
+ prefix_mac2str(&n->emac, buf, sizeof(buf)),
+ zvni->vni,
+ ipaddr2str(&n->ip, buf2, sizeof(buf2)));
}
}
}
char buf2[INET6_ADDRSTRLEN];
for (ALL_LIST_ELEMENTS_RO(zmac->neigh_list, node, n)) {
- if (CHECK_FLAG(n->flags, ZEBRA_NEIGH_LOCAL)) {
- if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_err(
- "remote MAC %s getting deleted on VNI %u has local neigh %s",
- prefix_mac2str(&n->emac, buf,
- sizeof(buf)),
- zvni->vni,
- ipaddr2str(&n->ip, buf2, sizeof(buf2)));
+ if (CHECK_FLAG(n->flags, ZEBRA_NEIGH_LOCAL)
+ && IS_ZEBRA_DEBUG_VXLAN) {
+ zlog_debug(
+ "remote MAC %s getting deleted on VNI %u has local neigh %s",
+ prefix_mac2str(&n->emac, buf, sizeof(buf)),
+ zvni->vni,
+ ipaddr2str(&n->ip, buf2, sizeof(buf2)));
}
}
}
return 0;
if (!zvni->vxlan_if) {
- zlog_err("VNI %u hash %p couldn't be uninstalled - no intf",
- zvni->vni, zvni);
+ zlog_warn("VNI %u hash %p couldn't be uninstalled - no intf",
+ zvni->vni, zvni);
return -1;
}
if (!mac) {
mac = zvni_mac_add(zvni, macaddr);
if (!mac) {
- zlog_err("Failed to add MAC %s intf %s(%u) VID %u",
- prefix_mac2str(macaddr, buf, sizeof(buf)),
- ifp->name, ifp->ifindex, vxl->access_vlan);
+ zlog_ferr(ZEBRA_ERR_MAC_ADD_FAILED,
+ "Failed to add MAC %s intf %s(%u) VID %u",
+ prefix_mac2str(macaddr, buf, sizeof(buf)),
+ ifp->name, ifp->ifindex, vxl->access_vlan);
return -1;
}
}
if (!n) {
n = zvni_neigh_add(zvni, ip, macaddr);
if (!n) {
- zlog_err(
+ zlog_ferr(
+ ZEBRA_ERR_MAC_ADD_FAILED,
"Failed to add neighbor %s MAC %s intf %s(%u) -> VNI %u",
ipaddr2str(ip, buf2, sizeof(buf2)),
prefix_mac2str(macaddr, buf, sizeof(buf)),
/* mac entry should be present */
mac = zvni_mac_lookup(zvni, &n->emac);
if (!mac) {
- zlog_err("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_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);
return -1;
}
/* New neighbor - create */
n = zvni_neigh_add(zvni, ip, macaddr);
if (!n) {
- zlog_err(
+ zlog_ferr(
+ ZEBRA_ERR_MAC_ADD_FAILED,
"Failed to add neighbor %s MAC %s intf %s(%u) -> VNI %u",
ipaddr2str(ip, buf2, sizeof(buf2)),
prefix_mac2str(macaddr, buf, sizeof(buf)),
*/
zmac = zvni_mac_lookup(zvni, macaddr);
if (!zmac || !CHECK_FLAG(zmac->flags, ZEBRA_MAC_REMOTE)) {
- zlog_err("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)),
- zvni->vni);
+ zlog_warn(
+ "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)),
+ zvni->vni);
return -1;
}
return 0;
if (!zvni->vxlan_if) {
- zlog_err("VNI %u hash %p couldn't be uninstalled - no intf",
- zvni->vni, zvni);
+ zlog_warn("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_err(
+ zlog_warn(
"VNI hash already present for IF %s(%u) L2-VNI %u",
ifp->name, ifp->ifindex, vni);
continue;
zvni = zvni_add(vni);
if (!zvni) {
- zlog_err(
+ zlog_warn(
"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_err("VNI %u hash %p couldn't be uninstalled - no intf",
- zvni->vni, zvni);
+ zlog_warn("VNI %u hash %p couldn't be uninstalled - no intf",
+ zvni->vni, zvni);
return -1;
}
return 0;
if (!zl3vni->vxlan_if) {
- zlog_err(
+ zlog_warn(
"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);
/* Delete the hash entry. */
if (zvni_del(zvni)) {
- zlog_err("Failed to del VNI hash %p, VNI %u", zvni,
- zvni->vni);
+ zlog_ferr(ZEBRA_ERR_VNI_DEL_FAILED,
+ "Failed to del VNI hash %p, VNI %u", zvni,
+ zvni->vni);
return -1;
}
} else {
return 0;
if (!zvni->vxlan_if) {
- zlog_err(
+ zlog_warn(
"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_err(
+ zlog_warn(
"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)),
}
ifp = zvni->vxlan_if;
if (!ifp) {
- zlog_err(
+ zlog_warn(
"VNI %u hash %p doesn't have intf upon remote MACIP DEL",
vni, zvni);
continue;
n = zvni_neigh_lookup(zvni, &ip);
if (n && !mac) {
- zlog_err("Failed to locate MAC %s for neigh %s VNI %u",
- prefix_mac2str(&macaddr, buf, sizeof(buf)),
- ipaddr2str(&ip, buf1, sizeof(buf1)), vni);
+ zlog_warn("Failed to locate MAC %s for neigh %s VNI %u",
+ prefix_mac2str(&macaddr, buf, sizeof(buf)),
+ ipaddr2str(&ip, buf1, sizeof(buf1)), vni);
continue;
}
/* Ignore the delete if this mac is a gateway mac-ip */
if (mac && CHECK_FLAG(mac->flags, ZEBRA_MAC_LOCAL)
&& CHECK_FLAG(mac->flags, ZEBRA_MAC_DEF_GW)) {
- zlog_err(
+ zlog_warn(
"%u: Ignore Del for MAC %s neigh %s on VNI %u as it is configured as a default gateway",
zvrf_id(zvrf),
prefix_mac2str(&macaddr, buf, sizeof(buf)),
/* Locate VNI hash entry - expected to exist. */
zvni = zvni_lookup(vni);
if (!zvni) {
- zlog_err(
+ zlog_warn(
"Failed to locate VNI hash upon remote MACIP ADD, VNI %u",
vni);
continue;
}
ifp = zvni->vxlan_if;
if (!ifp) {
- zlog_err(
+ zlog_warn(
"VNI %u hash %p doesn't have intf upon remote MACIP add",
vni, zvni);
continue;
zvtep = zvni_vtep_find(zvni, &vtep_ip);
if (!zvtep) {
if (zvni_vtep_add(zvni, &vtep_ip) == NULL) {
- zlog_err(
+ zlog_ferr(
+ ZEBRA_ERR_VTEP_ADD_FAILED,
"Failed to add remote VTEP, VNI %u zvni %p",
vni, zvni);
continue;
if (!zvni)
return 0;
if (!zvni->vxlan_if) {
- zlog_err("VNI %u hash %p doesn't have intf upon local MAC DEL",
- zvni->vni, zvni);
+ zlog_warn("VNI %u hash %p doesn't have intf upon local MAC DEL",
+ zvni->vni, zvni);
return -1;
}
}
if (!zvni->vxlan_if) {
- zlog_err("VNI %u hash %p doesn't have intf upon local MAC ADD",
- zvni->vni, zvni);
+ zlog_warn("VNI %u hash %p doesn't have intf upon local MAC ADD",
+ zvni->vni, zvni);
return -1;
}
if (!mac) {
mac = zvni_mac_add(zvni, macaddr);
if (!mac) {
- zlog_err("Failed to add MAC %s intf %s(%u) VID %u",
- prefix_mac2str(macaddr, buf, sizeof(buf)),
- ifp->name, ifp->ifindex, vid);
+ zlog_ferr(ZEBRA_ERR_MAC_ADD_FAILED,
+ "Failed to add MAC %s intf %s(%u) VID %u",
+ prefix_mac2str(macaddr, buf, sizeof(buf)),
+ ifp->name, ifp->ifindex, vid);
return -1;
}
}
}
if (zvrf_id(zvrf) != VRF_DEFAULT) {
- zlog_err("Recv MACIP DEL for non-default VRF %u",
- zvrf_id(zvrf));
+ zlog_warn("Recv MACIP DEL for non-default VRF %u",
+ zvrf_id(zvrf));
return;
}
ifp = zvni->vxlan_if;
if (!ifp) {
- zlog_err(
+ zlog_warn(
"VNI %u hash %p doesn't have intf upon remote VTEP DEL",
zvni->vni, zvni);
continue;
}
if (zvrf_id(zvrf) != VRF_DEFAULT) {
- zlog_err("Recv MACIP ADD for non-default VRF %u",
- zvrf_id(zvrf));
+ zlog_warn("Recv MACIP ADD for non-default VRF %u",
+ zvrf_id(zvrf));
return;
}
/* Locate VNI hash entry - expected to exist. */
zvni = zvni_lookup(vni);
if (!zvni) {
- zlog_err(
+ zlog_ferr(
+ ZEBRA_ERR_VTEP_ADD_FAILED,
"Failed to locate VNI hash upon remote VTEP ADD, VNI %u",
vni);
continue;
ifp = zvni->vxlan_if;
if (!ifp) {
- zlog_err(
+ zlog_ferr(
+ ZEBRA_ERR_VTEP_ADD_FAILED,
"VNI %u hash %p doesn't have intf upon remote VTEP ADD",
zvni->vni, zvni);
continue;
continue;
if (zvni_vtep_add(zvni, &vtep_ip) == NULL) {
- zlog_err("Failed to add remote VTEP, VNI %u zvni %p",
- vni, zvni);
+ zlog_ferr(ZEBRA_ERR_VTEP_ADD_FAILED,
+ "Failed to add remote VTEP, VNI %u zvni %p",
+ vni, zvni);
continue;
}
svi_if = if_lookup_by_index_per_ns(zebra_ns_lookup(NS_DEFAULT),
ifp_zif->link_ifindex);
if (!svi_if) {
- zlog_err("MACVLAN %s(%u) without link information",
- ifp->name, ifp->ifindex);
+ zlog_warn("MACVLAN %s(%u) without link information",
+ ifp->name, ifp->ifindex);
return -1;
}
return 0;
if (!zvni->vxlan_if) {
- zlog_err("VNI %u hash %p doesn't have intf upon MACVLAN up",
- zvni->vni, zvni);
+ zlog_warn("VNI %u hash %p doesn't have intf upon MACVLAN up",
+ zvni->vni, zvni);
return -1;
}
return 0;
if (!zvni->vxlan_if) {
- zlog_err("VNI %u hash %p doesn't have intf upon SVI up",
- zvni->vni, zvni);
+ zlog_warn(
+ "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_err(
+ zlog_warn(
"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_err(
+ zlog_warn(
"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_err(
+ zlog_warn(
"Failed to locate VNI hash at del, IF %s(%u) VNI %u",
ifp->name, ifp->ifindex, vni);
return 0;
/* Delete the hash entry. */
if (zvni_del(zvni)) {
- zlog_err("Failed to del VNI hash %p, IF %s(%u) VNI %u",
- zvni, ifp->name, ifp->ifindex, zvni->vni);
+ zlog_ferr(ZEBRA_ERR_VNI_DEL_FAILED,
+ "Failed to del VNI hash %p, IF %s(%u) VNI %u",
+ zvni, ifp->name, ifp->ifindex, zvni->vni);
return -1;
}
}
/* Update VNI hash. */
zvni = zvni_lookup(vni);
if (!zvni) {
- zlog_err(
+ zlog_warn(
"Failed to find L2-VNI hash on update, IF %s(%u) VNI %u",
ifp->name, ifp->ifindex, vni);
return -1;
if (!zvni) {
zvni = zvni_add(vni);
if (!zvni) {
- zlog_err(
+ zlog_ferr(
+ ZEBRA_ERR_VNI_ADD_FAILED,
"Failed to add VNI hash, IF %s(%u) VNI %u",
ifp->name, ifp->ifindex, vni);
return -1;
struct interface *vlan_if = NULL;
if (zvrf_id(zvrf) != VRF_DEFAULT) {
- zlog_err("EVPN GW-MACIP Adv for non-default VRF %u",
- zvrf_id(zvrf));
+ zlog_warn("EVPN GW-MACIP Adv for non-default VRF %u",
+ zvrf_id(zvrf));
return;
}
struct interface *ifp = NULL;
if (zvrf_id(zvrf) != VRF_DEFAULT) {
- zlog_err("EVPN GW-MACIP Adv for non-default VRF %u",
- zvrf_id(zvrf));
+ zlog_warn("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_err("EVPN VNI Adv for non-default VRF %u", zvrf_id(zvrf));
+ zlog_warn("EVPN VNI Adv for non-default VRF %u", zvrf_id(zvrf));
return;
}