summaryrefslogtreecommitdiffstats
path: root/bgpd
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 /bgpd
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 'bgpd')
-rw-r--r--bgpd/bgp_evpn.c2
-rw-r--r--bgpd/bgp_route.c14
-rw-r--r--bgpd/bgp_routemap.c317
-rw-r--r--bgpd/bgp_rpki.c12
-rw-r--r--bgpd/bgp_updgrp_adv.c2
5 files changed, 155 insertions, 192 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index c4b2a606c..a58fca0cc 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -4411,7 +4411,7 @@ void bgp_evpn_advertise_type5_routes(struct bgp *bgp_vrf, afi_t afi,
/* apply the route-map */
if (bgp_vrf->adv_cmd_rmap[afi][safi].map) {
- int ret = 0;
+ route_map_result_t ret;
ret = route_map_apply(
bgp_vrf->adv_cmd_rmap[afi][safi]
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 31243c899..edaab8828 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -1458,7 +1458,7 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_path_info *pi,
struct bgp *bgp;
struct attr *piattr;
char buf[PREFIX_STRLEN];
- int ret;
+ route_map_result_t ret;
int transparent;
int reflect;
afi_t afi;
@@ -2526,12 +2526,12 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn,
/* apply the route-map */
if (bgp->adv_cmd_rmap[afi][safi].map) {
- int ret = 0;
+ route_map_result_t ret;
ret = route_map_apply(
bgp->adv_cmd_rmap[afi][safi].map,
&rn->p, RMAP_BGP, new_select);
- if (ret == RMAP_MATCH)
+ if (ret == RMAP_PERMITMATCH)
bgp_evpn_advertise_type5_route(
bgp, &rn->p, new_select->attr,
afi, safi);
@@ -4557,7 +4557,7 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p,
struct bgp_path_info rmap_path;
struct attr attr;
struct attr *attr_new;
- int ret;
+ route_map_result_t ret;
#if ENABLE_BGP_VNC
int vnc_implicit_withdraw = 0;
#endif
@@ -4905,7 +4905,7 @@ static void bgp_static_update_safi(struct bgp *bgp, struct prefix *p,
if (bgp_static->rmap.name) {
struct attr attr_tmp = attr;
struct bgp_path_info rmap_path;
- int ret;
+ route_map_result_t ret;
rmap_path.peer = bgp->peer_self;
rmap_path.attr = &attr_tmp;
@@ -6567,7 +6567,7 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p,
struct attr attr;
struct attr *new_attr;
afi_t afi;
- int ret;
+ route_map_result_t ret;
struct bgp_redist *red;
/* Make default attribute. */
@@ -9082,7 +9082,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
struct route_map *rmap = output_arg;
struct bgp_path_info path;
struct attr dummy_attr;
- int ret;
+ route_map_result_t ret;
bgp_attr_dup(&dummy_attr, pi->attr);
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index b0ae9d78d..debed4c45 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -237,10 +237,9 @@ struct bgp_match_peer_compiled {
/* Compares the peer specified in the 'match peer' clause with the peer
received in bgp_path_info->peer. If it is the same, or if the peer structure
received is a peer_group containing it, returns RMAP_MATCH. */
-static route_map_result_t route_match_peer(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_match_peer(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct bgp_match_peer_compiled *pc;
union sockunion *su;
@@ -333,10 +332,9 @@ struct route_map_rule_cmd route_match_peer_cmd = {"peer", route_match_peer,
route_match_peer_free};
#if defined(HAVE_LUA)
-static route_map_result_t route_match_command(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_match_command(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
int status = RMAP_NOMATCH;
u_int32_t locpref = 0;
@@ -432,10 +430,9 @@ struct route_map_rule_cmd route_match_command_cmd = {
/* Match function should return 1 if match is success else return
zero. */
-static route_map_result_t route_match_ip_address(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_match_ip_address(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct access_list *alist;
@@ -472,10 +469,9 @@ struct route_map_rule_cmd route_match_ip_address_cmd = {
/* `match ip next-hop IP_ADDRESS' */
/* Match function return 1 if match is success else return zero. */
-static route_map_result_t route_match_ip_next_hop(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_match_ip_next_hop(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct access_list *alist;
struct bgp_path_info *path;
@@ -519,10 +515,9 @@ struct route_map_rule_cmd route_match_ip_next_hop_cmd = {
/* `match ip route-source ACCESS-LIST' */
/* Match function return 1 if match is success else return zero. */
-static route_map_result_t route_match_ip_route_source(void *rule,
- const struct prefix *pfx,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_match_ip_route_source(void *rule, const struct prefix *pfx,
+ route_map_object_t type, void *object)
{
struct access_list *alist;
struct bgp_path_info *path;
@@ -571,7 +566,7 @@ struct route_map_rule_cmd route_match_ip_route_source_cmd = {
/* `match ip address prefix-list PREFIX_LIST' */
-static route_map_result_t
+static enum route_map_match_result_t
route_match_ip_address_prefix_list(void *rule, const struct prefix *prefix,
route_map_object_t type, void *object)
{
@@ -606,7 +601,7 @@ struct route_map_rule_cmd route_match_ip_address_prefix_list_cmd = {
/* `match ip next-hop prefix-list PREFIX_LIST' */
-static route_map_result_t
+static enum route_map_match_result_t
route_match_ip_next_hop_prefix_list(void *rule, const struct prefix *prefix,
route_map_object_t type, void *object)
{
@@ -648,7 +643,7 @@ struct route_map_rule_cmd route_match_ip_next_hop_prefix_list_cmd = {
/* `match ip next-hop type <blackhole>' */
-static route_map_result_t
+static enum route_map_match_result_t
route_match_ip_next_hop_type(void *rule, const struct prefix *prefix,
route_map_object_t type, void *object)
{
@@ -687,7 +682,7 @@ static struct route_map_rule_cmd route_match_ip_next_hop_type_cmd = {
/* `match ip route-source prefix-list PREFIX_LIST' */
-static route_map_result_t
+static enum route_map_match_result_t
route_match_ip_route_source_prefix_list(void *rule,
const struct prefix *prefix,
route_map_object_t type, void *object)
@@ -737,10 +732,9 @@ struct route_map_rule_cmd route_match_ip_route_source_prefix_list_cmd = {
/* `match evpn default-route' */
/* Match function should return 1 if match is success else 0 */
-static route_map_result_t route_match_evpn_default_route(void *rule,
- const struct prefix *p,
- route_map_object_t
- type, void *object)
+static enum route_map_match_result_t
+route_match_evpn_default_route(void *rule, const struct prefix *p,
+ route_map_object_t type, void *object)
{
if (type == RMAP_BGP && is_evpn_prefix_default(p))
return RMAP_MATCH;
@@ -756,10 +750,9 @@ struct route_map_rule_cmd route_match_evpn_default_route_cmd = {
/* Match function should return 1 if match is success else return
zero. */
-static route_map_result_t route_match_mac_address(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_match_mac_address(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct access_list *alist;
struct prefix p;
@@ -806,9 +799,9 @@ struct route_map_rule_cmd route_match_mac_address_cmd = {
/* Match function should return 1 if match is success else return
zero. */
-static route_map_result_t route_match_vni(void *rule,
- const struct prefix *prefix,
- route_map_object_t type, void *object)
+static enum route_map_match_result_t
+route_match_vni(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
vni_t vni = 0;
struct bgp_path_info *path = NULL;
@@ -859,10 +852,9 @@ struct route_map_rule_cmd route_match_evpn_vni_cmd = {
/* Match function should return 1 if match is success else return
zero. */
-static route_map_result_t route_match_evpn_route_type(void *rule,
- const struct prefix *pfx,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_match_evpn_route_type(void *rule, const struct prefix *pfx,
+ route_map_object_t type, void *object)
{
uint8_t route_type = 0;
@@ -905,7 +897,7 @@ struct route_map_rule_cmd route_match_evpn_route_type_cmd = {
route_match_evpn_route_type_compile, route_match_evpn_route_type_free};
/* Route map commands for VRF route leak with source vrf matching */
-static route_map_result_t
+static enum route_map_match_result_t
route_match_vrl_source_vrf(void *rule, const struct prefix *prefix,
route_map_object_t type, void *object)
{
@@ -954,10 +946,9 @@ struct route_map_rule_cmd route_match_vrl_source_vrf_cmd = {
/* `match local-preference LOCAL-PREF' */
/* Match function return 1 if match is success else return zero. */
-static route_map_result_t route_match_local_pref(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_match_local_pref(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
uint32_t *local_pref;
struct bgp_path_info *path;
@@ -1011,10 +1002,9 @@ struct route_map_rule_cmd route_match_local_pref_cmd = {
/* `match metric METRIC' */
/* Match function return 1 if match is success else return zero. */
-static route_map_result_t route_match_metric(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_match_metric(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct rmap_value *rv;
struct bgp_path_info *path;
@@ -1035,10 +1025,9 @@ struct route_map_rule_cmd route_match_metric_cmd = {
/* `match as-path ASPATH' */
/* Match function for as-path match. I assume given object is */
-static route_map_result_t route_match_aspath(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_match_aspath(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct as_list *as_list;
@@ -1085,10 +1074,9 @@ struct rmap_community {
};
/* Match function for community match. */
-static route_map_result_t route_match_community(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_match_community(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct community_list *list;
struct bgp_path_info *path;
@@ -1155,10 +1143,9 @@ struct route_map_rule_cmd route_match_community_cmd = {
route_match_community_free};
/* Match function for lcommunity match. */
-static route_map_result_t route_match_lcommunity(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_match_lcommunity(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct community_list *list;
struct bgp_path_info *path;
@@ -1218,10 +1205,9 @@ struct route_map_rule_cmd route_match_lcommunity_cmd = {
/* Match function for extcommunity match. */
-static route_map_result_t route_match_ecommunity(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_match_ecommunity(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct community_list *list;
struct bgp_path_info *path;
@@ -1272,10 +1258,9 @@ struct route_map_rule_cmd route_match_ecommunity_cmd = {
and `address-family vpnv4'. */
/* `match origin' */
-static route_map_result_t route_match_origin(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_match_origin(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
uint8_t *origin;
struct bgp_path_info *path;
@@ -1320,10 +1305,9 @@ struct route_map_rule_cmd route_match_origin_cmd = {
/* match probability { */
-static route_map_result_t route_match_probability(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_match_probability(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
long r = random();
@@ -1375,10 +1359,9 @@ struct route_map_rule_cmd route_match_probability_cmd = {
/* `match interface IFNAME' */
/* Match function should return 1 if match is success else return
zero. */
-static route_map_result_t route_match_interface(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_match_interface(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct interface *ifp;
struct bgp_path_info *path;
@@ -1422,9 +1405,9 @@ struct route_map_rule_cmd route_match_interface_cmd = {
/* `set ip next-hop IP_ADDRESS' */
/* Match function return 1 if match is success else return zero. */
-static route_map_result_t route_match_tag(void *rule,
- const struct prefix *prefix,
- route_map_object_t type, void *object)
+static enum route_map_match_result_t
+route_match_tag(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
route_tag_t *tag;
struct bgp_path_info *path;
@@ -1454,10 +1437,9 @@ struct rmap_ip_nexthop_set {
int unchanged;
};
-static route_map_result_t route_set_ip_nexthop(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_set_ip_nexthop(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct rmap_ip_nexthop_set *rins = rule;
struct bgp_path_info *path;
@@ -1560,10 +1542,9 @@ struct route_map_rule_cmd route_set_ip_nexthop_cmd = {
/* `set local-preference LOCAL_PREF' */
/* Set local preference. */
-static route_map_result_t route_set_local_pref(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_set_local_pref(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct rmap_value *rv;
struct bgp_path_info *path;
@@ -1595,10 +1576,9 @@ struct route_map_rule_cmd route_set_local_pref_cmd = {
/* `set weight WEIGHT' */
/* Set weight. */
-static route_map_result_t route_set_weight(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_set_weight(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct rmap_value *rv;
struct bgp_path_info *path;
@@ -1623,10 +1603,9 @@ struct route_map_rule_cmd route_set_weight_cmd = {
/* `set metric METRIC' */
/* Set metric to attribute. */
-static route_map_result_t route_set_metric(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_set_metric(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct rmap_value *rv;
struct bgp_path_info *path;
@@ -1654,10 +1633,9 @@ struct route_map_rule_cmd route_set_metric_cmd = {
/* `set as-path prepend ASPATH' */
/* For AS path prepend mechanism. */
-static route_map_result_t route_set_aspath_prepend(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_set_aspath_prepend(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct aspath *aspath;
struct aspath *new;
@@ -1717,10 +1695,9 @@ struct route_map_rule_cmd route_set_aspath_prepend_cmd = {
* one.
* Make a deep copy of existing AS_PATH, but for the first ASn only.
*/
-static route_map_result_t route_set_aspath_exclude(void *rule,
- const struct prefix *dummy,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_set_aspath_exclude(void *rule, const struct prefix *dummy,
+ route_map_object_t type, void *object)
{
struct aspath *new_path, *exclude_path;
struct bgp_path_info *path;
@@ -1752,10 +1729,9 @@ struct rmap_com_set {
};
/* For community set mechanism. */
-static route_map_result_t route_set_community(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_set_community(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct rmap_com_set *rcs;
struct bgp_path_info *path;
@@ -1868,10 +1844,9 @@ struct rmap_lcom_set {
/* For lcommunity set mechanism. */
-static route_map_result_t route_set_lcommunity(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_set_lcommunity(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct rmap_lcom_set *rcs;
struct bgp_path_info *path;
@@ -1981,10 +1956,9 @@ struct route_map_rule_cmd route_set_lcommunity_cmd = {
/* `set large-comm-list (<1-99>|<100-500>|WORD) delete' */
/* For large community set mechanism. */
-static route_map_result_t route_set_lcommunity_delete(void *rule,
- const struct prefix *pfx,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_set_lcommunity_delete(void *rule, const struct prefix *pfx,
+ route_map_object_t type, void *object)
{
struct community_list *list;
struct lcommunity *merge;
@@ -2065,11 +2039,9 @@ struct route_map_rule_cmd route_set_lcommunity_delete_cmd = {
/* `set comm-list (<1-99>|<100-500>|WORD) delete' */
/* For community set mechanism. */
-static route_map_result_t route_set_community_delete(
- void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_set_community_delete(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct community_list *list;
struct community *merge;
@@ -2149,10 +2121,9 @@ struct route_map_rule_cmd route_set_community_delete_cmd = {
/* `set extcommunity rt COMMUNITY' */
/* For community set mechanism. Used by _rt and _soo. */
-static route_map_result_t route_set_ecommunity(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_set_ecommunity(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct ecommunity *ecom;
struct ecommunity *new_ecom;
@@ -2237,10 +2208,9 @@ struct route_map_rule_cmd route_set_ecommunity_soo_cmd = {
/* `set origin ORIGIN' */
/* For origin set. */
-static route_map_result_t route_set_origin(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_set_origin(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
uint8_t *origin;
struct bgp_path_info *path;
@@ -2287,10 +2257,9 @@ struct route_map_rule_cmd route_set_origin_cmd = {
/* `set atomic-aggregate' */
/* For atomic aggregate set. */
-static route_map_result_t route_set_atomic_aggregate(void *rule,
- const struct prefix *pfx,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_set_atomic_aggregate(void *rule, const struct prefix *pfx,
+ route_map_object_t type, void *object)
{
struct bgp_path_info *path;
@@ -2326,10 +2295,9 @@ struct aggregator {
struct in_addr address;
};
-static route_map_result_t route_set_aggregator_as(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_set_aggregator_as(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct bgp_path_info *path;
struct aggregator *aggregator;
@@ -2380,9 +2348,9 @@ struct route_map_rule_cmd route_set_aggregator_as_cmd = {
};
/* Set tag to object. object must be pointer to struct bgp_path_info */
-static route_map_result_t route_set_tag(void *rule,
- const struct prefix *prefix,
- route_map_object_t type, void *object)
+static enum route_map_match_result_t
+route_set_tag(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
route_tag_t *tag;
struct bgp_path_info *path;
@@ -2405,10 +2373,9 @@ static struct route_map_rule_cmd route_set_tag_cmd = {
};
/* Set label-index to object. object must be pointer to struct bgp_path_info */
-static route_map_result_t route_set_label_index(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_set_label_index(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct rmap_value *rv;
struct bgp_path_info *path;
@@ -2438,10 +2405,9 @@ static struct route_map_rule_cmd route_set_label_index_cmd = {
/* `match ipv6 address IP_ACCESS_LIST' */
-static route_map_result_t route_match_ipv6_address(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_match_ipv6_address(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct access_list *alist;
@@ -2474,10 +2440,9 @@ struct route_map_rule_cmd route_match_ipv6_address_cmd = {
/* `match ipv6 next-hop IP_ADDRESS' */
-static route_map_result_t route_match_ipv6_next_hop(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_match_ipv6_next_hop(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct in6_addr *addr = rule;
struct bgp_path_info *path;
@@ -2526,7 +2491,7 @@ struct route_map_rule_cmd route_match_ipv6_next_hop_cmd = {
/* `match ipv6 address prefix-list PREFIX_LIST' */
-static route_map_result_t
+static enum route_map_match_result_t
route_match_ipv6_address_prefix_list(void *rule, const struct prefix *prefix,
route_map_object_t type, void *object)
{
@@ -2561,9 +2526,9 @@ struct route_map_rule_cmd route_match_ipv6_address_prefix_list_cmd = {
/* `match ipv6 next-hop type <TYPE>' */
-static route_map_result_t
+static enum route_map_match_result_t
route_match_ipv6_next_hop_type(void *rule, const struct prefix *prefix,
- route_map_object_t type, void *object)
+ route_map_object_t type, void *object)
{
struct bgp_path_info *path;
struct in6_addr *addr = rule;
@@ -2609,10 +2574,9 @@ struct route_map_rule_cmd route_match_ipv6_next_hop_type_cmd = {
/* `set ipv6 nexthop global IP_ADDRESS' */
/* Set nexthop to object. ojbect must be pointer to struct attr. */
-static route_map_result_t route_set_ipv6_nexthop_global(void *rule,
- const struct prefix *p,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_set_ipv6_nexthop_global(void *rule, const struct prefix *p,
+ route_map_object_t type, void *object)
{
struct in6_addr *address;
struct bgp_path_info *path;
@@ -2668,7 +2632,7 @@ struct route_map_rule_cmd route_set_ipv6_nexthop_global_cmd = {
route_set_ipv6_nexthop_global_free};
/* Set next-hop preference value. */
-static route_map_result_t
+static enum route_map_match_result_t
route_set_ipv6_nexthop_prefer_global(void *rule, const struct prefix *prefix,
route_map_object_t type, void *object)
{
@@ -2722,10 +2686,9 @@ struct route_map_rule_cmd route_set_ipv6_nexthop_prefer_global_cmd = {
/* `set ipv6 nexthop local IP_ADDRESS' */
/* Set nexthop to object. ojbect must be pointer to struct attr. */
-static route_map_result_t route_set_ipv6_nexthop_local(void *rule,
- const struct prefix *p,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_set_ipv6_nexthop_local(void *rule, const struct prefix *p,
+ route_map_object_t type, void *object)
{
struct in6_addr *address;
struct bgp_path_info *path;
@@ -2785,10 +2748,9 @@ struct route_map_rule_cmd route_set_ipv6_nexthop_local_cmd = {
/* `set ipv6 nexthop peer-address' */
/* Set nexthop to object. ojbect must be pointer to struct attr. */
-static route_map_result_t route_set_ipv6_nexthop_peer(void *rule,
- const struct prefix *pfx,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_set_ipv6_nexthop_peer(void *rule, const struct prefix *pfx,
+ route_map_object_t type, void *object)
{
struct in6_addr peer_address;
struct bgp_path_info *path;
@@ -2863,10 +2825,9 @@ struct route_map_rule_cmd route_set_ipv6_nexthop_peer_cmd = {
/* `set ipv4 vpn next-hop A.B.C.D' */
-static route_map_result_t route_set_vpnv4_nexthop(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_set_vpnv4_nexthop(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct in_addr *address;
struct bgp_path_info *path;
@@ -2903,10 +2864,9 @@ static void *route_set_vpnv4_nexthop_compile(const char *arg)
/* `set ipv6 vpn next-hop A.B.C.D' */
-static route_map_result_t route_set_vpnv6_nexthop(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_set_vpnv6_nexthop(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct in6_addr *address;
struct bgp_path_info *path;
@@ -2959,10 +2919,9 @@ struct route_map_rule_cmd route_set_vpnv6_nexthop_cmd = {
/* `set originator-id' */
/* For origin set. */
-static route_map_result_t route_set_originator_id(void *rule,
- const struct prefix *prefix,
- route_map_object_t type,
- void *object)
+static enum route_map_match_result_t
+route_set_originator_id(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
{
struct in_addr *address;
struct bgp_path_info *path;
diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c
index aa09026b7..27b6347ab 100644
--- a/bgpd/bgp_rpki.c
+++ b/bgpd/bgp_rpki.c
@@ -129,8 +129,10 @@ static void print_record(const struct pfx_record *record, struct vty *vty);
static int is_synchronized(void);
static int is_running(void);
static void route_match_free(void *rule);
-static route_map_result_t route_match(void *rule, const struct prefix *prefix,
- route_map_object_t type, void *object);
+static enum route_map_match_result_t route_match(void *rule,
+ const struct prefix *prefix,
+ route_map_object_t type,
+ void *object);
static void *route_match_compile(const char *arg);
static void revalidate_bgp_node(struct bgp_node *bgp_node, afi_t afi,
safi_t safi);
@@ -213,8 +215,10 @@ static void ipv6_addr_to_host_byte_order(const uint32_t *src, uint32_t *dest)
dest[i] = ntohl(src[i]);
}
-static route_map_result_t route_match(void *rule, const struct prefix *prefix,
- route_map_object_t type, void *object)
+static enum route_map_match_result_t route_match(void *rule,
+ const struct prefix *prefix,
+ route_map_object_t type,
+ void *object)
{
int *rpki_status = rule;
struct bgp_path_info *path;
diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c
index b64c51f34..21f1dff60 100644
--- a/bgpd/bgp_updgrp_adv.c
+++ b/bgpd/bgp_updgrp_adv.c
@@ -716,7 +716,7 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
struct bgp_node *rn;
struct bgp_path_info *ri;
struct peer *peer;
- int ret = RMAP_DENYMATCH;
+ route_map_result_t ret = RMAP_DENYMATCH;
afi_t afi;
safi_t safi;