diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-02-09 22:58:09 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-02-09 22:58:09 +0000 |
commit | 310fe11715f87bf19aec652c96475cf4b4e3d383 (patch) | |
tree | 82988674fcfed18a5a04feddf6f324c12374ea0b | |
parent | 5c5f3bb5efbbc23618e67cedd29640c384fbf75d (diff) |
Fix premature ageing of self originating LSA. Still not perfect but better
than before where it just failed to work.
-rw-r--r-- | usr.sbin/ospfd/rde.c | 16 | ||||
-rw-r--r-- | usr.sbin/ospfd/rde.h | 3 | ||||
-rw-r--r-- | usr.sbin/ospfd/rde_lsdb.c | 11 |
3 files changed, 23 insertions, 7 deletions
diff --git a/usr.sbin/ospfd/rde.c b/usr.sbin/ospfd/rde.c index b835a90515c..d52d0cc0b6a 100644 --- a/usr.sbin/ospfd/rde.c +++ b/usr.sbin/ospfd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.4 2005/02/09 20:40:23 claudio Exp $ */ +/* $OpenBSD: rde.c,v 1.5 2005/02/09 22:58:08 claudio Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org> @@ -558,3 +558,17 @@ rde_nbr_loading(struct area *area) return (0); } +struct rde_nbr * +rde_nbr_self(struct area *area) +{ + struct rde_nbr *nbr; + + LIST_FOREACH(nbr, &area->nbr_list, entry) + if (nbr->self) + return (nbr); + + /* this may not happen */ + fatalx("rde_nbr_self: area without self"); + return (NULL); +} + diff --git a/usr.sbin/ospfd/rde.h b/usr.sbin/ospfd/rde.h index 404c036c70a..80e70023491 100644 --- a/usr.sbin/ospfd/rde.h +++ b/usr.sbin/ospfd/rde.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.h,v 1.3 2005/02/09 20:40:23 claudio Exp $ */ +/* $OpenBSD: rde.h,v 1.4 2005/02/09 22:58:08 claudio Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -62,6 +62,7 @@ int rde_imsg_compose_ospfe(int, u_int32_t, pid_t, void *, u_int32_t rde_router_id(void); void rde_nbr_del(struct rde_nbr *); int rde_nbr_loading(struct area *); +struct rde_nbr *rde_nbr_self(struct area *); /* rde_lsdb.c */ void lsa_init(struct lsa_tree *); diff --git a/usr.sbin/ospfd/rde_lsdb.c b/usr.sbin/ospfd/rde_lsdb.c index 2b32a76c4bf..79af6ed4c61 100644 --- a/usr.sbin/ospfd/rde_lsdb.c +++ b/usr.sbin/ospfd/rde_lsdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_lsdb.c,v 1.8 2005/02/09 20:44:37 claudio Exp $ */ +/* $OpenBSD: rde_lsdb.c,v 1.9 2005/02/09 22:58:08 claudio Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org> @@ -309,9 +309,10 @@ self: * the dummy LSA will be reflooded via the default timeout * handler. */ - lsa_add(nbr, dummy); + lsa_add(rde_nbr_self(nbr->area), dummy); return (1); } + /* * LSA is still originated, just reflood it. But we need to create * a new instance by setting the LSA sequence number equal to the @@ -346,7 +347,7 @@ lsa_add(struct rde_nbr *nbr, struct lsa *lsa) /* timeout handling either MAX_AGE or LS_REFRESH_TIME */ timerclear(&tv); - if (nbr->self) + if (nbr->self && ntohs(new->lsa->hdr.age) == DEFAULT_AGE) tv.tv_sec = LS_REFRESH_TIME; else tv.tv_sec = MAX_AGE - ntohs(new->lsa->hdr.age); @@ -464,9 +465,9 @@ lsa_timeout(int fd, short event, void *bula) lsa_age(v); - log_debug("lsa_timeout: REFLOOD"); + log_debug("lsa_timeout: REFLOOD age %d", ntohs(v->lsa->hdr.age)); - if (v->nbr->self && v->lsa->hdr.age != htons(MAX_AGE)) + if (v->nbr->self && ntohs(v->lsa->hdr.age) < MAX_AGE) lsa_refresh(v); rde_imsg_compose_ospfe(IMSG_LS_FLOOD, v->nbr->peerid, 0, |