/*------------------------------------------------------------------------ * nb_mismatch - handle sequence # mismatch event *------------------------------------------------------------------------ */ int nb_mismatch(struct ospf_if *pif, struct ospf_nb *pnb) { struct ep *pep; pnb->nb_state = NBS_EXSTART; /* empty lists */ while (pep = (struct ep *)deq(pnb->nb_lsal)) freebuf(pep); while (pep = (struct ep *)deq(pnb->nb_dsl)) freebuf(pep); while (pep = (struct ep *)deq(pnb->nb_lsrl)) freebuf(pep); pnb->nb_seq++; dd_queue(pif, pnb); return 0; }
/*------------------------------------------------------------------------ * nb_reform - reform adjacencies after a DR or BDR change *------------------------------------------------------------------------ */ int nb_reform(struct ospf_if *pif) { struct ospf_nb *pnb = &pif->if_nbtab[1]; int nn; for (nn=0; nn<MAXNBR; ++nn, ++pnb) { if (pnb->nb_state >= NBS_EXSTART) { if (!nb_aok(pif, pnb)) { /* break an adjacency */ pnb->nb_state = NBS_2WAY; nb_clearl(pnb); } } else if (pnb->nb_state == NBS_2WAY) { if (nb_aok(pif, pnb)) { /* form an adjacency */ gettime(&pnb->nb_seq); pnb->nb_state = NBS_EXSTART; nb_makel(pnb); dd_queue(pif, pnb); } } } }