summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2005-05-24 07:13:01 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2005-05-24 07:13:01 +0000
commitff0ca47f2e9361d0aa132a365c75d0a49f496d00 (patch)
tree005c781ecb11f84a1f43fde2a5d55a9feed2fa9f /usr.sbin
parentf47e823e3507b0596393156b5d9b4ed27c6a5d14 (diff)
In lsa_merge() check if the LSA changed. If it did not change just free the
new one and use the old one. This will reduce the amount of updates sent. OK norby@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ospfd/rde_lsdb.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/usr.sbin/ospfd/rde_lsdb.c b/usr.sbin/ospfd/rde_lsdb.c
index f5686a35d43..5239f7b2cac 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.14 2005/05/24 06:55:21 claudio Exp $ */
+/* $OpenBSD: rde_lsdb.c,v 1.15 2005/05/24 07:13:00 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org>
@@ -578,10 +578,18 @@ lsa_merge(struct rde_nbr *nbr, struct lsa *lsa, struct vertex *v)
return;
}
- /* TODO check for changes */
-
- /* set the seq_num to the current on. lsa_refresh() will do the ++ */
+ /* set the seq_num to the current one. lsa_refresh() will do the ++ */
lsa->hdr.seq_num = v->lsa->hdr.seq_num;
+
+ /* compare LSA most header fields are equal so don't check them */
+ if (lsa->hdr.len == v->lsa->hdr.len &&
+ lsa->hdr.opts == v->lsa->hdr.opts &&
+ memcmp(&lsa->data, &v->lsa->data, ntohs(lsa->hdr.len) -
+ sizeof(struct lsa_hdr)) == 0) {
+ free(lsa);
+ return;
+ }
+
/* overwrite the lsa all other fields are unaffected */
free(v->lsa);
v->lsa = lsa;