diff options
author | Emanuele Altomare <emanuele@common-net.org> | 2021-03-05 23:12:00 +0100 |
---|---|---|
committer | Emanuele Altomare <emanuele@common-net.org> | 2021-03-05 23:12:00 +0100 |
commit | 3b1e3aab803ff2874ed23a1c19042b9510ecdf8f (patch) | |
tree | f2958ed73332d7c17ee2e99b80f83ade0691f0b7 /isisd/isis_routemap.c | |
parent | Merge pull request #8188 from volta-networks/fix_ospf6_cost_flag (diff) | |
download | frr-3b1e3aab803ff2874ed23a1c19042b9510ecdf8f.tar.xz frr-3b1e3aab803ff2874ed23a1c19042b9510ecdf8f.zip |
isisd: added support for routemap match tag in redistribution
Now it's possible to filter routes redistributed by another protocol using tag
which comes from zebra daemon.
Example of a possible configuration:
```
!
ipv6 route fd00::/48 blackhole tag 20
ipv6 route fd00::/60 blackhole tag 10
!
interface one
ipv6 router isis COMMON
isis circuit-type level-1
!
interface two
ipv6 router isis COMMON
isis circuit-type level-2-only
!
router isis COMMON
net fd.0000.0000.0000.0001.00
redistribute ipv6 static level-1 route-map static-l1
redistribute ipv6 static level-2 route-map static-l2
topology ipv6-unicast
!
route-map static-l1 permit 10
match tag 10
!
route-map static-l2 permit 10
match tag 20
!
```
Signed-off-by: Emanuele Altomare <emanuele@common-net.org>
Diffstat (limited to 'isisd/isis_routemap.c')
-rw-r--r-- | isisd/isis_routemap.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/isisd/isis_routemap.c b/isisd/isis_routemap.c index db0f2fd8b..626e399e1 100644 --- a/isisd/isis_routemap.c +++ b/isisd/isis_routemap.c @@ -112,6 +112,35 @@ static const struct route_map_rule_cmd /* ------------------------------------------------------------*/ +/* `match tag TAG' */ +/* Match function return 1 if match is success else return zero. */ +static enum route_map_cmd_result_t +route_match_tag(void *rule, const struct prefix *p, void *object) +{ + route_tag_t *tag; + struct isis_ext_info *info; + route_tag_t info_tag; + + tag = rule; + info = object; + + info_tag = info->tag; + if (info_tag == *tag) + return RMAP_MATCH; + else + return RMAP_NOMATCH; +} + +/* Route map commands for tag matching. */ +static const struct route_map_rule_cmd route_match_tag_cmd = { + "tag", + route_match_tag, + route_map_rule_tag_compile, + route_map_rule_tag_free, +}; + +/* ------------------------------------------------------------*/ + static enum route_map_cmd_result_t route_match_ipv6_address(void *rule, const struct prefix *prefix, void *object) { @@ -234,6 +263,9 @@ void isis_route_map_init(void) route_map_match_ipv6_address_prefix_list_hook(generic_match_add); route_map_no_match_ipv6_address_prefix_list_hook(generic_match_delete); + route_map_match_tag_hook(generic_match_add); + route_map_no_match_tag_hook(generic_match_delete); + route_map_set_metric_hook(generic_set_add); route_map_no_set_metric_hook(generic_set_delete); @@ -241,5 +273,6 @@ void isis_route_map_init(void) route_map_install_match(&route_match_ip_address_prefix_list_cmd); route_map_install_match(&route_match_ipv6_address_cmd); route_map_install_match(&route_match_ipv6_address_prefix_list_cmd); + route_map_install_match(&route_match_tag_cmd); route_map_install_set(&route_set_metric_cmd); } |