summaryrefslogtreecommitdiff
path: root/ripd/rip_routemap.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2016-10-17 23:36:21 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2016-10-17 23:36:21 +0000
commite52702f29d003585dcfbb4914b2a52d77a177739 (patch)
tree3e130ded38c48316796bfb602dc6fe6d119129d2 /ripd/rip_routemap.c
parent6fbde29dafeaf7c6aab9789d3eaf0234e99eefb6 (diff)
parent3d3c3cbd115a3c38b490d656002af777d002743c (diff)
Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com> Conflicts: bgpd/bgp_route.c bgpd/bgp_routemap.c bgpd/bgp_vty.c isisd/isis_redist.c isisd/isis_routemap.c isisd/isis_vty.c isisd/isisd.c lib/command.c lib/distribute.c lib/if.c lib/keychain.c lib/routemap.c lib/routemap.h ospf6d/ospf6_asbr.c ospf6d/ospf6_interface.c ospf6d/ospf6_neighbor.c ospf6d/ospf6_top.c ospf6d/ospf6_zebra.c ospf6d/ospf6d.c ospfd/ospf_routemap.c ospfd/ospf_vty.c ripd/rip_routemap.c ripngd/ripng_routemap.c vtysh/extract.pl.in vtysh/vtysh.c zebra/interface.c zebra/irdp_interface.c zebra/rt_netlink.c zebra/rtadv.c zebra/test_main.c zebra/zebra_routemap.c zebra/zebra_vty.c
Diffstat (limited to 'ripd/rip_routemap.c')
-rw-r--r--ripd/rip_routemap.c70
1 files changed, 10 insertions, 60 deletions
diff --git a/ripd/rip_routemap.c b/ripd/rip_routemap.c
index 3cdfd8adfc..60ce66265e 100644
--- a/ripd/rip_routemap.c
+++ b/ripd/rip_routemap.c
@@ -366,8 +366,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 rip_info *rinfo;
+ route_tag_t rinfo_tag;
if (type == RMAP_RIP)
{
@@ -375,7 +376,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;
@@ -383,45 +385,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
+ route_map_rule_tag_compile,
+ route_map_rule_tag_free,
};
/* `set metric METRIC' */
@@ -590,7 +560,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 rip_info *rinfo;
if(type == RMAP_RIP)
@@ -606,33 +576,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"