]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Serious bug in ext lsa origination found. Going for 1.0.4.
authorOndrej Filip <feela@network.cz>
Sun, 3 Sep 2000 22:18:40 +0000 (22:18 +0000)
committerOndrej Filip <feela@network.cz>
Sun, 3 Sep 2000 22:18:40 +0000 (22:18 +0000)
misc/bird.spec
proto/ospf/lsalib.c
proto/ospf/ospf.c
proto/ospf/ospf.h
proto/ospf/rt.c
proto/ospf/topology.c
sysdep/config.h

index cc4ec46e8e72abc53b702f4fd2a5aa23fa7745e7..e963d9a610c81c5295bf7de0518a96c833c06dbf 100644 (file)
@@ -1,6 +1,6 @@
 Summary: BIRD Internet Routing Daemon
 Name: bird
-Version: 1.0.3
+Version: 1.0.4
 Release: 1
 Copyright: GPL
 Group: Networking/Daemons
index 16e1a80a49f4affe904320b7f35ec10dc8e4358a..27e2782290713cb2a0d47ffa1a3ba4b68c996a03 100644 (file)
@@ -123,7 +123,7 @@ htonlsab(void *h, void *n, u8 type, u16 len)
       hrt=h;
       links=hrt->links;
 
-      nrt->VEB=hrt->VEB;
+      nrt->veb.byte=hrt->veb.byte;
       nrt->padding=0;
       nrt->links=htons(hrt->links);
       nrtl=(struct ospf_lsa_rt_link *)(nrt+1);
@@ -220,7 +220,7 @@ ntohlsab(void *n, void *h, u8 type, u16 len)
       nrt=n;
       hrt=h;
 
-      hrt->VEB=nrt->VEB;
+      hrt->veb.byte=nrt->veb.byte;
       hrt->padding=0;
       links=hrt->links=ntohs(nrt->links);
       nrtl=(struct ospf_lsa_rt_link *)(nrt+1);
index e69afbc031bd368bccc89f139b8990af0b72b962..64bfcdc094044f92ce9fabaa2553f8deea24b28d 100644 (file)
@@ -164,6 +164,7 @@ ospf_init(struct proto_config *c)
   p->rte_same = ospf_rte_same;
 
   po->rfc1583=oc->rfc1583;
+  po->ebit=0;
   return p;
 }
 
index dd63c4cc6de2cc5f7adc9fb4fe4e47e5e71ac29f..d5ff8e99c7e88cb2dcb7ee0317f7e9b9f5d9e0c6 100644 (file)
@@ -209,8 +209,20 @@ struct ospf_lsa_header {
   u16 length;  
 };
 
+struct vebb {
+  u8 b:1;
+  u8 e:1;
+  u8 v:1;
+  u8 padding:5;
+};
+
+union veb {
+  u8 byte;
+  struct vebb bit;
+};
+
 struct ospf_lsa_rt {
-  u8 VEB;
+  union veb veb;
 #define LSA_RT_V 5
 #define LSA_RT_E 6
 #define LSA_RT_B 7
@@ -375,7 +387,8 @@ struct proto_ospf {
   list area_list;
   int areano;                  /* Number of area I belong to */
   struct fib efib;             /* FIB for external routes */
-  int rfc1583;
+  int rfc1583;                 /* RFC1583 compatibility */
+  int ebit;                    /* Did I originate any ext lsa? */
 };
 
 struct ospf_iface_patt {
index a7b541df9023bc66263bdeedba59297b08ae59c5..39e84bd76ae31a6409a2029139fdff01a309830b 100644 (file)
@@ -96,7 +96,7 @@ ospf_rt_spfa(struct ospf_area *oa)
     {
       case LSA_T_RT:
         rt=(struct ospf_lsa_rt *)act->lsa_body;
-       if((rt->VEB)&(1>>LSA_RT_V)) oa->trcap=1;
+       if(rt->veb.bit.v) oa->trcap=1;
        rr=(struct ospf_lsa_rt_link *)(rt+1);
        DBG("  Number of links: %u\n",rt->links);
        for(i=0;i<rt->links;i++)
@@ -269,6 +269,7 @@ ospf_ext_spfa(struct proto_ospf *po)        /* FIXME looking into inter-area */
   struct proto *p=&po->proto;
   struct ospf_lsa_ext *le;
   struct ospf_lsa_ext_tos *lt;
+  struct ospf_lsa_rt *rt;
   int mlen;
   ip_addr ip,nnh;
   struct iface *nnhi=NULL;
@@ -347,7 +348,8 @@ ospf_ext_spfa(struct proto_ospf *po)        /* FIXME looking into inter-area */
         }
       }
     }
