]> The Tcpdump Group git mirrors - tcpdump/commitdiff
show opaque-LSA specific fields of the LSA header
authorhannes <hannes>
Fri, 3 Oct 2003 13:00:33 +0000 (13:00 +0000)
committerhannes <hannes>
Fri, 3 Oct 2003 13:00:33 +0000 (13:00 +0000)
ospf.h
print-ospf.c

diff --git a/ospf.h b/ospf.h
index 08e4e0953bc01fc9f9fe419a94fec2dea82a0e95..6da06a0650b95e2790f173ebdeae5acea4664b05 100644 (file)
--- a/ospf.h
+++ b/ospf.h
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/ospf.h,v 1.8 2003-10-02 13:35:52 hannes Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/ospf.h,v 1.9 2003-10-03 13:00:33 hannes Exp $ (LBL) */
 /*
  * Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
  *     The Regents of the University of California.  All rights reserved.
@@ -107,7 +107,13 @@ struct lsa_hdr {
     u_int16_t ls_age;
     u_int8_t ls_options;
     u_int8_t ls_type;
-    struct in_addr ls_stateid;
+    union {
+        struct in_addr ls_stateid;
+        struct { /* opaque LSAs change the LSA-ID field */
+            u_int8_t opaque_type;
+            u_int8_t opaque_id[3];
+       };
+    };
     struct in_addr ls_router;
     u_int32_t ls_seq;
     u_int16_t ls_chksum;
@@ -162,16 +168,6 @@ struct lsa {
            struct in_addr mcla_vid;
        } un_mcla[1];
 
-       /* Opaque LSA */
-       struct opaque {
-           u_int8_t opaque_type;
-           u_int8_t opaque_id[3];
-           struct in_addr adv_router;
-           struct in_addr sequence_num;
-           u_int16_t chksum;
-            u_int16_t length;
-       } un_opaque[1];
-
         /* Unknown LSA */
         struct unknown {
            u_int8_t data[1]; /* may repeat   */
index 6cb6f98d894f78d82117775481a71bc1c1d86107..eaf0bb3e33c55a691639e8408253d292e596060f 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ospf.c,v 1.37 2003-10-02 13:35:52 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ospf.c,v 1.38 2003-10-03 13:00:33 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -144,13 +144,36 @@ ospf_print_lsa(register const struct lsa *lsap)
        register const u_int32_t *lp;
        register int j, k;
 
-        printf("\n\t  %s LSA (%d), LSA-ID: %s, Advertising Router: %s, seq 0x%08x, age %us",
-               tok2str(lsa_values,"unknown",lsap->ls_hdr.ls_type),
-               lsap->ls_hdr.ls_type,
-               ipaddr_string(&lsap->ls_hdr.ls_stateid),
-               ipaddr_string(&lsap->ls_hdr.ls_router),
-               EXTRACT_32BITS(&lsap->ls_hdr.ls_seq),
-               EXTRACT_16BITS(&lsap->ls_hdr.ls_age));
+        switch (lsap->ls_hdr.ls_type) {
+
+       /* the LSA header for opaque LSAs was slightly changed */
+        case LS_TYPE_OPAQUE_LL:
+        case LS_TYPE_OPAQUE_AL:
+        case LS_TYPE_OPAQUE_DW:
+
+            printf("\n\t  %s LSA (%d), Opaque-Type: %u, Opaque-ID: %u, Adv. Router: %s, seq 0x%08x, age %us",
+                  tok2str(lsa_values,"unknown",lsap->ls_hdr.ls_type),
+                  (lsap->ls_hdr.ls_type),
+                  *(&lsap->ls_hdr.opaque_type),
+                  EXTRACT_24BITS(&lsap->ls_hdr.opaque_id),
+                  ipaddr_string(&lsap->ls_hdr.ls_router),
+                  EXTRACT_32BITS(&lsap->ls_hdr.ls_seq),
+                  EXTRACT_16BITS(&lsap->ls_hdr.ls_age));
+
+           break;
+
+       /* all other LSA types use regular style LSA headers */
+       default:
+           printf("\n\t  %s LSA (%d), LSA-ID: %s, Adv. Router: %s, seq 0x%08x, age %us",
+                  tok2str(lsa_values,"unknown",lsap->ls_hdr.ls_type),
+                  lsap->ls_hdr.ls_type,
+                  ipaddr_string(&lsap->ls_hdr.ls_stateid),
+                  ipaddr_string(&lsap->ls_hdr.ls_router),
+                  EXTRACT_32BITS(&lsap->ls_hdr.ls_seq),
+                  EXTRACT_16BITS(&lsap->ls_hdr.ls_age));
+           break;
+       }
+
         printf("\n\t    Options: %s", bittok2str(ospf_option_values,"none",lsap->ls_hdr.ls_options));
 
        TCHECK(lsap->ls_hdr.ls_length);