avoid use of bitfield in packet format definition. it is non-portable

(packing constraint is unknown).
avoid use of u_int8_t bitfield.  it is illegal.
This commit is contained in:
itojun 2000-01-02 13:15:53 +00:00
parent 47956fff3f
commit f5507e1557
2 changed files with 23 additions and 19 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: isakmp.h,v 1.2 1999/07/04 02:57:51 itojun Exp $ */
/* $NetBSD: isakmp.h,v 1.3 2000/01/02 13:15:53 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -100,20 +100,18 @@ typedef struct { /* i_cookie + r_cookie */
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
struct isakmp {
cookie_t i_ck; /* Initiator Cookie */
cookie_t r_ck; /* Responder Cookie */
u_int8_t np; /* Next Payload Type */
#if BYTE_ORDER == LITTLE_ENDIAN
u_int8_t v_min:4, /* MnVer */
v_maj:4; /* MjVer */
#else
u_int8_t v_maj:4, /* MnVer */
v_min:4; /* MjVer */
#endif
u_int8_t etype; /* Exchange Type */
u_int8_t flags; /* Flags */
msgid_t msgid;
u_int32_t len; /* Length */
cookie_t i_ck; /* Initiator Cookie */
cookie_t r_ck; /* Responder Cookie */
u_int8_t np; /* Next Payload Type */
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;
u_int32_t len; /* Length */
};
/* Next Payload Type */

View File

@ -1,4 +1,4 @@
/* $NetBSD: print-isakmp.c,v 1.3 1999/12/10 05:45:08 itojun Exp $ */
/* $NetBSD: print-isakmp.c,v 1.4 2000/01/02 13:15:54 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -36,7 +36,7 @@ static const char rcsid[] =
"@(#) KAME Header: /cvsroot/kame/kame/kame/kame/tcpdump/print-isakmp.c,v 1.3 1999/12/01 01:41:25 itojun Exp";
#else
#include <sys/cdefs.h>
__RCSID("$NetBSD: print-isakmp.c,v 1.3 1999/12/10 05:45:08 itojun Exp $");
__RCSID("$NetBSD: print-isakmp.c,v 1.4 2000/01/02 13:15:54 itojun Exp $");
#endif
#endif
@ -965,6 +965,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;
@ -975,8 +976,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 ");