summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ospfd/ChangeLog8
-rw-r--r--ospfd/ospf_dump.c4
-rw-r--r--ospfd/ospf_flood.c2
-rw-r--r--ospfd/ospf_lsa.c19
4 files changed, 23 insertions, 10 deletions
diff --git a/ospfd/ChangeLog b/ospfd/ChangeLog
index fa901ced..5c4a6702 100644
--- a/ospfd/ChangeLog
+++ b/ospfd/ChangeLog
@@ -1,3 +1,11 @@
+2004-05-31 Sagun Shakya <sagun.shakya@sun.com>
+
+ * ospf_dump.c: (ospf_lsa_header_dump) LOOKUP can return null if
+ index is out of range.
+ ospf_flood.c: endianness fix
+ ospf_lsa.c: Missing ntohl's on (struct lsa *)->data->ls_seqnum
+ in various places.
+
2004-05-10 Hasso Tepper <hasso@estpak.ee>
* ospf_zebra.c, ospfd.c: Move ospf_prefix_list_update() function
diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c
index fe75a960..ccee1d6b 100644
--- a/ospfd/ospf_dump.c
+++ b/ospfd/ospf_dump.c
@@ -325,12 +325,14 @@ ospf_dd_flags_dump (u_char flags, char *buf, size_t size)
void
ospf_lsa_header_dump (struct lsa_header *lsah)
{
+ char *lsah_type = LOOKUP (ospf_lsa_type_msg, lsah->type);
+
zlog_info (" LSA Header");
zlog_info (" LS age %d", ntohs (lsah->ls_age));
zlog_info (" Options %d (%s)", lsah->options,
ospf_options_dump (lsah->options));
zlog_info (" LS type %d (%s)", lsah->type,
- LOOKUP (ospf_lsa_type_msg, lsah->type));
+ (lsah->type ? lsah->type : "unknown type"));
zlog_info (" Link State ID %s", inet_ntoa (lsah->id));
zlog_info (" Advertising Router %s", inet_ntoa (lsah->adv_router));
zlog_info (" LS sequence number 0x%lx", (u_long)ntohl (lsah->ls_seqnum));
diff --git a/ospfd/ospf_flood.c b/ospfd/ospf_flood.c
index 22611d8d..71910dd7 100644
--- a/ospfd/ospf_flood.c
+++ b/ospfd/ospf_flood.c
@@ -121,7 +121,7 @@ ospf_process_self_originated_lsa (struct ospf *ospf,
if (IS_DEBUG_OSPF_EVENT)
zlog_info ("LSA[Type%d:%s]: Process self-originated LSA seq 0x%lx",
new->data->type, inet_ntoa (new->data->id),
- (u_long)new->data->ls_seqnum);
+ ntohl(new->data->ls_seqnum));
/* If we're here, we installed a self-originated LSA that we received
from a neighbor, i.e. it's more recent. We must see whether we want
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index 4711f0fe..b7550b13 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -2380,9 +2380,9 @@ ospf_router_lsa_install (struct ospf *ospf,
area->router_lsa_self = ospf_lsa_lock (new);
if (IS_DEBUG_OSPF (lsa, LSA_INSTALL))
- zlog_info("LSA[Type%d]: ID %s seq 0x%x is self-originated",
- new->data->type, inet_ntoa (new->data->id),
- new->data->ls_seqnum);
+ zlog_info("LSA[Type%d]: ID %s seq 0x%x is self-originated",
+ new->data->type, inet_ntoa (new->data->id),
+ ntohl(new->data->ls_seqnum));
}
return new;
@@ -2652,12 +2652,13 @@ ospf_lsa_install (struct ospf *ospf, struct ospf_interface *oi,
can be originated. "
*/
- if (lsa->data->ls_seqnum - 1 == htonl(OSPF_MAX_SEQUENCE_NUMBER))
+ if (ntohl(lsa->data->ls_seqnum) - 1 == htonl(OSPF_MAX_SEQUENCE_NUMBER)
{
if (ospf_lsa_is_self_originated(ospf, lsa))
{
- lsa->data->ls_seqnum = htonl(OSPF_MAX_SEQUENCE_NUMBER);
- if (!IS_LSA_MAXAGE(lsa))
+ lsa->data->ls_seqnum = htonl(OSPF_MAX_SEQUENCE_NUMBER);
+
+ if (!IS_LSA_MAXAGE(lsa))
lsa->flags |= OSPF_LSA_PREMATURE_AGE;
lsa->data->ls_age = htons (OSPF_LSA_MAXAGE);
@@ -2769,8 +2770,10 @@ ospf_lsa_install (struct ospf *ospf, struct ospf_interface *oi,
(IS_LSA_MAXAGE (new) && !IS_LSA_SELF (new)))
{
if (IS_DEBUG_OSPF (lsa, LSA_INSTALL))
- zlog_info ("LSA[Type%d:%s]: Install LSA 0x%lx, MaxAge",
- new->data->type, inet_ntoa (new->data->id), (u_long)lsa);
+ zlog_info ("LSA[Type%d:%s]: Install LSA 0x%p, MaxAge",
+ new->data->type,
+ inet_ntoa (new->data->id),
+ lsa);
ospf_lsa_maxage (ospf, lsa);
}