summaryrefslogtreecommitdiffstats
path: root/ospf6d
diff options
context:
space:
mode:
authorLakshman Krishnamoorthy <lkrishnamoor@vmware.com>2019-05-29 23:32:08 +0200
committerLakshman Krishnamoorthy <lkrishnamoor@vmware.com>2019-05-30 20:21:28 +0200
commiteadd168781d31a282b601735241fd83adb2cace0 (patch)
tree9625bc578097aa556517283c95288528db20f393 /ospf6d
parentMerge pull request #4402 from chiragshah6/evpn_dev1 (diff)
downloadfrr-eadd168781d31a282b601735241fd83adb2cace0.tar.xz
frr-eadd168781d31a282b601735241fd83adb2cace0.zip
lib: Introducing a 3rd state for route-map match cmd: RMAP_NOOP
Introducing a 3rd state for route_map_apply library function: RMAP_NOOP Traditionally route map MATCH rule apis were designed to return a binary response, consisting of either RMAP_MATCH or RMAP_NOMATCH. (Route-map SET rule apis return RMAP_OKAY or RMAP_ERROR). Depending on this response, the following statemachine decided the course of action: Action: Apply route-map match and return the result (RMAP_MATCH/RMAP_NOMATCH) State1: Receveived RMAP_MATCH THEN: If Routemap type is PERMIT, execute other rules if applicable, otherwise we PERMIT! Else: If Routemap type is DENY, we DENYMATCH right away State2: Received RMAP_NOMATCH, continue on to next route-map, otherwise, return DENYMATCH by default if nothing matched. With reference to PR 4078 (https://github.com/FRRouting/frr/pull/4078), we require a 3rd state because of the following situation: The issue - what if, the rule api needs to abort or ignore a rule?: "match evpn vni xx" route-map filter can be applied to incoming routes regardless of whether the tunnel type is vxlan or mpls. This rule should be N/A for mpls based evpn route, but applicable to only vxlan based evpn route. Today, the filter produces either a match or nomatch response regardless of whether it is mpls/vxlan, resulting in either permitting or denying the route.. So an mpls evpn route may get filtered out incorrectly. Eg: "route-map RM1 permit 10 ; match evpn vni 20" or "route-map RM2 deny 20 ; match vni 20" With the introduction of the 3rd state, we can abort this rule check safely. How? The rules api can now return RMAP_NOOP (or another enum) to indicate that it encountered an invalid check, and needs to abort just that rule, but continue with other rules. Question: Do we repurpose an existing enum RMAP_OKAY or RMAP_ERROR as the 3rd state (or create a new enum like RMAP_NOOP)? RMAP_OKAY and RMAP_ERROR are used to return the result of set cmd. We chose to go with RMAP_NOOP (but open to ideas), as a way to bypass the rmap filter As a result we have a 3rd state: State3: Received RMAP_NOOP Then, proceed to other route-map, otherwise return RMAP_PERMITMATCH by default. Signed-off-by:Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
Diffstat (limited to 'ospf6d')
-rw-r--r--ospf6d/ospf6_asbr.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c
index 946bbf8cc..4fbf70c9d 100644
--- a/ospf6d/ospf6_asbr.c
+++ b/ospf6d/ospf6_asbr.c
@@ -1018,7 +1018,7 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
unsigned int nexthop_num,
struct in6_addr *nexthop, route_tag_t tag)
{
- int ret;
+ route_map_result_t ret;
struct ospf6_route troute;
struct ospf6_external_info tinfo;
struct ospf6_route *route, *match;
@@ -1355,7 +1355,7 @@ static void ospf6_redistribute_show_config(struct vty *vty)
/* Routemap Functions */
-static route_map_result_t
+static enum route_map_match_result_t
ospf6_routemap_rule_match_address_prefixlist(void *rule,
const struct prefix *prefix,
route_map_object_t type,
@@ -1395,7 +1395,7 @@ struct route_map_rule_cmd ospf6_routemap_rule_match_address_prefixlist_cmd = {
/* `match interface IFNAME' */
/* Match function should return 1 if match is success else return
zero. */
-static route_map_result_t
+static enum route_map_match_result_t
ospf6_routemap_rule_match_interface(void *rule, const struct prefix *prefix,
route_map_object_t type, void *object)
{
@@ -1433,10 +1433,9 @@ struct route_map_rule_cmd ospf6_routemap_rule_match_interface_cmd = {
ospf6_routemap_rule_match_interface_free};
/* Match function for matching route tags */
-static route_map_result_t ospf6_routemap_rule_match_tag(void *rule,
- const struct prefix *p,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+ospf6_routemap_rule_match_tag(void *rule, const struct prefix *p,
+ route_map_object_t type, void *object)
{
route_tag_t *tag = rule;
struct ospf6_route *route = object;
@@ -1453,7 +1452,7 @@ static struct route_map_rule_cmd ospf6_routemap_rule_match_tag_cmd = {
route_map_rule_tag_free,
};
-static route_map_result_t
+static enum route_map_match_result_t
ospf6_routemap_rule_set_metric_type(void *rule, const struct prefix *prefix,
route_map_object_t type, void *object)
{
@@ -1489,7 +1488,7 @@ struct route_map_rule_cmd ospf6_routemap_rule_set_metric_type_cmd = {
ospf6_routemap_rule_set_metric_type_free,
};
-static route_map_result_t
+static enum route_map_match_result_t
ospf6_routemap_rule_set_metric(void *rule, const struct prefix *prefix,
route_map_object_t type, void *object)
{
@@ -1524,7 +1523,7 @@ struct route_map_rule_cmd ospf6_routemap_rule_set_metric_cmd = {
ospf6_routemap_rule_set_metric_free,
};
-static route_map_result_t
+static enum route_map_match_result_t
ospf6_routemap_rule_set_forwarding(void *rule, const struct prefix *prefix,
route_map_object_t type, void *object)
{
@@ -1562,10 +1561,9 @@ struct route_map_rule_cmd ospf6_routemap_rule_set_forwarding_cmd = {
ospf6_routemap_rule_set_forwarding_free,
};
-static route_map_result_t ospf6_routemap_rule_set_tag(void *rule,
- const struct prefix *p,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+ospf6_routemap_rule_set_tag(void *rule, const struct prefix *p,
+ route_map_object_t type, void *object)
{
route_tag_t *tag = rule;
struct ospf6_route *route = object;