void ospf6_lsdb_remove_all(struct ospf6_lsdb *lsdb)
{
- struct ospf6_lsa *lsa, *lsa_next;
- const struct route_node *iterend;
+ struct ospf6_lsa *lsa;
if (lsdb == NULL)
return;
- for (iterend = ospf6_lsdb_head(lsdb, 0, 0, 0, &lsa); lsa;
- lsa = lsa_next) {
- lsa_next = ospf6_lsdb_next(iterend, lsa);
+ for (ALL_LSDB(lsdb, lsa))
ospf6_lsdb_remove(lsa, lsdb);
- }
}
void ospf6_lsdb_lsa_unlock(struct ospf6_lsa *lsa)
int ospf6_lsdb_maxage_remover(struct ospf6_lsdb *lsdb)
{
int reschedule = 0;
- struct ospf6_lsa *lsa, *lsa_next;
- const struct route_node *iterend;
+ struct ospf6_lsa *lsa;
- for (iterend = ospf6_lsdb_head(lsdb, 0, 0, 0, &lsa); lsa;
- lsa = lsa_next) {
- lsa_next = ospf6_lsdb_next(iterend, lsa);
+ for (ALL_LSDB(lsdb, lsa)) {
if (!OSPF6_LSA_IS_MAXAGE(lsa))
continue;
if (lsa->retrans_count != 0) {
int ospf6_dbdesc_send_newone(struct thread *thread)
{
struct ospf6_neighbor *on;
- struct ospf6_lsa *lsa, *lsa_next;
- const struct route_node *iterend;
+ struct ospf6_lsa *lsa;
unsigned int size = 0;
on = (struct ospf6_neighbor *)THREAD_ARG(thread);
structure)
so that ospf6_send_dbdesc () can send those LSAs */
size = sizeof(struct ospf6_lsa_header) + sizeof(struct ospf6_dbdesc);
-
- for (iterend = ospf6_lsdb_head(on->summary_list, 0, 0, 0, &lsa); lsa;
- lsa = lsa_next) {
- lsa_next = ospf6_lsdb_next(iterend, lsa);
+ for (ALL_LSDB(on->summary_list, lsa)) {
if (size + sizeof(struct ospf6_lsa_header)
> ospf6_packet_max(on->ospf6_if)) {
ospf6_lsdb_lsa_unlock(lsa);
struct ospf6_lsupdate *lsupdate;
uint8_t *p;
int lsa_cnt;
- struct ospf6_lsa *lsa, *lsa_next;
- const struct route_node *iterend;
+ struct ospf6_lsa *lsa;
on = (struct ospf6_neighbor *)THREAD_ARG(thread);
on->thread_send_lsupdate = (struct thread *)NULL;
/* lsupdate_list lists those LSA which doesn't need to be
retransmitted. remove those from the list */
- for (iterend = ospf6_lsdb_head(on->lsupdate_list, 0, 0, 0, &lsa); lsa;
- lsa = lsa_next) {
- lsa_next = ospf6_lsdb_next(iterend, lsa);
+ for (ALL_LSDB(on->lsupdate_list, lsa)) {
/* MTU check */
if ((p - sendbuf + (unsigned int)OSPF6_LSA_SIZE(lsa->header))
> ospf6_packet_max(on->ospf6_if)) {
p += OSPF6_LSA_SIZE(lsa->header);
lsa_cnt++;
- assert(lsa->lock == 1);
+ assert(lsa->lock == 2);
ospf6_lsdb_remove(lsa, on->lsupdate_list);
}
struct ospf6_lsupdate *lsupdate;
uint8_t *p;
int lsa_cnt;
- struct ospf6_lsa *lsa, *lsa_next;
- const struct route_node *iterend;
+ struct ospf6_lsa *lsa;
oi = (struct ospf6_interface *)THREAD_ARG(thread);
oi->thread_send_lsupdate = (struct thread *)NULL;
p = (uint8_t *)((caddr_t)lsupdate + sizeof(struct ospf6_lsupdate));
lsa_cnt = 0;
- for (iterend = ospf6_lsdb_head(oi->lsupdate_list, 0, 0, 0, &lsa); lsa;
- lsa = lsa_next) {
- lsa_next = ospf6_lsdb_next(iterend, lsa);
+ for (ALL_LSDB(oi->lsupdate_list, lsa)) {
/* MTU check */
if ((p - sendbuf + ((unsigned int)OSPF6_LSA_SIZE(lsa->header)))
> ospf6_packet_max(oi)) {
p += OSPF6_LSA_SIZE(lsa->header);
lsa_cnt++;
- assert(lsa->lock == 1);
+ assert(lsa->lock == 2);
ospf6_lsdb_remove(lsa, oi->lsupdate_list);
}
struct ospf6_neighbor *on;
struct ospf6_header *oh;
uint8_t *p;
- struct ospf6_lsa *lsa, *lsa_next;
- const struct route_node *iterend;
+ struct ospf6_lsa *lsa;
int lsa_cnt = 0;
on = (struct ospf6_neighbor *)THREAD_ARG(thread);
p = (uint8_t *)((caddr_t)oh + sizeof(struct ospf6_header));
- for (iterend = ospf6_lsdb_head(on->lsack_list, 0, 0, 0, &lsa); lsa;
- lsa = lsa_next) {
- lsa_next = ospf6_lsdb_next(iterend, lsa);
+ for (ALL_LSDB(on->lsack_list, lsa)) {
/* MTU check */
if (p - sendbuf + sizeof(struct ospf6_lsa_header)
> ospf6_packet_max(on->ospf6_if)) {
memcpy(p, lsa->header, sizeof(struct ospf6_lsa_header));
p += sizeof(struct ospf6_lsa_header);
- assert(lsa->lock == 1);
+ assert(lsa->lock == 2);
ospf6_lsdb_remove(lsa, on->lsack_list);
lsa_cnt++;
}
struct ospf6_interface *oi;
struct ospf6_header *oh;
uint8_t *p;
- struct ospf6_lsa *lsa, *lsa_next;
- const struct route_node *iterend;
+ struct ospf6_lsa *lsa;
int lsa_cnt = 0;
oi = (struct ospf6_interface *)THREAD_ARG(thread);
p = (uint8_t *)((caddr_t)oh + sizeof(struct ospf6_header));
- for (iterend = ospf6_lsdb_head(oi->lsack_list, 0, 0, 0, &lsa); lsa;
- lsa = lsa_next) {
- lsa_next = ospf6_lsdb_next(iterend, lsa);
+ for (ALL_LSDB(oi->lsack_list, lsa)) {
/* MTU check */
if (p - sendbuf + sizeof(struct ospf6_lsa_header)
> ospf6_packet_max(oi)) {
memcpy(p, lsa->header, sizeof(struct ospf6_lsa_header));
p += sizeof(struct ospf6_lsa_header);
- assert(lsa->lock == 1);
+ assert(lsa->lock == 2);
ospf6_lsdb_remove(lsa, oi->lsack_list);
lsa_cnt++;
}
void ospf6_neighbor_delete(struct ospf6_neighbor *on)
{
- struct ospf6_lsa *lsa, *lsa_next;
- const struct route_node *iterend;
+ struct ospf6_lsa *lsa;
ospf6_lsdb_remove_all(on->summary_list);
ospf6_lsdb_remove_all(on->request_list);
-
- for (iterend = ospf6_lsdb_head(on->retrans_list, 0, 0, 0, &lsa); lsa;
- lsa = lsa_next) {
- lsa_next = ospf6_lsdb_next(iterend, lsa);
+ for (ALL_LSDB(on->retrans_list, lsa)) {
ospf6_decrement_retrans_count(lsa);
ospf6_lsdb_remove(lsa, on->retrans_list);
}
int negotiation_done(struct thread *thread)
{
struct ospf6_neighbor *on;
- struct ospf6_lsa *lsa, *lsa_next;
- const struct route_node *iterend;
+ struct ospf6_lsa *lsa;
on = (struct ospf6_neighbor *)THREAD_ARG(thread);
assert(on);
/* clear ls-list */
ospf6_lsdb_remove_all(on->summary_list);
ospf6_lsdb_remove_all(on->request_list);
-
- for (iterend = ospf6_lsdb_head(on->retrans_list, 0, 0, 0, &lsa); lsa;
- lsa = lsa_next) {
- lsa_next = ospf6_lsdb_next(iterend, lsa);
+ for (ALL_LSDB(on->retrans_list, lsa)) {
ospf6_decrement_retrans_count(lsa);
ospf6_lsdb_remove(lsa, on->retrans_list);
}
int bad_lsreq(struct thread *thread)
{
struct ospf6_neighbor *on;
- struct ospf6_lsa *lsa, *lsa_next;
- const struct route_node *iterend;
+ struct ospf6_lsa *lsa;
on = (struct ospf6_neighbor *)THREAD_ARG(thread);
assert(on);
ospf6_lsdb_remove_all(on->summary_list);
ospf6_lsdb_remove_all(on->request_list);
-
- for (iterend = ospf6_lsdb_head(on->retrans_list, 0, 0, 0, &lsa); lsa;
- lsa = lsa_next) {
- lsa_next = ospf6_lsdb_next(iterend, lsa);
+ for (ALL_LSDB(on->retrans_list, lsa)) {
ospf6_decrement_retrans_count(lsa);
ospf6_lsdb_remove(lsa, on->retrans_list);
}
int oneway_received(struct thread *thread)
{
struct ospf6_neighbor *on;
- struct ospf6_lsa *lsa, *lsa_next;
- const struct route_node *iterend;
+ struct ospf6_lsa *lsa;
on = (struct ospf6_neighbor *)THREAD_ARG(thread);
assert(on);
ospf6_lsdb_remove_all(on->summary_list);
ospf6_lsdb_remove_all(on->request_list);
- for (iterend = ospf6_lsdb_head(on->retrans_list, 0, 0, 0, &lsa); lsa;
- lsa = lsa_next) {
- lsa_next = ospf6_lsdb_next(iterend, lsa);
+ for (ALL_LSDB(on->retrans_list, lsa)) {
ospf6_decrement_retrans_count(lsa);
ospf6_lsdb_remove(lsa, on->retrans_list);
}