diff options
author | Igor Ryzhov <iryzhov@nfware.com> | 2021-07-01 13:47:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-01 13:47:40 +0200 |
commit | bc65216a299bd54dd91a7f0a2fde3034a39eb738 (patch) | |
tree | 44e77d9c5a5dac7096ae272c53edf89fdaba8e4e /ospf6d | |
parent | Merge pull request #8871 from opensourcerouting/msdp-peer-rework (diff) | |
parent | ospf6d: route-map config changed, not getting applied on all types of routes (diff) | |
download | frr-bc65216a299bd54dd91a7f0a2fde3034a39eb738.tar.xz frr-bc65216a299bd54dd91a7f0a2fde3034a39eb738.zip |
Merge pull request #8954 from mobash-rasool/ospfv3-feature
ospf6d: route-map config changed, not getting applied on all types of…
Diffstat (limited to 'ospf6d')
-rw-r--r-- | ospf6d/ospf6_asbr.c | 63 | ||||
-rw-r--r-- | ospf6d/ospf6_asbr.h | 3 | ||||
-rw-r--r-- | ospf6d/ospf6_top.h | 3 |
3 files changed, 37 insertions, 32 deletions
diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index d7307fe37..315449ae9 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -1010,53 +1010,55 @@ static void ospf6_asbr_routemap_unset(struct ospf6_redist *red) static int ospf6_asbr_routemap_update_timer(struct thread *thread) { - void **arg; - int arg_type; - struct ospf6 *ospf6; + struct ospf6 *ospf6 = THREAD_ARG(thread); struct ospf6_redist *red; - - arg = THREAD_ARG(thread); - ospf6 = (struct ospf6 *)arg[0]; - arg_type = (int)(intptr_t)arg[1]; + int type; ospf6->t_distribute_update = NULL; - red = ospf6_redist_lookup(ospf6, arg_type, 0); + for (type = 0; type < ZEBRA_ROUTE_MAX; type++) { + red = ospf6_redist_lookup(ospf6, type, 0); - if (red && ROUTEMAP_NAME(red)) - ROUTEMAP(red) = route_map_lookup_by_name(ROUTEMAP_NAME(red)); - if (red && ROUTEMAP(red)) { - if (IS_OSPF6_DEBUG_ASBR) - zlog_debug("%s: route-map %s update, reset redist %s", - __func__, ROUTEMAP_NAME(red), - ZROUTE_NAME(arg_type)); + if (!red) + continue; + + if (!CHECK_FLAG(red->flag, OSPF6_IS_RMAP_CHANGED)) + continue; + + if (ROUTEMAP_NAME(red)) + ROUTEMAP(red) = + route_map_lookup_by_name(ROUTEMAP_NAME(red)); + + if (ROUTEMAP(red)) { + if (IS_OSPF6_DEBUG_ASBR) + zlog_debug( + "%s: route-map %s update, reset redist %s", + __func__, ROUTEMAP_NAME(red), + ZROUTE_NAME(type)); + + ospf6_zebra_no_redistribute(type, ospf6->vrf_id); + ospf6_zebra_redistribute(type, ospf6->vrf_id); + } - ospf6_zebra_no_redistribute(arg_type, ospf6->vrf_id); - ospf6_zebra_redistribute(arg_type, ospf6->vrf_id); + UNSET_FLAG(red->flag, OSPF6_IS_RMAP_CHANGED); } - XFREE(MTYPE_OSPF6_DIST_ARGS, arg); return 0; } -void ospf6_asbr_distribute_list_update(int type, struct ospf6 *ospf6) +void ospf6_asbr_distribute_list_update(struct ospf6 *ospf6, + struct ospf6_redist *red) { - void **args = NULL; + SET_FLAG(red->flag, OSPF6_IS_RMAP_CHANGED); if (ospf6->t_distribute_update) return; - args = XCALLOC(MTYPE_OSPF6_DIST_ARGS, sizeof(void *) * 2); - - args[0] = ospf6; - args[1] = (void *)((ptrdiff_t)type); - if (IS_OSPF6_DEBUG_ASBR) - zlog_debug("%s: trigger redistribute %s reset thread", __func__, - ZROUTE_NAME(type)); + zlog_debug("%s: trigger redistribute reset thread", __func__); ospf6->t_distribute_update = NULL; - thread_add_timer_msec(master, ospf6_asbr_routemap_update_timer, args, + thread_add_timer_msec(master, ospf6_asbr_routemap_update_timer, ospf6, OSPF_MIN_LS_INTERVAL, &ospf6->t_distribute_update); } @@ -1092,8 +1094,7 @@ void ospf6_asbr_routemap_update(const char *mapname) type)); route_map_counter_increment(ROUTEMAP(red)); - - ospf6_asbr_distribute_list_update(type, ospf6); + ospf6_asbr_distribute_list_update(ospf6, red); } else { /* * if the mapname matches a @@ -1131,7 +1132,7 @@ static void ospf6_asbr_routemap_event(const char *name) red = ospf6_redist_lookup(ospf6, type, 0); if (red && ROUTEMAP_NAME(red) && (strcmp(ROUTEMAP_NAME(red), name) == 0)) - ospf6_asbr_distribute_list_update(type, ospf6); + ospf6_asbr_distribute_list_update(ospf6, red); } } } diff --git a/ospf6d/ospf6_asbr.h b/ospf6d/ospf6_asbr.h index 8f2135ef3..7ccd1c992 100644 --- a/ospf6d/ospf6_asbr.h +++ b/ospf6d/ospf6_asbr.h @@ -105,7 +105,8 @@ extern void install_element_ospf6_debug_asbr(void); extern void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old, struct ospf6_route *route, struct ospf6 *ospf6); -extern void ospf6_asbr_distribute_list_update(int type, struct ospf6 *ospf6); +extern void ospf6_asbr_distribute_list_update(struct ospf6 *ospf6, + struct ospf6_redist *red); struct ospf6_redist *ospf6_redist_lookup(struct ospf6 *ospf6, int type, unsigned short instance); extern void ospf6_asbr_routemap_update(const char *mapname); diff --git a/ospf6d/ospf6_top.h b/ospf6d/ospf6_top.h index f0251bcb6..3eb423f68 100644 --- a/ospf6d/ospf6_top.h +++ b/ospf6d/ospf6_top.h @@ -37,9 +37,12 @@ enum { OSPF6_LOG_ADJACENCY_DETAIL = (1 << 1), }; +/* For processing route-map change update in the callback */ +#define OSPF6_IS_RMAP_CHANGED 0x01 struct ospf6_redist { uint8_t instance; + uint8_t flag; /* Redistribute metric info. */ struct { int type; /* External metric type (E1 or E2). */ |