]> The Tcpdump Group git mirrors - tcpdump/commitdiff
fix isakmp version # field handling.
authoritojun <itojun>
Fri, 7 Jan 2000 14:09:02 +0000 (14:09 +0000)
committeritojun <itojun>
Fri, 7 Jan 2000 14:09:02 +0000 (14:09 +0000)
- previous change (attempt to avoid non-"int" bitfield) broke the structure
  alignment/size.  we've fixed it to u_int8_t.
- we nuked use of bitfield.

isakmp.h
print-isakmp.c

index da793e1ff1749b6ada605c08da63fa8c2900537c..3dfee757197ef97812869eef5a1fe2259aa6ff7d 100644 (file)
--- a/isakmp.h
+++ b/isakmp.h
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-/* YIPS @(#)$Id: isakmp.h,v 1.4 1999-12-22 06:27:20 itojun Exp $ */
+/* YIPS @(#)$Id: isakmp.h,v 1.5 2000-01-07 14:09:02 itojun Exp $ */
 
 /* refer to RFC 2408 */
 
@@ -101,13 +101,11 @@ struct isakmp {
        cookie_t i_ck;          /* Initiator Cookie */
        cookie_t r_ck;          /* Responder Cookie */
        u_int8_t np;            /* Next Payload Type */
-#if defined(WORDS_BIGENDIAN) || (defined(BYTE_ORDER) && (BYTE_ORDER == BIG_ENDIAN))
-       u_int v_maj:4,          /* MnVer */
-               v_min:4;        /* MjVer */
-#else
-       u_int v_min:4,          /* MnVer */
-               v_maj:4;        /* MjVer */
-#endif
+       u_int8_t vers;
+#define ISAKMP_VERS_MAJOR      0xf0
+#define ISAKMP_VERS_MAJOR_SHIFT        4
+#define ISAKMP_VERS_MINOR      0x0f
+#define ISAKMP_VERS_MINOR_SHIFT        0
        u_int8_t etype;         /* Exchange Type */
        u_int8_t flags;         /* Flags */
        msgid_t msgid;
index 02b7ca4819c348f3c864cbf9ad08f0193e089090..8d19c3a8357d888d5ff31517c5c795a700e197f3 100644 (file)
@@ -30,7 +30,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.8 1999-11-21 09:36:54 fenner Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.9 2000-01-07 14:09:02 itojun Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -1001,6 +1001,7 @@ isakmp_print(const u_char *bp, u_int length, const u_char *bp2)
        u_char np;
        int i;
        int phase;
+       int major, minor;
 
        base = (struct isakmp *)bp;
        ep = (u_char *)snapend;
@@ -1011,8 +1012,13 @@ isakmp_print(const u_char *bp, u_int length, const u_char *bp2)
        }
 
        printf("isakmp");
-       if (vflag)
-               printf(" %d.%d", base->v_maj, base->v_min);
+       if (vflag) {
+               major = (base->vers & ISAKMP_VERS_MAJOR)
+                               >> ISAKMP_VERS_MAJOR_SHIFT;
+               minor = (base->vers & ISAKMP_VERS_MINOR)
+                               >> ISAKMP_VERS_MINOR_SHIFT;
+               printf(" %d.%d", major, minor);
+       }
 
        if (vflag) {
                printf(" msgid ");