]> The Tcpdump Group git mirrors - tcpdump/commitdiff
- fix a compiler padding issue in the LS-Request structure
authorhannes <hannes>
Wed, 22 Oct 2003 17:08:45 +0000 (17:08 +0000)
committerhannes <hannes>
Wed, 22 Oct 2003 17:08:45 +0000 (17:08 +0000)
    u_int32_t ls_type becomes
    u_int8_t  ls_type[4];

- teach the LS-Request decoder howto properly print Opaque LSAs

ospf.h
print-ospf.c

diff --git a/ospf.h b/ospf.h
index 66fe0d842176472423113abcff0377755dd4fcfc..17b8d778ed56f87b18d49104fb28e2e258fb8588 100644 (file)
--- a/ospf.h
+++ b/ospf.h
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/ospf.h,v 1.10 2003-10-04 14:29:52 hannes Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/ospf.h,v 1.11 2003-10-22 17:08:46 hannes Exp $ (LBL) */
 /*
  * Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
  *     The Regents of the University of California.  All rights reserved.
@@ -255,8 +255,14 @@ struct ospfhdr {
 
        /* Link State Request */
        struct lsr {
-           u_int32_t ls_type;
-           struct in_addr ls_stateid;
+           u_int8_t ls_type[4];
+            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];
+                } opaque_field;
+            } un_ls_stateid;
            struct in_addr ls_router;
        } un_lsr[1];            /* may repeat   */
 
index 6ba3176c348251acbfeb6cb4816596f757b66467..9eeadfc5fb2a5fb5f8d5f6eeb491711d5fbbcaeb 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ospf.c,v 1.43 2003-10-22 16:29:18 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ospf.c,v 1.44 2003-10-22 17:08:45 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -629,14 +629,30 @@ ospf_decode_v2(register const struct ospfhdr *op,
        case OSPF_TYPE_LS_REQ:
                 lsrp = op->ospf_lsr;
                 while ((u_char *)lsrp < dataend) {
-                        TCHECK(*lsrp);
-
-                        printf("\n\t  %s LSA (%d), LSA-ID: %s, Advertising Router: %s",
-                               tok2str(lsa_values,"unknown",lsrp->ls_type),
-                               lsrp->ls_type,
-                               ipaddr_string(&lsrp->ls_stateid),
-                               ipaddr_string(&lsrp->ls_router));
-                        ++lsrp;
+                    TCHECK(*lsrp);
+
+                    printf("\n\t  Advertising Router: %s, %s LSA (%u)",
+                           ipaddr_string(&lsrp->ls_router),
+                           tok2str(lsa_values,"unknown",EXTRACT_32BITS(lsrp->ls_type)),
+                           EXTRACT_32BITS(&lsrp->ls_type));
+
+                    switch (EXTRACT_32BITS(lsrp->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(", Opaque-Type: %s LSA (%u), Opaque-ID: %u",
+                               tok2str(lsa_opaque_values, "unknown",lsrp->un_ls_stateid.opaque_field.opaque_type),
+                               lsrp->un_ls_stateid.opaque_field.opaque_type,
+                               EXTRACT_24BITS(&lsrp->un_ls_stateid.opaque_field.opaque_id));
+                        break;
+                    default:
+                        printf(", LSA-ID: %s",
+                               ipaddr_string(&lsrp->un_ls_stateid.ls_stateid));
+                        break;
+                    }
+                    
+                    ++lsrp;
                 }
                break;