diff options
| author | 2010-06-07 16:20:58 +0000 | |
|---|---|---|
| committer | 2010-06-07 16:20:58 +0000 | |
| commit | 8c3c61dd8e2dcdfc80e245fa783cfb789c5b32f9 (patch) | |
| tree | 3774916ca986c95c3d23c979c50bb48979f702d5 /usr.sbin/tcpdump/print-ike.c | |
| parent | setproctitle(NULL) is not needed, Michael Lechtermann; ok mpf (diff) | |
| download | wireguard-openbsd-8c3c61dd8e2dcdfc80e245fa783cfb789c5b32f9.tar.xz wireguard-openbsd-8c3c61dd8e2dcdfc80e245fa783cfb789c5b32f9.zip | |
minimal decode support for IKEv2 exchange types and payloads.
ok deraadt@ sthen@
Diffstat (limited to 'usr.sbin/tcpdump/print-ike.c')
| -rw-r--r-- | usr.sbin/tcpdump/print-ike.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/tcpdump/print-ike.c b/usr.sbin/tcpdump/print-ike.c index f76b4339a32..a93b0b106d0 100644 --- a/usr.sbin/tcpdump/print-ike.c +++ b/usr.sbin/tcpdump/print-ike.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-ike.c,v 1.34 2010/01/20 15:19:25 sthen Exp $ */ +/* $OpenBSD: print-ike.c,v 1.35 2010/06/07 16:20:58 jsg Exp $ */ /* * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999 @@ -233,7 +233,7 @@ ike_print (const u_int8_t *cp, u_int length) TCHECK(ih->length, sizeof(ih->length)); printf(" len: %d", ntohl(ih->length)); - if (ih->version > 16) { + if (ih->version > IKE_VERSION_2) { printf(" new version"); return; } @@ -836,6 +836,7 @@ ike_pl_print (u_int8_t type, u_int8_t *buf, u_int8_t doi) static const char *pltypes[] = IKE_PAYLOAD_TYPES_INITIALIZER; static const char *plprivtypes[] = IKE_PRIVATE_PAYLOAD_TYPES_INITIALIZER; + static const char *plv2types[] = IKEV2_PAYLOAD_TYPES_INITIALIZER; u_int8_t next_type; u_int16_t this_len; @@ -846,7 +847,10 @@ ike_pl_print (u_int8_t type, u_int8_t *buf, u_int8_t doi) next_type = buf[0]; this_len = buf[2]<<8 | buf[3]; - if (type < PAYLOAD_PRIVATE_MIN || type >= PAYLOAD_PRIVATE_MAX) + if (type < PAYLOAD_PRIVATE_MIN && type >= PAYLOAD_IKEV2_SA) + printf("\n\t%spayload: %s len: %hu", ike_tab_offset(), + plv2types[type - PAYLOAD_IKEV2_SA], this_len); + else if (type < PAYLOAD_PRIVATE_MIN || type >= PAYLOAD_PRIVATE_MAX) printf("\n\t%spayload: %s len: %hu", ike_tab_offset(), (type < (sizeof pltypes/sizeof pltypes[0]) ? pltypes[type] : "<unknown>"), this_len); |
