From 45301f8cb2305153931d05fe227a795bed34adf4 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 20 Aug 2018 14:45:25 -0400 Subject: [PATCH] ospfd: Convert ospf_routemap.c to use error card subsystem Signed-off-by: Donald Sharp --- ospfd/ospf_errors.c | 14 +++++++++++++- ospfd/ospf_errors.h | 1 + ospfd/ospf_routemap.c | 4 +++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ospfd/ospf_errors.c b/ospfd/ospf_errors.c index 2927f7cb14..e321a03b84 100644 --- a/ospfd/ospf_errors.c +++ b/ospfd/ospf_errors.c @@ -23,6 +23,18 @@ #include "lib/ferr.h" #include "ospf_errors.h" +static struct log_ref ferr_ospf_warn[] = { + { + .code = OSPF_WARN_SET_METRIC_PLUS, + .title = "OSPF does not support `set metric +rtt/-rtt`", + .description = "This implementation of OSPF does not currently support `set metric +rtt/-rtt`", + .suggestion = "Do not use this particular set command for an ospf route-map", + }, + { + .code = END_FERR, + } +}; + static struct log_ref ferr_ospf_err[] = { { .code = OSPF_ERR_PKT_PROCESS, @@ -72,7 +84,6 @@ static struct log_ref ferr_ospf_err[] = { .description = "OSPF Segment Routing invalid Algorithm", .suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting" }, - { .code = END_FERR, } @@ -80,5 +91,6 @@ static struct log_ref ferr_ospf_err[] = { void ospf_error_init(void) { + log_ref_add(ferr_ospf_warn); log_ref_add(ferr_ospf_err); } diff --git a/ospfd/ospf_errors.h b/ospfd/ospf_errors.h index c3f1018550..ef1431ba7b 100644 --- a/ospfd/ospf_errors.h +++ b/ospfd/ospf_errors.h @@ -32,6 +32,7 @@ enum ospf_log_refs { OSPF_ERR_SR_NODE_CREATE, OSPF_ERR_SR_INVALID_LSA_ID, OSPF_ERR_SR_INVALID_ALGORITHM, + OSPF_WARN_SET_METRIC_PLUS, }; extern void ospf_error_init(void); diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c index c5ec1db336..d4513eebd3 100644 --- a/ospfd/ospf_routemap.c +++ b/ospfd/ospf_routemap.c @@ -40,6 +40,7 @@ #include "ospfd/ospf_lsa.h" #include "ospfd/ospf_route.h" #include "ospfd/ospf_zebra.h" +#include "ospfd/ospf_errors.h" /* Hook function for updating route_map assignment. */ static void ospf_route_map_update(const char *name) @@ -392,7 +393,8 @@ static void *route_set_metric_compile(const char *arg) metric->type = metric_absolute; if (strmatch(arg, "+rtt") || strmatch(arg, "-rtt")) { - zlog_warn("OSPF does not support 'set metric +rtt / -rtt'"); + flog_warn(OSPF_WARN_SET_METRIC_PLUS, + "OSPF does not support 'set metric +rtt / -rtt'"); return metric; } -- 2.39.5