*: 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/ospfd/ospf_asbr.h b/ospfd/ospf_asbr.h
index bc41a14..0fc3302 100644
--- a/ospfd/ospf_asbr.h
+++ b/ospfd/ospf_asbr.h
@@ -44,7 +44,7 @@
/* Nexthop address. */
struct in_addr nexthop;
- /* Additional Route tag. */
+ /* Additional Route tag: this is the wire type */
u_int32_t tag;
struct route_map_set_values route_map_set;
diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c
index 66cc294..be9fa2a 100644
--- a/ospfd/ospf_dump.c
+++ b/ospfd/ospf_dump.c
@@ -493,7 +493,7 @@
IS_EXTERNAL_METRIC (al->e[i].tos) ? "E" : "-",
al->e[i].tos & 0x7f, GET_METRIC (al->e[i].metric));
zlog_debug (" Forwarding address %s", inet_ntoa (al->e[i].fwd_addr));
- zlog_debug (" External Route Tag %d", al->e[i].route_tag);
+ zlog_debug (" External Route Tag %u", al->e[i].route_tag);
}
}
diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c
index dc41812..31d7ce2 100644
--- a/ospfd/ospf_routemap.c
+++ b/ospfd/ospf_routemap.c
@@ -436,45 +436,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,
};
@@ -626,46 +594,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;
- 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 tag value. */
-static void
-route_set_tag_free (void *rule)
-{
- XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
-}
-
/* Route map commands for tag set. */
-struct route_map_rule_cmd route_set_tag_cmd =
+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,
};
DEFUN (match_ip_nexthop,
@@ -855,7 +790,7 @@
DEFUN (match_tag,
match_tag_cmd,
- "match tag <1-65535>",
+ "match tag <1-4294967295>",
MATCH_STR
"Match tag of route\n"
"Tag value\n")
@@ -878,7 +813,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"
@@ -955,7 +890,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")
@@ -978,7 +913,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/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 1772f24..f31355e 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -3872,8 +3872,8 @@
zlog_debug( " Forward Address: %s%s",
inet_ntoa (al->e[0].fwd_addr), "\n");
- zlog_debug( " External Route Tag: %u%s%s",
- ntohl (al->e[0].route_tag), "\n", "\n");
+ zlog_debug( " External Route Tag: %lu%s%s",
+ (u_long)ntohl (al->e[0].route_tag), "\n", "\n");
return 0;
}
@@ -3900,8 +3900,8 @@
vty_out (vty, " NSSA: Forward Address: %s%s",
inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE);
- vty_out (vty, " External Route Tag: %u%s%s",
- ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, " External Route Tag: %lu%s%s",
+ (u_long)ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE);
}
return 0;