Revision 035f6acb

View differences:

proto/ospf/hello.c
19 19

  
20 20
  if(n->inactim==NULL)
21 21
  {
22
    n->inactim=tm_new(p->pool);
22
    n->inactim=tm_new(n->pool);
23 23
    n->inactim->data=n;
24 24
    n->inactim->randomize=0;
25 25
    n->inactim->hook=neighbor_timer_hook;
......
64 64
  ip_addr mask;
65 65
  char *beg=": Bad OSPF hello packet from ", *rec=" received: ";
66 66
  int eligible=0;
67
  pool *pool;
67 68

  
68 69
  nrid=ntohl(((struct ospf_packet *)ps)->routerid);
69 70

  
......
130 131
    }
131 132
    OSPF_TRACE(D_EVENTS, "New neighbor found: %I on %s.", faddr,
132 133
      ifa->iface->name);
133
    n=mb_allocz(p->pool, sizeof(struct ospf_neighbor));
134
    pool=rp_new(p->pool, "OSPF Neighbor");
135
    n=mb_allocz(pool, sizeof(struct ospf_neighbor));
136
    n->pool=pool;
134 137
    add_tail(&ifa->neigh_list, NODE n);
135 138
    n->rid=nrid;
136 139
    n->ip=faddr;
......
142 145
    n->options=ps->options;
143 146
    n->ifa=ifa;
144 147
    n->adj=0;
145
    n->ldbdes=mb_alloc(p->pool, ifa->iface->mtu);
148
    n->ldbdes=mb_alloc(pool, ifa->iface->mtu);
146 149
    n->state=NEIGHBOR_DOWN;
147 150
    install_inactim(n);
148
    n->rxmt_timer=tm_new(p->pool);
151
    n->rxmt_timer=tm_new(pool);
149 152
    n->rxmt_timer->data=n;
150 153
    n->rxmt_timer->randomize=0;
151 154
    n->rxmt_timer->hook=rxmt_timer_hook;
152 155
    n->rxmt_timer->recurrent=ifa->rxmtint;
153 156
    DBG("%s: Installing rxmt timer.\n", p->name);
154
    n->lsrr_timer=tm_new(p->pool);
157
    n->lsrr_timer=tm_new(pool);
155 158
    n->lsrr_timer->data=n;
156 159
    n->lsrr_timer->randomize=0;
157 160
    n->lsrr_timer->hook=lsrr_timer_hook;
158 161
    n->lsrr_timer->recurrent=ifa->rxmtint;
159 162
    DBG("%s: Installing lsrr timer.\n", p->name);
160 163
    init_list(&n->ackl);
161
    n->ackd_timer=tm_new(p->pool);
164
    n->ackd_timer=tm_new(pool);
162 165
    n->ackd_timer->data=n;
163 166
    n->ackd_timer->randomize=0;
164 167
    n->ackd_timer->hook=ackd_timer_hook;
proto/ospf/iface.c
70 70
      {
71 71
        if(ifa->dr_sk!=NULL)
72 72
	{
73
          if (ifa->dr_sk->rbuf)
74
            mb_free(ifa->dr_sk->rbuf);
75
          if (ifa->dr_sk->tbuf)
76
            mb_free(ifa->dr_sk->tbuf);
73 77
	  rfree(ifa->dr_sk);
74 78
	  ifa->dr_sk=NULL;
75 79
	}
......
103 107
  rem_node(NODE ifa);
104 108
  if(ifa->hello_sk!=NULL)
105 109
  {
110
    if (ifa->hello_sk->rbuf)
111
      mb_free(ifa->hello_sk->rbuf);
112
    if (ifa->hello_sk->tbuf)
113
      mb_free(ifa->hello_sk->tbuf);
106 114
    rfree(ifa->hello_sk);
107 115
  }
108 116
  if(ifa->dr_sk!=NULL)
109 117
  {
118
    if (ifa->dr_sk->rbuf)
119
      mb_free(ifa->dr_sk->rbuf);
120
    if (ifa->dr_sk->tbuf)
121
      mb_free(ifa->dr_sk->tbuf);
110 122
    rfree(ifa->dr_sk);
111 123
  }
112 124
  if(ifa->ip_sk!=NULL)
113 125
  {
126
    if (ifa->ip_sk->rbuf)
127
      mb_free(ifa->ip_sk->rbuf);
128
    if (ifa->ip_sk->tbuf)
129
      mb_free(ifa->ip_sk->tbuf);
114 130
    rfree(ifa->ip_sk);
115 131
  }
116 132
  if(ifa->wait_timer!=NULL)
proto/ospf/lsack.c
40 40
{
41 41
  struct lsah_n *no;
42 42

  
43
  no=mb_alloc(p->pool,sizeof(struct lsah_n));
43
  no=mb_alloc(n->pool,sizeof(struct lsah_n));
44 44
  memcpy(&no->lsa,h,sizeof(struct ospf_lsa_header));
45 45
  add_tail(&n->ackl, NODE no);
46 46
  DBG("Adding delay ack for %I, ID: %I, RT: %I, Type: %u\n",n->rid,
......
213 213
    DBG("Deleting LS Id: %I RT: %I Type: %u from LS Retl for neighbor %I\n",
214 214
      lsa.id,lsa.rt,lsa.type,n->rid);
215 215
    s_rem_node(SNODE en);
216
    if(en->lsa_body!=NULL) mb_free(en->lsa_body);
217
    en->lsa_body=NULL;
216 218
    ospf_hash_delete(n->lsrth,en);
217 219
  }  
218 220
}
proto/ospf/lsalib.c
15 15
  OSPF_TRACE(D_EVENTS, "Going to remove node Type: %u, Id: %I, Rt: %I, Age: %u",
16 16
    en->lsa.type, en->lsa.id, en->lsa.rt, en->lsa.age);
17 17
  s_rem_node(SNODE en);
18
  if(en->lsa_body!=NULL) mb_free(en->lsa_body);
19
  en->lsa_body=NULL;
18 20
  ospf_hash_delete(oa->gr,en);
19 21
}
20 22

  
proto/ospf/lsreq.c
82 82
      struct l_lsr_head *llsh;
