#include "vty.h"
#include "srcdest_table.h"
-#include "isisd/dict.h"
#include "isisd/isis_constants.h"
#include "isisd/isis_common.h"
#include "isisd/isis_flags.h"
if (!er_table) {
zlog_warn(
- "%s: External reachability table of area %s"
- " is not initialized.",
+ "%s: External reachability table of area %s is not initialized.",
__func__, area->area_tag);
return;
}
if (!er_table) {
zlog_warn(
- "%s: External reachability table of area %s"
- " is not initialized.",
+ "%s: External reachability table of area %s is not initialized.",
__func__, area->area_tag);
return;
}
}
/* Handle notification about route being added */
-void isis_redist_add(int type, struct prefix *p, struct prefix_ipv6 *src_p,
- uint8_t distance, uint32_t metric)
+void isis_redist_add(struct isis *isis, int type, struct prefix *p,
+ struct prefix_ipv6 *src_p, uint8_t distance,
+ uint32_t metric)
{
int family = p->family;
struct route_table *ei_table = get_ext_info(isis, family);
int level;
struct isis_redist *redist;
- char debug_buf[BUFSIZ];
- prefix2str(p, debug_buf, sizeof(debug_buf));
-
- zlog_debug("%s: New route %s from %s: distance %d.", __func__,
- debug_buf, zebra_route_string(type), distance);
+ zlog_debug("%s: New route %pFX from %s: distance %d.", __func__, p,
+ zebra_route_string(type), distance);
if (!ei_table) {
zlog_warn("%s: External information table not initialized.",
}
}
-void isis_redist_delete(int type, struct prefix *p, struct prefix_ipv6 *src_p)
+void isis_redist_delete(struct isis *isis, int type, struct prefix *p,
+ struct prefix_ipv6 *src_p)
{
int family = p->family;
struct route_table *ei_table = get_ext_info(isis, family);
int level;
struct isis_redist *redist;
- char debug_buf[BUFSIZ];
- prefix2str(p, debug_buf, sizeof(debug_buf));
-
- zlog_debug("%s: Removing route %s from %s.", __func__, debug_buf,
+ zlog_debug("%s: Removing route %pFX from %s.", __func__, p,
zebra_route_string(type));
if (is_default_prefix(p)
* by "default-information originate always". Areas without the
* "always" setting will ignore routes with origin
* DEFAULT_ROUTE. */
- isis_redist_add(DEFAULT_ROUTE, p, NULL,
- 254, MAX_WIDE_PATH_METRIC);
+ isis_redist_add(isis, DEFAULT_ROUTE, p, NULL, 254,
+ MAX_WIDE_PATH_METRIC);
return;
}
ei_node = srcdest_rnode_lookup(ei_table, p, src_p);
if (!ei_node || !ei_node->info) {
- char buf[BUFSIZ];
- prefix2str(p, buf, sizeof(buf));
zlog_warn(
- "%s: Got a delete for %s route %s, but that route"
- " was never added.",
- __func__, zebra_route_string(type), buf);
+ "%s: Got a delete for %s route %pFX, but that route was never added.",
+ __func__, zebra_route_string(type), p);
if (ei_node)
route_unlock_node(ei_node);
return;
{
if (redist->map_name) {
XFREE(MTYPE_ISIS, redist->map_name);
+ route_map_counter_decrement(redist->map);
redist->map = NULL;
}
if (routemap && strlen(routemap)) {
redist->map_name = XSTRDUP(MTYPE_ISIS, routemap);
redist->map = route_map_lookup_by_name(routemap);
+ route_map_counter_increment(redist->map);
}
}
redist = &area->redist_settings[protocol][type]
[level];
redist->redist = 0;
- if (redist->map_name)
- XFREE(MTYPE_ISIS, redist->map_name);
+ XFREE(MTYPE_ISIS, redist->map_name);
}
route_table_finish(area->ext_reach[protocol][level]);
}
DEFUN (isis_redistribute,
isis_redistribute_cmd,
"redistribute <ipv4|ipv6> " PROTO_REDIST_STR
- " [<metric (0-16777215)|route-map WORD>]",
+ " [{metric (0-16777215)|route-map WORD}]",
REDIST_STR
"Redistribute IPv4 routes\n"
"Redistribute IPv6 routes\n"
{
int idx_afi = 1;
int idx_protocol = 2;
- int idx_metric_rmap = fabricd ? 3 : 4;
+ int idx_metric_rmap = 1;
VTY_DECLVAR_CONTEXT(isis_area, area);
int family;
int afi;
return CMD_WARNING_CONFIG_FAILED;
}
- if (argc > idx_metric_rmap + 1) {
- if (argv[idx_metric_rmap + 1]->arg[0] == '\0')
- return CMD_WARNING_CONFIG_FAILED;
-
- if (strmatch(argv[idx_metric_rmap]->text, "metric")) {
- char *endp;
- metric = strtoul(argv[idx_metric_rmap + 1]->arg, &endp,
- 10);
+ if (argv_find(argv, argc, "metric", &idx_metric_rmap)) {
+ metric = strtoul(argv[idx_metric_rmap + 1]->arg, NULL, 10);
+ }
- if (*endp != '\0')
- return CMD_WARNING_CONFIG_FAILED;
- } else {
- routemap = argv[idx_metric_rmap + 1]->arg;
- }
+ idx_metric_rmap = 1;
+ if (argv_find(argv, argc, "route-map", &idx_metric_rmap)) {
+ routemap = argv[idx_metric_rmap + 1]->arg;
}
isis_redist_set(area, level, family, type, metric, routemap, 0);
DEFUN (isis_default_originate,
isis_default_originate_cmd,
- "default-information originate <ipv4|ipv6>"
- " [always] [<metric (0-16777215)|route-map WORD>]",
+ "default-information originate <ipv4|ipv6> [always] [{metric (0-16777215)|route-map WORD}]",
"Control distribution of default information\n"
"Distribute a default route\n"
"Distribute default route for IPv4\n"
{
int idx_afi = 2;
int idx_always = fabricd ? 3 : 4;
- int idx_metric_rmap = fabricd ? 3 : 4;
+ int idx_metric_rmap = 1;
VTY_DECLVAR_CONTEXT(isis_area, area);
int family;
int originate_type = DEFAULT_ORIGINATE;
idx_metric_rmap++;
}
- if (argc > idx_metric_rmap) {
- if (strmatch(argv[idx_metric_rmap]->text, "metric"))
- metric = strtoul(argv[idx_metric_rmap + 1]->arg, NULL,
- 10);
- else
- routemap = argv[idx_metric_rmap + 1]->arg;
+ if (argv_find(argv, argc, "metric", &idx_metric_rmap)) {
+ metric = strtoul(argv[idx_metric_rmap + 1]->arg, NULL, 10);
+ }
+
+ idx_metric_rmap = 1;
+ if (argv_find(argv, argc, "route-map", &idx_metric_rmap)) {
+ routemap = argv[idx_metric_rmap + 1]->arg;
}
if (family == AF_INET6 && originate_type != DEFAULT_ORIGINATE_ALWAYS) {