summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_routemap.c
diff options
context:
space:
mode:
authorChristian Franke <chris@opensourcerouting.org>2016-10-01 20:42:34 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-10-08 03:05:05 +0200
commitdc9ffce87868441da9653d1476a4307eb2ecd996 (patch)
treed690391791c1c6882062806e16733e7df5c17c6d /zebra/zebra_routemap.c
parentospfd: Update route in zebra when tag changes (diff)
downloadfrr-dc9ffce87868441da9653d1476a4307eb2ecd996.tar.xz
frr-dc9ffce87868441da9653d1476a4307eb2ecd996.zip
*: Consistently support 32-bit route tags
This patch improves zebra,ripd,ripngd,ospfd and bgpd so that they can make use of 32-bit route tags in the case of zebra,ospf,bgp or 16-bit route-tags in the case of ripd,ripngd. It is based on the following patch: commit d25764028829a3a30cdbabe85f32408a63cccadf Author: Paul Jakma <paul.jakma@hpe.com> Date: Fri Jul 1 14:23:45 2016 +0100 *: Widen width of Zserv routing tag field. But also contains the changes which make this actually useful for all the daemons. Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Diffstat (limited to 'zebra/zebra_routemap.c')
-rw-r--r--zebra/zebra_routemap.c54
1 files changed, 11 insertions, 43 deletions
diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c
index 685f5cc4b..9cfae6e70 100644
--- a/zebra/zebra_routemap.c
+++ b/zebra/zebra_routemap.c
@@ -51,7 +51,7 @@ struct nh_rmap_obj
vrf_id_t vrf_id;
u_int32_t source_protocol;
int metric;
- u_short tag;
+ route_tag_t tag;
};
static void zebra_route_map_set_delay_timer(u_int32_t value);
@@ -193,7 +193,7 @@ static route_map_result_t
route_match_tag (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
- u_short *tag;
+ route_tag_t *tag;
struct nh_rmap_obj *nh_data;
if (type == RMAP_ZEBRA)
@@ -207,45 +207,13 @@ route_match_tag (void *rule, struct prefix *prefix,
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;
- u_short 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
+ "tag",
+ route_match_tag,
+ route_map_rule_tag_compile,
+ route_map_rule_tag_free,
};
@@ -332,7 +300,7 @@ ALIAS (no_match_interface,
DEFUN (match_tag,
match_tag_cmd,
- "match tag <1-65535>",
+ "match tag <1-4294967295>",
MATCH_STR
"Match tag of route\n"
"Tag value\n")
@@ -358,7 +326,7 @@ DEFUN (no_match_tag,
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")
@@ -1649,7 +1617,7 @@ zebra_route_map_write_delay_timer (struct vty *vty)
route_map_result_t
zebra_route_map_check (int family, int rib_type, struct prefix *p,
- struct nexthop *nexthop, vrf_id_t vrf_id, u_short tag)
+ struct nexthop *nexthop, vrf_id_t vrf_id, route_tag_t tag)
{
struct route_map *rmap = NULL;
route_map_result_t ret = RMAP_MATCH;
@@ -1692,7 +1660,7 @@ zebra_del_import_table_route_map (afi_t afi, uint32_t table)
route_map_result_t
zebra_import_table_route_map_check (int family, int rib_type, struct prefix *p,
- struct nexthop *nexthop, vrf_id_t vrf_id, u_short tag, const char *rmap_name)
+ struct nexthop *nexthop, vrf_id_t vrf_id, route_tag_t tag, const char *rmap_name)
{
struct route_map *rmap = NULL;
route_map_result_t ret = RMAP_DENYMATCH;