diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2013-03-25 14:29:36 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2013-03-25 14:29:36 +0000 |
commit | 9ef9bdd8e6e8b7914738b7d218dcf146d3114aa2 (patch) | |
tree | fd510aadc93545cc1c87abd61fc54f9acda0ddd6 /usr.sbin | |
parent | b50b2e839763da89bc8cf518cdabc36d36652d14 (diff) |
sync w/ospfd: improve snapshot handling; ok claudio, sthen
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ospf6d/database.c | 2 | ||||
-rw-r--r-- | usr.sbin/ospf6d/lsupdate.c | 2 | ||||
-rw-r--r-- | usr.sbin/ospf6d/neighbor.c | 19 | ||||
-rw-r--r-- | usr.sbin/ospf6d/ospf6.h | 2 | ||||
-rw-r--r-- | usr.sbin/ospf6d/ospf6d.h | 3 | ||||
-rw-r--r-- | usr.sbin/ospf6d/ospfe.c | 18 | ||||
-rw-r--r-- | usr.sbin/ospf6d/ospfe.h | 3 | ||||
-rw-r--r-- | usr.sbin/ospf6d/rde_lsdb.c | 4 |
8 files changed, 38 insertions, 15 deletions
diff --git a/usr.sbin/ospf6d/database.c b/usr.sbin/ospf6d/database.c index 53f46eee4e4..6f6efec2169 100644 --- a/usr.sbin/ospf6d/database.c +++ b/usr.sbin/ospf6d/database.c @@ -1,4 +1,4 @@ -/* $OpenBSD: database.c,v 1.13 2013/03/25 14:26:16 markus Exp $ */ +/* $OpenBSD: database.c,v 1.14 2013/03/25 14:29:34 markus Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> diff --git a/usr.sbin/ospf6d/lsupdate.c b/usr.sbin/ospf6d/lsupdate.c index df03723163a..60e355bd8ec 100644 --- a/usr.sbin/ospf6d/lsupdate.c +++ b/usr.sbin/ospf6d/lsupdate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lsupdate.c,v 1.9 2013/03/25 14:23:47 markus Exp $ */ +/* $OpenBSD: lsupdate.c,v 1.10 2013/03/25 14:29:35 markus Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> diff --git a/usr.sbin/ospf6d/neighbor.c b/usr.sbin/ospf6d/neighbor.c index 3154bced219..b750d7faae8 100644 --- a/usr.sbin/ospf6d/neighbor.c +++ b/usr.sbin/ospf6d/neighbor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: neighbor.c,v 1.12 2013/03/25 14:27:33 markus Exp $ */ +/* $OpenBSD: neighbor.c,v 1.13 2013/03/25 14:29:35 markus Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -56,7 +56,7 @@ struct { int state; enum nbr_event event; enum nbr_action action; - int new_state; + int new_state; /* 0 means action decides or unchanged */ } nbr_fsm_tbl[] = { /* current state event that happened action to take resulting state */ {NBR_STA_ACTIVE, NBR_EVT_HELLO_RCVD, NBR_ACT_RST_ITIMER, 0}, @@ -65,7 +65,7 @@ struct { {NBR_STA_DOWN, NBR_EVT_HELLO_RCVD, NBR_ACT_STRT_ITIMER, NBR_STA_INIT}, {NBR_STA_ATTEMPT, NBR_EVT_HELLO_RCVD, NBR_ACT_RST_ITIMER, NBR_STA_INIT}, {NBR_STA_INIT, NBR_EVT_2_WAY_RCVD, NBR_ACT_EVAL, 0}, - {NBR_STA_XSTRT, NBR_EVT_NEG_DONE, NBR_ACT_SNAP, NBR_STA_SNAP}, + {NBR_STA_XSTRT, NBR_EVT_NEG_DONE, NBR_ACT_SNAP, 0}, {NBR_STA_SNAP, NBR_EVT_SNAP_DONE, NBR_ACT_SNAP_DONE, NBR_STA_XCHNG}, {NBR_STA_XCHNG, NBR_EVT_XCHNG_DONE, NBR_ACT_XCHNG_DONE, 0}, {NBR_STA_LOAD, NBR_EVT_LOAD_DONE, NBR_ACT_NOTHING, NBR_STA_FULL}, @@ -73,8 +73,8 @@ struct { {NBR_STA_ADJFORM, NBR_EVT_ADJ_OK, NBR_ACT_ADJ_OK, 0}, {NBR_STA_PRELIM, NBR_EVT_ADJ_OK, NBR_ACT_HELLO_CHK, 0}, {NBR_STA_ADJFORM, NBR_EVT_ADJTMOUT, NBR_ACT_RESTRT_DD, 0}, - {NBR_STA_FLOOD, NBR_EVT_SEQ_NUM_MIS, NBR_ACT_RESTRT_DD, NBR_STA_XSTRT}, - {NBR_STA_FLOOD, NBR_EVT_BAD_LS_REQ, NBR_ACT_RESTRT_DD, NBR_STA_XSTRT}, + {NBR_STA_FLOOD, NBR_EVT_SEQ_NUM_MIS, NBR_ACT_RESTRT_DD, 0}, + {NBR_STA_FLOOD, NBR_EVT_BAD_LS_REQ, NBR_ACT_RESTRT_DD, 0}, {NBR_STA_ANY, NBR_EVT_KILL_NBR, NBR_ACT_DEL, NBR_STA_DOWN}, {NBR_STA_ANY, NBR_EVT_LL_DOWN, NBR_ACT_DEL, NBR_STA_DOWN}, {NBR_STA_ANY, NBR_EVT_ITIMER, NBR_ACT_DEL, NBR_STA_DOWN}, @@ -527,8 +527,17 @@ nbr_act_snapshot(struct nbr *nbr) { stop_db_tx_timer(nbr); + /* we need to wait for the old snapshot to finish */ + if (nbr->dd_snapshot) { + log_debug("nbr_act_snapshot: giving up, old snapshot running " + "for neigbor ID %s", inet_ntoa(nbr->id)); + return (nbr_act_restart_dd(nbr)); + } ospfe_imsg_compose_rde(IMSG_DB_SNAPSHOT, nbr->peerid, 0, NULL, 0); + nbr->dd_snapshot = 1; /* wait for IMSG_DB_END */ + nbr->state = NBR_STA_SNAP; + return (0); } diff --git a/usr.sbin/ospf6d/ospf6.h b/usr.sbin/ospf6d/ospf6.h index 8aab5e88b77..296fe1ff339 100644 --- a/usr.sbin/ospf6d/ospf6.h +++ b/usr.sbin/ospf6d/ospf6.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ospf6.h,v 1.20 2013/03/25 14:22:02 markus Exp $ */ +/* $OpenBSD: ospf6.h,v 1.21 2013/03/25 14:29:35 markus Exp $ */ /* * Copyright (c) 2004, 2005, 2007 Esben Norby <norby@openbsd.org> diff --git a/usr.sbin/ospf6d/ospf6d.h b/usr.sbin/ospf6d/ospf6d.h index 48fec773e76..5ebddcf22a7 100644 --- a/usr.sbin/ospf6d/ospf6d.h +++ b/usr.sbin/ospf6d/ospf6d.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ospf6d.h,v 1.27 2013/03/22 14:25:31 sthen Exp $ */ +/* $OpenBSD: ospf6d.h,v 1.28 2013/03/25 14:29:35 markus Exp $ */ /* * Copyright (c) 2004, 2007 Esben Norby <norby@openbsd.org> @@ -112,6 +112,7 @@ enum imsg_type { IMSG_DB_END, IMSG_LS_REQ, IMSG_LS_UPD, + IMSG_LS_SNAP, IMSG_LS_ACK, IMSG_LS_FLOOD, IMSG_LS_BADREQ, diff --git a/usr.sbin/ospf6d/ospfe.c b/usr.sbin/ospf6d/ospfe.c index 679e046c596..cdb6510db0d 100644 --- a/usr.sbin/ospf6d/ospfe.c +++ b/usr.sbin/ospf6d/ospfe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfe.c,v 1.40 2013/03/22 14:25:31 sthen Exp $ */ +/* $OpenBSD: ospfe.c,v 1.41 2013/03/25 14:29:35 markus Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -484,6 +484,8 @@ ospfe_dispatch_rde(int fd, short event, void *bula) nbr = nbr_find_peerid(imsg.hdr.peerid); if (nbr == NULL) break; + if (nbr->state != NBR_STA_SNAP) /* discard */ + break; /* add LSA header to the neighbor db_sum_list */ lhp = lsa_hdr_new(); @@ -495,6 +497,10 @@ ospfe_dispatch_rde(int fd, short event, void *bula) if (nbr == NULL) break; + nbr->dd_snapshot = 0; + if (nbr->state != NBR_STA_SNAP) + break; + /* snapshot done, start tx of dd packets */ nbr_fsm(nbr, NBR_EVT_SNAP_DONE); break; @@ -584,12 +590,14 @@ ospfe_dispatch_rde(int fd, short event, void *bula) lsa_cache_put(ref, nbr); break; case IMSG_LS_UPD: + case IMSG_LS_SNAP: /* - * IMSG_LS_UPD is used in three cases: + * IMSG_LS_UPD is used in two cases: * 1. as response to ls requests * 2. as response to ls updates where the DB * is newer then the sent LSA - * 3. in EXSTART when the LSA has age MaxAge + * IMSG_LS_SNAP is used in one case: + * in EXSTART when the LSA has age MaxAge */ l = imsg.hdr.len - IMSG_HEADER_SIZE; if (l < sizeof(lsa_hdr)) @@ -603,6 +611,10 @@ ospfe_dispatch_rde(int fd, short event, void *bula) if (nbr->iface->self == nbr) break; + if (imsg.hdr.type == IMSG_LS_SNAP && + nbr->state != NBR_STA_SNAP) + break; + memcpy(&age, imsg.data, sizeof(age)); ref = lsa_cache_add(imsg.data, l); if (ntohs(age) >= MAX_AGE) diff --git a/usr.sbin/ospf6d/ospfe.h b/usr.sbin/ospf6d/ospfe.h index 3c4ebcca9d3..5877775d721 100644 --- a/usr.sbin/ospf6d/ospfe.h +++ b/usr.sbin/ospf6d/ospfe.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfe.h,v 1.17 2010/08/22 20:27:52 bluhm Exp $ */ +/* $OpenBSD: ospfe.h,v 1.18 2013/03/25 14:29:35 markus Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -93,6 +93,7 @@ struct nbr { u_int8_t last_rx_bits; u_int8_t dd_master; u_int8_t dd_more; + u_int8_t dd_snapshot; /* snapshot running */ }; /* database.c */ diff --git a/usr.sbin/ospf6d/rde_lsdb.c b/usr.sbin/ospf6d/rde_lsdb.c index 40b5a812f08..19d5c3e2dd3 100644 --- a/usr.sbin/ospf6d/rde_lsdb.c +++ b/usr.sbin/ospf6d/rde_lsdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_lsdb.c,v 1.35 2010/08/22 20:55:10 bluhm Exp $ */ +/* $OpenBSD: rde_lsdb.c,v 1.36 2013/03/25 14:29:35 markus Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org> @@ -701,7 +701,7 @@ lsa_snap(struct rde_nbr *nbr, u_int32_t peerid) continue; lsa_age(v); if (ntohs(v->lsa->hdr.age) >= MAX_AGE) { - rde_imsg_compose_ospfe(IMSG_LS_UPD, peerid, + rde_imsg_compose_ospfe(IMSG_LS_SNAP, peerid, 0, &v->lsa->hdr, ntohs(v->lsa->hdr.len)); } else { rde_imsg_compose_ospfe(IMSG_DB_SNAPSHOT, peerid, |