diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2009-03-12 01:21:50 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2009-03-12 01:21:50 +0000 |
commit | df1f1951ead3dc980478947ee0d01a380808b44b (patch) | |
tree | a7821d510c20774d42b72f9d43746daef3fcf158 /usr.sbin/ospf6d/rde.c | |
parent | 16b28103432692f21f24ff02f6d001f50a29c7f3 (diff) |
lsa_self() did too many things at once, and had too much logic
buried inside of it that its caller relied on.
So split it up as follows:
lsa_self() Check whether an LSA is self-originated.
lsa_flush() Flush an LSA from the LSDB.
lsa_reflood() Prepare an LSA for reflooding (actual reflooding currently
requires sending an imsg which must be done by the caller).
ok claudio@
Diffstat (limited to 'usr.sbin/ospf6d/rde.c')
-rw-r--r-- | usr.sbin/ospf6d/rde.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/usr.sbin/ospf6d/rde.c b/usr.sbin/ospf6d/rde.c index dab6850c231..c16e46aa1ae 100644 --- a/usr.sbin/ospf6d/rde.c +++ b/usr.sbin/ospf6d/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.25 2009/03/07 00:33:13 stsp Exp $ */ +/* $OpenBSD: rde.c,v 1.26 2009/03/12 01:21:49 stsp Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org> @@ -429,10 +429,17 @@ rde_dispatch_imsg(int fd, short event, void *bula) rde_req_list_del(nbr, &lsa->hdr); - if (!(self = lsa_self(nbr, lsa, v))) - if (lsa_add(nbr, lsa)) - /* delayed lsa */ - break; + self = lsa_self(lsa); + if (self) { + if (v == NULL) + /* LSA is no longer announced, + * remove by premature aging. */ + lsa_flush(nbr, lsa); + else + lsa_reflood(v, lsa); + } else if (lsa_add(nbr, lsa)) + /* delayed lsa, don't flood yet */ + break; /* flood and perhaps ack LSA */ imsg_compose(ibuf_ospfe, IMSG_LS_FLOOD, @@ -444,7 +451,7 @@ rde_dispatch_imsg(int fd, short event, void *bula) imsg_compose(ibuf_ospfe, IMSG_LS_FLOOD, v->peerid, 0, v->lsa, ntohs(v->lsa->hdr.len)); - /* lsa not added so free it */ + /* new LSA was not added so free it */ if (self) free(lsa); } else if (r < 0) { |