summaryrefslogtreecommitdiffstats
path: root/pimd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-06-18 19:21:27 +0200
committerQuentin Young <qlyoung@cumulusnetworks.com>2018-08-14 22:02:05 +0200
commitd9ff43027374621745f195352be8907ff3ad8393 (patch)
treece5bcedc50347b5c8cab31dd056cefa5aa54c917 /pimd
parentbgpd: Cleanup initialization of bgp_errors.c (diff)
downloadfrr-d9ff43027374621745f195352be8907ff3ad8393.tar.xz
frr-d9ff43027374621745f195352be8907ff3ad8393.zip
pimd: Add pim_errors and define some pim specific errors
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd')
-rw-r--r--pimd/pim_errors.c48
-rw-r--r--pimd/pim_errors.h33
-rw-r--r--pimd/pim_main.c2
-rw-r--r--pimd/pim_msdp_packet.c6
-rw-r--r--pimd/pim_msdp_socket.c6
-rw-r--r--pimd/pim_pim.c6
-rw-r--r--pimd/pim_rp.c3
-rw-r--r--pimd/pim_ssm.c6
-rw-r--r--pimd/pim_zlookup.c7
-rw-r--r--pimd/subdir.am2
10 files changed, 107 insertions, 12 deletions
diff --git a/pimd/pim_errors.c b/pimd/pim_errors.c
new file mode 100644
index 000000000..ffffa8dd9
--- /dev/null
+++ b/pimd/pim_errors.c
@@ -0,0 +1,48 @@
+/*
+ * pim_errors - code for error messages that may occur in the
+ * pim process
+ * Copyright (C) 2018 Cumulus Networks, Inc.
+ * Donald Sharp
+ *
+ * FRR 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, or (at your option) any
+ * later version.
+ *
+ * FRR 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 "pim_errors.h"
+
+static struct ferr_ref ferr_pim_err[] = {
+ {
+ .code = PIM_ERR_MSDP_PACKET,
+ .title = "PIM MSDP Packet Error",
+ .description = "PIM has received a packet from a peer that does not correctly decode",
+ .suggestion = "Check MSDP peer and ensure it is correctly working"
+ },
+ {
+ .code = PIM_ERR_CONFIG,
+ .title = "PIM Configuration Error",
+ .description = "Pim has detected a configuration error",
+ .suggestion = "Ensure the configuration is correct and apply correct configuration"
+ },
+ {
+ .code = END_FERR,
+ }
+};
+
+void pim_error_init(void)
+{
+ ferr_ref_init();
+
+ ferr_ref_add(ferr_pim_err);
+}
diff --git a/pimd/pim_errors.h b/pimd/pim_errors.h
new file mode 100644
index 000000000..bcb1628e6
--- /dev/null
+++ b/pimd/pim_errors.h
@@ -0,0 +1,33 @@
+/*
+ * pim_errors - header for error messages that may occur in the pim process
+ * Copyright (C) 2018 Cumulus Networks, Inc.
+ * Donald Sharp
+ *
+ * FRR 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, or (at your option) any
+ * later version.
+ *
+ * FRR 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 __PIM_ERRORS_H__
+#define __PIM_ERRORS_H__
+
+#include "ferr.h"
+#include "pim_errors.h"
+
+enum pim_ferr_refs {
+ PIM_ERR_MSDP_PACKET = PIM_FERR_START,
+ PIM_ERR_CONFIG,
+};
+
+extern void pim_error_init(void);
+
+#endif
diff --git a/pimd/pim_main.c b/pimd/pim_main.c
index c4cab25ae..578794086 100644
--- a/pimd/pim_main.c
+++ b/pimd/pim_main.c
@@ -47,6 +47,7 @@
#include "pim_msdp.h"
#include "pim_iface.h"
#include "pim_bfd.h"
+#include "pim_errors.h"
extern struct host host;
@@ -108,6 +109,7 @@ int main(int argc, char **argv, char **envp)
/*
* Initializations
*/
+ pim_error_init();
pim_vrf_init();
access_list_init();
prefix_list_init();
diff --git a/pimd/pim_msdp_packet.c b/pimd/pim_msdp_packet.c
index 7aa9357b8..5c950e8dc 100644
--- a/pimd/pim_msdp_packet.c
+++ b/pimd/pim_msdp_packet.c
@@ -27,6 +27,7 @@
#include "pimd.h"
#include "pim_str.h"
+#include "pim_errors.h"
#include "pim_msdp.h"
#include "pim_msdp_packet.h"
@@ -483,8 +484,9 @@ static void pim_msdp_pkt_sa_rx_one(struct pim_msdp_peer *mp, struct in_addr rp)
if (prefix_len != 32) {
/* ignore SA update if the prefix length is not 32 */
- zlog_err("rxed sa update with invalid prefix length %d",
- prefix_len);
+ zlog_ferr(PIM_ERR_MSDP_PACKET,
+ "rxed sa update with invalid prefix length %d",
+ prefix_len);
return;
}
if (PIM_DEBUG_MSDP_PACKETS) {
diff --git a/pimd/pim_msdp_socket.c b/pimd/pim_msdp_socket.c
index 5b1afb774..d5bd34557 100644
--- a/pimd/pim_msdp_socket.c
+++ b/pimd/pim_msdp_socket.c
@@ -30,6 +30,7 @@
#include "pimd.h"
#include "pim_sock.h"
+#include "pim_errors.h"
#include "pim_msdp.h"
#include "pim_msdp_socket.h"
@@ -93,8 +94,9 @@ static int pim_msdp_sock_accept(struct thread *thread)
if (!mp || !PIM_MSDP_PEER_IS_LISTENER(mp)) {
++pim->msdp.rejected_accepts;
if (PIM_DEBUG_MSDP_EVENTS) {
- zlog_err("msdp peer connection refused from %s",
- sockunion2str(&su, buf, SU_ADDRSTRLEN));
+ zlog_ferr(PIM_ERR_MSDP_PACKET,
+ "msdp peer connection refused from %s",
+ sockunion2str(&su, buf, SU_ADDRSTRLEN));
}
close(msdp_sock);
return -1;
diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c
index f50687528..6fb0b2892 100644
--- a/pimd/pim_pim.c
+++ b/pimd/pim_pim.c
@@ -38,6 +38,7 @@
#include "pim_assert.h"
#include "pim_msg.h"
#include "pim_register.h"
+#include "pim_errors.h"
static int on_pim_hello_send(struct thread *t);
static int pim_hello_send(struct interface *ifp, uint16_t holdtime);
@@ -115,8 +116,9 @@ void pim_sock_delete(struct interface *ifp, const char *delete_message)
delete_message);
if (!ifp->info) {
- zlog_err("%s: %s: but PIM not enabled on interface %s (!)",
- __PRETTY_FUNCTION__, delete_message, ifp->name);
+ zlog_ferr(PIM_ERR_CONFIG,
+ "%s: %s: but PIM not enabled on interface %s (!)",
+ __PRETTY_FUNCTION__, delete_message, ifp->name);
return;
}
diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c
index fd1b96505..77e76c3b0 100644
--- a/pimd/pim_rp.c
+++ b/pimd/pim_rp.c
@@ -111,7 +111,8 @@ void pim_rp_init(struct pim_instance *pim)
rp_info = XCALLOC(MTYPE_PIM_RP, sizeof(*rp_info));
if (!str2prefix("224.0.0.0/4", &rp_info->group)) {
- zlog_err("Unable to convert 224.0.0.0/4 to prefix");
+ zlog_ferr(LIB_ERR_DEVELOPMENT,
+ "Unable to convert 224.0.0.0/4 to prefix");
list_delete_and_null(&pim->rp_list);
route_table_finish(pim->rp_table);
XFREE(MTYPE_PIM_RP, rp_info);
diff --git a/pimd/pim_ssm.c b/pimd/pim_ssm.c
index 1f7cfcaa9..f10cef9ce 100644
--- a/pimd/pim_ssm.c
+++ b/pimd/pim_ssm.c
@@ -24,6 +24,7 @@
#include <lib/vty.h>
#include <lib/vrf.h>
#include <lib/plist.h>
+#include <lib/lib_errors.h>
#include "pimd.h"
#include "pim_ssm.h"
@@ -72,8 +73,9 @@ static int pim_is_grp_standard_ssm(struct prefix *group)
if (first) {
if (!str2prefix(PIM_SSM_STANDARD_RANGE, &group_ssm))
- zlog_err("%s: Failure to Read Group Address: %s",
- __PRETTY_FUNCTION__, PIM_SSM_STANDARD_RANGE);
+ zlog_ferr(LIB_ERR_DEVELOPMENT,
+ "%s: Failure to Read Group Address: %s",
+ __PRETTY_FUNCTION__, PIM_SSM_STANDARD_RANGE);
first = 0;
}
diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c
index 12958b039..8b67fb7f5 100644
--- a/pimd/pim_zlookup.c
+++ b/pimd/pim_zlookup.c
@@ -315,14 +315,15 @@ static int zclient_lookup_nexthop_once(struct pim_instance *pim,
/* Check socket. */
if (zlookup->sock < 0) {
- zlog_err("%s: zclient lookup socket is not connected",
- __PRETTY_FUNCTION__);
+ zlog_ferr(LIB_ERR_ZAPI_SOCKET,
+ "%s: zclient lookup socket is not connected",
+ __PRETTY_FUNCTION__);
zclient_lookup_failed(zlookup);
return -1;
}
if (pim->vrf->vrf_id == VRF_UNKNOWN) {
- zlog_err(
+ zlog_notice(
"%s: VRF: %s does not fully exist yet, delaying lookup",
__PRETTY_FUNCTION__, pim->vrf->name);
return -1;
diff --git a/pimd/subdir.am b/pimd/subdir.am
index 0696d9b1e..55d56ece9 100644
--- a/pimd/subdir.am
+++ b/pimd/subdir.am
@@ -15,6 +15,7 @@ pimd_libpim_a_SOURCES = \
pimd/pim_bfd.c \
pimd/pim_br.c \
pimd/pim_cmd.c \
+ pimd/pim_errors.c \
pimd/pim_hello.c \
pimd/pim_iface.c \
pimd/pim_ifchannel.c \
@@ -64,6 +65,7 @@ noinst_HEADERS += \
pimd/pim_bfd.h \
pimd/pim_br.h \
pimd/pim_cmd.h \
+ pimd/pim_errors.h \
pimd/pim_hello.h \
pimd/pim_iface.h \
pimd/pim_ifchannel.h \