diff options
author | Christian Franke <chris@opensourcerouting.org> | 2016-10-01 20:42:34 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-10-08 03:05:05 +0200 |
commit | dc9ffce87868441da9653d1476a4307eb2ecd996 (patch) | |
tree | d690391791c1c6882062806e16733e7df5c17c6d /ripngd/ripng_routemap.c | |
parent | ospfd: Update route in zebra when tag changes (diff) | |
download | frr-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 'ripngd/ripng_routemap.c')
-rw-r--r-- | ripngd/ripng_routemap.c | 66 |
1 files changed, 14 insertions, 52 deletions
diff --git a/ripngd/ripng_routemap.c b/ripngd/ripng_routemap.c index 9bda2e260..ee4f4afce 100644 --- a/ripngd/ripng_routemap.c +++ b/ripngd/ripng_routemap.c @@ -240,8 +240,9 @@ 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 ripng_info *rinfo; + route_tag_t rinfo_tag; if (type == RMAP_RIPNG) { @@ -249,7 +250,8 @@ route_match_tag (void *rule, struct prefix *prefix, rinfo = object; /* The information stored by rinfo is host ordered. */ - if (rinfo->tag == *tag) + rinfo_tag = rinfo->tag; + if (rinfo_tag == *tag) return RMAP_MATCH; else return RMAP_NOMATCH; @@ -257,32 +259,12 @@ 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; - - 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 +434,7 @@ static route_map_result_t 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 +442,7 @@ route_set_tag (void *rule, struct prefix *prefix, /* Fetch routemap's rule information. */ tag = rule; rinfo = object; - + /* Set next hop value. */ rinfo->tag_out = *tag; } @@ -468,33 +450,13 @@ route_set_tag (void *rule, struct prefix *prefix, 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 +526,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" "Metric value\n") @@ -587,7 +549,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" @@ -681,7 +643,7 @@ ALIAS (no_set_ipv6_nexthop_local, 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") @@ -704,7 +666,7 @@ DEFUN (no_set_tag, 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" |