summaryrefslogtreecommitdiffstats
path: root/ospf6d/ospf6_lsa.c
diff options
context:
space:
mode:
authorAvneesh Sachdev <avneesh@opensourcerouting.org>2012-04-09 00:25:15 -0700
committerAvneesh Sachdev <avneesh@opensourcerouting.org>2012-04-09 00:25:15 -0700
commit3cf6c2b4e43f44a977d218c96c26250654ae333e (patch)
treee017cde2015fbf3ef6c250327428d7c6152aa8f7 /ospf6d/ospf6_lsa.c
parent01d7ff0a2166a422c56bd26f04fc22832a9e690b (diff)
parente96b312150d8e376c1ef463793d1929eca3618d5 (diff)
downloadquagga-3cf6c2b4e43f44a977d218c96c26250654ae333e.tar.bz2
quagga-3cf6c2b4e43f44a977d218c96c26250654ae333e.tar.xz
Merge branch 'quagga' into google-bgp-multipath
Conflicts: bgpd/bgp_route.c
Diffstat (limited to 'ospf6d/ospf6_lsa.c')
-rw-r--r--ospf6d/ospf6_lsa.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c
index 588b9462..e65752d8 100644
--- a/ospf6d/ospf6_lsa.c
+++ b/ospf6d/ospf6_lsa.c
@@ -163,9 +163,19 @@ ospf6_lsa_is_changed (struct ospf6_lsa *lsa1,
return 1;
if (ntohs (lsa1->header->length) != ntohs (lsa2->header->length))
return 1;
+ /* Going beyond LSA headers to compare the payload only makes sense, when both LSAs aren't header-only. */
+ if (CHECK_FLAG (lsa1->flag, OSPF6_LSA_HEADERONLY) != CHECK_FLAG (lsa2->flag, OSPF6_LSA_HEADERONLY))
+ {
+ zlog_warn ("%s: only one of two (%s, %s) LSAs compared is header-only", __func__, lsa1->name, lsa2->name);
+ return 1;
+ }
+ if (CHECK_FLAG (lsa1->flag, OSPF6_LSA_HEADERONLY))
+ return 0;
length = OSPF6_LSA_SIZE (lsa1->header) - sizeof (struct ospf6_lsa_header);
- assert (length > 0);
+ /* Once upper layer verifies LSAs received, length underrun should become a warning. */
+ if (length <= 0)
+ return 0;
return memcmp (OSPF6_LSA_HEADER_END (lsa1->header),
OSPF6_LSA_HEADER_END (lsa2->header), length);