83 83

  
84 84
      init_list(&uplist);
85
      upslab=sl_new(p->pool,sizeof(struct l_lsr_head));
85
      upslab=sl_new(n->pool,sizeof(struct l_lsr_head));
86 86

  
87 87
      WALK_SLIST(SNODE en,n->lsrtl)
88 88
      {
......
132 132
  length=ntohs(ps->ospf_packet.length);
133 133
  lsh=(void *)(ps+1);
134 134
  init_list(&uplist);
135
  upslab=sl_new(p->pool,sizeof(struct l_lsr_head));
135
  upslab=sl_new(n->pool,sizeof(struct l_lsr_head));
136 136

  
137 137
  lsano=(length-sizeof(struct ospf_lsreq_packet))/
138 138
    sizeof(struct ospf_lsreq_header);
proto/ospf/lsupd.c
55 55
	      break;
56 56
	    case CMP_SAME:
57 57
              s_rem_node(SNODE en);
58
              if(en->lsa_body!=NULL) mb_free(en->lsa_body);
59
              en->lsa_body=NULL;
58 60
	      DBG("Removing from lsreq list for neigh %I\n", nn->rid);
59 61
	      ospf_hash_delete(nn->lsrqh,en);
60 62
	      if(EMPTY_SLIST(nn->lsrql)) ospf_neigh_sm(nn, INM_LOADDONE);
......
62 64
	      break;
63 65
	    case CMP_NEWER:
64 66
              s_rem_node(SNODE en);
67
              if(en->lsa_body!=NULL) mb_free(en->lsa_body);
68
              en->lsa_body=NULL;
65 69
	      DBG("Removing from lsreq list for neigh %I\n", nn->rid);
66 70
	      ospf_hash_delete(nn->lsrqh,en);
67 71
	      if(EMPTY_SLIST(nn->lsrql)) ospf_neigh_sm(nn, INM_LOADDONE);
......
91 95
        if((en=ospf_hash_find_header(nn->lsrth, hh))!=NULL)
92 96
        {
93 97
          s_rem_node(SNODE en);
98
          if(en->lsa_body!=NULL) mb_free(en->lsa_body);
99
          en->lsa_body=NULL;
94 100
          ospf_hash_delete(nn->lsrth, en);
95 101
        }
96 102
      }
......
416 422
              if((en=ospf_hash_find_header(ntmp->lsrth,&lsadb->lsa))!=NULL)
417 423
              {
418 424
                s_rem_node(SNODE en);
425
                if(en->lsa_body!=NULL) mb_free(en->lsa_body);
426
                en->lsa_body=NULL;
419 427
                ospf_hash_delete(ntmp->lsrth,en);
420 428
              }
421 429
          }
......
448 456
      if((en=ospf_hash_find_header(n->lsrth,&lsadb->lsa))!=NULL)
