summaryrefslogtreecommitdiffstats
path: root/lib/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 /lib/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 'lib/routemap.c')
-rw-r--r--lib/routemap.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/routemap.c b/lib/routemap.c
index e0a7080bb..6f93087ae 100644
--- a/lib/routemap.c
+++ b/lib/routemap.c
@@ -1829,6 +1829,32 @@ route_map_init_dep_hashes (void)
route_map_dep_hash_cmp);
}
+/* Common route map rules */
+
+void *
+route_map_rule_tag_compile (const char *arg)
+{
+ unsigned long int tmp;
+ char *endptr;
+ route_tag_t *tag;
+
+ errno = 0;
+ tmp = strtoul(arg, &endptr, 0);
+ if (arg[0] == '\0' || *endptr != '\0' || errno || tmp > ROUTE_TAG_MAX)
+ return NULL;
+
+ tag = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(*tag));
+ *tag = tmp;
+
+ return tag;
+}
+
+void
+route_map_rule_tag_free (void *rule)
+{
+ XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
+}
+
/* Initialization of route map vector. */
void
route_map_init_vty (void)