summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_routemap.c
diff options
context:
space:
mode:
authorChirag Shah <chirag@cumulusnetworks.com>2017-08-25 22:51:12 +0200
committerChirag Shah <chirag@cumulusnetworks.com>2017-10-03 18:15:19 +0200
commitb5a8894de6454e1dc0b75e1d676c5ed0fcf3438b (patch)
tree8da7790f9c160dc34874e260a910f0886b24e79c /ospfd/ospf_routemap.c
parentMerge pull request #1278 from chiragshah6/ospf_vrf_dev (diff)
downloadfrr-b5a8894de6454e1dc0b75e1d676c5ed0fcf3438b.tar.xz
frr-b5a8894de6454e1dc0b75e1d676c5ed0fcf3438b.zip
ospfd: OSPFv2 VRF Support
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
Diffstat (limited to 'ospfd/ospf_routemap.c')
-rw-r--r--ospfd/ospf_routemap.c98
1 files changed, 49 insertions, 49 deletions
diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c
index f47e2b6f1..c3ba1d93b 100644
--- a/ospfd/ospf_routemap.c
+++ b/ospfd/ospf_routemap.c
@@ -45,38 +45,40 @@ static void ospf_route_map_update(const char *name)
{
struct ospf *ospf;
int type;
+ struct listnode *n1 = NULL;
/* If OSPF instatnce does not exist, return right now. */
- ospf = ospf_lookup();
- if (ospf == NULL)
+ if (listcount(om->ospf) == 0)
return;
- /* Update route-map */
- for (type = 0; type <= ZEBRA_ROUTE_MAX; type++) {
- struct list *red_list;
- struct listnode *node;
- struct ospf_redist *red;
-
- red_list = ospf->redist[type];
- if (!red_list)
- continue;
-
- for (ALL_LIST_ELEMENTS_RO(red_list, node, red)) {
- if (ROUTEMAP_NAME(red)
- && strcmp(ROUTEMAP_NAME(red), name) == 0) {
- /* Keep old route-map. */
- struct route_map *old = ROUTEMAP(red);
-
- /* Update route-map. */
- ROUTEMAP(red) = route_map_lookup_by_name(
- ROUTEMAP_NAME(red));
-
- /* No update for this distribute type. */
- if (old == NULL && ROUTEMAP(red) == NULL)
- continue;
-
- ospf_distribute_list_update(ospf, type,
- red->instance);
+ for (ALL_LIST_ELEMENTS_RO (om->ospf, n1, ospf)) {
+ /* Update route-map */
+ for (type = 0; type <= ZEBRA_ROUTE_MAX; type++) {
+ struct list *red_list;
+ struct listnode *node;
+ struct ospf_redist *red;
+
+ red_list = ospf->redist[type];
+ if (!red_list)
+ continue;
+
+ for (ALL_LIST_ELEMENTS_RO(red_list, node, red)) {
+ if (ROUTEMAP_NAME(red)
+ && strcmp(ROUTEMAP_NAME(red), name) == 0) {
+ /* Keep old route-map. */
+ struct route_map *old = ROUTEMAP(red);
+
+ /* Update route-map. */
+ ROUTEMAP(red) = route_map_lookup_by_name(
+ ROUTEMAP_NAME(red));
+
+ /* No update for this distribute type. */
+ if (old == NULL && ROUTEMAP(red) == NULL)
+ continue;
+
+ ospf_distribute_list_update(ospf, type,
+ red->instance);
+ }
}
}
}
@@ -86,26 +88,24 @@ static void ospf_route_map_event(route_map_event_t event, const char *name)
{
struct ospf *ospf;
int type;
-
- /* If OSPF instatnce does not exist, return right now. */
- ospf = ospf_lookup();
- if (ospf == NULL)
- return;
-
- for (type = 0; type <= ZEBRA_ROUTE_MAX; type++) {
- struct list *red_list;
- struct listnode *node;
- struct ospf_redist *red;
-
- red_list = ospf->redist[type];
- if (!red_list)
- continue;
-
- for (ALL_LIST_ELEMENTS_RO(red_list, node, red)) {
- if (ROUTEMAP_NAME(red) && ROUTEMAP(red)
- && !strcmp(ROUTEMAP_NAME(red), name)) {
- ospf_distribute_list_update(ospf, type,
- red->instance);
+ struct listnode *n1 = NULL;
+
+ for (ALL_LIST_ELEMENTS_RO(om->ospf, n1, ospf)) {
+ for (type = 0; type <= ZEBRA_ROUTE_MAX; type++) {
+ struct list *red_list;
+ struct listnode *node;
+ struct ospf_redist *red;
+
+ red_list = ospf->redist[type];
+ if (!red_list)
+ continue;
+
+ for (ALL_LIST_ELEMENTS_RO(red_list, node, red)) {
+ if (ROUTEMAP_NAME(red) && ROUTEMAP(red)
+ && !strcmp(ROUTEMAP_NAME(red), name)) {
+ ospf_distribute_list_update(ospf, type,
+ red->instance);
+ }
}
}
}
@@ -285,7 +285,7 @@ static route_map_result_t route_match_interface(void *rule,
if (type == RMAP_OSPF) {
ei = object;
- ifp = if_lookup_by_name((char *)rule, VRF_DEFAULT);
+ ifp = if_lookup_by_name_all_vrf((char *)rule);
if (ifp == NULL || ifp->ifindex != ei->ifindex)
return RMAP_NOMATCH;