*: 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/ripngd/ripng_route.h b/ripngd/ripng_route.h
index fe65c88..9ff90aa 100644
--- a/ripngd/ripng_route.h
+++ b/ripngd/ripng_route.h
@@ -35,13 +35,13 @@
u_char metric;
/* Tag field of RIPng packet.*/
- u_short tag;
+ u_int16_t tag;
/* Route-map futures - this variables can be changed. */
struct in6_addr nexthop_out;
u_char metric_set;
u_char metric_out;
- u_short tag_out;
+ u_int16_t tag_out;
};
extern void ripng_aggregate_increment (struct route_node *rp,
diff --git a/ripngd/ripng_routemap.c b/ripngd/ripng_routemap.c
index eae4566..c596aec 100644
--- a/ripngd/ripng_routemap.c
+++ b/ripngd/ripng_routemap.c
@@ -240,7 +240,7 @@
route_match_tag (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
- u_short *tag;
+ route_tag_t *tag;
struct ripng_info *rinfo;
if (type == RMAP_RIPNG)
@@ -257,32 +257,12 @@
return RMAP_NOMATCH;
}
-/* Route map `match tag' match statement. `arg' is TAG value */
-static void *
-route_match_tag_compile (const char *arg)
-{
- u_short *tag;
-
- tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short));
- *tag = atoi (arg);
-
- 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. */
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' */
@@ -452,7 +432,7 @@
route_set_tag (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
- u_short *tag;
+ route_tag_t *tag;
struct ripng_info *rinfo;
if(type == RMAP_RIPNG)
@@ -460,7 +440,7 @@
/* Fetch routemap's rule information. */
tag = rule;
rinfo = object;
-
+
/* Set next hop value. */
rinfo->tag_out = *tag;
}
@@ -468,33 +448,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)
-{
- u_short *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"
@@ -564,7 +524,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")
@@ -587,7 +547,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"
@@ -675,7 +635,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")
@@ -698,7 +658,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/ripngd/ripngd.h b/ripngd/ripngd.h
index 93f6ff1..ef6d56a 100644
--- a/ripngd/ripngd.h
+++ b/ripngd/ripngd.h
@@ -146,7 +146,7 @@
struct rte
{
struct in6_addr addr; /* RIPng destination prefix */
- u_short tag; /* RIPng tag */
+ u_int16_t tag; /* RIPng tag */
u_char prefixlen; /* Length of the RIPng prefix */
u_char metric; /* Metric of the RIPng route */
/* The nexthop is stored by the structure
@@ -200,7 +200,7 @@
struct in6_addr nexthop_out;
u_char metric_set;
u_char metric_out;
- u_short tag_out;
+ u_int16_t tag_out;
struct route_node *rp;
};