]> git.puffer.fish Git - matthieu/frr.git/commitdiff
* Make updating redistributions work if prefix list is changed and it's
authorhasso <hasso>
Mon, 10 May 2004 07:43:59 +0000 (07:43 +0000)
committerhasso <hasso>
Mon, 10 May 2004 07:43:59 +0000 (07:43 +0000)
  used in route-map used to filter redistributions.
* Move ospf_prefix_list_update() function from ospfd.c to ospf_zebra.c.

ospfd/ChangeLog
ospfd/ospf_main.c
ospfd/ospf_zebra.c
ospfd/ospfd.c

index 77ffbe5928639da743e3b880b612e77dd6172f50..fa901ced84ab08a61906737a0f08fb851628328a 100644 (file)
@@ -1,3 +1,10 @@
+2004-05-10 Hasso Tepper <hasso@estpak.ee>
+
+       * ospf_zebra.c, ospfd.c: Move ospf_prefix_list_update() function
+         to ospf_zebra.c from ospfd.c and add redistribution updates if
+         route-map is used in redistribution.
+       * ospf_main.c: Remove now useless call to ospf_init().
+
 2004-05-08 Paul Jakma <paul@dishone.st>
 
        * ospf_zebra.c: Sync with lib/zclient changes
index d80aa26c3404b720669c8eb368e232fc82908b24..1ebc9e9eeda8677d60b21c2ede7850aa866a4245 100644 (file)
@@ -268,7 +268,6 @@ main (int argc, char **argv)
   prefix_list_init ();
 
   /* OSPFd inits. */
-  ospf_init ();
   ospf_if_init ();
   ospf_zebra_init ();
 
index 518f554a1de99b4aa307c316101339277e03d034..e42373c877c078546f62c0178a747d587b771685 100644 (file)
@@ -32,6 +32,7 @@
 #include "memory.h"
 #include "zclient.h"
 #include "filter.h"
+#include "plist.h"
 #include "log.h"
 
 #include "ospfd/ospfd.h"
@@ -1038,7 +1039,62 @@ ospf_filter_update (struct access_list *access)
   if (IS_OSPF_ABR (ospf) && abr_inv)
     ospf_schedule_abr_task (ospf);
 }
-\f
+
+/* If prefix-list is updated, do some updates. */
+void
+ospf_prefix_list_update (struct prefix_list *plist)
+{
+  struct ospf *ospf;
+  int type;
+  int abr_inv = 0;
+  struct ospf_area *area;
+  listnode node;
+
+  /* If OSPF instatnce does not exist, return right now. */
+  ospf = ospf_lookup ();
+  if (ospf == NULL)
+    return;
+
+  /* Update all route-maps which are used as redistribution filters.
+   * They might use prefix-list.
+   */
+  for (type = 0; type < ZEBRA_ROUTE_MAX; type++)
+    {
+      if (ROUTEMAP (ospf, type) != NULL)
+        {
+          /* If route-map is not NULL it may be using this prefix list */
+          ospf_distribute_list_update (ospf, type);
+          continue;
+        }
+    }
+
+  /* Update area filter-lists. */
+  for (node = listhead (ospf->areas); node; nextnode (node))
+    if ((area = getdata (node)) != NULL)
+      {
+       /* Update filter-list in. */
+       if (PREFIX_NAME_IN (area))
+          if (strcmp (PREFIX_NAME_IN (area), plist->name) == 0)
+            {
+              PREFIX_LIST_IN (area) =
+                prefix_list_lookup (AFI_IP, PREFIX_NAME_IN (area));
+              abr_inv++;
+            }
+
+        /* Update filter-list out. */
+        if (PREFIX_NAME_OUT (area))
+          if (strcmp (PREFIX_NAME_OUT (area), plist->name) == 0)
+            {
+              PREFIX_LIST_IN (area) =
+                prefix_list_lookup (AFI_IP, PREFIX_NAME_OUT (area));
+              abr_inv++;
+            }
+      }
+
+  /* Schedule ABR task. */
+  if (IS_OSPF_ABR (ospf) && abr_inv)
+    ospf_schedule_abr_task (ospf);
+}
 
 struct ospf_distance *
 ospf_distance_new ()
@@ -1203,4 +1259,6 @@ ospf_zebra_init ()
 
   access_list_add_hook (ospf_filter_update);
   access_list_delete_hook (ospf_filter_update);
+  prefix_list_add_hook (ospf_prefix_list_update);
+  prefix_list_delete_hook (ospf_prefix_list_update);
 }
index abf898ca666763f46435c0be0ee2157ab3b2b1b8..3cf93a67e5e0469e4c37c6dd893228356aa69f1b 100644 (file)
@@ -1638,49 +1638,6 @@ ospf_nbr_nbma_poll_interval_unset (struct ospf *ospf, struct in_addr addr)
   return 1;
 }
 
-\f
-void
-ospf_prefix_list_update (struct prefix_list *plist)
-{
-  struct ospf *ospf;
-  struct ospf_area *area;
-  listnode node;
-  int abr_inv = 0;
-
-  /* If OSPF instatnce does not exist, return right now. */
-  ospf = ospf_lookup ();
-  if (ospf == NULL)
-    return;
-
-  /* Update Area prefix-list. */
-  for (node = listhead (ospf->areas); node; nextnode (node))
-    {
-      area = getdata (node);
-
-      /* Update filter-list in. */
-      if (PREFIX_NAME_IN (area))
-       if (strcmp (PREFIX_NAME_IN (area), plist->name) == 0)
-         {
-           PREFIX_LIST_IN (area) = 
-             prefix_list_lookup (AFI_IP, PREFIX_NAME_IN (area));
-           abr_inv++;
-         }
-
-      /* Update filter-list out. */
-      if (PREFIX_NAME_OUT (area))
-       if (strcmp (PREFIX_NAME_OUT (area), plist->name) == 0)
-         {
-           PREFIX_LIST_IN (area) = 
-             prefix_list_lookup (AFI_IP, PREFIX_NAME_OUT (area));
-           abr_inv++;
-         }
-    }
-
-  /* Schedule ABR tasks. */
-  if (IS_OSPF_ABR (ospf) && abr_inv)
-    ospf_schedule_abr_task (ospf);
-}
-
 void
 ospf_master_init ()
 {
@@ -1691,10 +1648,3 @@ ospf_master_init ()
   om->master = thread_master_create ();
   om->start_time = time (NULL);
 }
-
-void
-ospf_init ()
-{
-  prefix_list_add_hook (ospf_prefix_list_update);
-  prefix_list_delete_hook (ospf_prefix_list_update);
-}