Ethereal-dev: [ethereal-dev] Quick OSPF improvements

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Craig Metz <cmetz@xxxxxxxxx>
Date: Wed, 13 Sep 2000 02:50:39 -0400
  Find enclosed two quick improvements to the OSPF packet decode.

  First is to decode type 7 LSAs (NSSA AS external), which have basically the
same contents as type 5 LSAs (backbone AS external).

  Second is to print the LS checksum as a four digit hexadecimal number. This
is what every router I've seen does, and having the value displayed by
Ethereal be directly comparable with those displayed in a router's LSA database
would be very helpful.

                                                                        -Craig

diff -ur ethereal-0.8.10/packet-ospf.c ethereal-0.8.10+cmetz/packet-ospf.c
--- ethereal-0.8.10/packet-ospf.c	Tue Jul  4 08:12:23 2000
+++ ethereal-0.8.10+cmetz/packet-ospf.c	Tue Jul 25 02:10:34 2000
@@ -691,6 +691,9 @@
         case OSPF_LSTYPE_ASEXT:
 	    lsa_type="AS-external-LSA";
             break;
+        case OSPF_LSTYPE_ASEXT7:
+	    lsa_type="AS-external-LSA Type 7/NSSA";
+            break;
         case OSPF_LSTYPE_OP_LINKLOCAL:
 	    lsa_type="Opaque LSA, Link-local scope";
             break;
@@ -732,7 +735,7 @@
 	                                             ip_to_str((guint8 *) &(lsa_hdr.adv_router)));
         proto_tree_add_text(ospf_lsa_tree, NullTVB, offset + 12, 4, "LS Sequence Number: 0x%04lx ", 
 	                                             (unsigned long)ntohl(lsa_hdr.ls_seq));
-        proto_tree_add_text(ospf_lsa_tree, NullTVB, offset + 16, 2, "LS Checksum: %d ", ntohs(lsa_hdr.ls_checksum));
+        proto_tree_add_text(ospf_lsa_tree, NullTVB, offset + 16, 2, "LS Checksum: %04x ", ntohs(lsa_hdr.ls_checksum));
 
         proto_tree_add_text(ospf_lsa_tree, NullTVB, offset + 18, 2, "Length: %d ", ntohs(lsa_hdr.length));
 
@@ -831,6 +834,7 @@
                 /* returns only the TOS 0 metric (even if there are more TOS metrics) */
                 break;
             case(OSPF_LSTYPE_ASEXT):
+            case(OSPF_LSTYPE_ASEXT7):
                 memcpy(&summary_lsa, &pd[offset], sizeof(e_ospf_summary_lsa));
                 proto_tree_add_text(ospf_lsa_tree, NullTVB, offset, 4, "Netmask: %s", 
                                                   ip_to_str((guint8 *) &(summary_lsa.network_mask)));
diff -ur ethereal-0.8.10/packet-ospf.h ethereal-0.8.10+cmetz/packet-ospf.h
--- ethereal-0.8.10/packet-ospf.h	Tue Jul  4 08:12:23 2000
+++ ethereal-0.8.10+cmetz/packet-ospf.h	Tue Jul 25 01:50:19 2000
@@ -31,6 +31,7 @@
 #define OSPF_LSTYPE_SUMMERY	3
 #define OSPF_LSTYPE_ASBR	4
 #define OSPF_LSTYPE_ASEXT	5
+#define OSPF_LSTYPE_ASEXT7	7
 
 /* Opaque LSA types */
 #define OSPF_LSTYPE_OP_LINKLOCAL 9
Only in ethereal-0.8.10: ps.c
Only in ethereal-0.8.10: register.c
Only in ethereal-0.8.10+cmetz: tethereal.1