diff options
author | Ondrej Filip <feela@network.cz> | 2000-05-10 12:37:43 +0000 |
---|---|---|
committer | Ondrej Filip <feela@network.cz> | 2000-05-10 12:37:43 +0000 |
commit | c7e46aae66861ce282e9b1a0140fa422763094ce (patch) | |
tree | 2719cf1b4edaae8a3465f1d278a8dd0ffbd4c715 | |
parent | 7f5f44bb9248f05f397617f3874feef26bbb0b0b (diff) |
Destroying of neighbor moved from 'hello' to 'neighbor' and
improved.
-rw-r--r-- | proto/ospf/hello.c | 20 | ||||
-rw-r--r-- | proto/ospf/hello.h | 1 | ||||
-rw-r--r-- | proto/ospf/neighbor.c | 47 | ||||
-rw-r--r-- | proto/ospf/neighbor.h | 1 |
4 files changed, 48 insertions, 21 deletions
diff --git a/proto/ospf/hello.c b/proto/ospf/hello.c index b6e34e28..eb506f4b 100644 --- a/proto/ospf/hello.c +++ b/proto/ospf/hello.c @@ -238,23 +238,3 @@ wait_timer_hook(timer *timer) ospf_int_sm(ifa, ISM_WAITF); } -/* Neighbor is inactive for a long time. Remove it. */ -void -neighbor_timer_hook(timer *timer) -{ - struct ospf_neighbor *n; - struct ospf_iface *ifa; - struct proto *p; - - n=(struct ospf_neighbor *)timer->data; - ifa=n->ifa; - p=(struct proto *)(ifa->proto); - debug("%s: Inactivity timer fired on interface %s for neighbor %I.\n", - p->name, ifa->iface->name, n->rid); - tm_stop(n->inactim); - rfree(n->inactim); - rem_node(NODE n); - mb_free(n); - debug("%s: Deleting neigbor.\n", p->name); - /* FIXME: Go on */ -} diff --git a/proto/ospf/hello.h b/proto/ospf/hello.h index f40ea018..4369b607 100644 --- a/proto/ospf/hello.h +++ b/proto/ospf/hello.h @@ -18,6 +18,5 @@ void ospf_hello_rx(struct ospf_hello_packet *ps, struct proto *p, struct ospf_iface *ifa, int size, ip_addr faddr); void hello_timer_hook(timer *timer); void wait_timer_hook(timer *timer); -void neighbor_timer_hook(timer *timer); #endif /* _BIRD_OSPF_HELLO_H_ */ diff --git a/proto/ospf/neighbor.c b/proto/ospf/neighbor.c index c959ab87..78bba618 100644 --- a/proto/ospf/neighbor.c +++ b/proto/ospf/neighbor.c @@ -427,4 +427,51 @@ ospf_find_area(struct proto_ospf *po, u32 aid) return NULL; } +/* Neighbor is inactive for a long time. Remove it. */ +void +neighbor_timer_hook(timer *timer) +{ + struct ospf_neighbor *n; + struct ospf_iface *ifa; + struct proto *p; + + n=(struct ospf_neighbor *)timer->data; + ifa=n->ifa; + p=(struct proto *)(ifa->proto); + debug("%s: Inactivity timer fired on interface %s for neighbor %I.\n", + p->name, ifa->iface->name, n->rid); + neigh_chstate(n, NEIGHBOR_DOWN); + tm_stop(n->inactim); + rfree(n->inactim); + if(n->rxmt_timer!=NULL) + { + tm_stop(n->rxmt_timer); + rfree(n->rxmt_timer); + } + if(n->lsrr_timer!=NULL) + { + tm_stop(n->lsrr_timer); + rfree(n->lsrr_timer); + } + if(n->ackd_timer!=NULL) + { + tm_stop(n->ackd_timer); + rfree(n->ackd_timer); + } + if(n->ldbdes!=NULL) + { + mb_free(n->ldbdes); + } + if(n->lsrqh!=NULL) + { + ospf_top_free(n->lsrqh); + } + if(n->lsrth!=NULL) + { + ospf_top_free(n->lsrth); + } + rem_node(NODE n); + mb_free(n); + debug("%s: Deleting neigbor.\n", p->name); +} diff --git a/proto/ospf/neighbor.h b/proto/ospf/neighbor.h index 501b9654..5deb37a6 100644 --- a/proto/ospf/neighbor.h +++ b/proto/ospf/neighbor.h @@ -20,5 +20,6 @@ void bdr_election(struct ospf_iface *ifa, struct proto *p); struct ospf_neighbor *find_neigh(struct ospf_iface *ifa, u32 rid); struct ospf_neighbor *find_neigh_noifa(struct proto_ospf *po, u32 rid); struct ospf_area *ospf_find_area(struct proto_ospf *po, u32 aid); +void neighbor_timer_hook(timer *timer); #endif /* _BIRD_OSPF_NEIGHBOR_H_ */ |