From 7e16ec5b991b12020f7bdc135fd4943858bc3218 Mon Sep 17 00:00:00 2001 From: Jaap Keuter Date: Sun, 19 Dec 2010 18:46:08 +0000 Subject: [PATCH] Prepare for handling DLT_IPV4 and DLT_IPV6. svn path=/trunk/; revision=35223 --- epan/dissectors/packet-raw.c | 10 ++++++++++ wiretap/pcap-common.c | 4 ++++ wiretap/wtap.c | 8 +++++++- wiretap/wtap.h | 4 +++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/epan/dissectors/packet-raw.c b/epan/dissectors/packet-raw.c index 0697bc97d2..e575508de6 100644 --- a/epan/dissectors/packet-raw.c +++ b/epan/dissectors/packet-raw.c @@ -120,6 +120,14 @@ dissect_raw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_text(fh_tree, tvb, 0, 0, "No link information available"); } + if (pinfo->fd->lnk_t == WTAP_ENCAP_RAW_IP4) { + call_dissector(ip_handle, tvb, pinfo, tree); + } + else if (pinfo->fd->lnk_t == WTAP_ENCAP_RAW_IP6) { + call_dissector(ipv6_handle, tvb, pinfo, tree); + } + else + /* So far, the only time we get raw connection types are with Linux and * Irix PPP connections. We can't tell what type of data is coming down * the line, so our safest bet is IP. - GCC @@ -198,4 +206,6 @@ proto_reg_handoff_raw(void) ppp_hdlc_handle = find_dissector("ppp_hdlc"); raw_handle = create_dissector_handle(dissect_raw, proto_raw); dissector_add("wtap_encap", WTAP_ENCAP_RAW_IP, raw_handle); + dissector_add("wtap_encap", WTAP_ENCAP_RAW_IP4, raw_handle); + dissector_add("wtap_encap", WTAP_ENCAP_RAW_IP6, raw_handle); } diff --git a/wiretap/pcap-common.c b/wiretap/pcap-common.c index bdcbbfe421..278107a1a0 100644 --- a/wiretap/pcap-common.c +++ b/wiretap/pcap-common.c @@ -358,6 +358,10 @@ static const struct { { 226, WTAP_ENCAP_IPNET }, /* SocketCAN frame */ { 227, WTAP_ENCAP_SOCKETCAN }, + /* Raw IPv4 */ + { 228, WTAP_ENCAP_RAW_IP4 }, + /* Raw IPv6 */ + { 229, WTAP_ENCAP_RAW_IP6 }, /* IEEE 802.15.4 Wireless PAN no fcs */ { 230, WTAP_ENCAP_IEEE802_15_4_NOFCS }, diff --git a/wiretap/wtap.c b/wiretap/wtap.c index ea2193f5fe..efd175eb1c 100644 --- a/wiretap/wtap.c +++ b/wiretap/wtap.c @@ -479,7 +479,13 @@ static struct encap_type_info encap_table_base[] = { { "IEEE 802.15.4 Wireless PAN with FCS not present", "wpan-nofcs" }, /* WTAP_ENCAP_RAW_IPFIX */ - { "IPFIX", "ipfix" } + { "IPFIX", "ipfix" }, + + /* WTAP_ENCAP_RAW_IP4 */ + { "Raw IPv4", "rawip4" }, + + /* WTAP_ENCAP_RAW_IP6 */ + { "Raw IPv6", "rawip6" } }; gint wtap_num_encap_types = sizeof(encap_table_base) / sizeof(struct encap_type_info); diff --git a/wiretap/wtap.h b/wiretap/wtap.h index e4ccc5efba..6d298f6dc1 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -216,8 +216,10 @@ extern "C" { #define WTAP_ENCAP_IPNET 124 #define WTAP_ENCAP_SOCKETCAN 125 #define WTAP_ENCAP_IEEE802_11_NETMON_RADIO 126 -#define WTAP_ENCAP_IEEE802_15_4_NOFCS 127 +#define WTAP_ENCAP_IEEE802_15_4_NOFCS 127 #define WTAP_ENCAP_RAW_IPFIX 128 +#define WTAP_ENCAP_RAW_IP4 129 +#define WTAP_ENCAP_RAW_IP6 130 #define WTAP_NUM_ENCAP_TYPES wtap_get_num_encap_types()