*: Port Christians tweaks for 32-bit route tags
Port over Christian's tweaks from his port of my commit widening the
route-tag field width to 32-bit. Commit dc9ffce8786844
"*: Consistently support 32-bit route tags".
with "changes which make this actually useful for all the daemons".
This is missing the zebra route-map changes.
diff --git a/ripd/rip_routemap.c b/ripd/rip_routemap.c
index 20d3e6e..4e73694 100644
--- a/ripd/rip_routemap.c
+++ b/ripd/rip_routemap.c
@@ -480,45 +480,13 @@
return RMAP_NOMATCH;
}
-/* Route map `match tag' match statement. `arg' is TAG value */
-static void *
-route_match_tag_compile (const char *arg)
-{
- route_tag_t *tag;
- route_tag_t tmp;
-
- /* tag value shoud be integer. */
- if (! all_digit (arg))
- return NULL;
-
- tmp = atoi(arg);
- if (tmp < 1)
- return NULL;
-
- tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short));
-
- if (!tag)
- return tag;
-
- *tag = tmp;
-
- return tag;
-}
-
-/* Free route map's compiled `match tag' value. */
-static void
-route_match_tag_free (void *rule)
-{
- XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
-}
-
/* Route map commands for tag matching. */
-struct route_map_rule_cmd route_match_tag_cmd =
+static struct route_map_rule_cmd route_match_tag_cmd =
{
"tag",
route_match_tag,
- route_match_tag_compile,
- route_match_tag_free
+ route_map_rule_tag_compile,
+ route_map_rule_tag_free,
};
/* `set metric METRIC' */
@@ -703,33 +671,13 @@
return RMAP_OKAY;
}
-/* Route map `tag' compile function. Given string is converted
- to u_short. */
-static void *
-route_set_tag_compile (const char *arg)
-{
- route_tag_t *tag;
-
- tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short));
- *tag = atoi (arg);
-
- return tag;
-}
-
-/* Free route map's compiled `ip nexthop' value. */
-static void
-route_set_tag_free (void *rule)
-{
- XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
-}
-
/* Route map commands for tag set. */
static struct route_map_rule_cmd route_set_tag_cmd =
{
"tag",
route_set_tag,
- route_set_tag_compile,
- route_set_tag_free
+ route_map_rule_tag_compile,
+ route_map_rule_tag_free
};
#define MATCH_STR "Match values from routing table\n"
@@ -950,7 +898,7 @@
DEFUN (match_tag,
match_tag_cmd,
- "match tag <1-65535>",
+ "match tag <1-4294967295>",
MATCH_STR
"Match tag of route\n"
"Metric value\n")
@@ -973,7 +921,7 @@
ALIAS (no_match_tag,
no_match_tag_val_cmd,
- "no match tag <1-65535>",
+ "no match tag <1-4294967295>",
NO_STR
MATCH_STR
"Match tag of route\n"
@@ -1073,7 +1021,7 @@
DEFUN (set_tag,
set_tag_cmd,
- "set tag <1-65535>",
+ "set tag <1-4294967295>",
SET_STR
"Tag value for routing protocol\n"
"Tag value\n")
@@ -1096,7 +1044,7 @@
ALIAS (no_set_tag,
no_set_tag_val_cmd,
- "no set tag <1-65535>",
+ "no set tag <1-4294967295>",
NO_STR
SET_STR
"Tag value for routing protocol\n"
diff --git a/ripd/ripd.h b/ripd/ripd.h
index 5e87fcd..9dba1a5 100644
--- a/ripd/ripd.h
+++ b/ripd/ripd.h
@@ -223,7 +223,7 @@
struct in_addr nexthop_out;
u_char metric_set;
u_int32_t metric_out;
- u_short tag_out;
+ u_int16_t tag_out;
ifindex_t ifindex_out;
struct route_node *rp;