mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 10:08:41 +00:00
*: Remove route_map_object_t from the system
The route_map_object_t was being used to track what protocol we were being called against. But each protocol was only ever calling itself. So we had a variable that was only ever being passed in from route_map_apply that had to be carried against and everyone was testing if that variable was for their own stack. Clean up this route_map_object_t from the entire system. We should speed some stuff up. Yes I know not a bunch but this will add up. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
15675d025d
commit
1782514fb9
@ -1003,8 +1003,7 @@ struct attr *bgp_attr_aggregate_intern(
|
||||
|
||||
SET_FLAG(bgp->peer_self->rmap_type, PEER_RMAP_TYPE_AGGREGATE);
|
||||
|
||||
ret = route_map_apply(aggregate->rmap.map, p, RMAP_BGP,
|
||||
&rmap_path);
|
||||
ret = route_map_apply(aggregate->rmap.map, p, &rmap_path);
|
||||
|
||||
bgp->peer_self->rmap_type = 0;
|
||||
|
||||
|
@ -47,7 +47,7 @@ bgp_check_rmap_prefixes_in_bgp_table(struct bgp_table *table,
|
||||
|
||||
RESET_FLAG(dummy_attr.rmap_change_flags);
|
||||
|
||||
ret = route_map_apply(rmap, dest_p, RMAP_BGP, &path);
|
||||
ret = route_map_apply(rmap, dest_p, &path);
|
||||
if (ret != RMAP_PERMITMATCH)
|
||||
bgp_attr_flush(&dummy_attr);
|
||||
else {
|
||||
@ -112,7 +112,7 @@ static void bgp_conditional_adv_routes(struct peer *peer, afi_t afi,
|
||||
|
||||
RESET_FLAG(dummy_attr.rmap_change_flags);
|
||||
|
||||
if (route_map_apply(rmap, dest_p, RMAP_BGP, &path)
|
||||
if (route_map_apply(rmap, dest_p, &path)
|
||||
!= RMAP_PERMITMATCH) {
|
||||
bgp_attr_flush(&dummy_attr);
|
||||
continue;
|
||||
|
@ -4201,7 +4201,7 @@ void bgp_evpn_advertise_type5_routes(struct bgp *bgp_vrf, afi_t afi,
|
||||
bgp_vrf->adv_cmd_rmap[afi][safi]
|
||||
.map,
|
||||
bgp_dest_get_prefix(dest),
|
||||
RMAP_BGP, &tmp_pi);
|
||||
&tmp_pi);
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
bgp_attr_flush(&tmp_attr);
|
||||
continue;
|
||||
|
@ -744,7 +744,7 @@ void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, /* to */
|
||||
info.attr = &static_attr;
|
||||
ret = route_map_apply(
|
||||
bgp_vrf->vpn_policy[afi].rmap[BGP_VPN_POLICY_DIR_TOVPN],
|
||||
p, RMAP_BGP, &info);
|
||||
p, &info);
|
||||
if (RMAP_DENYMATCH == ret) {
|
||||
bgp_attr_flush(&static_attr); /* free any added parts */
|
||||
if (debug)
|
||||
@ -1190,7 +1190,7 @@ vpn_leak_to_vrf_update_onevrf(struct bgp *bgp_vrf, /* to */
|
||||
info.extra = path_vpn->extra; /* Used for source-vrf filter */
|
||||
ret = route_map_apply(bgp_vrf->vpn_policy[afi]
|
||||
.rmap[BGP_VPN_POLICY_DIR_FROMVPN],
|
||||
p, RMAP_BGP, &info);
|
||||
p, &info);
|
||||
if (RMAP_DENYMATCH == ret) {
|
||||
bgp_attr_flush(&static_attr); /* free any added parts */
|
||||
if (debug)
|
||||
|
@ -1500,7 +1500,7 @@ static int bgp_input_modifier(struct peer *peer, const struct prefix *p,
|
||||
SET_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IN);
|
||||
|
||||
/* Apply BGP route map to the attribute. */
|
||||
ret = route_map_apply(rmap, p, RMAP_BGP, &rmap_path);
|
||||
ret = route_map_apply(rmap, p, &rmap_path);
|
||||
|
||||
peer->rmap_type = 0;
|
||||
|
||||
@ -1551,7 +1551,7 @@ static int bgp_output_modifier(struct peer *peer, const struct prefix *p,
|
||||
SET_FLAG(peer->rmap_type, PEER_RMAP_TYPE_OUT);
|
||||
|
||||
/* Apply BGP route map to the attribute. */
|
||||
ret = route_map_apply(rmap, p, RMAP_BGP, &rmap_path);
|
||||
ret = route_map_apply(rmap, p, &rmap_path);
|
||||
|
||||
peer->rmap_type = rmap_type;
|
||||
|
||||
@ -2047,10 +2047,10 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi,
|
||||
|
||||
if (bgp_path_suppressed(pi))
|
||||
ret = route_map_apply(UNSUPPRESS_MAP(filter), p,
|
||||
RMAP_BGP, &rmap_path);
|
||||
&rmap_path);
|
||||
else
|
||||
ret = route_map_apply(ROUTE_MAP_OUT(filter), p,
|
||||
RMAP_BGP, &rmap_path);
|
||||
&rmap_path);
|
||||
|
||||
peer->rmap_type = 0;
|
||||
|
||||
@ -2633,7 +2633,7 @@ static void bgp_process_evpn_route_injection(struct bgp *bgp, afi_t afi,
|
||||
RESET_FLAG(dummy_attr.rmap_change_flags);
|
||||
|
||||
ret = route_map_apply(bgp->adv_cmd_rmap[afi][safi].map,
|
||||
p, RMAP_BGP, &rmap_path);
|
||||
p, &rmap_path);
|
||||
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
bgp_attr_flush(&dummy_attr);
|
||||
@ -5215,8 +5215,7 @@ void bgp_static_update(struct bgp *bgp, const struct prefix *p,
|
||||
|
||||
SET_FLAG(bgp->peer_self->rmap_type, PEER_RMAP_TYPE_NETWORK);
|
||||
|
||||
ret = route_map_apply(bgp_static->rmap.map, p, RMAP_BGP,
|
||||
&rmap_path);
|
||||
ret = route_map_apply(bgp_static->rmap.map, p, &rmap_path);
|
||||
|
||||
bgp->peer_self->rmap_type = 0;
|
||||
|
||||
@ -5535,8 +5534,7 @@ static void bgp_static_update_safi(struct bgp *bgp, const struct prefix *p,
|
||||
|
||||
SET_FLAG(bgp->peer_self->rmap_type, PEER_RMAP_TYPE_NETWORK);
|
||||
|
||||
ret = route_map_apply(bgp_static->rmap.map, p, RMAP_BGP,
|
||||
&rmap_path);
|
||||
ret = route_map_apply(bgp_static->rmap.map, p, &rmap_path);
|
||||
|
||||
bgp->peer_self->rmap_type = 0;
|
||||
|
||||
@ -6387,7 +6385,7 @@ static bool aggr_suppress_map_test(struct bgp *bgp,
|
||||
rmap_path.attr = &attr;
|
||||
|
||||
SET_FLAG(bgp->peer_self->rmap_type, PEER_RMAP_TYPE_AGGREGATE);
|
||||
rmr = route_map_apply(aggregate->suppress_map, p, RMAP_BGP, &rmap_path);
|
||||
rmr = route_map_apply(aggregate->suppress_map, p, &rmap_path);
|
||||
bgp->peer_self->rmap_type = 0;
|
||||
|
||||
bgp_attr_flush(&attr);
|
||||
@ -7845,8 +7843,7 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p,
|
||||
SET_FLAG(bgp->peer_self->rmap_type,
|
||||
PEER_RMAP_TYPE_REDISTRIBUTE);
|
||||
|
||||
ret = route_map_apply(red->rmap.map, p, RMAP_BGP,
|
||||
&rmap_path);
|
||||
ret = route_map_apply(red->rmap.map, p, &rmap_path);
|
||||
|
||||
bgp->peer_self->rmap_type = 0;
|
||||
|
||||
@ -10392,8 +10389,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
|
||||
path.peer = pi->peer;
|
||||
path.attr = &dummy_attr;
|
||||
|
||||
ret = route_map_apply(rmap, dest_p, RMAP_BGP,
|
||||
&path);
|
||||
ret = route_map_apply(rmap, dest_p, &path);
|
||||
if (ret == RMAP_DENYMATCH)
|
||||
continue;
|
||||
}
|
||||
|
1248
bgpd/bgp_routemap.c
1248
bgpd/bgp_routemap.c
File diff suppressed because it is too large
Load Diff
@ -124,7 +124,7 @@ static int is_running(void);
|
||||
static void route_match_free(void *rule);
|
||||
static enum route_map_cmd_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_dest *dest, afi_t afi, safi_t safi);
|
||||
@ -213,20 +213,18 @@ static void ipv6_addr_to_host_byte_order(const uint32_t *src, uint32_t *dest)
|
||||
|
||||
static enum route_map_cmd_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;
|
||||
|
||||
if (type == RMAP_BGP) {
|
||||
path = object;
|
||||
path = object;
|
||||
|
||||
if (rpki_validate_prefix(path->peer, path->attr, prefix)
|
||||
== *rpki_status) {
|
||||
return RMAP_MATCH;
|
||||
}
|
||||
if (rpki_validate_prefix(path->peer, path->attr, prefix)
|
||||
== *rpki_status) {
|
||||
return RMAP_MATCH;
|
||||
}
|
||||
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
|
||||
|
@ -823,8 +823,7 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
|
||||
|
||||
ret = route_map_apply(
|
||||
peer->default_rmap[afi][safi].map,
|
||||
bgp_dest_get_prefix(dest), RMAP_BGP,
|
||||
&tmp_pi);
|
||||
bgp_dest_get_prefix(dest), &tmp_pi);
|
||||
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
bgp_attr_flush(&tmp_attr);
|
||||
|
@ -918,7 +918,7 @@ static bool bgp_table_map_apply(struct route_map *map, const struct prefix *p,
|
||||
{
|
||||
route_map_result_t ret;
|
||||
|
||||
ret = route_map_apply(map, p, RMAP_BGP, path);
|
||||
ret = route_map_apply(map, p, path);
|
||||
bgp_attr_flush(path->attr);
|
||||
|
||||
if (ret != RMAP_DENYMATCH)
|
||||
|
@ -290,7 +290,7 @@ void vnc_direct_bgp_add_route_ce(struct bgp *bgp, struct agg_node *rn,
|
||||
info.peer = peer;
|
||||
info.attr = &hattr;
|
||||
ret = route_map_apply(bgp->rfapi_cfg->routemap_export_bgp,
|
||||
prefix, RMAP_BGP, &info);
|
||||
prefix, &info);
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
bgp_attr_flush(&hattr);
|
||||
return;
|
||||
@ -1033,7 +1033,7 @@ void vnc_direct_bgp_add_nve(struct bgp *bgp, struct rfapi_descriptor *rfd)
|
||||
ret = route_map_apply(
|
||||
rfgn->rfg
|
||||
->routemap_export_bgp,
|
||||
p, RMAP_BGP, &info);
|
||||
p, &info);
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
bgp_attr_flush(&hattr);
|
||||
continue;
|
||||
@ -1242,8 +1242,7 @@ static void vnc_direct_add_rn_group_rd(struct bgp *bgp,
|
||||
|
||||
info.peer = irfd->peer;
|
||||
info.attr = &hattr;
|
||||
ret = route_map_apply(rfg->routemap_export_bgp, p, RMAP_BGP,
|
||||
&info);
|
||||
ret = route_map_apply(rfg->routemap_export_bgp, p, &info);
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
bgp_attr_flush(&hattr);
|
||||
vnc_zlog_debug_verbose(
|
||||
@ -1691,8 +1690,7 @@ void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi,
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.peer = peer;
|
||||
info.attr = &hattr;
|
||||
ret = route_map_apply(hc->routemap_export_bgp, prefix, RMAP_BGP,
|
||||
&info);
|
||||
ret = route_map_apply(hc->routemap_export_bgp, prefix, &info);
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
bgp_attr_flush(&hattr);
|
||||
return;
|
||||
@ -1917,8 +1915,7 @@ void vnc_direct_bgp_rh_vpn_enable(struct bgp *bgp, afi_t afi)
|
||||
info.attr = &hattr;
|
||||
ret = route_map_apply(
|
||||
hc->routemap_export_bgp,
|
||||
dest_p, RMAP_BGP,
|
||||
&info);
|
||||
dest_p, &info);
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
bgp_attr_flush(&hattr);
|
||||
vnc_zlog_debug_verbose(
|
||||
|
@ -357,7 +357,7 @@ static int process_unicast_route(struct bgp *bgp, /* in */
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.peer = peer;
|
||||
info.attr = &hattr;
|
||||
ret = route_map_apply(rmap, prefix, RMAP_BGP, &info);
|
||||
ret = route_map_apply(rmap, prefix, &info);
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
bgp_attr_flush(&hattr);
|
||||
vnc_zlog_debug_verbose(
|
||||
@ -784,7 +784,7 @@ static void vnc_import_bgp_add_route_mode_plain(struct bgp *bgp,
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.peer = peer;
|
||||
info.attr = &hattr;
|
||||
ret = route_map_apply(rmap, prefix, RMAP_BGP, &info);
|
||||
ret = route_map_apply(rmap, prefix, &info);
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
bgp_attr_flush(&hattr);
|
||||
vnc_zlog_debug_verbose(
|
||||
@ -977,7 +977,7 @@ static void vnc_import_bgp_add_route_mode_nvegroup(
|
||||
memset(&path, 0, sizeof(path));
|
||||
path.peer = peer;
|
||||
path.attr = &hattr;
|
||||
ret = route_map_apply(rmap, prefix, RMAP_BGP, &path);
|
||||
ret = route_map_apply(rmap, prefix, &path);
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
bgp_attr_flush(&hattr);
|
||||
vnc_zlog_debug_verbose(
|
||||
|
@ -167,8 +167,7 @@ static void isis_redist_update_ext_reach(struct isis_area *area, int level,
|
||||
area_info.metric = redist->metric;
|
||||
|
||||
if (redist->map_name) {
|
||||
map_ret =
|
||||
route_map_apply(redist->map, p, RMAP_ISIS, &area_info);
|
||||
map_ret = route_map_apply(redist->map, p, &area_info);
|
||||
if (map_ret == RMAP_DENYMATCH)
|
||||
area_info.distance = 255;
|
||||
}
|
||||
|
@ -49,14 +49,10 @@
|
||||
#include "isis_routemap.h"
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_ip_address(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
route_match_ip_address(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
struct access_list *alist;
|
||||
|
||||
if (type != RMAP_ISIS)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
alist = access_list_lookup(AFI_IP, (char *)rule);
|
||||
if (access_list_apply(alist, prefix) != FILTER_DENY)
|
||||
return RMAP_MATCH;
|
||||
@ -85,13 +81,10 @@ static const struct route_map_rule_cmd route_match_ip_address_cmd = {
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_ip_address_prefix_list(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
void *object)
|
||||
{
|
||||
struct prefix_list *plist;
|
||||
|
||||
if (type != RMAP_ISIS)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
plist = prefix_list_lookup(AFI_IP, (char *)rule);
|
||||
if (prefix_list_apply(plist, prefix) != PREFIX_DENY)
|
||||
return RMAP_MATCH;
|
||||
@ -120,14 +113,10 @@ static const struct route_map_rule_cmd
|
||||
/* ------------------------------------------------------------*/
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_ipv6_address(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
route_match_ipv6_address(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
struct access_list *alist;
|
||||
|
||||
if (type != RMAP_ISIS)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
alist = access_list_lookup(AFI_IP6, (char *)rule);
|
||||
if (access_list_apply(alist, prefix) != FILTER_DENY)
|
||||
return RMAP_MATCH;
|
||||
@ -156,13 +145,10 @@ static const struct route_map_rule_cmd route_match_ipv6_address_cmd = {
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_ipv6_address_prefix_list(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
void *object)
|
||||
{
|
||||
struct prefix_list *plist;
|
||||
|
||||
if (type != RMAP_ISIS)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
plist = prefix_list_lookup(AFI_IP6, (char *)rule);
|
||||
if (prefix_list_apply(plist, prefix) != PREFIX_DENY)
|
||||
return RMAP_MATCH;
|
||||
@ -191,18 +177,16 @@ static const struct route_map_rule_cmd
|
||||
/* ------------------------------------------------------------*/
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
route_set_metric(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
route_set_metric(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
uint32_t *metric;
|
||||
struct isis_ext_info *info;
|
||||
|
||||
if (type == RMAP_ISIS) {
|
||||
metric = rule;
|
||||
info = object;
|
||||
metric = rule;
|
||||
info = object;
|
||||
|
||||
info->metric = *metric;
|
||||
|
||||
info->metric = *metric;
|
||||
}
|
||||
return RMAP_OKAY;
|
||||
}
|
||||
|
||||
|
@ -1530,8 +1530,7 @@ enum rmap_compile_rets route_map_delete_set(struct route_map_index *index,
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
route_map_apply_match(struct route_map_rule_list *match_list,
|
||||
const struct prefix *prefix, route_map_object_t type,
|
||||
void *object)
|
||||
const struct prefix *prefix, void *object)
|
||||
{
|
||||
enum route_map_cmd_result_t ret = RMAP_NOMATCH;
|
||||
struct route_map_rule *match;
|
||||
@ -1555,7 +1554,7 @@ route_map_apply_match(struct route_map_rule_list *match_list,
|
||||
* If all result in NOOP, end-result is NOOP.
|
||||
*/
|
||||
ret = (*match->cmd->func_apply)(match->value, prefix,
|
||||
type, object);
|
||||
object);
|
||||
|
||||
/*
|
||||
* If the consolidated result of func_apply is:
|
||||
@ -1647,9 +1646,10 @@ static struct list *route_map_get_index_list(struct route_node **rn,
|
||||
/*
|
||||
* This function returns the route-map index that best matches the prefix.
|
||||
*/
|
||||
static struct route_map_index *
|
||||
route_map_get_index(struct route_map *map, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object, uint8_t *match_ret)
|
||||
static struct route_map_index *route_map_get_index(struct route_map *map,
|
||||
const struct prefix *prefix,
|
||||
void *object,
|
||||
uint8_t *match_ret)
|
||||
{
|
||||
int ret = 0;
|
||||
struct list *candidate_rmap_list = NULL;
|
||||
@ -1695,7 +1695,7 @@ route_map_get_index(struct route_map *map, const struct prefix *prefix,
|
||||
break;
|
||||
|
||||
ret = route_map_apply_match(&index->match_list, prefix,
|
||||
type, object);
|
||||
object);
|
||||
|
||||
if (ret == RMAP_MATCH) {
|
||||
*match_ret = ret;
|
||||
@ -2369,8 +2369,7 @@ void route_map_notify_pentry_dependencies(const char *affected_name,
|
||||
We need to make sure our route-map processing matches the above
|
||||
*/
|
||||
route_map_result_t route_map_apply(struct route_map *map,
|
||||
const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
const struct prefix *prefix, void *object)
|
||||
{
|
||||
static int recursion = 0;
|
||||
enum route_map_cmd_result_t match_ret = RMAP_NOMATCH;
|
||||
@ -2397,7 +2396,7 @@ route_map_result_t route_map_apply(struct route_map *map,
|
||||
|
||||
if ((!map->optimization_disabled)
|
||||
&& (map->ipv4_prefix_table || map->ipv6_prefix_table)) {
|
||||
index = route_map_get_index(map, prefix, type, object,
|
||||
index = route_map_get_index(map, prefix, object,
|
||||
(uint8_t *)&match_ret);
|
||||
if (index) {
|
||||
if (rmap_debug)
|
||||
@ -2431,7 +2430,7 @@ route_map_result_t route_map_apply(struct route_map *map,
|
||||
index->applied++;
|
||||
/* Apply this index. */
|
||||
match_ret = route_map_apply_match(&index->match_list,
|
||||
prefix, type, object);
|
||||
prefix, object);
|
||||
if (rmap_debug) {
|
||||
zlog_debug(
|
||||
"Route-map: %s, sequence: %d, prefix: %pFX, result: %s",
|
||||
@ -2489,9 +2488,8 @@ route_map_result_t route_map_apply(struct route_map *map,
|
||||
* set succeeded or not. So, ignore
|
||||
* return code.
|
||||
*/
|
||||
(void) (*set->cmd->func_apply)(
|
||||
set->value, prefix, type,
|
||||
object);
|
||||
(void)(*set->cmd->func_apply)(
|
||||
set->value, prefix, object);
|
||||
|
||||
/* Call another route-map if available */
|
||||
if (index->nextrm) {
|
||||
@ -2504,8 +2502,7 @@ route_map_result_t route_map_apply(struct route_map *map,
|
||||
{
|
||||
recursion++;
|
||||
ret = route_map_apply(
|
||||
nextrm, prefix, type,
|
||||
object);
|
||||
nextrm, prefix, object);
|
||||
recursion--;
|
||||
}
|
||||
|
||||
|
@ -68,17 +68,6 @@ enum route_map_cmd_result_t {
|
||||
RMAP_ERROR
|
||||
};
|
||||
|
||||
|
||||
typedef enum {
|
||||
RMAP_RIP,
|
||||
RMAP_RIPNG,
|
||||
RMAP_OSPF,
|
||||
RMAP_OSPF6,
|
||||
RMAP_BGP,
|
||||
RMAP_ZEBRA,
|
||||
RMAP_ISIS,
|
||||
} route_map_object_t;
|
||||
|
||||
typedef enum { RMAP_EXIT, RMAP_GOTO, RMAP_NEXT } route_map_end_t;
|
||||
|
||||
typedef enum {
|
||||
@ -117,7 +106,6 @@ struct route_map_rule_cmd {
|
||||
/* Function for value set or match. */
|
||||
enum route_map_cmd_result_t (*func_apply)(void *rule,
|
||||
const struct prefix *prefix,
|
||||
route_map_object_t type,
|
||||
void *object);
|
||||
|
||||
/* Compile argument and return result as void *. */
|
||||
@ -299,7 +287,6 @@ struct route_map *route_map_lookup_warn_noexist(struct vty *vty, const char *nam
|
||||
/* Apply route map to the object. */
|
||||
extern route_map_result_t route_map_apply(struct route_map *map,
|
||||
const struct prefix *prefix,
|
||||
route_map_object_t object_type,
|
||||
void *object);
|
||||
|
||||
extern void route_map_add_hook(void (*func)(const char *));
|
||||
|
@ -1095,8 +1095,7 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
|
||||
tinfo.ifindex = ifindex;
|
||||
tinfo.tag = tag;
|
||||
|
||||
ret = route_map_apply(ospf6->rmap[type].map, prefix, RMAP_OSPF6,
|
||||
&troute);
|
||||
ret = route_map_apply(ospf6->rmap[type].map, prefix, &troute);
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
if (IS_OSPF6_DEBUG_ASBR)
|
||||
zlog_debug("Denied by route-map \"%s\"",
|
||||
@ -1400,14 +1399,11 @@ static void ospf6_redistribute_show_config(struct vty *vty, struct ospf6 *ospf6)
|
||||
static enum route_map_cmd_result_t
|
||||
ospf6_routemap_rule_match_address_prefixlist(void *rule,
|
||||
const struct prefix *prefix,
|
||||
route_map_object_t type,
|
||||
|
||||
void *object)
|
||||
{
|
||||
struct prefix_list *plist;
|
||||
|
||||
if (type != RMAP_OSPF6)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
plist = prefix_list_lookup(AFI_IP6, (char *)rule);
|
||||
if (plist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
@ -1440,18 +1436,16 @@ static const struct route_map_rule_cmd
|
||||
zero. */
|
||||
static enum route_map_cmd_result_t
|
||||
ospf6_routemap_rule_match_interface(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
void *object)
|
||||
{
|
||||
struct interface *ifp;
|
||||
struct ospf6_external_info *ei;
|
||||
|
||||
if (type == RMAP_OSPF6) {
|
||||
ei = ((struct ospf6_route *)object)->route_option;
|
||||
ifp = if_lookup_by_name_all_vrf((char *)rule);
|
||||
ei = ((struct ospf6_route *)object)->route_option;
|
||||
ifp = if_lookup_by_name_all_vrf((char *)rule);
|
||||
|
||||
if (ifp != NULL && ei->ifindex == ifp->ifindex)
|
||||
return RMAP_MATCH;
|
||||
}
|
||||
if (ifp != NULL && ei->ifindex == ifp->ifindex)
|
||||
return RMAP_MATCH;
|
||||
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
@ -1480,14 +1474,13 @@ static const struct route_map_rule_cmd
|
||||
|
||||
/* Match function for matching route tags */
|
||||
static enum route_map_cmd_result_t
|
||||
ospf6_routemap_rule_match_tag(void *rule, const struct prefix *p,
|
||||
route_map_object_t type, void *object)
|
||||
ospf6_routemap_rule_match_tag(void *rule, const struct prefix *p, void *object)
|
||||
{
|
||||
route_tag_t *tag = rule;
|
||||
struct ospf6_route *route = object;
|
||||
struct ospf6_external_info *info = route->route_option;
|
||||
|
||||
if (type == RMAP_OSPF6 && info->tag == *tag)
|
||||
if (info->tag == *tag)
|
||||
return RMAP_MATCH;
|
||||
|
||||
return RMAP_NOMATCH;
|
||||
@ -1503,14 +1496,11 @@ static const struct route_map_rule_cmd
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
ospf6_routemap_rule_set_metric_type(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
void *object)
|
||||
{
|
||||
char *metric_type = rule;
|
||||
struct ospf6_route *route = object;
|
||||
|
||||
if (type != RMAP_OSPF6)
|
||||
return RMAP_OKAY;
|
||||
|
||||
if (strcmp(metric_type, "type-2") == 0)
|
||||
route->path.metric_type = 2;
|
||||
else
|
||||
@ -1541,14 +1531,11 @@ static const struct route_map_rule_cmd
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
ospf6_routemap_rule_set_metric(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
void *object)
|
||||
{
|
||||
char *metric = rule;
|
||||
struct ospf6_route *route = object;
|
||||
|
||||
if (type != RMAP_OSPF6)
|
||||
return RMAP_OKAY;
|
||||
|
||||
route->path.cost = atoi(metric);
|
||||
return RMAP_OKAY;
|
||||
}
|
||||
@ -1578,15 +1565,12 @@ static const struct route_map_rule_cmd
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
ospf6_routemap_rule_set_forwarding(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
void *object)
|
||||
{
|
||||
char *forwarding = rule;
|
||||
struct ospf6_route *route = object;
|
||||
struct ospf6_external_info *info = route->route_option;
|
||||
|
||||
if (type != RMAP_OSPF6)
|
||||
return RMAP_OKAY;
|
||||
|
||||
if (inet_pton(AF_INET6, forwarding, &info->forwarding) != 1) {
|
||||
memset(&info->forwarding, 0, sizeof(struct in6_addr));
|
||||
return RMAP_ERROR;
|
||||
@ -1617,16 +1601,12 @@ static const struct route_map_rule_cmd
|
||||
};
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
ospf6_routemap_rule_set_tag(void *rule, const struct prefix *p,
|
||||
route_map_object_t type, void *object)
|
||||
ospf6_routemap_rule_set_tag(void *rule, const struct prefix *p, void *object)
|
||||
{
|
||||
route_tag_t *tag = rule;
|
||||
struct ospf6_route *route = object;
|
||||
struct ospf6_external_info *info = route->route_option;
|
||||
|
||||
if (type != RMAP_OSPF6)
|
||||
return RMAP_OKAY;
|
||||
|
||||
info->tag = *tag;
|
||||
return RMAP_OKAY;
|
||||
}
|
||||
|
@ -127,27 +127,22 @@ static void ospf_route_map_event(const char *name)
|
||||
/* `match ip netxthop ' */
|
||||
/* Match function return 1 if match is success else return zero. */
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_ip_nexthop(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
route_match_ip_nexthop(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
struct access_list *alist;
|
||||
struct external_info *ei = object;
|
||||
struct prefix_ipv4 p;
|
||||
|
||||
if (type == RMAP_OSPF) {
|
||||
p.family = AF_INET;
|
||||
p.prefix = ei->nexthop;
|
||||
p.prefixlen = IPV4_MAX_BITLEN;
|
||||
p.family = AF_INET;
|
||||
p.prefix = ei->nexthop;
|
||||
p.prefixlen = IPV4_MAX_BITLEN;
|
||||
|
||||
alist = access_list_lookup(AFI_IP, (char *)rule);
|
||||
if (alist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
alist = access_list_lookup(AFI_IP, (char *)rule);
|
||||
if (alist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
return (access_list_apply(alist, &p) == FILTER_DENY
|
||||
? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
}
|
||||
return RMAP_NOMATCH;
|
||||
return (access_list_apply(alist, &p) == FILTER_DENY ? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
}
|
||||
|
||||
/* Route map `ip next-hop' match statement. `arg' should be
|
||||
@ -175,26 +170,22 @@ static const struct route_map_rule_cmd route_match_ip_nexthop_cmd = {
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_ip_next_hop_prefix_list(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
void *object)
|
||||
{
|
||||
struct prefix_list *plist;
|
||||
struct external_info *ei = object;
|
||||
struct prefix_ipv4 p;
|
||||
|
||||
if (type == RMAP_OSPF) {
|
||||
p.family = AF_INET;
|
||||
p.prefix = ei->nexthop;
|
||||
p.prefixlen = IPV4_MAX_BITLEN;
|
||||
p.family = AF_INET;
|
||||
p.prefix = ei->nexthop;
|
||||
p.prefixlen = IPV4_MAX_BITLEN;
|
||||
|
||||
plist = prefix_list_lookup(AFI_IP, (char *)rule);
|
||||
if (plist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
plist = prefix_list_lookup(AFI_IP, (char *)rule);
|
||||
if (plist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
return (prefix_list_apply(plist, &p) == PREFIX_DENY
|
||||
? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
}
|
||||
return RMAP_NOMATCH;
|
||||
return (prefix_list_apply(plist, &p) == PREFIX_DENY ? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
}
|
||||
|
||||
static void *route_match_ip_next_hop_prefix_list_compile(const char *arg)
|
||||
@ -219,11 +210,11 @@ static const struct route_map_rule_cmd
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_ip_next_hop_type(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
void *object)
|
||||
{
|
||||
struct external_info *ei = object;
|
||||
|
||||
if (type == RMAP_OSPF && prefix->family == AF_INET) {
|
||||
if (prefix->family == AF_INET) {
|
||||
ei = (struct external_info *)object;
|
||||
if (!ei)
|
||||
return RMAP_NOMATCH;
|
||||
@ -256,22 +247,17 @@ static const struct route_map_rule_cmd
|
||||
/* Match function should return 1 if match is success else return
|
||||
zero. */
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_ip_address(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
route_match_ip_address(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
struct access_list *alist;
|
||||
/* struct prefix_ipv4 match; */
|
||||
|
||||
if (type == RMAP_OSPF) {
|
||||
alist = access_list_lookup(AFI_IP, (char *)rule);
|
||||
if (alist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
alist = access_list_lookup(AFI_IP, (char *)rule);
|
||||
if (alist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
return (access_list_apply(alist, prefix) == FILTER_DENY
|
||||
? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
}
|
||||
return RMAP_NOMATCH;
|
||||
return (access_list_apply(alist, prefix) == FILTER_DENY ? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
}
|
||||
|
||||
/* Route map `ip address' match statement. `arg' should be
|
||||
@ -298,20 +284,16 @@ static const struct route_map_rule_cmd route_match_ip_address_cmd = {
|
||||
/* `match ip address prefix-list PREFIX_LIST' */
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_ip_address_prefix_list(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
void *object)
|
||||
{
|
||||
struct prefix_list *plist;
|
||||
|
||||
if (type == RMAP_OSPF) {
|
||||
plist = prefix_list_lookup(AFI_IP, (char *)rule);
|
||||
if (plist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
plist = prefix_list_lookup(AFI_IP, (char *)rule);
|
||||
if (plist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
return (prefix_list_apply(plist, prefix) == PREFIX_DENY
|
||||
? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
}
|
||||
return RMAP_NOMATCH;
|
||||
return (prefix_list_apply(plist, prefix) == PREFIX_DENY ? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
}
|
||||
|
||||
static void *route_match_ip_address_prefix_list_compile(const char *arg)
|
||||
@ -336,22 +318,18 @@ static const struct route_map_rule_cmd
|
||||
/* Match function should return 1 if match is success else return
|
||||
zero. */
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_interface(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
route_match_interface(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
struct interface *ifp;
|
||||
struct external_info *ei;
|
||||
|
||||
if (type == RMAP_OSPF) {
|
||||
ei = object;
|
||||
ifp = if_lookup_by_name_all_vrf((char *)rule);
|
||||
ei = object;
|
||||
ifp = if_lookup_by_name_all_vrf((char *)rule);
|
||||
|
||||
if (ifp == NULL || ifp->ifindex != ei->ifindex)
|
||||
return RMAP_NOMATCH;
|
||||
if (ifp == NULL || ifp->ifindex != ei->ifindex)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
return RMAP_MATCH;
|
||||
}
|
||||
return RMAP_NOMATCH;
|
||||
return RMAP_MATCH;
|
||||
}
|
||||
|
||||
/* Route map `interface' match statement. `arg' should be
|
||||
@ -377,20 +355,15 @@ static const struct route_map_rule_cmd route_match_interface_cmd = {
|
||||
|
||||
/* 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 *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
route_match_tag(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
route_tag_t *tag;
|
||||
struct external_info *ei;
|
||||
|
||||
if (type == RMAP_OSPF) {
|
||||
tag = rule;
|
||||
ei = object;
|
||||
tag = rule;
|
||||
ei = object;
|
||||
|
||||
return ((ei->tag == *tag) ? RMAP_MATCH : RMAP_NOMATCH);
|
||||
}
|
||||
|
||||
return RMAP_NOMATCH;
|
||||
return ((ei->tag == *tag) ? RMAP_MATCH : RMAP_NOMATCH);
|
||||
}
|
||||
|
||||
/* Route map commands for tag matching. */
|
||||
@ -410,33 +383,31 @@ struct ospf_metric {
|
||||
/* `set metric METRIC' */
|
||||
/* Set metric to attribute. */
|
||||
static enum route_map_cmd_result_t
|
||||
route_set_metric(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
route_set_metric(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
struct ospf_metric *metric;
|
||||
struct external_info *ei;
|
||||
|
||||
if (type == RMAP_OSPF) {
|
||||
/* Fetch routemap's rule information. */
|
||||
metric = rule;
|
||||
ei = object;
|
||||
/* Fetch routemap's rule information. */
|
||||
metric = rule;
|
||||
ei = object;
|
||||
|
||||
/* Set metric out value. */
|
||||
if (!metric->used)
|
||||
return RMAP_OKAY;
|
||||
/* Set metric out value. */
|
||||
if (!metric->used)
|
||||
return RMAP_OKAY;
|
||||
|
||||
ei->route_map_set.metric = DEFAULT_DEFAULT_METRIC;
|
||||
ei->route_map_set.metric = DEFAULT_DEFAULT_METRIC;
|
||||
|
||||
if (metric->type == metric_increment)
|
||||
ei->route_map_set.metric += metric->metric;
|
||||
else if (metric->type == metric_decrement)
|
||||
ei->route_map_set.metric -= metric->metric;
|
||||
else if (metric->type == metric_absolute)
|
||||
ei->route_map_set.metric = metric->metric;
|
||||
if (metric->type == metric_increment)
|
||||
ei->route_map_set.metric += metric->metric;
|
||||
else if (metric->type == metric_decrement)
|
||||
ei->route_map_set.metric -= metric->metric;
|
||||
else if (metric->type == metric_absolute)
|
||||
ei->route_map_set.metric = metric->metric;
|
||||
|
||||
if (ei->route_map_set.metric > OSPF_LS_INFINITY)
|
||||
ei->route_map_set.metric = OSPF_LS_INFINITY;
|
||||
|
||||
if (ei->route_map_set.metric > OSPF_LS_INFINITY)
|
||||
ei->route_map_set.metric = OSPF_LS_INFINITY;
|
||||
}
|
||||
return RMAP_OKAY;
|
||||
}
|
||||
|
||||
@ -492,20 +463,18 @@ static const struct route_map_rule_cmd route_set_metric_cmd = {
|
||||
/* `set metric-type TYPE' */
|
||||
/* Set metric-type to attribute. */
|
||||
static enum route_map_cmd_result_t
|
||||
route_set_metric_type(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
route_set_metric_type(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
uint32_t *metric_type;
|
||||
struct external_info *ei;
|
||||
|
||||
if (type == RMAP_OSPF) {
|
||||
/* Fetch routemap's rule information. */
|
||||
metric_type = rule;
|
||||
ei = object;
|
||||
/* Fetch routemap's rule information. */
|
||||
metric_type = rule;
|
||||
ei = object;
|
||||
|
||||
/* Set metric out value. */
|
||||
ei->route_map_set.metric_type = *metric_type;
|
||||
|
||||
/* Set metric out value. */
|
||||
ei->route_map_set.metric_type = *metric_type;
|
||||
}
|
||||
return RMAP_OKAY;
|
||||
}
|
||||
|
||||
@ -543,19 +512,16 @@ static const struct route_map_rule_cmd route_set_metric_type_cmd = {
|
||||
};
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
route_set_tag(void *rule, const struct prefix *prefix, route_map_object_t type,
|
||||
void *object)
|
||||
route_set_tag(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
route_tag_t *tag;
|
||||
struct external_info *ei;
|
||||
|
||||
if (type == RMAP_OSPF) {
|
||||
tag = rule;
|
||||
ei = object;
|
||||
tag = rule;
|
||||
ei = object;
|
||||
|
||||
/* Set tag value */
|
||||
ei->tag = *tag;
|
||||
}
|
||||
/* Set tag value */
|
||||
ei->tag = *tag;
|
||||
|
||||
return RMAP_OKAY;
|
||||
}
|
||||
|
@ -902,8 +902,7 @@ int ospf_external_info_apply_default_routemap(struct ospf *ospf,
|
||||
if (red && ROUTEMAP_NAME(red)) {
|
||||
route_map_result_t ret;
|
||||
|
||||
ret = route_map_apply(ROUTEMAP(red), (struct prefix *)p,
|
||||
RMAP_OSPF, ei);
|
||||
ret = route_map_apply(ROUTEMAP(red), (struct prefix *)p, ei);
|
||||
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
ei->route_map_set = save_values;
|
||||
@ -1056,8 +1055,7 @@ int ospf_redistribute_check(struct ospf *ospf, struct external_info *ei,
|
||||
if (red && ROUTEMAP_NAME(red)) {
|
||||
route_map_result_t ret;
|
||||
|
||||
ret = route_map_apply(ROUTEMAP(red), (struct prefix *)p,
|
||||
RMAP_OSPF, ei);
|
||||
ret = route_map_apply(ROUTEMAP(red), (struct prefix *)p, ei);
|
||||
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
ei->route_map_set = save_values;
|
||||
|
@ -43,27 +43,23 @@ struct rip_metric_modifier {
|
||||
/* `match metric METRIC' */
|
||||
/* Match function return 1 if match is success else return zero. */
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_metric(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
route_match_metric(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
uint32_t *metric;
|
||||
uint32_t check;
|
||||
struct rip_info *rinfo;
|
||||
|
||||
if (type == RMAP_RIP) {
|
||||
metric = rule;
|
||||
rinfo = object;
|
||||
metric = rule;
|
||||
rinfo = object;
|
||||
|
||||
/* If external metric is available, the route-map should
|
||||
work on this one (for redistribute purpose) */
|
||||
check = (rinfo->external_metric) ? rinfo->external_metric
|
||||
: rinfo->metric;
|
||||
if (check == *metric)
|
||||
return RMAP_MATCH;
|
||||
else
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
return RMAP_NOMATCH;
|
||||
/* If external metric is available, the route-map should
|
||||
work on this one (for redistribute purpose) */
|
||||
check = (rinfo->external_metric) ? rinfo->external_metric
|
||||
: rinfo->metric;
|
||||
if (check == *metric)
|
||||
return RMAP_MATCH;
|
||||
else
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
|
||||
/* Route map `match metric' match statement. `arg' is METRIC value */
|
||||
@ -98,29 +94,25 @@ static const struct route_map_rule_cmd route_match_metric_cmd = {
|
||||
/* `match interface IFNAME' */
|
||||
/* Match function return 1 if match is success else return zero. */
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_interface(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
route_match_interface(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
struct rip_info *rinfo;
|
||||
struct interface *ifp;
|
||||
char *ifname;
|
||||
|
||||
if (type == RMAP_RIP) {
|
||||
ifname = rule;
|
||||
ifp = if_lookup_by_name(ifname, VRF_DEFAULT);
|
||||
ifname = rule;
|
||||
ifp = if_lookup_by_name(ifname, VRF_DEFAULT);
|
||||
|
||||
if (!ifp)
|
||||
return RMAP_NOMATCH;
|
||||
if (!ifp)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
rinfo = object;
|
||||
rinfo = object;
|
||||
|
||||
if (rinfo->ifindex_out == ifp->ifindex
|
||||
|| rinfo->nh.ifindex == ifp->ifindex)
|
||||
return RMAP_MATCH;
|
||||
else
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
return RMAP_NOMATCH;
|
||||
if (rinfo->ifindex_out == ifp->ifindex
|
||||
|| rinfo->nh.ifindex == ifp->ifindex)
|
||||
return RMAP_MATCH;
|
||||
else
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
|
||||
/* Route map `match interface' match statement. `arg' is IFNAME value */
|
||||
@ -148,30 +140,25 @@ static const struct route_map_rule_cmd route_match_interface_cmd = {
|
||||
|
||||
/* Match function return 1 if match is success else return zero. */
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_ip_next_hop(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
route_match_ip_next_hop(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
struct access_list *alist;
|
||||
struct rip_info *rinfo;
|
||||
struct prefix_ipv4 p;
|
||||
|
||||
if (type == RMAP_RIP) {
|
||||
rinfo = object;
|
||||
p.family = AF_INET;
|
||||
p.prefix = (rinfo->nh.gate.ipv4.s_addr != INADDR_ANY)
|
||||
? rinfo->nh.gate.ipv4
|
||||
: rinfo->from;
|
||||
p.prefixlen = IPV4_MAX_BITLEN;
|
||||
rinfo = object;
|
||||
p.family = AF_INET;
|
||||
p.prefix = (rinfo->nh.gate.ipv4.s_addr != INADDR_ANY)
|
||||
? rinfo->nh.gate.ipv4
|
||||
: rinfo->from;
|
||||
p.prefixlen = IPV4_MAX_BITLEN;
|
||||
|
||||
alist = access_list_lookup(AFI_IP, (char *)rule);
|
||||
if (alist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
alist = access_list_lookup(AFI_IP, (char *)rule);
|
||||
if (alist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
return (access_list_apply(alist, &p) == FILTER_DENY
|
||||
? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
}
|
||||
return RMAP_NOMATCH;
|
||||
return (access_list_apply(alist, &p) == FILTER_DENY ? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
}
|
||||
|
||||
/* Route map `ip next-hop' match statement. `arg' should be
|
||||
@ -199,29 +186,25 @@ static const struct route_map_rule_cmd route_match_ip_next_hop_cmd = {
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_ip_next_hop_prefix_list(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
void *object)
|
||||
{
|
||||
struct prefix_list *plist;
|
||||
struct rip_info *rinfo;
|
||||
struct prefix_ipv4 p;
|
||||
|
||||
if (type == RMAP_RIP) {
|
||||
rinfo = object;
|
||||
p.family = AF_INET;
|
||||
p.prefix = (rinfo->nh.gate.ipv4.s_addr != INADDR_ANY)
|
||||
? rinfo->nh.gate.ipv4
|
||||
: rinfo->from;
|
||||
p.prefixlen = IPV4_MAX_BITLEN;
|
||||
rinfo = object;
|
||||
p.family = AF_INET;
|
||||
p.prefix = (rinfo->nh.gate.ipv4.s_addr != INADDR_ANY)
|
||||
? rinfo->nh.gate.ipv4
|
||||
: rinfo->from;
|
||||
p.prefixlen = IPV4_MAX_BITLEN;
|
||||
|
||||
plist = prefix_list_lookup(AFI_IP, (char *)rule);
|
||||
if (plist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
plist = prefix_list_lookup(AFI_IP, (char *)rule);
|
||||
if (plist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
return (prefix_list_apply(plist, &p) == PREFIX_DENY
|
||||
? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
}
|
||||
return RMAP_NOMATCH;
|
||||
return (prefix_list_apply(plist, &p) == PREFIX_DENY ? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
}
|
||||
|
||||
static void *route_match_ip_next_hop_prefix_list_compile(const char *arg)
|
||||
@ -246,11 +229,11 @@ static const struct route_map_rule_cmd
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_ip_next_hop_type(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
void *object)
|
||||
{
|
||||
struct rip_info *rinfo;
|
||||
|
||||
if (type == RMAP_RIP && prefix->family == AF_INET) {
|
||||
if (prefix->family == AF_INET) {
|
||||
rinfo = (struct rip_info *)object;
|
||||
if (!rinfo)
|
||||
return RMAP_NOMATCH;
|
||||
@ -284,21 +267,16 @@ static const struct route_map_rule_cmd
|
||||
/* Match function should return 1 if match is success else return
|
||||
zero. */
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_ip_address(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
route_match_ip_address(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
struct access_list *alist;
|
||||
|
||||
if (type == RMAP_RIP) {
|
||||
alist = access_list_lookup(AFI_IP, (char *)rule);
|
||||
if (alist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
alist = access_list_lookup(AFI_IP, (char *)rule);
|
||||
if (alist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
return (access_list_apply(alist, prefix) == FILTER_DENY
|
||||
? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
}
|
||||
return RMAP_NOMATCH;
|
||||
return (access_list_apply(alist, prefix) == FILTER_DENY ? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
}
|
||||
|
||||
/* Route map `ip address' match statement. `arg' should be
|
||||
@ -326,20 +304,16 @@ static const struct route_map_rule_cmd route_match_ip_address_cmd = {
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_ip_address_prefix_list(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
void *object)
|
||||
{
|
||||
struct prefix_list *plist;
|
||||
|
||||
if (type == RMAP_RIP) {
|
||||
plist = prefix_list_lookup(AFI_IP, (char *)rule);
|
||||
if (plist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
plist = prefix_list_lookup(AFI_IP, (char *)rule);
|
||||
if (plist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
return (prefix_list_apply(plist, prefix) == PREFIX_DENY
|
||||
? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
}
|
||||
return RMAP_NOMATCH;
|
||||
return (prefix_list_apply(plist, prefix) == PREFIX_DENY ? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
}
|
||||
|
||||
static void *route_match_ip_address_prefix_list_compile(const char *arg)
|
||||
@ -363,25 +337,21 @@ 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, route_map_object_t type,
|
||||
void *object)
|
||||
route_match_tag(void *rule, const struct prefix *p, void *object)
|
||||
{
|
||||
route_tag_t *tag;
|
||||
struct rip_info *rinfo;
|
||||
route_tag_t rinfo_tag;
|
||||
|
||||
if (type == RMAP_RIP) {
|
||||
tag = rule;
|
||||
rinfo = object;
|
||||
tag = rule;
|
||||
rinfo = object;
|
||||
|
||||
/* The information stored by rinfo is host ordered. */
|
||||
rinfo_tag = rinfo->tag;
|
||||
if (rinfo_tag == *tag)
|
||||
return RMAP_MATCH;
|
||||
else
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
return RMAP_NOMATCH;
|
||||
/* The information stored by rinfo is host ordered. */
|
||||
rinfo_tag = rinfo->tag;
|
||||
if (rinfo_tag == *tag)
|
||||
return RMAP_MATCH;
|
||||
else
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
|
||||
/* Route map commands for tag matching. */
|
||||
@ -396,33 +366,30 @@ static const struct route_map_rule_cmd route_match_tag_cmd = {
|
||||
|
||||
/* Set metric to attribute. */
|
||||
static enum route_map_cmd_result_t
|
||||
route_set_metric(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
route_set_metric(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
if (type == RMAP_RIP) {
|
||||
struct rip_metric_modifier *mod;
|
||||
struct rip_info *rinfo;
|
||||
struct rip_metric_modifier *mod;
|
||||
struct rip_info *rinfo;
|
||||
|
||||
mod = rule;
|
||||
rinfo = object;
|
||||
mod = rule;
|
||||
rinfo = object;
|
||||
|
||||
if (!mod->used)
|
||||
return RMAP_OKAY;
|
||||
if (!mod->used)
|
||||
return RMAP_OKAY;
|
||||
|
||||
if (mod->type == metric_increment)
|
||||
rinfo->metric_out += mod->metric;
|
||||
else if (mod->type == metric_decrement)
|
||||
rinfo->metric_out -= mod->metric;
|
||||
else if (mod->type == metric_absolute)
|
||||
rinfo->metric_out = mod->metric;
|
||||
if (mod->type == metric_increment)
|
||||
rinfo->metric_out += mod->metric;
|
||||
else if (mod->type == metric_decrement)
|
||||
rinfo->metric_out -= mod->metric;
|
||||
else if (mod->type == metric_absolute)
|
||||
rinfo->metric_out = mod->metric;
|
||||
|
||||
if ((signed int)rinfo->metric_out < 1)
|
||||
rinfo->metric_out = 1;
|
||||
if (rinfo->metric_out > RIP_METRIC_INFINITY)
|
||||
rinfo->metric_out = RIP_METRIC_INFINITY;
|
||||
if ((signed int)rinfo->metric_out < 1)
|
||||
rinfo->metric_out = 1;
|
||||
if (rinfo->metric_out > RIP_METRIC_INFINITY)
|
||||
rinfo->metric_out = RIP_METRIC_INFINITY;
|
||||
|
||||
rinfo->metric_set = 1;
|
||||
}
|
||||
rinfo->metric_set = 1;
|
||||
return RMAP_OKAY;
|
||||
}
|
||||
|
||||
@ -495,22 +462,20 @@ static const struct route_map_rule_cmd route_set_metric_cmd = {
|
||||
/* `set ip next-hop IP_ADDRESS' */
|
||||
|
||||
/* Set nexthop to object. ojbect must be pointer to struct attr. */
|
||||
static enum route_map_cmd_result_t route_set_ip_nexthop(void *rule,
|
||||
const struct prefix *prefix,
|
||||
route_map_object_t type,
|
||||
void *object)
|
||||
static enum route_map_cmd_result_t
|
||||
route_set_ip_nexthop(void *rule, const struct prefix *prefix,
|
||||
|
||||
void *object)
|
||||
{
|
||||
struct in_addr *address;
|
||||
struct rip_info *rinfo;
|
||||
|
||||
if (type == RMAP_RIP) {
|
||||
/* Fetch routemap's rule information. */
|
||||
address = rule;
|
||||
rinfo = object;
|
||||
/* Fetch routemap's rule information. */
|
||||
address = rule;
|
||||
rinfo = object;
|
||||
|
||||
/* Set next hop value. */
|
||||
rinfo->nexthop_out = *address;
|
||||
}
|
||||
/* Set next hop value. */
|
||||
rinfo->nexthop_out = *address;
|
||||
|
||||
return RMAP_OKAY;
|
||||
}
|
||||
@ -552,20 +517,17 @@ static const struct route_map_rule_cmd route_set_ip_nexthop_cmd = {
|
||||
|
||||
/* Set tag to object. ojbect must be pointer to struct attr. */
|
||||
static enum route_map_cmd_result_t
|
||||
route_set_tag(void *rule, const struct prefix *prefix, route_map_object_t type,
|
||||
void *object)
|
||||
route_set_tag(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
route_tag_t *tag;
|
||||
struct rip_info *rinfo;
|
||||
|
||||
if (type == RMAP_RIP) {
|
||||
/* Fetch routemap's rule information. */
|
||||
tag = rule;
|
||||
rinfo = object;
|
||||
/* Fetch routemap's rule information. */
|
||||
tag = rule;
|
||||
rinfo = object;
|
||||
|
||||
/* Set next hop value. */
|
||||
rinfo->tag_out = *tag;
|
||||
}
|
||||
/* Set next hop value. */
|
||||
rinfo->tag_out = *tag;
|
||||
|
||||
return RMAP_OKAY;
|
||||
}
|
||||
|
@ -462,7 +462,7 @@ static void rip_rte_process(struct rte *rte, struct sockaddr_in *from,
|
||||
if (ri->routemap[RIP_FILTER_IN]) {
|
||||
/* The object should be of the type of rip_info */
|
||||
ret = route_map_apply(ri->routemap[RIP_FILTER_IN],
|
||||
(struct prefix *)&p, RMAP_RIP, &newinfo);
|
||||
(struct prefix *)&p, &newinfo);
|
||||
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
if (IS_RIP_DEBUG_PACKET)
|
||||
@ -2251,7 +2251,7 @@ void rip_output_process(struct connected *ifc, struct sockaddr_in *to,
|
||||
if (ri->routemap[RIP_FILTER_OUT]) {
|
||||
ret = route_map_apply(
|
||||
ri->routemap[RIP_FILTER_OUT],
|
||||
(struct prefix *)p, RMAP_RIP, rinfo);
|
||||
(struct prefix *)p, rinfo);
|
||||
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
if (IS_RIP_DEBUG_PACKET)
|
||||
@ -2267,7 +2267,7 @@ void rip_output_process(struct connected *ifc, struct sockaddr_in *to,
|
||||
&& rinfo->sub_type != RIP_ROUTE_INTERFACE) {
|
||||
ret = route_map_apply(
|
||||
rip->redist[rinfo->type].route_map.map,
|
||||
(struct prefix *)p, RMAP_RIP, rinfo);
|
||||
(struct prefix *)p, rinfo);
|
||||
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
if (IS_RIP_DEBUG_PACKET)
|
||||
|
@ -39,21 +39,19 @@ struct rip_metric_modifier {
|
||||
/* `match metric METRIC' */
|
||||
/* Match function return 1 if match is success else return zero. */
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_metric(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
route_match_metric(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
uint32_t *metric;
|
||||
struct ripng_info *rinfo;
|
||||
|
||||
if (type == RMAP_RIPNG) {
|
||||
metric = rule;
|
||||
rinfo = object;
|
||||
metric = rule;
|
||||
rinfo = object;
|
||||
|
||||
if (rinfo->metric == *metric)
|
||||
return RMAP_MATCH;
|
||||
else
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
if (rinfo->metric == *metric)
|
||||
return RMAP_MATCH;
|
||||
else
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
|
||||
@ -89,27 +87,25 @@ static const struct route_map_rule_cmd route_match_metric_cmd = {
|
||||
/* `match interface IFNAME' */
|
||||
/* Match function return 1 if match is success else return zero. */
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_interface(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
route_match_interface(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
struct ripng_info *rinfo;
|
||||
struct interface *ifp;
|
||||
char *ifname;
|
||||
|
||||
if (type == RMAP_RIPNG) {
|
||||
ifname = rule;
|
||||
ifp = if_lookup_by_name(ifname, VRF_DEFAULT);
|
||||
ifname = rule;
|
||||
ifp = if_lookup_by_name(ifname, VRF_DEFAULT);
|
||||
|
||||
if (!ifp)
|
||||
return RMAP_NOMATCH;
|
||||
if (!ifp)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
rinfo = object;
|
||||
rinfo = object;
|
||||
|
||||
if (rinfo->ifindex == ifp->ifindex)
|
||||
return RMAP_MATCH;
|
||||
else
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
if (rinfo->ifindex == ifp->ifindex)
|
||||
return RMAP_MATCH;
|
||||
else
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
|
||||
@ -135,27 +131,24 @@ static const struct route_map_rule_cmd route_match_interface_cmd = {
|
||||
/* 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 *prefix,
|
||||
route_map_object_t type,
|
||||
void *object)
|
||||
{
|
||||
route_tag_t *tag;
|
||||
struct ripng_info *rinfo;
|
||||
route_tag_t rinfo_tag;
|
||||
|
||||
if (type == RMAP_RIPNG) {
|
||||
tag = rule;
|
||||
rinfo = object;
|
||||
tag = rule;
|
||||
rinfo = object;
|
||||
|
||||
/* The information stored by rinfo is host ordered. */
|
||||
rinfo_tag = rinfo->tag;
|
||||
if (rinfo_tag == *tag)
|
||||
return RMAP_MATCH;
|
||||
else
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
return RMAP_NOMATCH;
|
||||
/* The information stored by rinfo is host ordered. */
|
||||
rinfo_tag = rinfo->tag;
|
||||
if (rinfo_tag == *tag)
|
||||
return RMAP_MATCH;
|
||||
else
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
|
||||
|
||||
static const struct route_map_rule_cmd route_match_tag_cmd = {
|
||||
"tag",
|
||||
route_match_tag,
|
||||
@ -167,33 +160,31 @@ static const struct route_map_rule_cmd route_match_tag_cmd = {
|
||||
|
||||
/* Set metric to attribute. */
|
||||
static enum route_map_cmd_result_t
|
||||
route_set_metric(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
route_set_metric(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
if (type == RMAP_RIPNG) {
|
||||
struct rip_metric_modifier *mod;
|
||||
struct ripng_info *rinfo;
|
||||
struct rip_metric_modifier *mod;
|
||||
struct ripng_info *rinfo;
|
||||
|
||||
mod = rule;
|
||||
rinfo = object;
|
||||
mod = rule;
|
||||
rinfo = object;
|
||||
|
||||
if (!mod->used)
|
||||
return RMAP_OKAY;
|
||||
if (!mod->used)
|
||||
return RMAP_OKAY;
|
||||
|
||||
if (mod->type == metric_increment)
|
||||
rinfo->metric_out += mod->metric;
|
||||
else if (mod->type == metric_decrement)
|
||||
rinfo->metric_out -= mod->metric;
|
||||
else if (mod->type == metric_absolute)
|
||||
rinfo->metric_out = mod->metric;
|
||||
if (mod->type == metric_increment)
|
||||
rinfo->metric_out += mod->metric;
|
||||
else if (mod->type == metric_decrement)
|
||||
rinfo->metric_out -= mod->metric;
|
||||
else if (mod->type == metric_absolute)
|
||||
rinfo->metric_out = mod->metric;
|
||||
|
||||
if (rinfo->metric_out < 1)
|
||||
rinfo->metric_out = 1;
|
||||
if (rinfo->metric_out > RIPNG_METRIC_INFINITY)
|
||||
rinfo->metric_out = RIPNG_METRIC_INFINITY;
|
||||
if (rinfo->metric_out < 1)
|
||||
rinfo->metric_out = 1;
|
||||
if (rinfo->metric_out > RIPNG_METRIC_INFINITY)
|
||||
rinfo->metric_out = RIPNG_METRIC_INFINITY;
|
||||
|
||||
rinfo->metric_set = 1;
|
||||
|
||||
rinfo->metric_set = 1;
|
||||
}
|
||||
return RMAP_OKAY;
|
||||
}
|
||||
|
||||
@ -265,20 +256,17 @@ static const struct route_map_rule_cmd route_set_metric_cmd = {
|
||||
|
||||
/* Set nexthop to object. ojbect must be pointer to struct attr. */
|
||||
static enum route_map_cmd_result_t
|
||||
route_set_ipv6_nexthop_local(void *rule, const struct prefix *p,
|
||||
route_map_object_t type, void *object)
|
||||
route_set_ipv6_nexthop_local(void *rule, const struct prefix *p, void *object)
|
||||
{
|
||||
struct in6_addr *address;
|
||||
struct ripng_info *rinfo;
|
||||
|
||||
if (type == RMAP_RIPNG) {
|
||||
/* Fetch routemap's rule information. */
|
||||
address = rule;
|
||||
rinfo = object;
|
||||
/* Fetch routemap's rule information. */
|
||||
address = rule;
|
||||
rinfo = object;
|
||||
|
||||
/* Set next hop value. */
|
||||
rinfo->nexthop_out = *address;
|
||||
}
|
||||
/* Set next hop value. */
|
||||
rinfo->nexthop_out = *address;
|
||||
|
||||
return RMAP_OKAY;
|
||||
}
|
||||
@ -321,20 +309,17 @@ static const struct route_map_rule_cmd
|
||||
|
||||
/* Set tag to object. ojbect must be pointer to struct attr. */
|
||||
static enum route_map_cmd_result_t
|
||||
route_set_tag(void *rule, const struct prefix *prefix, route_map_object_t type,
|
||||
void *object)
|
||||
route_set_tag(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
route_tag_t *tag;
|
||||
struct ripng_info *rinfo;
|
||||
|
||||
if (type == RMAP_RIPNG) {
|
||||
/* Fetch routemap's rule information. */
|
||||
tag = rule;
|
||||
rinfo = object;
|
||||
/* Fetch routemap's rule information. */
|
||||
tag = rule;
|
||||
rinfo = object;
|
||||
|
||||
/* Set next hop value. */
|
||||
rinfo->tag_out = *tag;
|
||||
}
|
||||
/* Set next hop value. */
|
||||
rinfo->tag_out = *tag;
|
||||
|
||||
return RMAP_OKAY;
|
||||
}
|
||||
|
@ -748,8 +748,7 @@ static void ripng_route_process(struct rte *rte, struct sockaddr_in6 *from,
|
||||
/* Modify entry. */
|
||||
if (ri->routemap[RIPNG_FILTER_IN]) {
|
||||
ret = route_map_apply(ri->routemap[RIPNG_FILTER_IN],
|
||||
(struct prefix *)&p, RMAP_RIPNG,
|
||||
&newinfo);
|
||||
(struct prefix *)&p, &newinfo);
|
||||
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
if (IS_RIPNG_DEBUG_PACKET)
|
||||
@ -1661,7 +1660,7 @@ void ripng_output_process(struct interface *ifp, struct sockaddr_in6 *to,
|
||||
if (ri->routemap[RIPNG_FILTER_OUT]) {
|
||||
ret = route_map_apply(
|
||||
ri->routemap[RIPNG_FILTER_OUT],
|
||||
(struct prefix *)p, RMAP_RIPNG, rinfo);
|
||||
(struct prefix *)p, rinfo);
|
||||
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
if (IS_RIPNG_DEBUG_PACKET)
|
||||
@ -1677,7 +1676,7 @@ void ripng_output_process(struct interface *ifp, struct sockaddr_in6 *to,
|
||||
ret = route_map_apply(ripng->redist[rinfo->type]
|
||||
.route_map.map,
|
||||
(struct prefix *)p,
|
||||
RMAP_RIPNG, rinfo);
|
||||
rinfo);
|
||||
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
if (IS_RIPNG_DEBUG_PACKET)
|
||||
@ -1773,8 +1772,7 @@ void ripng_output_process(struct interface *ifp, struct sockaddr_in6 *to,
|
||||
|
||||
ret = route_map_apply(
|
||||
ri->routemap[RIPNG_FILTER_OUT],
|
||||
(struct prefix *)p, RMAP_RIPNG,
|
||||
&newinfo);
|
||||
(struct prefix *)p, &newinfo);
|
||||
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
if (IS_RIPNG_DEBUG_PACKET)
|
||||
|
@ -64,19 +64,17 @@ static void zebra_route_map_set_delay_timer(uint32_t value);
|
||||
* Match function return 1 if match is success else return 0
|
||||
*/
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_tag(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
route_match_tag(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
route_tag_t *tag;
|
||||
struct nh_rmap_obj *nh_data;
|
||||
|
||||
if (type == RMAP_ZEBRA) {
|
||||
tag = rule;
|
||||
nh_data = object;
|
||||
tag = rule;
|
||||
nh_data = object;
|
||||
|
||||
if (nh_data->tag == *tag)
|
||||
return RMAP_MATCH;
|
||||
|
||||
if (nh_data->tag == *tag)
|
||||
return RMAP_MATCH;
|
||||
}
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
|
||||
@ -92,25 +90,23 @@ static const struct route_map_rule_cmd route_match_tag_cmd = {
|
||||
/* `match interface IFNAME' */
|
||||
/* Match function return 1 if match is success else return zero. */
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_interface(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
route_match_interface(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
struct nh_rmap_obj *nh_data;
|
||||
char *ifname = rule;
|
||||
ifindex_t ifindex;
|
||||
|
||||
if (type == RMAP_ZEBRA) {
|
||||
if (strcasecmp(ifname, "any") == 0)
|
||||
return RMAP_MATCH;
|
||||
nh_data = object;
|
||||
if (!nh_data || !nh_data->nexthop)
|
||||
return RMAP_NOMATCH;
|
||||
ifindex = ifname2ifindex(ifname, nh_data->vrf_id);
|
||||
if (ifindex == 0)
|
||||
return RMAP_NOMATCH;
|
||||
if (nh_data->nexthop->ifindex == ifindex)
|
||||
return RMAP_MATCH;
|
||||
}
|
||||
if (strcasecmp(ifname, "any") == 0)
|
||||
return RMAP_MATCH;
|
||||
nh_data = object;
|
||||
if (!nh_data || !nh_data->nexthop)
|
||||
return RMAP_NOMATCH;
|
||||
ifindex = ifname2ifindex(ifname, nh_data->vrf_id);
|
||||
if (ifindex == 0)
|
||||
return RMAP_NOMATCH;
|
||||
if (nh_data->nexthop->ifindex == ifindex)
|
||||
return RMAP_MATCH;
|
||||
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
|
||||
@ -938,40 +934,35 @@ DEFPY_YANG (show_ipv6_protocol_nht,
|
||||
|
||||
/* Match function return 1 if match is success else return zero. */
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_ip_next_hop(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
route_match_ip_next_hop(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
struct access_list *alist;
|
||||
struct nh_rmap_obj *nh_data;
|
||||
struct prefix_ipv4 p;
|
||||
|
||||
if (type == RMAP_ZEBRA) {
|
||||
nh_data = object;
|
||||
if (!nh_data)
|
||||
return RMAP_NOMATCH;
|
||||
nh_data = object;
|
||||
if (!nh_data)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
switch (nh_data->nexthop->type) {
|
||||
case NEXTHOP_TYPE_IFINDEX:
|
||||
/* Interface routes can't match ip next-hop */
|
||||
return RMAP_NOMATCH;
|
||||
case NEXTHOP_TYPE_IPV4_IFINDEX:
|
||||
case NEXTHOP_TYPE_IPV4:
|
||||
p.family = AF_INET;
|
||||
p.prefix = nh_data->nexthop->gate.ipv4;
|
||||
p.prefixlen = IPV4_MAX_BITLEN;
|
||||
break;
|
||||
default:
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
alist = access_list_lookup(AFI_IP, (char *)rule);
|
||||
if (alist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
return (access_list_apply(alist, &p) == FILTER_DENY
|
||||
? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
switch (nh_data->nexthop->type) {
|
||||
case NEXTHOP_TYPE_IFINDEX:
|
||||
/* Interface routes can't match ip next-hop */
|
||||
return RMAP_NOMATCH;
|
||||
case NEXTHOP_TYPE_IPV4_IFINDEX:
|
||||
case NEXTHOP_TYPE_IPV4:
|
||||
p.family = AF_INET;
|
||||
p.prefix = nh_data->nexthop->gate.ipv4;
|
||||
p.prefixlen = IPV4_MAX_BITLEN;
|
||||
break;
|
||||
default:
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
return RMAP_NOMATCH;
|
||||
alist = access_list_lookup(AFI_IP, (char *)rule);
|
||||
if (alist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
return (access_list_apply(alist, &p) == FILTER_DENY ? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
}
|
||||
|
||||
/* Route map `ip next-hop' match statement. `arg' should be
|
||||
@ -999,39 +990,35 @@ static const struct route_map_rule_cmd route_match_ip_next_hop_cmd = {
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_ip_next_hop_prefix_list(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
void *object)
|
||||
{
|
||||
struct prefix_list *plist;
|
||||
struct nh_rmap_obj *nh_data;
|
||||
struct prefix_ipv4 p;
|
||||
|
||||
if (type == RMAP_ZEBRA) {
|
||||
nh_data = (struct nh_rmap_obj *)object;
|
||||
if (!nh_data)
|
||||
return RMAP_NOMATCH;
|
||||
nh_data = (struct nh_rmap_obj *)object;
|
||||
if (!nh_data)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
switch (nh_data->nexthop->type) {
|
||||
case NEXTHOP_TYPE_IFINDEX:
|
||||
/* Interface routes can't match ip next-hop */
|
||||
return RMAP_NOMATCH;
|
||||
case NEXTHOP_TYPE_IPV4_IFINDEX:
|
||||
case NEXTHOP_TYPE_IPV4:
|
||||
p.family = AF_INET;
|
||||
p.prefix = nh_data->nexthop->gate.ipv4;
|
||||
p.prefixlen = IPV4_MAX_BITLEN;
|
||||
break;
|
||||
default:
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
plist = prefix_list_lookup(AFI_IP, (char *)rule);
|
||||
if (plist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
return (prefix_list_apply(plist, &p) == PREFIX_DENY
|
||||
? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
switch (nh_data->nexthop->type) {
|
||||
case NEXTHOP_TYPE_IFINDEX:
|
||||
/* Interface routes can't match ip next-hop */
|
||||
return RMAP_NOMATCH;
|
||||
case NEXTHOP_TYPE_IPV4_IFINDEX:
|
||||
case NEXTHOP_TYPE_IPV4:
|
||||
p.family = AF_INET;
|
||||
p.prefix = nh_data->nexthop->gate.ipv4;
|
||||
p.prefixlen = IPV4_MAX_BITLEN;
|
||||
break;
|
||||
default:
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
return RMAP_NOMATCH;
|
||||
plist = prefix_list_lookup(AFI_IP, (char *)rule);
|
||||
if (plist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
return (prefix_list_apply(plist, &p) == PREFIX_DENY ? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
}
|
||||
|
||||
static void *route_match_ip_next_hop_prefix_list_compile(const char *arg)
|
||||
@ -1058,34 +1045,28 @@ static const struct route_map_rule_cmd
|
||||
zero. */
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_address(afi_t afi, void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
void *object)
|
||||
{
|
||||
struct access_list *alist;
|
||||
|
||||
if (type == RMAP_ZEBRA) {
|
||||
alist = access_list_lookup(afi, (char *)rule);
|
||||
if (alist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
alist = access_list_lookup(afi, (char *)rule);
|
||||
if (alist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
return (access_list_apply(alist, prefix) == FILTER_DENY
|
||||
? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
}
|
||||
return RMAP_NOMATCH;
|
||||
return (access_list_apply(alist, prefix) == FILTER_DENY ? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
}
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_ip_address(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
route_match_ip_address(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
return route_match_address(AFI_IP, rule, prefix, type, object);
|
||||
return route_match_address(AFI_IP, rule, prefix, object);
|
||||
}
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_ipv6_address(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
route_match_ipv6_address(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
return route_match_address(AFI_IP6, rule, prefix, type, object);
|
||||
return route_match_address(AFI_IP6, rule, prefix, object);
|
||||
}
|
||||
|
||||
/* Route map `ip address' match statement. `arg' should be
|
||||
@ -1121,28 +1102,23 @@ static const struct route_map_rule_cmd route_match_ipv6_address_cmd = {
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_address_prefix_list(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object, afi_t afi)
|
||||
void *object, afi_t afi)
|
||||
{
|
||||
struct prefix_list *plist;
|
||||
|
||||
if (type == RMAP_ZEBRA) {
|
||||
plist = prefix_list_lookup(afi, (char *)rule);
|
||||
if (plist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
plist = prefix_list_lookup(afi, (char *)rule);
|
||||
if (plist == NULL)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
return (prefix_list_apply(plist, prefix) == PREFIX_DENY
|
||||
? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
}
|
||||
return RMAP_NOMATCH;
|
||||
return (prefix_list_apply(plist, prefix) == PREFIX_DENY ? RMAP_NOMATCH
|
||||
: RMAP_MATCH);
|
||||
}
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_ip_address_prefix_list(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
void *object)
|
||||
{
|
||||
return (route_match_address_prefix_list(rule, prefix, type, object,
|
||||
AFI_IP));
|
||||
return (route_match_address_prefix_list(rule, prefix, object, AFI_IP));
|
||||
}
|
||||
|
||||
static void *route_match_address_prefix_list_compile(const char *arg)
|
||||
@ -1165,10 +1141,9 @@ static const struct route_map_rule_cmd
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_ipv6_address_prefix_list(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
void *object)
|
||||
{
|
||||
return (route_match_address_prefix_list(rule, prefix, type, object,
|
||||
AFI_IP6));
|
||||
return (route_match_address_prefix_list(rule, prefix, object, AFI_IP6));
|
||||
}
|
||||
|
||||
static const struct route_map_rule_cmd
|
||||
@ -1183,11 +1158,11 @@ static const struct route_map_rule_cmd
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_ipv6_next_hop_type(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
void *object)
|
||||
{
|
||||
struct nh_rmap_obj *nh_data;
|
||||
|
||||
if (type == RMAP_ZEBRA && prefix->family == AF_INET6) {
|
||||
if (prefix->family == AF_INET6) {
|
||||
nh_data = (struct nh_rmap_obj *)object;
|
||||
if (!nh_data)
|
||||
return RMAP_NOMATCH;
|
||||
@ -1195,6 +1170,7 @@ route_match_ipv6_next_hop_type(void *rule, const struct prefix *prefix,
|
||||
if (nh_data->nexthop->type == NEXTHOP_TYPE_BLACKHOLE)
|
||||
return RMAP_MATCH;
|
||||
}
|
||||
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
|
||||
@ -1220,15 +1196,11 @@ static const struct route_map_rule_cmd
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_address_prefix_len(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
void *object)
|
||||
{
|
||||
uint32_t *prefixlen = (uint32_t *)rule;
|
||||
|
||||
if (type == RMAP_ZEBRA) {
|
||||
return ((prefix->prefixlen == *prefixlen) ? RMAP_MATCH
|
||||
: RMAP_NOMATCH);
|
||||
}
|
||||
return RMAP_NOMATCH;
|
||||
return ((prefix->prefixlen == *prefixlen) ? RMAP_MATCH : RMAP_NOMATCH);
|
||||
}
|
||||
|
||||
static void *route_match_address_prefix_len_compile(const char *arg)
|
||||
@ -1277,34 +1249,30 @@ static const struct route_map_rule_cmd
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_ip_nexthop_prefix_len(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
void *object)
|
||||
{
|
||||
uint32_t *prefixlen = (uint32_t *)rule;
|
||||
struct nh_rmap_obj *nh_data;
|
||||
struct prefix_ipv4 p;
|
||||
|
||||
if (type == RMAP_ZEBRA) {
|
||||
nh_data = (struct nh_rmap_obj *)object;
|
||||
if (!nh_data || !nh_data->nexthop)
|
||||
return RMAP_NOMATCH;
|
||||
nh_data = (struct nh_rmap_obj *)object;
|
||||
if (!nh_data || !nh_data->nexthop)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
switch (nh_data->nexthop->type) {
|
||||
case NEXTHOP_TYPE_IFINDEX:
|
||||
/* Interface routes can't match ip next-hop */
|
||||
return RMAP_NOMATCH;
|
||||
case NEXTHOP_TYPE_IPV4_IFINDEX:
|
||||
case NEXTHOP_TYPE_IPV4:
|
||||
p.family = AF_INET;
|
||||
p.prefix = nh_data->nexthop->gate.ipv4;
|
||||
p.prefixlen = IPV4_MAX_BITLEN;
|
||||
break;
|
||||
default:
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
return ((p.prefixlen == *prefixlen) ? RMAP_MATCH
|
||||
: RMAP_NOMATCH);
|
||||
switch (nh_data->nexthop->type) {
|
||||
case NEXTHOP_TYPE_IFINDEX:
|
||||
/* Interface routes can't match ip next-hop */
|
||||
return RMAP_NOMATCH;
|
||||
case NEXTHOP_TYPE_IPV4_IFINDEX:
|
||||
case NEXTHOP_TYPE_IPV4:
|
||||
p.family = AF_INET;
|
||||
p.prefix = nh_data->nexthop->gate.ipv4;
|
||||
p.prefixlen = IPV4_MAX_BITLEN;
|
||||
break;
|
||||
default:
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
return RMAP_NOMATCH;
|
||||
return ((p.prefixlen == *prefixlen) ? RMAP_MATCH : RMAP_NOMATCH);
|
||||
}
|
||||
|
||||
static const struct route_map_rule_cmd
|
||||
@ -1319,11 +1287,11 @@ static const struct route_map_rule_cmd
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_ip_next_hop_type(void *rule, const struct prefix *prefix,
|
||||
route_map_object_t type, void *object)
|
||||
void *object)
|
||||
{
|
||||
struct nh_rmap_obj *nh_data;
|
||||
|
||||
if (type == RMAP_ZEBRA && prefix->family == AF_INET) {
|
||||
if (prefix->family == AF_INET) {
|
||||
nh_data = (struct nh_rmap_obj *)object;
|
||||
if (!nh_data)
|
||||
return RMAP_NOMATCH;
|
||||
@ -1331,6 +1299,7 @@ route_match_ip_next_hop_type(void *rule, const struct prefix *prefix,
|
||||
if (nh_data->nexthop->type == NEXTHOP_TYPE_BLACKHOLE)
|
||||
return RMAP_MATCH;
|
||||
}
|
||||
|
||||
return RMAP_NOMATCH;
|
||||
}
|
||||
|
||||
@ -1355,21 +1324,17 @@ static const struct route_map_rule_cmd
|
||||
/* `match source-protocol PROTOCOL' */
|
||||
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_source_protocol(void *rule, const struct prefix *p,
|
||||
route_map_object_t type, void *object)
|
||||
route_match_source_protocol(void *rule, const struct prefix *p, void *object)
|
||||
{
|
||||
uint32_t *rib_type = (uint32_t *)rule;
|
||||
struct nh_rmap_obj *nh_data;
|
||||
|
||||
if (type == RMAP_ZEBRA) {
|
||||
nh_data = (struct nh_rmap_obj *)object;
|
||||
if (!nh_data)
|
||||
return RMAP_NOMATCH;
|
||||
nh_data = (struct nh_rmap_obj *)object;
|
||||
if (!nh_data)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
return ((nh_data->source_protocol == *rib_type) ? RMAP_MATCH
|
||||
: RMAP_NOMATCH);
|
||||
}
|
||||
return RMAP_NOMATCH;
|
||||
return ((nh_data->source_protocol == *rib_type) ? RMAP_MATCH
|
||||
: RMAP_NOMATCH);
|
||||
}
|
||||
|
||||
static void *route_match_source_protocol_compile(const char *arg)
|
||||
@ -1399,15 +1364,11 @@ static const struct route_map_rule_cmd route_match_source_protocol_cmd = {
|
||||
|
||||
/* `source-instance` */
|
||||
static enum route_map_cmd_result_t
|
||||
route_match_source_instance(void *rule, const struct prefix *p,
|
||||
route_map_object_t type, void *object)
|
||||
route_match_source_instance(void *rule, const struct prefix *p, void *object)
|
||||
{
|
||||
uint8_t *instance = (uint8_t *)rule;
|
||||
struct nh_rmap_obj *nh_data;
|
||||
|
||||
if (type != RMAP_ZEBRA)
|
||||
return RMAP_NOMATCH;
|
||||
|
||||
nh_data = (struct nh_rmap_obj *)object;
|
||||
if (!nh_data)
|
||||
return RMAP_NOMATCH;
|
||||
@ -1444,15 +1405,13 @@ static const struct route_map_rule_cmd route_match_source_instance_cmd = {
|
||||
|
||||
/* Set src. */
|
||||
static enum route_map_cmd_result_t
|
||||
route_set_src(void *rule, const struct prefix *prefix, route_map_object_t type,
|
||||
void *object)
|
||||
route_set_src(void *rule, const struct prefix *prefix, void *object)
|
||||
{
|
||||
struct nh_rmap_obj *nh_data;
|
||||
|
||||
if (type == RMAP_ZEBRA) {
|
||||
nh_data = (struct nh_rmap_obj *)object;
|
||||
nh_data->nexthop->rmap_src = *(union g_addr *)rule;
|
||||
}
|
||||
nh_data = (struct nh_rmap_obj *)object;
|
||||
nh_data->nexthop->rmap_src = *(union g_addr *)rule;
|
||||
|
||||
return RMAP_OKAY;
|
||||
}
|
||||
|
||||
@ -1738,7 +1697,7 @@ zebra_route_map_check(int family, int rib_type, uint8_t instance,
|
||||
if (!rmap && PROTO_RM_NAME(zvrf, family, ZEBRA_ROUTE_MAX))
|
||||
rmap = PROTO_RM_MAP(zvrf, family, ZEBRA_ROUTE_MAX);
|
||||
if (rmap) {
|
||||
ret = route_map_apply(rmap, p, RMAP_ZEBRA, &nh_obj);
|
||||
ret = route_map_apply(rmap, p, &nh_obj);
|
||||
}
|
||||
|
||||
return (ret);
|
||||
@ -1782,7 +1741,7 @@ zebra_import_table_route_map_check(int family, int re_type, uint8_t instance,
|
||||
if (re_type >= 0 && re_type < ZEBRA_ROUTE_MAX)
|
||||
rmap = route_map_lookup_by_name(rmap_name);
|
||||
if (rmap) {
|
||||
ret = route_map_apply(rmap, p, RMAP_ZEBRA, &nh_obj);
|
||||
ret = route_map_apply(rmap, p, &nh_obj);
|
||||
}
|
||||
|
||||
return (ret);
|
||||
@ -1810,7 +1769,7 @@ route_map_result_t zebra_nht_route_map_check(afi_t afi, int client_proto,
|
||||
if (!rmap && NHT_RM_MAP(zvrf, afi, ZEBRA_ROUTE_MAX))
|
||||
rmap = NHT_RM_MAP(zvrf, afi, ZEBRA_ROUTE_MAX);
|
||||
if (rmap)
|
||||
ret = route_map_apply(rmap, p, RMAP_ZEBRA, &nh_obj);
|
||||
ret = route_map_apply(rmap, p, &nh_obj);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user