449 457
      {
450 458
        s_rem_node(SNODE en);
459
        if(en->lsa_body!=NULL) mb_free(en->lsa_body);
460
        en->lsa_body=NULL;
451 461
        ospf_hash_delete(n->lsrth, en);
452 462
        if(ifa->state==OSPF_IS_BACKUP)
453 463
        {
proto/ospf/neighbor.c
261 261
      if(n->state==NEIGHBOR_EXSTART)
262 262
      {
263 263
        neigh_chstate(n,NEIGHBOR_EXCHANGE);
264
        while(!EMPTY_LIST(n->ackl))
265
        {
266
          struct lsah_n *no;
267
          no=(struct lsah_n *)HEAD(n->ackl);
268
          rem_node(NODE no);
269
          mb_free(no);
270
        }
264 271
        s_init_list(&(n->lsrql));
265
	n->lsrqh=ospf_top_new(n->ifa->proto);
272
	if(n->lsrqh) ospf_top_free(n->lsrqh);
273
	n->lsrqh=ospf_top_new(n->pool, n->ifa->proto);
266 274
        s_init_list(&(n->lsrtl));
267
	n->lsrth=ospf_top_new(n->ifa->proto);
275
	if(n->lsrth) ospf_top_free(n->lsrth);
276
	n->lsrth=ospf_top_new(n->pool, n->ifa->proto);
268 277
	s_init(&(n->dbsi), &(n->ifa->oa->lsal));
269 278
	s_init(&(n->lsrqi), &(n->lsrql));
270 279
	s_init(&(n->lsrti), &(n->lsrtl));
......
490 499
  ifa=n->ifa;
491 500
  p=(struct proto *)(ifa->proto);
492 501
  neigh_chstate(n, NEIGHBOR_DOWN);
493
  tm_stop(n->inactim);
494
  rfree(n->inactim);
495
  if(n->rxmt_timer!=NULL)
496
  {
497
    tm_stop(n->rxmt_timer);
498
    rfree(n->rxmt_timer);
499
  }
500
  if(n->lsrr_timer!=NULL)
501
  {
502
    tm_stop(n->lsrr_timer);
503
    rfree(n->lsrr_timer);
504
  }
505
  if(n->ackd_timer!=NULL)
506
  {
507
    tm_stop(n->ackd_timer);
508
    rfree(n->ackd_timer);
509
  }
510
  if(n->ldbdes!=NULL)
511
  {
512
    mb_free(n->ldbdes);
513
  }
514
  if(n->lsrqh!=NULL)
515
  {
516
    ospf_top_free(n->lsrqh);
517
  }
518
  if(n->lsrth!=NULL)
519
  {
520
    ospf_top_free(n->lsrth);
521
  }
522 502
  rem_node(NODE n);
523
  mb_free(n);
503
  rfree(n->pool);
524 504
  OSPF_TRACE(D_EVENTS, "Deleting neigbor.");
525 505
}
526 506

  
proto/ospf/ospf.c
100 100
    oa->stub=ac->stub;
101 101
    oa->tick=ac->tick;
102 102
    oa->areaid=ac->areaid;
103
    oa->gr=ospf_top_new(po);
103
    oa->gr=ospf_top_new(po->proto.pool, po);
104 104
    s_init_list(&(oa->lsal));
105 105
    oa->rt=NULL;
106 106
    oa->po=po;
proto/ospf/ospf.h
324 324
struct ospf_neighbor
325 325
{
326 326
  node n;
327
  pool *pool;
327 328
  struct ospf_iface *ifa;
328 329
  u8 state;
329 330
#define NEIGHBOR_DOWN 0
proto/ospf/topology.c
284 284
    ifa->nlsa->lsa.age=LSA_MAXAGE;
285 285
    flood_lsa(NULL,NULL,&ifa->nlsa->lsa,po,NULL,ifa->oa,0);
286 286
    s_rem_node(SNODE ifa->nlsa);
287
    if(ifa->nlsa->lsa_body!=NULL) mb_free(ifa->nlsa->lsa_body);
288
    ifa->nlsa->lsa_body=NULL;
287 289
    ospf_hash_delete(ifa->oa->gr, ifa->nlsa);
288 290
    schedule_rtcalc(ifa->oa);
289 291
    ifa->nlsa=NULL;
......
511 513
 * its used in @ospf_area structure.
512 514
 */
513 515
struct top_graph *
514
ospf_top_new(struct proto_ospf *p)
516
ospf_top_new(pool *pool, struct proto_ospf *p)
515 517
{
516 518
  struct top_graph *f;
517 519

  
518
  f = mb_allocz(p->proto.pool, sizeof(struct top_graph));
519
  f->pool = p->proto.pool;
520
  f = mb_allocz(pool, sizeof(struct top_graph));
521
  f->pool = pool;
520 522
  f->hash_slab = sl_new(f->pool, sizeof(struct top_hash_entry));
521 523
  f->hash_order = HASH_DEF_ORDER;
522 524
  ospf_top_ht_alloc(f);
proto/ospf/topology.h
42 42
  unsigned int hash_entries_min, hash_entries_max;
43 43
};
44 44

  
45
struct top_graph *ospf_top_new(struct proto_ospf *);
45
struct top_graph *ospf_top_new(pool *, struct proto_ospf *);
46 46
void ospf_top_free(struct top_graph *);
47 47
void ospf_top_dump(struct top_graph *, struct proto *);
48 48
struct top_hash_entry *ospf_hash_find_header(struct top_graph *f, struct ospf_lsa_header *h);

Also available in: Unified diff