Statistics
| Branch: | Revision:

iof-bird-daemon / proto / ospf / lsupd.c @ 13e9bac3

History | View | Annotate | Download (12.4 KB)

1 de769e24 Ondrej Filip
/*
2
 *        BIRD -- OSPF
3
 *
4
 *        (c) 2000 Ondrej Filip <feela@network.cz>
5
 *
6
 *        Can be freely distributed and used under the terms of the GNU GPL.
7
 */
8
9
#include "ospf.h"
10
11 84228eee Ondrej Filip
int
12 2c971094 Ondrej Filip
flood_lsa(struct ospf_neighbor *n, struct ospf_lsa_header *hn,
13 38130b86 Ondrej Filip
  struct ospf_lsa_header *hh, struct proto_ospf *po, struct ospf_iface *iff,
14 3dd8f983 Ondrej Filip
  struct ospf_area *oa, int rtl)
15 2c971094 Ondrej Filip
{
16
  struct ospf_iface *ifa;
17
  struct ospf_neighbor *nn;
18
  struct top_hash_entry *en;
19 5da1f935 Ondrej Filip
  struct proto *p=&po->proto;
20 84228eee Ondrej Filip
  int ret,retval=0;
21 2c971094 Ondrej Filip
22
  /* pg 148 */
23
  WALK_LIST(NODE ifa,po->iface_list)
24
  {
25
    if(hh->type==LSA_T_EXT)
26
    {
27
      if(ifa->type==OSPF_IT_VLINK) continue;
28
      if(ifa->oa->stub) continue;
29
    }
30
    else
31
    {
32 38130b86 Ondrej Filip
      if(oa->areaid==BACKBONE)
33 2c971094 Ondrej Filip
      {
34 38130b86 Ondrej Filip
        if((ifa->type!=OSPF_IT_VLINK)&&(ifa->oa!=oa)) continue;
35 2c971094 Ondrej Filip
      }
36
      else
37
      {
38 38130b86 Ondrej Filip
        if(ifa->oa!=oa) continue;
39 2c971094 Ondrej Filip
      }
40
    }
41
    ret=0;
42
    WALK_LIST(NODE nn, ifa->neigh_list)
43
    {
44
      if(nn->state<NEIGHBOR_EXCHANGE) continue;
45
      if(nn->state<NEIGHBOR_FULL)
46
      {
47
        if((en=ospf_hash_find_header(nn->lsrqh,hh))!=NULL)
48
        {
49
          switch(lsa_comp(hh,&en->lsa))
50
          {
51
            case CMP_OLDER:
52
              continue;
53
              break;
54
            case CMP_SAME:
55
              s_rem_node(SNODE en);
56 44724025 Ondrej Filip
              DBG("Removing from lsreq list for neigh %I\n", nn->rid);
57 2c971094 Ondrej Filip
              ospf_hash_delete(nn->lsrqh,en);
58
              if(EMPTY_SLIST(nn->lsrql)) ospf_neigh_sm(nn, INM_LOADDONE);
59
              continue;
60
              break;
61
            case CMP_NEWER:
62
              s_rem_node(SNODE en);
63 44724025 Ondrej Filip
              DBG("Removing from lsreq list for neigh %I\n", nn->rid);
64 2c971094 Ondrej Filip
              ospf_hash_delete(nn->lsrqh,en);
65
              if(EMPTY_SLIST(nn->lsrql)) ospf_neigh_sm(nn, INM_LOADDONE);
66
              break;
67 df49d4e1 Martin Mares
            default: bug("Bug in lsa_comp?");
68 2c971094 Ondrej Filip
          }
69
        }
70
      }
71
      if(nn==n) continue;
72 3dd8f983 Ondrej Filip
      if(rtl!=0)
73 9669362f Ondrej Filip
      {
74 3dd8f983 Ondrej Filip
        if((en=ospf_hash_find_header(nn->lsrth, hh))==NULL)
75
        {
76
          en=ospf_hash_get_header(nn->lsrth, hh);
77
        }
78
        else
79
        {
80
          s_rem_node(SNODE en);
81
        }
82
        s_add_tail(&nn->lsrtl, SNODE en);
83
        memcpy(&en->lsa,hh,sizeof(struct ospf_lsa_header));
84
        DBG("Adding LSA lsrt RT: %I, Id: %I, Type: %u for n: %I\n",
85
          en->lsa.rt,en->lsa.id, en->lsa.type, nn->ip);
86 9669362f Ondrej Filip
      }
87
      else
88
      {
89 3dd8f983 Ondrej Filip
        if((en=ospf_hash_find_header(nn->lsrth, hh))!=NULL)
90
        {
91
          s_rem_node(SNODE en);
92
          ospf_hash_delete(nn->lsrth, en);
93
        }
94 9669362f Ondrej Filip
      }
95 42542c56 Ondrej Filip
      ret=1;
96 2c971094 Ondrej Filip
    }
97 37282678 Ondrej Filip
98 2c971094 Ondrej Filip
    if(ret==0) continue;
99 37282678 Ondrej Filip
100 2c971094 Ondrej Filip
    if(ifa==iff)
101
    {
102
      if((n->rid==iff->drid)||n->rid==iff->bdrid) continue;
103 84228eee Ondrej Filip
      if(iff->state==OSPF_IS_BACKUP) continue;
104
      retval=1;
105 2c971094 Ondrej Filip
    }
106 740d16d9 Ondrej Filip
107 2c971094 Ondrej Filip
    {
108
      sock *sk;
109
      ip_addr to;
110
      u16 len;
111
      struct ospf_lsupd_packet *pk;
112
      struct ospf_packet *op;
113
114 38130b86 Ondrej Filip
      if(ifa->type==OSPF_IT_NBMA)  sk=ifa->ip_sk;
115
      else sk=ifa->hello_sk;        /* FIXME is this true for PTP? */
116 2c971094 Ondrej Filip
117
      pk=(struct ospf_lsupd_packet *)sk->tbuf;
118
      op=(struct ospf_packet *)sk->tbuf;
119
120 89d6782d Ondrej Filip
      fill_ospf_pkt_hdr(ifa, pk, LSUPD_P);
121 2c971094 Ondrej Filip
      pk->lsano=htonl(1);
122 38130b86 Ondrej Filip
      if(hn!=NULL)
123
      {
124
        memcpy(pk+1,hn,ntohs(hn->length));
125
        len=sizeof(struct ospf_lsupd_packet)+ntohs(hn->length);
126
      }
127
      else
128
      {
129
        u8 *help;
130
        struct top_hash_entry *en;
131 249fdef7 Ondrej Filip
        struct ospf_lsa_header *lh;
132
        u16 age;
133
134
        lh=(struct ospf_lsa_header *)(pk+1);
135
        htonlsah(hh,lh);
136
        age=hh->age;
137
        age+=ifa->inftransdelay;
138
        if(age>LSA_MAXAGE) age=LSA_MAXAGE;
139
        lh->age=htons(age);
140
        help=(u8 *)(lh+1);
141 38130b86 Ondrej Filip
        en=ospf_hash_find_header(oa->gr,hh);
142 d345cda5 Ondrej Filip
        htonlsab(en->lsa_body,help,hh->type,hh->length
143
          -sizeof(struct ospf_lsa_header));
144 5da1f935 Ondrej Filip
        len=hh->length+sizeof(struct ospf_lsupd_packet);
145 38130b86 Ondrej Filip
      }
146 2c971094 Ondrej Filip
      op->length=htons(len);
147
      ospf_pkt_finalize(ifa, op);
148 5da1f935 Ondrej Filip
      debug("%s: LS upd flooded via %s\n", p->name, ifa->iface->name);
149 2c971094 Ondrej Filip
150
      if(ifa->type==OSPF_IT_NBMA)
151
      {
152 67315ef6 Ondrej Filip
        sk_send_to_agt(sk ,len, ifa, NEIGHBOR_EXCHANGE);
153 2c971094 Ondrej Filip
      }
154
      else
155
      {
156
        if((ifa->state==OSPF_IS_BACKUP)||(ifa->state==OSPF_IS_DR))
157
          sk_send_to(sk,len, AllSPFRouters, OSPF_PROTO);
158
        else sk_send_to(sk,len, AllDRouters, OSPF_PROTO);
159
      }
160
    }
161
  }
162 84228eee Ondrej Filip
  return retval;
163 2c971094 Ondrej Filip
}
164
165 f45fd316 Ondrej Filip
void                /* I send all I received in LSREQ */
166
ospf_lsupd_tx_list(struct ospf_neighbor *n, list *l)
167
{
168
  struct l_lsr_head *llsh;
169
  u16 len;
170
  u32 lsano;
171
  struct top_hash_entry *en;
172
  struct ospf_lsupd_packet *pk;
173
  struct ospf_packet *op;
174 9669362f Ondrej Filip
  struct proto *p=&n->ifa->oa->po->proto;
175 f45fd316 Ondrej Filip
  void *pktpos;
176 9f940976 Ondrej Filip
  u8 ii;
177
  u8 *jj=n->ifa->ip_sk->tbuf;
178 f45fd316 Ondrej Filip
179 5d608eba Ondrej Filip
  if(EMPTY_LIST(*l)) return;
180 f45fd316 Ondrej Filip
181
  pk=(struct ospf_lsupd_packet *)n->ifa->ip_sk->tbuf;
182
  op=(struct ospf_packet *)n->ifa->ip_sk->tbuf;
183 9f940976 Ondrej Filip
184
  DBG("LSupd: 1st packet\n");
185 f45fd316 Ondrej Filip
       
186 89d6782d Ondrej Filip
  fill_ospf_pkt_hdr(n->ifa, pk, LSUPD_P);
187 f45fd316 Ondrej Filip
  len=SIPH+sizeof(struct ospf_lsupd_packet);
188
  lsano=0;
189
  pktpos=(pk+1);
190
191
  WALK_LIST(llsh, *l)
192
  {
193 cd22a62b Ondrej Filip
    if((en=ospf_hash_find(n->ifa->oa->gr,llsh->lsh.id,llsh->lsh.rt,
194
      llsh->lsh.type))==NULL) continue;                /* Probably flushed LSA */
195
196 44724025 Ondrej Filip
    DBG("Sending ID=%I, Type=%u, RT=%I\n", llsh->lsh.id, llsh->lsh.type,
197 9f940976 Ondrej Filip
      llsh->lsh.rt);
198 a9eeefd6 Ondrej Filip
    if(((u32)(len+en->lsa.length))>n->ifa->iface->mtu)
199 f45fd316 Ondrej Filip
    {
200
      pk->lsano=htonl(lsano);
201 5da1f935 Ondrej Filip
      op->length=htons(len-SIPH);
202 f45fd316 Ondrej Filip
      ospf_pkt_finalize(n->ifa, op);
203 9f940976 Ondrej Filip
                       
204 5da1f935 Ondrej Filip
      sk_send_to(n->ifa->ip_sk,len-SIPH, n->ip, OSPF_PROTO);
205 935ceabe Ondrej Filip
      debug("%s: LS upd sent to %I (%d LSAs)\n", p->name, n->ip, lsano);
206 f45fd316 Ondrej Filip
207 9f940976 Ondrej Filip
      DBG("LSupd: next packet\n");
208 89d6782d Ondrej Filip
      fill_ospf_pkt_hdr(n->ifa, pk, LSUPD_P);
209 f45fd316 Ondrej Filip
      len=SIPH+sizeof(struct ospf_lsupd_packet);
210
      lsano=0;
211
      pktpos=(pk+1);
212
    }
213
    htonlsah(&(en->lsa), pktpos);
214
    pktpos=pktpos+sizeof(struct ospf_lsa_header);
215 d345cda5 Ondrej Filip
    htonlsab(en->lsa_body, pktpos, en->lsa.type, en->lsa.length
216
      -sizeof(struct ospf_lsa_header));
217 9f940976 Ondrej Filip
    pktpos=pktpos+en->lsa.length-sizeof(struct ospf_lsa_header);
218 5da1f935 Ondrej Filip
    len+=en->lsa.length;
219 9f940976 Ondrej Filip
    lsano++;
220 f45fd316 Ondrej Filip
  }
221 b477a9a8 Ondrej Filip
  if(lsano>0)
222
  {
223
    pk->lsano=htonl(lsano);
224
    op->length=htons(len-SIPH);
225
    ospf_pkt_finalize(n->ifa, op);
226 9f940976 Ondrej Filip
227 b477a9a8 Ondrej Filip
    debug("%s: LS upd sent to %I (%d LSAs)\n", p->name, n->ip, lsano);
228
    sk_send_to(n->ifa->ip_sk,len-SIPH, n->ip, OSPF_PROTO);
229
  }
230 f45fd316 Ondrej Filip
}
231
232 de769e24 Ondrej Filip
void
233
ospf_lsupd_rx(struct ospf_lsupd_packet *ps, struct proto *p,
234
  struct ospf_iface *ifa, u16 size)
