.description = "BGP received an open from a peer that was invalid",
.suggestion = "Determine the sending peer and correct his invalid open packet"
},
- {
- .code = BGP_ERR_SOCKET,
- .title = "Socket Error",
- .description = "When attempting to access a socket a system error has occurred\nand we were unable to properly complete the request",
- .suggestion = "Ensure that there are sufficient system resources available and\nensure that the frr user has sufficient permissions to work"
- },
{
.code = BGP_ERR_SND_FAIL,
.title = "BGP error sending to peer",
.description = "BGP unable to process nexthop update",
.suggestion = "BGP received nexthop update but nexthop is not reachable in this bgp\ninstance. Report for troubleshooting"
},
- {
- .code = BGP_ERR_PRIVILEGES,
- .title = "Failure to raise or lower privileges",
- .description = "FRR attempted to raise or lower its privileges and was unable to do so",
- .suggestion = "Ensure that you are running FRR as the frr user and that the user has\nSufficient privileges to properly access root privileges"
- },
{
.code = BGP_ERR_LABEL,
.title = "Failure to apply label",
BGP_ERR_UPDGRP_CREATE,
BGP_ERR_UPDATE_SND,
BGP_ERR_PKT_OPEN,
- BGP_ERR_SOCKET,
BGP_ERR_SND_FAIL,
BGP_ERR_INVALID_STATUS,
BGP_ERR_UPDATE_RCV,
BGP_ERR_RFSH_RCV,
BGP_ERR_CAP_RCV,
BGP_ERR_NH_UPD,
- BGP_ERR_PRIVILEGES,
BGP_ERR_LABEL,
BGP_ERR_MULTIPATH,
BGP_ERR_PKT_PROCESS,
#include <zebra.h>
#include "prefix.h"
+#include "lib_errors.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_route.h"
safi = packet->safi;
if (afi == AFI_IP6) {
- zlog_err("BGP flowspec IPv6 not supported");
+ zlog_ferr(LIB_ERR_DEVELOPMENT,
+ "BGP flowspec IPv6 not supported");
return -1;
}
#include "zebra.h"
#include "prefix.h"
+#include "lib_errors.h"
#include "bgp_table.h"
#include "bgp_flowspec_util.h"
offset += ret;
break;
default:
- zlog_err("%s: unknown type %d\n", __func__, type);
+ zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: unknown type %d\n",
+ __func__, type);
}
}
return error;
#include "queue.h"
#include "filter.h"
#include "command.h"
+#include "lib_errors.h"
#include "lib/json.h"
#include "bgpd/bgpd.h"
if (bgp_getsockname(peer) < 0) {
zlog_ferr(
- BGP_ERR_SOCKET,
+ LIB_ERR_SOCKET,
"%%bgp_getsockname() failed for %s peer %s fd %d (from_peer fd %d)",
(CHECK_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER)
? "accept"
if (from_peer->status > Active) {
if (bgp_getsockname(from_peer) < 0) {
zlog_ferr(
- BGP_ERR_SOCKET,
+ LIB_ERR_SOCKET,
"%%bgp_getsockname() failed for %s from_peer %s fd %d (peer fd %d)",
(CHECK_FLAG(from_peer->sflags,
}
if (bgp_getsockname(peer) < 0) {
- zlog_ferr(BGP_ERR_SOCKET,
+ zlog_ferr(LIB_ERR_SOCKET,
"%s: bgp_getsockname(): failed for peer %s, fd %d",
__FUNCTION__, peer->host, peer->fd);
bgp_notify_send(peer, BGP_NOTIFY_FSM_ERR,
#if HAVE_DECL_TCP_MD5SIG
if (bgpd_privs.change(ZPRIVS_RAISE)) {
- zlog_ferr(BGP_ERR_PRIVILEGES, "%s: could not raise privs",
+ zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not raise privs",
__func__);
return ret;
}
ret = bgp_md5_set_socket(socket, su, password);
if (bgpd_privs.change(ZPRIVS_LOWER))
- zlog_ferr(BGP_ERR_PRIVILEGES, "%s: could not lower privs",
+ zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not lower privs",
__func__);
#endif /* HAVE_TCP_MD5SIG */
struct bgp_listener *listener;
if (bgpd_privs.change(ZPRIVS_RAISE)) {
- zlog_ferr(BGP_ERR_PRIVILEGES, "%s: could not raise privs",
+ zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not raise privs",
__func__);
return -1;
}
}
if (bgpd_privs.change(ZPRIVS_LOWER))
- zlog_ferr(BGP_ERR_PRIVILEGES, "%s: could not lower privs",
+ zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not lower privs",
__func__);
return ret;
ret = sockopt_ttl(peer->su.sa.sa_family, bgp_sock, peer->ttl);
if (ret) {
zlog_ferr(
- BGP_ERR_SOCKET,
+ LIB_ERR_SOCKET,
"%s: Can't set TxTTL on peer (rtrid %s) socket, err = %d",
__func__,
inet_ntop(AF_INET, &peer->remote_id, buf,
ret = sockopt_ttl(peer->su.sa.sa_family, bgp_sock, MAXTTL);
if (ret) {
zlog_ferr(
- BGP_ERR_SOCKET,
+ LIB_ERR_SOCKET,
"%s: Can't set TxTTL on peer (rtrid %s) socket, err = %d",
__func__,
inet_ntop(AF_INET, &peer->remote_id, buf,
MAXTTL + 1 - peer->gtsm_hops);
if (ret) {
zlog_ferr(
- BGP_ERR_SOCKET,
+ LIB_ERR_SOCKET,
"%s: Can't set MinTTL on peer (rtrid %s) socket, err = %d",
__func__,
inet_ntop(AF_INET, &peer->remote_id, buf,
if (rc != 0) {
#if defined(HAVE_CUMULUS)
zlog_ferr(
- BGP_ERR_SOCKET,
+ LIB_ERR_SOCKET,
"[Error] BGP SO_BINDTODEVICE get failed (%s), sock %d",
safe_strerror(errno), sock);
return -1;
/* Register accept thread. */
accept_sock = THREAD_FD(thread);
if (accept_sock < 0) {
- zlog_ferr(BGP_ERR_SOCKET, "accept_sock is nevative value %d",
+ zlog_ferr(LIB_ERR_SOCKET, "accept_sock is nevative value %d",
accept_sock);
return -1;
}
/* Accept client connection. */
bgp_sock = sockunion_accept(accept_sock, &su);
if (bgp_sock < 0) {
- zlog_ferr(BGP_ERR_SOCKET,
+ zlog_ferr(LIB_ERR_SOCKET,
"[Error] BGP socket accept failed (%s)",
safe_strerror(errno));
return -1;
#ifdef IPTOS_PREC_INTERNETCONTROL
if (bgpd_privs.change(ZPRIVS_RAISE))
- zlog_ferr(BGP_ERR_PRIVILEGES, "%s: could not raise privs",
+ zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not raise privs",
__func__);
if (sockunion_family(&peer->su) == AF_INET)
setsockopt_ipv4_tos(peer->fd, IPTOS_PREC_INTERNETCONTROL);
else if (sockunion_family(&peer->su) == AF_INET6)
setsockopt_ipv6_tclass(peer->fd, IPTOS_PREC_INTERNETCONTROL);
if (bgpd_privs.change(ZPRIVS_LOWER))
- zlog_ferr(BGP_ERR_PRIVILEGES, "%s: could not lower privs",
+ zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not lower privs",
__func__);
#endif
sockopt_reuseport(sock);
if (bgpd_privs.change(ZPRIVS_RAISE))
- zlog_ferr(BGP_ERR_PRIVILEGES, "%s: could not raise privs",
+ zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not raise privs",
__func__);
#ifdef IPTOS_PREC_INTERNETCONTROL
ret = bind(sock, sa, salen);
en = errno;
if (bgpd_privs.change(ZPRIVS_LOWER))
- zlog_ferr(BGP_ERR_PRIVILEGES, "%s: could not lower privs",
+ zlog_ferr(LIB_ERR_PRIVILEGES, "%s: could not lower privs",
__func__);
if (ret < 0) {
- zlog_ferr(BGP_ERR_SOCKET, "bind: %s", safe_strerror(en));
+ zlog_ferr(LIB_ERR_SOCKET, "bind: %s", safe_strerror(en));
return ret;
}
ret = listen(sock, SOMAXCONN);
if (ret < 0) {
- zlog_ferr(BGP_ERR_SOCKET, "listen: %s", safe_strerror(errno));
+ zlog_ferr(LIB_ERR_SOCKET, "listen: %s", safe_strerror(errno));
return ret;
}
if (bgpd_privs.change(ZPRIVS_LOWER))
zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges");
if (ret != 0) {
- zlog_ferr(BGP_ERR_SOCKET, "getaddrinfo: %s", gai_strerror(ret));
+ zlog_ferr(LIB_ERR_SOCKET, "getaddrinfo: %s", gai_strerror(ret));
return -1;
}
if (bgpd_privs.change(ZPRIVS_LOWER))
zlog_ferr(LIB_ERR_PRIVILEGES, "Can't lower privileges");
if (sock < 0) {
- zlog_ferr(BGP_ERR_SOCKET, "socket: %s",
+ zlog_ferr(LIB_ERR_SOCKET, "socket: %s",
safe_strerror(errno));
continue;
}
freeaddrinfo(ainfo_save);
if (count == 0 && bgp->inst_type != BGP_INSTANCE_TYPE_VRF) {
zlog_ferr(
- BGP_ERR_SOCKET,
+ LIB_ERR_SOCKET,
"%s: no usable addresses please check other programs usage of specified port %d",
__func__, port);
- zlog_ferr(BGP_ERR_SOCKET, "%s: Program cannot continue",
+ zlog_ferr(LIB_ERR_SOCKET, "%s: Program cannot continue",
__func__);
exit(-1);
}
#include "plist.h"
#include "queue.h"
#include "filter.h"
+#include "lib_errors.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_table.h"
/* Get sockname. */
if ((ret = bgp_getsockname(peer)) < 0) {
- zlog_ferr(BGP_ERR_SOCKET,
+ zlog_ferr(LIB_ERR_SOCKET,
"%s: bgp_getsockname() failed for peer: %s",
__FUNCTION__, peer->host);
return BGP_Stop;
#include "lib/command.h"
#include "lib/stream.h"
#include "lib/ringbuf.h"
+#include "lib/lib_errors.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_ecommunity.h"
size);
break;
default:
- zlog_err("%s: Unknown group type=%d", __func__, type);
+ zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: Unknown group type=%d",
+ __func__, type);
/* should never happen */
assert("Unknown type" == NULL);
break;
criteria, search_cb);
break;
default:
- zlog_err("%s: Unknown group type=%d", __func__, type);
+ zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: Unknown group type=%d",
+ __func__, type);
/* should never happen */
assert("Unknown type" == NULL);
break;
#include "lib/skiplist.h"
#include "lib/thread.h"
#include "lib/stream.h"
+#include "lib/lib_errors.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_ecommunity.h"
break;
default:
- zlog_err("%s: bad afi %d", __func__, afi);
+ zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", __func__, afi);
return;
}
break;
default:
- zlog_err("%s: bad afi %d", __func__, afi);
+ zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", __func__, afi);
return;
}
default:
/* not expected */
- zlog_err("%s: bad safi %d", __func__, safi);
+ zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: bad safi %d", __func__,
+ safi);
return rfapiBgpInfoFilteredImportBadSafi;
}
}
#include "lib/linklist.h"
#include "lib/plist.h"
#include "lib/routemap.h"
+#include "lib/lib_errors.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_ecommunity.h"
if (!afi) {
- zlog_err("%s: can't get afi of route node", __func__);
+ zlog_ferr(LIB_ERR_DEVELOPMENT,
+ "%s: can't get afi of route node", __func__);
return;
}
struct prefix ce_nexthop;
if (!afi) {
- zlog_err("%s: bad afi", __func__);
+ zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: bad afi", __func__);
return;
}
afi_t afi = family2afi(rn->p.family);
if (!afi) {
- zlog_err("%s: can't get afi of route node", __func__);
+ zlog_ferr(LIB_ERR_DEVELOPMENT,
+ "%s: can't get afi of route node", __func__);
return;
}
afi_t afi = family2afi(rn->p.family);
if (!afi) {
- zlog_err("%s: can't get afi route node", __func__);
+ zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: can't get afi route node",
+ __func__);
return;
}
afi_t afi = family2afi(rfd->vn_addr.addr_family);
if (!afi) {
- zlog_err("%s: can't get afi of nve vn addr", __func__);
+ zlog_ferr(LIB_ERR_DEVELOPMENT,
+ "%s: can't get afi of nve vn addr", __func__);
return;
}
if (afi == AFI_IP || afi == AFI_IP6) {
rt = import_table->imported_vpn[afi];
} else {
- zlog_err("%s: bad afi %d", __func__, afi);
+ zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: bad afi %d",
+ __func__, afi);
return;
}
afi_t afi = family2afi(rfd->vn_addr.addr_family);
if (!afi) {
- zlog_err("%s: can't get afi of nve vn addr", __func__);
+ zlog_ferr(LIB_ERR_DEVELOPMENT,
+ "%s: can't get afi of nve vn addr", __func__);
return;
}
if (afi == AFI_IP || afi == AFI_IP6) {
rt = import_table->imported_vpn[afi];
} else {
- zlog_err("%s: bad afi %d", __func__, afi);
+ zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: bad afi %d",
+ __func__, afi);
return;
}
if (afi == AFI_IP || afi == AFI_IP6) {
rt = import_table->imported_vpn[afi];
} else {
- zlog_err("%s: bad afi %d", __func__, afi);
+ zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", __func__, afi);
return;
}
struct attr *iattr;
if (!afi) {
- zlog_err("%s: can't get afi of route node", __func__);
+ zlog_ferr(LIB_ERR_DEVELOPMENT,
+ "%s: can't get afi of route node", __func__);
return;
}
struct vnc_export_info *eti;
if (!afi) {
- zlog_err("%s: can't get afi route node", __func__);
+ zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: can't get afi route node",
+ __func__);
return;
}
#include "lib/linklist.h"
#include "lib/plist.h"
#include "lib/routemap.h"
+#include "lib/lib_errors.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_ecommunity.h"
*/
if (!afi) {
- zlog_err("%s: can't get afi of prefix", __func__);
+ zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: can't get afi of prefix",
+ __func__);
return;
}
}
if (!afi) {
- zlog_err("%s: can't get afi of prefix", __func__);
+ zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: can't get afi of prefix",
+ __func__);
return;
}
assert(rfg);
if (!afi) {
- zlog_err("%s: can't get afi of prefix", __func__);
+ zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: can't get afi of prefix",
+ __func__);
return;
}
VNC_RHNCK(enter);
if (!afi) {
- zlog_err("%s: can't get afi of prefix", __func__);
+ zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: can't get afi of prefix",
+ __func__);
return;
}
#include "lib/stream.h"
#include "lib/ringbuf.h"
#include "lib/memory.h"
+#include "lib/lib_errors.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_ecommunity.h"
return;
if (rn->p.family != AF_INET && rn->p.family != AF_INET6) {
- zlog_err("%s: invalid route node addr family", __func__);
+ zlog_ferr(LIB_ERR_DEVELOPMENT,
+ "%s: invalid route node addr family", __func__);
return;
}
return;
if (afi != AFI_IP && afi != AFI_IP6) {
- zlog_err("%s: invalid vn addr family", __func__);
+ zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: invalid vn addr family",
+ __func__);
return;
}
if (afi == AFI_IP || afi == AFI_IP6) {
rt = import_table->imported_vpn[afi];
} else {
- zlog_err("%s: bad afi %d", __func__, afi);
+ zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", __func__, afi);
return;
}
if (!family) {
- zlog_err("%s: computed bad family: %d", __func__, family);
+ zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: computed bad family: %d",
+ __func__, family);
return;
}