]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Originate default route into stub areas.
authorOndrej Filip <feela@network.cz>
Sun, 20 Feb 2005 16:53:06 +0000 (16:53 +0000)
committerOndrej Filip <feela@network.cz>
Sun, 20 Feb 2005 16:53:06 +0000 (16:53 +0000)
proto/ospf/rt.c
proto/ospf/topology.c

index 653e594f2584a0f9de5006299efc2d0f89ad0eaa..c2f7ca0e0b9cc36a605cfd05fe87f6782a372bfd 100644 (file)
@@ -1049,10 +1049,24 @@ again2:
 
        if ((oa == po->backbone) && oaa->trcap) fl = 1;
 
+       if (oaa->stub) fl = 1;
+
         if(fl) flush_sum_lsa(oaa, &anet->fn, ORT_NET);
         else originate_sum_lsa(oaa, &anet->fn, ORT_NET, anet->metric);
       }
     }
     FIB_WALK_END;
+
+    /* Check default summary LSA for stub areas
+     * just for router connected to backbone */
+    if (po->backbone)
+    {
+      struct fib_node fnn;
+
+      fnn.prefix = IPA_NONE;
+      fnn.pxlen = 0;
+      if(oa->stub) originate_sum_lsa(oa, &fnn, ORT_NET, oa->stub);
+      else flush_sum_lsa(oa, &fnn, ORT_NET);
+    }
   }
 }
index 43dbc7d68e5753fd115978accc5a557c7dde7eba..34fc3165fb2a53920bb9b3baec33d8b543e5a27a 100644 (file)
@@ -441,6 +441,7 @@ originate_sum_lsa(struct ospf_area *oa, struct fib_node *fn, int type, int metri
   u32 rtid = po->proto.cf->global->router_id;
   struct ospf_lsa_header lsa;
   int i, max, mlen = fn->pxlen, free = 0;
+  u32 freeid = 0xFFFF;
   struct ospf_lsa_sum *sum = NULL;
   union ospf_lsa_sum_tm *tm;
   lsa.type = LSA_T_SUM_NET;
@@ -464,7 +465,11 @@ originate_sum_lsa(struct ospf_area *oa, struct fib_node *fn, int type, int metri
     lsa.id = ipa_to_u32(fn->prefix) + i;
     if ((en = ospf_hash_find_header(po->gr, oa->areaid, &lsa)) == NULL)
     {
-      if (!free) free = lsa.id;
+      if (!free)
+      {
+        freeid = lsa.id;
+       free = 1;
+      }
     }
     else
     {
@@ -472,9 +477,10 @@ originate_sum_lsa(struct ospf_area *oa, struct fib_node *fn, int type, int metri
       if (mlen == ipa_mklen(sum->netmask))
       {
         tm = (union ospf_lsa_sum_tm *) (sum + 1);
-        if (tm->metric == (unsigned)metric) return;    /* No reason for origination */
+        if (tm->metric == (unsigned) metric) return;   /* No reason for origination */
         lsa.sn = en->lsa.sn + 1;
-        free = en->lsa.id;
+        freeid = en->lsa.id;
+       free = 1;
         break;
       }
     }
@@ -486,7 +492,7 @@ originate_sum_lsa(struct ospf_area *oa, struct fib_node *fn, int type, int metri
         fn->pxlen, max);
     return;
   }
-  lsa.id = free;
+  lsa.id = freeid;
   
   OSPF_TRACE(D_EVENTS, "Originating summary (type %d) lsa for %I/%d (met %d).", lsa.type, fn->prefix,
              fn->pxlen, metric);
@@ -537,10 +543,11 @@ check_sum_lsa(struct proto_ospf *po, ort *nf, int dest)
       }
     else flush = 1;
 
-    if ((dest == ORT_ROUTER) && oa->stub)
+    /* Don't send summary into stub areas
+     * We send just default route (and later) */
+    if (oa->stub)
       flush = 1;
-    /* FIXME stub for networks? */
-
+    
     mlen = nf->fn.pxlen;
     ip = ipa_and(nf->fn.prefix, ipa_mkmask(mlen));