X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/e89409254248af64db721ede4babbe9fd1753f6c..f243e70b91b9a25a4cda052f37f48fb5aa49bf39:/print-esp.c diff --git a/print-esp.c b/print-esp.c index 4e1c67b0..a57e072b 100644 --- a/print-esp.c +++ b/print-esp.c @@ -23,7 +23,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.7 2000-09-23 08:03:34 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.17 2000-12-12 09:58:41 itojun Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -36,17 +36,7 @@ static const char rcsid[] = #include #include -#include -#include - #include -#include -#include -#include -#include -#include -#include -#include #ifdef HAVE_LIBCRYPTO #include @@ -61,33 +51,12 @@ static const char rcsid[] = #include +#include "ip.h" +#include "esp.h" #ifdef INET6 -#include +#include "ip6.h" #endif -/* there's no standard definition so we are on our own */ -struct esp { - u_int32_t esp_spi; /* ESP */ - /*variable size, 32bit bound*/ /* Initialization Vector */ - /*variable size*/ /* Payload data */ - /*variable size*/ /* padding */ - /*8bit*/ /* pad size */ - /*8bit*/ /* next header */ - /*8bit*/ /* next header */ - /*variable size, 32bit bound*/ /* Authentication data (new IPsec) */ -}; - -struct newesp { - u_int32_t esp_spi; /* ESP */ - u_int32_t esp_seq; /* Sequence number */ - /*variable size*/ /* (IV and) Payload data */ - /*variable size*/ /* padding */ - /*8bit*/ /* pad size */ - /*8bit*/ /* next header */ - /*8bit*/ /* next header */ - /*variable size, 32bit bound*/ /* Authentication data */ -}; - #include "interface.h" #include "addrtoname.h" @@ -111,14 +80,14 @@ esp_print(register const u_char *bp, register const u_char *bp2, int *nhdr) esp = (struct esp *)bp; spi = (u_int32_t)ntohl(esp->esp_spi); - /* 'ep' points to the end of avaible data. */ + /* 'ep' points to the end of available data. */ ep = snapend; if ((u_char *)(esp + 1) >= ep - sizeof(struct esp)) { fputs("[|ESP]", stdout); goto fail; } - printf("ESP(spi=%u", spi); + printf("ESP(spi=0x%08x", spi); printf(",seq=0x%x", (u_int32_t)ntohl(*(u_int32_t *)(esp + 1))); printf(")"); @@ -163,7 +132,7 @@ esp_print(register const u_char *bp, register const u_char *bp2, int *nhdr) } ip = (struct ip *)bp2; - switch (ip->ip_v) { + switch (IP_V(ip)) { #ifdef INET6 case 6: ip6 = (struct ip6_hdr *)bp2;