-    if((absr==NULL)||(absr->dist==LSINFINITY))
+    rt=(struct ospf_lsa_rt *)absr->lsa_body;
+    if((absr==NULL)||(absr->dist==LSINFINITY)||(rt->veb.bit.e==0))
     {
       DBG("ASBR is null or its dist=INF\n");
       continue;
index e3e240f13bfe442fb6a53e475a0df6d4eace9d9b..a0dd18a6bbf3e9290b86e834fed0c159aaf62d54 100644 (file)
@@ -24,7 +24,7 @@ void *
 originate_rt_lsa_body(struct ospf_area *oa, u16 *length, struct proto_ospf *p)
 {
   struct ospf_iface *ifa;
-  int j=0,k=0,v=0,e=0,b=0;
+  int j=0,k=0,v=0;
   u16 i=0;
   struct ospf_lsa_rt *rt;
   struct ospf_lsa_rt_link *ln;
@@ -45,8 +45,9 @@ originate_rt_lsa_body(struct ospf_area *oa, u16 *length, struct proto_ospf *p)
   }
   rt=mb_allocz(p->proto.pool, sizeof(struct ospf_lsa_rt)+
     i*sizeof(struct ospf_lsa_rt_link));
-  if((p->areano>1) && (!oa->stub)) e=1;
-  rt->VEB=(v>>LSA_RT_V)+(e>>LSA_RT_E)+(b>>LSA_RT_B);
+  if((p->areano>1) && (!oa->stub)) rt->veb.bit.b=1;
+  if((p->ebit)&&(!oa->stub)) rt->veb.bit.e=1;
+  rt->veb.bit.v=v;
   ln=(struct ospf_lsa_rt_link *)(rt+1);
 
   WALK_LIST (ifa, p->iface_list)
@@ -352,6 +353,9 @@ originate_ext_lsa_body(net *n, rte *e, struct proto_ospf *po, struct ea_list *at
  * external LSA. LSA header of such LSA does not contain information about
  * prefix lenght, so if I have to originate multiple LSAs for route with
  * different prefixes I try to increment prefix id to find a "free" one.
+ *
+ * The function also set flag ebit. If it's first time, the new router lsa
+ * origination is necessary.
  */
 void
 originate_ext_lsa(net *n, rte *e, struct proto_ospf *po, struct ea_list *attrs)
@@ -406,6 +410,15 @@ originate_ext_lsa(net *n, rte *e, struct proto_ospf *po, struct ea_list *attrs)
     body=originate_ext_lsa_body(n, e, po, attrs);
   }
   mb_free(body);
+
+  if(po->ebit==0)
+  {
+    po->ebit=1;
+    WALK_LIST(oa, po->area_list)
+    {
+      schedule_rt_lsa(oa);
+    }
+  }
 }
 
 
index 0ebf1fbc0294f89cbb5e261d0bb9d434c06f6fff..7ca6c8c1aea9282c1cd9688239d3b19d74f310b8 100644 (file)
@@ -7,7 +7,7 @@
 #define _BIRD_CONFIG_H_
 
 /* BIRD version */
-#define BIRD_VERSION "1.0.3"
+#define BIRD_VERSION "1.0.4"
 
 /* Include parameters determined by configure script */
 #include "sysdep/autoconf.h"