diff options
author | Ondrej Filip <feela@network.cz> | 2000-09-04 00:18:40 +0200 |
---|---|---|
committer | Ondrej Filip <feela@network.cz> | 2000-09-04 00:18:40 +0200 |
commit | fdb19982020abeddf2d9eb73efae92ae2cc58d93 (patch) | |
tree | 4c837c9252bb1d3324c0a4005cd600d3081c7810 /proto/ospf | |
parent | f02e4258b9bb7f823ddfbfb88284c868502b1433 (diff) | |
download | bird-fdb19982020abeddf2d9eb73efae92ae2cc58d93.tar bird-fdb19982020abeddf2d9eb73efae92ae2cc58d93.zip |
Serious bug in ext lsa origination found. Going for 1.0.4.
Diffstat (limited to 'proto/ospf')
-rw-r--r-- | proto/ospf/lsalib.c | 4 | ||||
-rw-r--r-- | proto/ospf/ospf.c | 1 | ||||
-rw-r--r-- | proto/ospf/ospf.h | 17 | ||||
-rw-r--r-- | proto/ospf/rt.c | 6 | ||||
-rw-r--r-- | proto/ospf/topology.c | 19 |
5 files changed, 38 insertions, 9 deletions
diff --git a/proto/ospf/lsalib.c b/proto/ospf/lsalib.c index 16e1a80..27e2782 100644 --- a/proto/ospf/lsalib.c +++ b/proto/ospf/lsalib.c @@ -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); diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index e69afbc..64bfcdc 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -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; } diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h index dd63c4c..d5ff8e9 100644 --- a/proto/ospf/ospf.h +++ b/proto/ospf/ospf.h @@ -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 { diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index a7b541d..39e84bd 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -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; diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c index e3e240f..a0dd18a 100644 --- a/proto/ospf/topology.c +++ b/proto/ospf/topology.c @@ -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); + } + } } |