235
{
236 394acced Ondrej Filip
  u32 area,nrid,myrid;
237 d8852b36 Ondrej Filip
  struct ospf_neighbor *n,*ntmp;
238 394acced Ondrej Filip
  struct ospf_lsa_header *lsa;
239 8496b2e4 Ondrej Filip
  struct ospf_area *oa;
240 921a93f2 Ondrej Filip
  struct proto_ospf *po=(struct proto_ospf *)p;
241 394acced Ondrej Filip
  u16 length;
242 de769e24 Ondrej Filip
  u8 i;
243
244
  nrid=ntohl(ps->ospf_packet.routerid);
245
246
  myrid=p->cf->global->router_id;
247
248 5da1f935 Ondrej Filip
249 de769e24 Ondrej Filip
  if((n=find_neigh(ifa, nrid))==NULL)
250
  {
251 44724025 Ondrej Filip
    debug("%s: Received lsupd from unknown neigbor! (%I)\n", p->name,
252 de769e24 Ondrej Filip
      nrid);
253
    return ;
254
  }
255 394acced Ondrej Filip
  if(n->state<NEIGHBOR_EXCHANGE)
256
  {
257 44724025 Ondrej Filip
    debug("%s: Received lsupd in lesser state than EXCHANGE from (%I)\n",
258 77fbd315 Ondrej Filip
      p->name,n->ip);
259 394acced Ondrej Filip
    return;
260
  }
261 5da1f935 Ondrej Filip
  if(size<=(sizeof(struct ospf_lsupd_packet)+sizeof(struct ospf_lsa_header)))
262
  {
263 13e9bac3 Martin Mares
    log("%s: Received lsupd from %I is too short!", p->name,n->ip);
264 5da1f935 Ondrej Filip
    return;
265
  }
266 394acced Ondrej Filip
267 e9d6b1d1 Ondrej Filip
  debug("%s: Received LS upd from %I\n", p->name, n->ip); 
268 9669362f Ondrej Filip
269 394acced Ondrej Filip
  lsa=(struct ospf_lsa_header *)(ps+1);
270
  area=htonl(ps->ospf_packet.areaid);
271 8496b2e4 Ondrej Filip
  oa=ospf_find_area((struct proto_ospf *)p,area);
272
  for(i=0;i<ntohl(ps->lsano);i++,
273
    lsa=(struct ospf_lsa_header *)(((u8 *)lsa)+ntohs(lsa->length)))
274 394acced Ondrej Filip
  {
275 921a93f2 Ondrej Filip
    struct ospf_lsa_header lsatmp;
276
    struct top_hash_entry *lsadb;
277 13741548 Ondrej Filip
    u16 lenn;
278 5da1f935 Ondrej Filip
    int diff=((u8 *)lsa)-((u8 *)ps);
279
280
    if(((diff+sizeof(struct ospf_lsa_header))>=size) ||
281
      ((ntohs(lsa->length)+diff)>size))
282 df49d4e1 Martin Mares
      log("%s: Received lsupd from %I is too short.", p->name,n->ip);
283 13741548 Ondrej Filip
284
    lenn=ntohs(lsa->length);
285
286
    if((lenn<=sizeof(struct ospf_lsa_header))||(lenn!=(4*(lenn/4))))
287
    {
288 df49d4e1 Martin Mares
      log("Received LSA with bad length");
289 13741548 Ondrej Filip
      ospf_neigh_sm(n,INM_BADLSREQ);
290
      break;
291
    }
292 2c971094 Ondrej Filip
    /* pg 143 (1) */
293 921a93f2 Ondrej Filip
    if(lsa->checksum!=lsasum_check(lsa,NULL,po))
294 394acced Ondrej Filip
    {
295 df49d4e1 Martin Mares
      log("Received bad lsa checksum from %I",n->rid);
296 8496b2e4 Ondrej Filip
      continue;
297
    }
298 2c971094 Ondrej Filip
    /* pg 143 (2) */
299 8496b2e4 Ondrej Filip
    if((lsa->type<LSA_T_RT)||(lsa->type>LSA_T_EXT))
300
    {
301 df49d4e1 Martin Mares
      log("Unknown LSA type from %I",n->rid);
302 8496b2e4 Ondrej Filip
      continue;
303 394acced Ondrej Filip
    }
304 2c971094 Ondrej Filip
    /* pg 143 (3) */
305 8496b2e4 Ondrej Filip
    if((lsa->type==LSA_T_EXT)&&oa->stub)
306
    {
307 df49d4e1 Martin Mares
      log("Received External LSA in stub area from %I",n->rid);
308 8496b2e4 Ondrej Filip
      continue;
309
    }
310 921a93f2 Ondrej Filip
    ntohlsah(lsa,&lsatmp);
311 b36a0a79 Ondrej Filip
    debug("Update Type: %u ID: %I RT: %I, Sn: 0x%08x Age: %u, Sum: %u\n",
312
      lsatmp.type, lsatmp.id, lsatmp.rt, lsatmp.sn, lsatmp.age,
313
      lsatmp.checksum);
314 921a93f2 Ondrej Filip
    lsadb=ospf_hash_find_header(oa->gr, &lsatmp);
315 b36a0a79 Ondrej Filip
    if(lsadb)
316
      debug("I have Type: %u ID: %I RT: %I, Sn: 0x%08x Age: %u, Sum: %u\n",
317
      lsadb->lsa.type, lsadb->lsa.id, lsadb->lsa.rt, lsadb->lsa.sn,
318
      lsadb->lsa.age, lsadb->lsa.checksum);
319 d8852b36 Ondrej Filip
320 2c971094 Ondrej Filip
    /* pg 143 (4) */
321 921a93f2 Ondrej Filip
    if((lsatmp.age==LSA_MAXAGE)&&(lsadb==NULL))
322
    {
323
      int flag=0;
324 67315ef6 Ondrej Filip
      struct ospf_iface *ifatmp;
325 921a93f2 Ondrej Filip
326 e4ba0ec1 Ondrej Filip
      if(can_flush_lsa(oa))
327 921a93f2 Ondrej Filip
      {
328 67315ef6 Ondrej Filip
        ospf_lsack_direct_tx(n,lsa);
329 921a93f2 Ondrej Filip
        continue;
330
      }
331
    }
332 2c971094 Ondrej Filip
    /* pg 144 (5) */
333 921a93f2 Ondrej Filip
    if((lsadb==NULL)||(lsa_comp(&lsatmp,&lsadb->lsa)==CMP_NEWER))
334
    {
335 2c971094 Ondrej Filip
       struct ospf_iface *ift=NULL;
336 d8852b36 Ondrej Filip
       void *body;
337 32fa4a5a Ondrej Filip
       struct ospf_iface *nifa;
338
       int self=0;
339 921a93f2 Ondrej Filip
340 84228eee Ondrej Filip
       DBG("PG143(5): Received LSA is newer\n");
341 921a93f2 Ondrej Filip
342 32fa4a5a Ondrej Filip
       if(lsatmp.rt==p->cf->global->router_id) self=1;
343
344
       if(lsatmp.type==LSA_T_NET)
345
       {
346
         WALK_LIST(nifa,po->iface_list)
347
         {
348
           if(ipa_compare(nifa->iface->addr->ip,ipa_from_u32(lsatmp.id))==0)
349
           {
350
             self=1;
351
             break;
352
           }
353
         }
354
       }
355
356
       if(self)
357
       {
358 82364f4d Ondrej Filip
         struct top_hash_entry *en;
359
360 37282678 Ondrej Filip
         if((lsatmp.age==LSA_MAXAGE)&&(lsatmp.sn==LSA_MAXSEQNO)) continue;
361
362 32fa4a5a Ondrej Filip
         lsatmp.age=LSA_MAXAGE;
363 31ee3d5f Ondrej Filip
         lsatmp.sn=LSA_MAXSEQNO;
364 37282678 Ondrej Filip
         lsa->age=htons(LSA_MAXAGE);
365
         lsa->sn=htonl(LSA_MAXSEQNO);
366 3dd8f983 Ondrej Filip
         debug("%s: Premature aging self originated lsa.\n",p->name);
367 7e1c7efa Ondrej Filip
         debug("%s: Type: %d, Id: %I, Rt: %I\n", p->name, lsatmp.type,
368
           lsatmp.id, lsatmp.rt);
369 31ee3d5f Ondrej Filip
         lsasum_check(lsa,(lsa+1),po);
370
         lsatmp.checksum=ntohs(lsa->checksum);
371 3dd8f983 Ondrej Filip
         flood_lsa(NULL,lsa,&lsatmp,po,NULL,oa,0);
372 82364f4d Ondrej Filip
         if(en=ospf_hash_find_header(oa->gr,&lsatmp))
373
         {
374
           flood_lsa(NULL,NULL,&en->lsa,po,NULL,oa,1);
375
         }
376 32fa4a5a Ondrej Filip
         continue;
377
       }
378
379 2c971094 Ondrej Filip
      /* pg 144 (5a) */
380 42542c56 Ondrej Filip
      if(lsadb && ((now-lsadb->inst_t)<=MINLSARRIVAL))
381 85c92555 Ondrej Filip
      {
382
        DBG("I got it in less that MINLSARRIVAL\n");
383
        continue;
384
      }
385 740d16d9 Ondrej Filip
        
386 3dd8f983 Ondrej Filip
      if(flood_lsa(n,lsa,&lsatmp,po,ifa,ifa->oa,1)==0)
387 84228eee Ondrej Filip
      {
388 85c92555 Ondrej Filip
        DBG("Wasn't flooded back\n");
389 84228eee Ondrej Filip
        if(ifa->state==OSPF_IS_BACKUP)
390
        {
391
          if(ifa->drid==n->rid) ospf_lsa_delay(n, lsa, p);
392
        }
393
        else ospf_lsa_delay(n, lsa, p);
394
      }
395 2c971094 Ondrej Filip
396 921a93f2 Ondrej Filip
      /* Remove old from all ret lists */
397 2c971094 Ondrej Filip
      /* pg 144 (5c) */
398 d8852b36 Ondrej Filip
      if(lsadb)
399 2c971094 Ondrej Filip
        WALK_LIST(NODE ift,po->iface_list)
400
          WALK_LIST(NODE ntmp,ift->neigh_list)
401 62924172 Ondrej Filip
          {
402
            struct top_hash_entry *en;
403
            if(ntmp->state>NEIGHBOR_EXSTART)
404
              if((en=ospf_hash_find_header(ntmp->lsrth,&lsadb->lsa))!=NULL)
405
              {
406
                s_rem_node(SNODE en);
407
                ospf_hash_delete(ntmp->lsrth,en);
408
              }
409
          }
410
411
      if((lsatmp.age==LSA_MAXAGE)&&(lsatmp.sn==LSA_MAXSEQNO)
412
        &&lsadb&&can_flush_lsa(oa))
413
      {
414
        flush_lsa(lsadb,oa);
415 ce8f0c08 Ondrej Filip
        schedule_rtcalc(oa);
416 62924172 Ondrej Filip
        continue;
417
      }
418 921a93f2 Ondrej Filip
419 2c971094 Ondrej Filip
      /* pg 144 (5d) */
420 d8852b36 Ondrej Filip
      body=mb_alloc(p->pool,lsatmp.length-sizeof(struct ospf_lsa_header));
421 2c971094 Ondrej Filip
      ntohlsab(lsa+1,body,lsatmp.type,
422
        lsatmp.length-sizeof(struct ospf_lsa_header));
423 85195f1a Ondrej Filip
      lsadb=lsa_install_new(&lsatmp,body, oa, p);
424 10000b96 Ondrej Filip
      DBG("New LSA installed in DB\n");
425 d8852b36 Ondrej Filip
426 921a93f2 Ondrej Filip
      continue;
427
    }
428
429 2c971094 Ondrej Filip
    /* FIXME pg145 (6)?? */
430 921a93f2 Ondrej Filip
431 2c971094 Ondrej Filip
    /* pg145 (7) */
432 921a93f2 Ondrej Filip
    if(lsa_comp(&lsatmp,&lsadb->lsa)==CMP_SAME)
433
    {
434 84228eee Ondrej Filip
      struct top_hash_entry *en;
435
      DBG("PG145(6) Got the same LSA\n");
436
      if((en=ospf_hash_find_header(n->lsrth,&lsadb->lsa))!=NULL)
437
      {
438
        s_rem_node(SNODE en);
439
        ospf_hash_delete(n->lsrth, en);
440
        if(ifa->state==OSPF_IS_BACKUP)
441
        {
442
          if(n->rid==ifa->drid) ospf_lsa_delay(n, lsa, p);
443
        }
444
      }
445
      else
446
      {
447
        ospf_lsack_direct_tx(n,lsa);
448
      }
449
      continue;
450 921a93f2 Ondrej Filip
    }
451
452 2c971094 Ondrej Filip
    /* pg145 (8) */
453 67315ef6 Ondrej Filip
    if((lsadb->lsa.age==LSA_MAXAGE)&&(lsadb->lsa.sn==LSA_MAXSEQNO))
454
    {
455
      continue;
456
    }
457 921a93f2 Ondrej Filip
458 2c971094 Ondrej Filip
    {
459
      list l;
460 a548a7e1 Ondrej Filip
      struct l_lsr_head ll;
461 2c971094 Ondrej Filip
      init_list(&l);
462 a548a7e1 Ondrej Filip
      ll.lsh.id=lsadb->lsa.id;
463
      ll.lsh.rt=lsadb->lsa.rt;
464
      ll.lsh.type=lsadb->lsa.type;
465
      add_tail(&l, NODE &ll);
466 2c971094 Ondrej Filip
      ospf_lsupd_tx_list(n, &l);
467
    }
468 394acced Ondrej Filip
  }
469 489f800b Ondrej Filip
  if(n->state==NEIGHBOR_LOADING)
470
  {
471
    ospf_lsreq_tx(n);        /* Send me another part of database */
472
  }
473 de769e24 Ondrej Filip
}
474
475 4bd28fb6 Ondrej Filip
void
476
net_flush_lsa(struct top_hash_entry *en, struct proto_ospf *po,
477
  struct ospf_area *oa)
478
{
479
  struct ospf_lsa_header *lsa=&en->lsa;
480
481
  lsa->age=LSA_MAXAGE;
482 31ee3d5f Ondrej Filip
  lsa->sn=LSA_MAXSEQNO;
483
  lsasum_calculate(lsa,en->lsa_body,po);
484 3dd8f983 Ondrej Filip
  debug("%s: Premature aging self originated lsa!\n",po->proto.name);
485 7e1c7efa Ondrej Filip
  debug("%s: Type: %d, Id: %I, Rt: %I\n", po->proto.name, lsa->type,
486
    lsa->id, lsa->rt);
487 3dd8f983 Ondrej Filip
  flood_lsa(NULL,NULL,lsa,po,NULL,oa,0);
488 4bd28fb6 Ondrej Filip
}