1999-03-29 02:21:34 +00:00
|
|
|
/* packet-ipsec.c
|
2002-08-28 21:04:11 +00:00
|
|
|
* Routines for IPsec/IPComp packet disassembly
|
1999-03-29 02:21:34 +00:00
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
1999-03-29 02:21:34 +00:00
|
|
|
*
|
|
|
|
* Ethereal - Network traffic analyzer
|
2001-08-29 08:12:32 +00:00
|
|
|
* By Gerald Combs <gerald@ethereal.com>
|
1999-03-29 02:21:34 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-03-29 02:21:34 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-03-29 02:21:34 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-03-29 02:21:34 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2000-11-17 21:00:40 +00:00
|
|
|
#include <string.h>
|
1999-03-29 02:21:34 +00:00
|
|
|
#include <glib.h>
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/packet.h>
|
2000-02-15 21:06:58 +00:00
|
|
|
#include "packet-ipsec.h"
|
2004-08-06 19:57:49 +00:00
|
|
|
#include <epan/addr_resolv.h>
|
2001-04-17 06:29:14 +00:00
|
|
|
#include "ipproto.h"
|
2000-07-08 10:46:23 +00:00
|
|
|
#include "prefs.h"
|
|
|
|
|
|
|
|
/* Place AH payload in sub tree */
|
2002-05-10 23:20:38 +00:00
|
|
|
static gboolean g_ah_payload_in_subtree = FALSE;
|
1999-03-29 02:21:34 +00:00
|
|
|
|
1999-07-29 05:47:07 +00:00
|
|
|
static int proto_ah = -1;
|
1999-10-11 12:37:50 +00:00
|
|
|
static int hf_ah_spi = -1;
|
|
|
|
static int hf_ah_sequence = -1;
|
1999-07-29 05:47:07 +00:00
|
|
|
static int proto_esp = -1;
|
1999-10-11 12:37:50 +00:00
|
|
|
static int hf_esp_spi = -1;
|
|
|
|
static int hf_esp_sequence = -1;
|
1999-10-15 05:30:43 +00:00
|
|
|
static int proto_ipcomp = -1;
|
1999-10-15 05:46:18 +00:00
|
|
|
static int hf_ipcomp_flags = -1;
|
1999-10-15 05:30:43 +00:00
|
|
|
static int hf_ipcomp_cpi = -1;
|
1999-07-29 05:47:07 +00:00
|
|
|
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint ett_ah = -1;
|
|
|
|
static gint ett_esp = -1;
|
|
|
|
static gint ett_ipcomp = -1;
|
|
|
|
|
2001-11-26 04:52:51 +00:00
|
|
|
static dissector_handle_t data_handle;
|
|
|
|
|
2003-04-29 17:24:35 +00:00
|
|
|
static dissector_table_t ip_dissector_table;
|
|
|
|
|
1999-03-29 02:21:34 +00:00
|
|
|
struct newah {
|
|
|
|
guint8 ah_nxt; /* Next Header */
|
|
|
|
guint8 ah_len; /* Length of data + 1, in 32bit */
|
|
|
|
guint16 ah_reserve; /* Reserved for future use */
|
|
|
|
guint32 ah_spi; /* Security parameter index */
|
|
|
|
guint32 ah_seq; /* Sequence number field */
|
|
|
|
/* variable size, 32bit bound*/ /* Authentication data */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct newesp {
|
|
|
|
guint32 esp_spi; /* ESP */
|
|
|
|
guint32 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 */
|
|
|
|
};
|
|
|
|
|
1999-10-15 05:30:43 +00:00
|
|
|
struct ipcomp {
|
|
|
|
guint8 comp_nxt; /* Next Header */
|
|
|
|
guint8 comp_flags; /* Must be zero */
|
|
|
|
guint16 comp_cpi; /* Compression parameter index */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* well-known algorithm number (in CPI), from RFC2409 */
|
|
|
|
#define IPCOMP_OUI 1 /* vendor specific */
|
|
|
|
#define IPCOMP_DEFLATE 2 /* RFC2394 */
|
|
|
|
#define IPCOMP_LZS 3 /* RFC2395 */
|
|
|
|
#define IPCOMP_MAX 4
|
|
|
|
|
|
|
|
static const value_string cpi2val[] = {
|
|
|
|
{ IPCOMP_OUI, "OUI" },
|
|
|
|
{ IPCOMP_DEFLATE, "DEFLATE" },
|
|
|
|
{ IPCOMP_LZS, "LZS" },
|
|
|
|
{ 0, NULL },
|
|
|
|
};
|
|
|
|
|
1999-03-29 02:21:34 +00:00
|
|
|
#ifndef offsetof
|
|
|
|
#define offsetof(type, member) ((size_t)(&((type *)0)->member))
|
|
|
|
#endif
|
|
|
|
|
2001-02-28 06:37:29 +00:00
|
|
|
static void
|
|
|
|
dissect_ah(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
|
|
|
proto_tree *next_tree;
|
|
|
|
guint8 nxt;
|
|
|
|
tvbuff_t *next_tvb;
|
|
|
|
int advance;
|
1999-03-29 02:21:34 +00:00
|
|
|
|
2001-02-28 06:37:29 +00:00
|
|
|
advance = dissect_ah_header(tvb, pinfo, tree, &nxt, &next_tree);
|
|
|
|
next_tvb = tvb_new_subset(tvb, advance, -1, -1);
|
|
|
|
|
|
|
|
if (g_ah_payload_in_subtree) {
|
2001-12-10 00:26:21 +00:00
|
|
|
col_set_writable(pinfo->cinfo, FALSE);
|
1999-03-29 02:21:34 +00:00
|
|
|
}
|
|
|
|
|
2001-02-28 06:37:29 +00:00
|
|
|
/* do lookup with the subdissector table */
|
|
|
|
if (!dissector_try_port(ip_dissector_table, nxt, next_tvb, pinfo, next_tree)) {
|
2001-11-26 04:52:51 +00:00
|
|
|
call_dissector(data_handle,next_tvb, pinfo, next_tree);
|
2001-02-28 06:37:29 +00:00
|
|
|
}
|
1999-03-29 02:21:34 +00:00
|
|
|
}
|
|
|
|
|
2001-04-23 03:37:31 +00:00
|
|
|
int
|
2001-02-28 06:37:29 +00:00
|
|
|
dissect_ah_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|
|
|
guint8 *nxt_p, proto_tree **next_tree_p)
|
2000-06-05 03:21:03 +00:00
|
|
|
{
|
2001-02-28 06:37:29 +00:00
|
|
|
proto_tree *ah_tree;
|
2000-06-05 03:21:03 +00:00
|
|
|
proto_item *ti;
|
|
|
|
struct newah ah;
|
|
|
|
int advance;
|
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_PROTOCOL))
|
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "AH");
|
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
Add the "Edit:Protocols..." feature which currently only implements
the following:
It is now possible to enable/disable a particular protocol decoding
(i.e. the protocol dissector is void or not). When a protocol
is disabled, it is displayed as Data and of course, all linked
sub-protocols are disabled as well.
Disabling a protocol could be interesting:
- in case of buggy dissectors
- in case of wrong heuristics
- for performance reasons
- to decode the data as another protocol (TODO)
Currently (if I am not wrong), all dissectors but NFS can be disabled
(and dissectors that do not register protocols :-)
I do not like the way the RPC sub-dissectors are disabled (in the
sub-dissectors) since this could be done in the RPC dissector itself,
knowing the sub-protocol hfinfo entry (this is why, I've not modified
the NFS one yet).
Two functions are added in proto.c :
gboolean proto_is_protocol_enabled(int n);
void proto_set_decoding(int n, gboolean enabled);
and two MACROs which can be used in dissectors:
OLD_CHECK_DISPLAY_AS_DATA(index, pd, offset, fd, tree)
CHECK_DISPLAY_AS_DATA(index, tvb, pinfo, tree)
See also the XXX in proto_dlg.c and proto.c around the new functions.
svn path=/trunk/; revision=2267
2000-08-13 14:09:15 +00:00
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
tvb_memcpy(tvb, (guint8 *)&ah, 0, sizeof(ah));
|
2000-06-05 03:21:03 +00:00
|
|
|
advance = sizeof(ah) + ((ah.ah_len - 1) << 2);
|
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_INFO)) {
|
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "AH (SPI=0x%08x)",
|
2002-08-02 23:36:07 +00:00
|
|
|
(guint32)g_ntohl(ah.ah_spi));
|
2000-06-05 03:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
/* !!! specify length */
|
2001-02-28 06:37:29 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_ah, tvb, 0, advance, FALSE);
|
2000-06-05 03:21:03 +00:00
|
|
|
ah_tree = proto_item_add_subtree(ti, ett_ah);
|
|
|
|
|
2001-02-28 06:37:29 +00:00
|
|
|
proto_tree_add_text(ah_tree, tvb,
|
|
|
|
offsetof(struct newah, ah_nxt), 1,
|
|
|
|
"Next Header: %s (0x%02x)",
|
|
|
|
ipprotostr(ah.ah_nxt), ah.ah_nxt);
|
|
|
|
proto_tree_add_text(ah_tree, tvb,
|
|
|
|
offsetof(struct newah, ah_len), 1,
|
2001-11-09 08:16:25 +00:00
|
|
|
"Length: %u", (ah.ah_len + 2) << 2);
|
2001-02-28 06:37:29 +00:00
|
|
|
proto_tree_add_uint(ah_tree, hf_ah_spi, tvb,
|
|
|
|
offsetof(struct newah, ah_spi), 4,
|
2002-08-02 23:36:07 +00:00
|
|
|
(guint32)g_ntohl(ah.ah_spi));
|
2001-02-28 06:37:29 +00:00
|
|
|
proto_tree_add_uint(ah_tree, hf_ah_sequence, tvb,
|
|
|
|
offsetof(struct newah, ah_seq), 4,
|
2002-08-02 23:36:07 +00:00
|
|
|
(guint32)g_ntohl(ah.ah_seq));
|
2001-02-28 06:37:29 +00:00
|
|
|
proto_tree_add_text(ah_tree, tvb,
|
|
|
|
sizeof(ah), (ah.ah_len - 1) << 2,
|
2000-06-05 03:21:03 +00:00
|
|
|
"ICV");
|
2000-07-08 10:46:23 +00:00
|
|
|
|
2001-02-28 06:37:29 +00:00
|
|
|
if (next_tree_p != NULL) {
|
|
|
|
/* Decide where to place next protocol decode */
|
|
|
|
if (g_ah_payload_in_subtree) {
|
|
|
|
*next_tree_p = ah_tree;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
*next_tree_p = tree;
|
|
|
|
}
|
2000-07-08 10:46:23 +00:00
|
|
|
}
|
2001-02-28 06:37:29 +00:00
|
|
|
} else {
|
|
|
|
if (next_tree_p != NULL)
|
|
|
|
*next_tree_p = NULL;
|
2000-06-05 03:21:03 +00:00
|
|
|
}
|
|
|
|
|
2001-02-28 06:37:29 +00:00
|
|
|
if (nxt_p != NULL)
|
|
|
|
*nxt_p = ah.ah_nxt;
|
2000-07-08 10:46:23 +00:00
|
|
|
|
2001-02-28 06:37:29 +00:00
|
|
|
/* start of the new header (could be a extension header) */
|
|
|
|
return advance;
|
2000-06-05 03:21:03 +00:00
|
|
|
}
|
|
|
|
|
2000-04-20 07:05:58 +00:00
|
|
|
static void
|
2001-02-28 06:37:29 +00:00
|
|
|
dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
1999-03-29 02:21:34 +00:00
|
|
|
{
|
1999-10-17 08:33:23 +00:00
|
|
|
proto_tree *esp_tree;
|
1999-03-29 02:21:34 +00:00
|
|
|
proto_item *ti;
|
|
|
|
struct newesp esp;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* load the top pane info. This should be overwritten by
|
|
|
|
* the next protocol in the stack
|
|
|
|
*/
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_PROTOCOL))
|
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ESP");
|
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2001-02-28 06:37:29 +00:00
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
tvb_memcpy(tvb, (guint8 *)&esp, 0, sizeof(esp));
|
2001-02-28 06:37:29 +00:00
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_INFO)) {
|
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "ESP (SPI=0x%08x)",
|
2002-08-02 23:36:07 +00:00
|
|
|
(guint32)g_ntohl(esp.esp_spi));
|
1999-03-29 02:21:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* populate a tree in the second pane with the status of the link layer
|
|
|
|
* (ie none)
|
|
|
|
*/
|
|
|
|
if(tree) {
|
2002-01-24 09:20:54 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_esp, tvb, 0, -1, FALSE);
|
1999-11-16 11:44:20 +00:00
|
|
|
esp_tree = proto_item_add_subtree(ti, ett_esp);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_uint(esp_tree, hf_esp_spi, tvb,
|
2001-02-28 06:37:29 +00:00
|
|
|
offsetof(struct newesp, esp_spi), 4,
|
2002-08-02 23:36:07 +00:00
|
|
|
(guint32)g_ntohl(esp.esp_spi));
|
2001-02-28 06:37:29 +00:00
|
|
|
proto_tree_add_uint(esp_tree, hf_esp_sequence, tvb,
|
|
|
|
offsetof(struct newesp, esp_seq), 4,
|
2002-08-02 23:36:07 +00:00
|
|
|
(guint32)g_ntohl(esp.esp_seq));
|
2002-05-30 05:26:05 +00:00
|
|
|
call_dissector(data_handle,
|
|
|
|
tvb_new_subset(tvb, sizeof(struct newesp), -1, -1),
|
|
|
|
pinfo, esp_tree);
|
1999-10-15 05:30:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-04-20 07:05:58 +00:00
|
|
|
static void
|
2001-02-28 06:37:29 +00:00
|
|
|
dissect_ipcomp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
1999-10-15 05:30:43 +00:00
|
|
|
{
|
|
|
|
proto_tree *ipcomp_tree;
|
|
|
|
proto_item *ti;
|
|
|
|
struct ipcomp ipcomp;
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* load the top pane info. This should be overwritten by
|
|
|
|
* the next protocol in the stack
|
|
|
|
*/
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_PROTOCOL))
|
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPComp");
|
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2001-02-28 06:37:29 +00:00
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
tvb_memcpy(tvb, (guint8 *)&ipcomp, 0, sizeof(ipcomp));
|
2001-02-28 06:37:29 +00:00
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_INFO)) {
|
2002-08-02 23:36:07 +00:00
|
|
|
p = match_strval(g_ntohs(ipcomp.comp_cpi), cpi2val);
|
2001-02-28 06:37:29 +00:00
|
|
|
if (p == NULL) {
|
2001-12-10 00:26:21 +00:00
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "IPComp (CPI=0x%04x)",
|
2002-08-02 23:36:07 +00:00
|
|
|
g_ntohs(ipcomp.comp_cpi));
|
1999-10-15 05:30:43 +00:00
|
|
|
} else
|
2001-12-10 00:26:21 +00:00
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "IPComp (CPI=%s)", p);
|
1999-10-15 05:30:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* populate a tree in the second pane with the status of the link layer
|
|
|
|
* (ie none)
|
|
|
|
*/
|
|
|
|
if (tree) {
|
2002-01-24 09:20:54 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_ipcomp, tvb, 0, -1, FALSE);
|
1999-11-16 11:44:20 +00:00
|
|
|
ipcomp_tree = proto_item_add_subtree(ti, ett_ipcomp);
|
1999-10-15 05:30:43 +00:00
|
|
|
|
2001-02-28 06:37:29 +00:00
|
|
|
proto_tree_add_text(ipcomp_tree, tvb,
|
|
|
|
offsetof(struct ipcomp, comp_nxt), 1,
|
1999-10-15 05:30:43 +00:00
|
|
|
"Next Header: %s (0x%02x)",
|
|
|
|
ipprotostr(ipcomp.comp_nxt), ipcomp.comp_nxt);
|
2001-02-28 06:37:29 +00:00
|
|
|
proto_tree_add_uint(ipcomp_tree, hf_ipcomp_flags, tvb,
|
|
|
|
offsetof(struct ipcomp, comp_flags), 1,
|
1999-10-15 05:46:18 +00:00
|
|
|
ipcomp.comp_flags);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_uint(ipcomp_tree, hf_ipcomp_cpi, tvb,
|
2001-02-28 06:37:29 +00:00
|
|
|
offsetof(struct ipcomp, comp_cpi), 2,
|
2002-08-02 23:36:07 +00:00
|
|
|
g_ntohs(ipcomp.comp_cpi));
|
2002-05-30 05:26:05 +00:00
|
|
|
call_dissector(data_handle,
|
|
|
|
tvb_new_subset(tvb, sizeof(struct ipcomp), -1, -1), pinfo,
|
|
|
|
ipcomp_tree);
|
1999-03-29 02:21:34 +00:00
|
|
|
}
|
|
|
|
}
|
1999-07-29 05:47:07 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_ipsec(void)
|
|
|
|
{
|
1999-10-11 12:37:50 +00:00
|
|
|
|
|
|
|
static hf_register_info hf_ah[] = {
|
|
|
|
{ &hf_ah_spi,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "SPI", "ah.spi", FT_UINT32, BASE_HEX, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-10-11 12:37:50 +00:00
|
|
|
{ &hf_ah_sequence,
|
2003-08-16 00:11:07 +00:00
|
|
|
{ "Sequence", "ah.sequence", FT_UINT32, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }}
|
1999-10-11 12:37:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static hf_register_info hf_esp[] = {
|
|
|
|
{ &hf_esp_spi,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "SPI", "esp.spi", FT_UINT32, BASE_HEX, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-10-11 12:37:50 +00:00
|
|
|
{ &hf_esp_sequence,
|
2003-08-16 00:11:07 +00:00
|
|
|
{ "Sequence", "esp.sequence", FT_UINT32, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }}
|
1999-10-11 12:37:50 +00:00
|
|
|
};
|
|
|
|
|
1999-10-15 05:30:43 +00:00
|
|
|
static hf_register_info hf_ipcomp[] = {
|
1999-10-15 05:46:18 +00:00
|
|
|
{ &hf_ipcomp_flags,
|
|
|
|
{ "Flags", "ipcomp.flags", FT_UINT8, BASE_HEX, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-10-15 05:30:43 +00:00
|
|
|
{ &hf_ipcomp_cpi,
|
2002-08-28 21:04:11 +00:00
|
|
|
{ "CPI", "ipcomp.cpi", FT_UINT16, BASE_HEX,
|
2001-06-18 02:18:27 +00:00
|
|
|
VALS(cpi2val), 0x0, "", HFILL }},
|
1999-10-15 05:30:43 +00:00
|
|
|
};
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_ah,
|
|
|
|
&ett_esp,
|
|
|
|
&ett_ipcomp,
|
|
|
|
};
|
1999-10-15 05:30:43 +00:00
|
|
|
|
2000-07-08 10:46:23 +00:00
|
|
|
module_t *ah_module;
|
|
|
|
|
2001-01-03 06:56:03 +00:00
|
|
|
proto_ah = proto_register_protocol("Authentication Header", "AH", "ah");
|
1999-10-11 12:37:50 +00:00
|
|
|
proto_register_field_array(proto_ah, hf_ah, array_length(hf_ah));
|
1999-10-15 05:30:43 +00:00
|
|
|
|
2001-02-03 20:08:04 +00:00
|
|
|
proto_esp = proto_register_protocol("Encapsulating Security Payload",
|
2001-01-03 06:56:03 +00:00
|
|
|
"ESP", "esp");
|
1999-10-11 12:37:50 +00:00
|
|
|
proto_register_field_array(proto_esp, hf_esp, array_length(hf_esp));
|
|
|
|
|
2001-01-03 06:56:03 +00:00
|
|
|
proto_ipcomp = proto_register_protocol("IP Payload Compression",
|
|
|
|
"IPComp", "ipcomp");
|
1999-10-15 05:30:43 +00:00
|
|
|
proto_register_field_array(proto_ipcomp, hf_ipcomp, array_length(hf_ipcomp));
|
1999-11-16 11:44:20 +00:00
|
|
|
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
2000-07-08 10:46:23 +00:00
|
|
|
|
|
|
|
/* Register a configuration option for placement of AH payload dissection */
|
2001-01-03 07:53:48 +00:00
|
|
|
ah_module = prefs_register_protocol(proto_ah, NULL);
|
2000-07-08 10:46:23 +00:00
|
|
|
prefs_register_bool_preference(ah_module, "place_ah_payload_in_subtree",
|
|
|
|
"Place AH payload in subtree",
|
|
|
|
"Whether the AH payload decode should be placed in a subtree",
|
|
|
|
&g_ah_payload_in_subtree);
|
2001-08-29 08:12:32 +00:00
|
|
|
|
|
|
|
register_dissector("esp", dissect_esp, proto_esp);
|
2001-08-30 02:23:17 +00:00
|
|
|
register_dissector("ah", dissect_ah, proto_ah);
|
1999-07-29 05:47:07 +00:00
|
|
|
}
|
2000-04-16 22:46:25 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_ipsec(void)
|
|
|
|
{
|
2001-12-03 04:00:26 +00:00
|
|
|
dissector_handle_t esp_handle, ah_handle, ipcomp_handle;
|
|
|
|
|
2001-11-26 04:52:51 +00:00
|
|
|
data_handle = find_dissector("data");
|
2001-12-03 04:00:26 +00:00
|
|
|
ah_handle = find_dissector("ah");
|
|
|
|
dissector_add("ip.proto", IP_PROTO_AH, ah_handle);
|
|
|
|
esp_handle = find_dissector("esp");
|
|
|
|
dissector_add("ip.proto", IP_PROTO_ESP, esp_handle);
|
|
|
|
ipcomp_handle = create_dissector_handle(dissect_ipcomp, proto_ipcomp);
|
|
|
|
dissector_add("ip.proto", IP_PROTO_IPCOMP, ipcomp_handle);
|
2003-04-29 17:24:35 +00:00
|
|
|
|
|
|
|
ip_dissector_table = find_dissector_table("ip.proto");
|
2000-04-16 22:46:25 +00:00
|
|
|
}
|