aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2009-05-05 22:35:19 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2009-05-05 22:35:19 +0000
commit9c8c789f553e5e7bd6d067cb57a1651113599241 (patch)
tree624286e669463f313ad8ee0d1462a6595c5465e5 /epan
parent053982156484dc93a4f60f9196408f1d26e3258c (diff)
Add support for the IANA's OUI, and recognize NHRP-over-SNAP.
An NHRP extension offset of 0 is not an error - it means there are no extensions. Start using the address family number to determine the type of link-layer addresses in NHRP. Don't fetch IPv4 addresses and add them to the tree - just use proto_tree_add_item(). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@28286 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan')
-rw-r--r--epan/Makefile.common1
-rw-r--r--epan/dissectors/Makefile.common1
-rw-r--r--epan/dissectors/packet-iana-oui.c61
-rw-r--r--epan/dissectors/packet-nhrp.c105
-rw-r--r--epan/iana_snap_pid.h33
-rw-r--r--epan/oui.h1
6 files changed, 156 insertions, 46 deletions
diff --git a/epan/Makefile.common b/epan/Makefile.common
index 371c2dcca7..60b8c5d868 100644
--- a/epan/Makefile.common
+++ b/epan/Makefile.common
@@ -179,6 +179,7 @@ LIBWIRESHARK_INCLUDES = \
greproto.h \
guid-utils.h \
h225-persistentdata.h \
+ iana_snap_pid.h \
iax2_codec_type.h \
in_cksum.h \
ip_opts.h \
diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common
index da74226ba4..80966ea471 100644
--- a/epan/dissectors/Makefile.common
+++ b/epan/dissectors/Makefile.common
@@ -498,6 +498,7 @@ DISSECTOR_SRC = \
packet-http.c \
packet-hyperscsi.c \
packet-i2c.c \
+ packet-iana-oui.c \
packet-iapp.c \
packet-iax2.c \
packet-icap.c \
diff --git a/epan/dissectors/packet-iana-oui.c b/epan/dissectors/packet-iana-oui.c
new file mode 100644
index 0000000000..14a71e05a0
--- /dev/null
+++ b/epan/dissectors/packet-iana-oui.c
@@ -0,0 +1,61 @@
+/* packet-iana-oui.c
+ * Register an LLC dissector table for the IANA's OUI 00:00:5e
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ */
+
+#include "config.h"
+
+#include <epan/packet.h>
+#include "packet-llc.h"
+#include <epan/oui.h>
+#include <epan/iana_snap_pid.h>
+
+static int hf_llc_iana_pid = -1;
+
+static const value_string iana_pid_vals[] = {
+ { IANA_PID_MARS_DATA_SHORT, "MARS Data Messages (short form)" },
+ { IANA_PID_NHRP_RESERVED, "Reserved for future NHRP use" },
+ { IANA_PID_MARS_NHRP_CONTROL, "MARS/NHRP Control Messages" },
+ { IANA_PID_MARS_DATA_LONG, "MARS Data Messages (long form)" },
+ { IANA_PID_SCSP, "SCSP" },
+ { IANA_PID_VRID, "VRID" },
+ { IANA_PID_L2TP, "L2TP" },
+ { IANA_PID_VPN_ID, "VPN ID" },
+ { IANA_PID_MSDP_GRE_PROTO_TYPE, "MSDP-GRE-Protocol Type" },
+ { 0, NULL }
+};
+
+/*
+ * NOTE: there's no dissector here, just registration routines to set
+ * up the dissector table for the IANA OUI.
+ */
+void
+proto_register_iana_oui(void)
+{
+ static hf_register_info hf = {
+ &hf_llc_iana_pid,
+ { "PID", "llc.iana_pid", FT_UINT16, BASE_HEX,
+ VALS(iana_pid_vals), 0x0, "", HFILL },
+ };
+
+ llc_add_oui(OUI_IANA, "llc.iana_pid", "IANA OUI PID", &hf);
+}
diff --git a/epan/dissectors/packet-nhrp.c b/epan/dissectors/packet-nhrp.c
index 2b223051da..97ad1dcbe2 100644
--- a/epan/dissectors/packet-nhrp.c
+++ b/epan/dissectors/packet-nhrp.c
@@ -46,6 +46,7 @@
#include <epan/sminmpec.h>
#include <epan/afn.h>
#include <epan/in_cksum.h>
+#include <epan/iana_snap_pid.h>
#include <epan/dissectors/packet-llc.h>
#include "packet-nhrp.h"
@@ -366,7 +367,7 @@ void dissect_nhrp_hdr(tvbuff_t *tvb,
hdr->ar_extoff = tvb_get_ntohs(tvb, offset);
ti = proto_tree_add_item(nhrp_tree, hf_nhrp_hdr_extoff, tvb, offset, 2, FALSE);
- if (hdr->ar_extoff < 20) {
+ if (hdr->ar_extoff != 0 && hdr->ar_extoff < 20) {
expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
"Extension offset is less than the fixed header length");
}
@@ -403,7 +404,7 @@ void dissect_nhrp_hdr(tvbuff_t *tvb,
offset += 1;
*pOffset = offset;
- if (hdr->ar_extoff) {
+ if (hdr->ar_extoff != 0) {
if (hdr->ar_extoff >= 20) {
*pMandLen = hdr->ar_extoff - 20;
*pExtLen = total_len - hdr->ar_extoff;
@@ -428,9 +429,9 @@ void dissect_cie_list(tvbuff_t *tvb,
proto_tree *tree,
gint offset,
gint cieEnd,
+ e_nhrp_hdr *hdr,
gint isReq)
{
- guint32 addr;
proto_item *cli_addr_tree_item = NULL;
proto_tree *cli_addr_tree = NULL;
proto_item *cli_saddr_tree_item = NULL;
@@ -496,14 +497,23 @@ void dissect_cie_list(tvbuff_t *tvb,
offset += 1;
if (cli_addr_len) {
- if (cli_addr_len == 4) {
- addr = tvb_get_ipv4(tvb, offset);
- proto_tree_add_ipv4(cie_tree, hf_nhrp_client_nbma_addr, tvb, offset, 4, addr);
- }
- else {
+ switch (hdr->ar_afn) {
+
+ case AFNUM_INET:
+ if (cli_addr_len == 4)
+ proto_tree_add_item(cie_tree, hf_nhrp_client_nbma_addr, tvb, offset, 4, FALSE);
+ else {
+ proto_tree_add_text(cie_tree, tvb, offset, cli_addr_len,
+ "Client NBMA Address: %s",
+ tvb_bytes_to_str(tvb, offset, cli_addr_len));
+ }
+ break;
+
+ default:
proto_tree_add_text(cie_tree, tvb, offset, cli_addr_len,
- "Client NBMA Address: %s",
- tvb_bytes_to_str(tvb, offset, cli_addr_len));
+ "Client NBMA Address: %s",
+ tvb_bytes_to_str(tvb, offset, cli_addr_len));
+ break;
}
offset += cli_addr_len;
}
@@ -515,10 +525,8 @@ void dissect_cie_list(tvbuff_t *tvb,
}
if (cli_prot_len) {
- if (cli_prot_len == 4) {
- addr = tvb_get_ipv4(tvb, offset);
- proto_tree_add_ipv4(cie_tree, hf_nhrp_client_prot_addr, tvb, offset, 4, addr);
- }
+ if (cli_prot_len == 4)
+ proto_tree_add_ipv4(cie_tree, hf_nhrp_client_prot_addr, tvb, offset, 4, FALSE);
else {
proto_tree_add_text(cie_tree, tvb, offset, cli_prot_len,
"Client Protocol Address: %s",
@@ -533,13 +541,12 @@ void dissect_nhrp_mand(tvbuff_t *tvb,
packet_info *pinfo,
proto_tree *tree,
gint *pOffset,
+ gint mandLen,
oui_info_t *oui_info,
- e_nhrp_hdr *hdr,
- gint mandLen)
+ e_nhrp_hdr *hdr)
{
gint offset = *pOffset;
gint mandEnd = offset + mandLen;
- guint32 addr;
guint8 ssl, shl;
guint16 flags;
guint srcLen, dstLen;
@@ -628,24 +635,31 @@ void dissect_nhrp_mand(tvbuff_t *tvb,
offset += 6;
}
- /* TBD : Check for hdr->afn */
- shl = hdr->ar_shtl & NHRP_SHTL_LEN_MASK;
+ shl = NHRP_SHTL_LEN(hdr->ar_shtl);
if (shl) {
- if (shl == 4) {
- addr = tvb_get_ipv4(tvb, offset);
- proto_tree_add_ipv4(nhrp_tree, hf_nhrp_src_nbma_addr, tvb, offset, 4, addr);
- }
- else {
+ switch (hdr->ar_afn) {
+
+ case AFNUM_INET:
+ if (shl == 4)
+ proto_tree_add_item(nhrp_tree, hf_nhrp_src_nbma_addr, tvb, offset, 4, FALSE);
+ else {
+ proto_tree_add_text(nhrp_tree, tvb, offset, shl,
+ "Source NBMA Address: %s",
+ tvb_bytes_to_str(tvb, offset, shl));
+ }
+ break;
+
+ default:
proto_tree_add_text(nhrp_tree, tvb, offset, shl,
- "Source NBMA Address: %s",
- tvb_bytes_to_str(tvb, offset, shl));
+ "Source NBMA Address: %s",
+ tvb_bytes_to_str(tvb, offset, shl));
+ break;
}
offset += shl;
}
- ssl = hdr->ar_sstl & NHRP_SHTL_LEN_MASK;
+ ssl = NHRP_SHTL_LEN(hdr->ar_sstl);
if (ssl) {
- tvb_ensure_bytes_exist(tvb, offset, ssl);
proto_tree_add_text(nhrp_tree, tvb, offset, ssl,
"Source NBMA Sub Address: %s",
tvb_bytes_to_str(tvb, offset, ssl));
@@ -653,10 +667,8 @@ void dissect_nhrp_mand(tvbuff_t *tvb,
}
if (srcLen) {
- if (srcLen == 4) {
- addr = tvb_get_ipv4(tvb, offset);
- proto_tree_add_ipv4(nhrp_tree, hf_nhrp_src_prot_addr, tvb, offset, 4, addr);
- }
+ if (srcLen == 4)
+ proto_tree_add_item(nhrp_tree, hf_nhrp_src_prot_addr, tvb, offset, 4, FALSE);
else {
proto_tree_add_text(nhrp_tree, tvb, offset, srcLen,
"Source Protocol Address: %s",
@@ -666,10 +678,8 @@ void dissect_nhrp_mand(tvbuff_t *tvb,
}
if (dstLen) {
- if (dstLen == 4) {
- addr = tvb_get_ipv4(tvb, offset);
- proto_tree_add_ipv4(nhrp_tree, hf_nhrp_dst_prot_addr, tvb, offset, 4, addr);
- }
+ if (dstLen == 4)
+ proto_tree_add_item(nhrp_tree, hf_nhrp_dst_prot_addr, tvb, offset, 4, FALSE);
else {
proto_tree_add_text(nhrp_tree, tvb, offset, dstLen,
"Destination Protocol Address: %s",
@@ -761,7 +771,7 @@ void dissect_nhrp_mand(tvbuff_t *tvb,
offset = mandEnd;
}
- dissect_cie_list(tvb, nhrp_tree, offset, mandEnd, isReq);
+ dissect_cie_list(tvb, nhrp_tree, offset, mandEnd, hdr, isReq);
*pOffset = mandEnd;
}
@@ -770,7 +780,8 @@ void dissect_nhrp_mand(tvbuff_t *tvb,
void dissect_nhrp_ext(tvbuff_t *tvb,
proto_tree *tree,
gint *pOffset,
- gint extLen)
+ gint extLen,
+ e_nhrp_hdr *hdr)
{
gint offset = *pOffset;
gint extEnd = offset + extLen;
@@ -786,8 +797,8 @@ void dissect_nhrp_ext(tvbuff_t *tvb,
gint extType = extTypeC & 0x3FFF;
gint len = tvb_get_ntohs(tvb, offset+2);
nhrp_tree_item = proto_tree_add_text(tree, tvb, offset,
- len + 4, "%s",
- val_to_str(extType, ext_type_vals, "Unknown (%u)"));
+ len + 4, "%s",
+ val_to_str(extType, ext_type_vals, "Unknown (%u)"));
nhrp_tree = proto_item_add_subtree(nhrp_tree_item, ett_nhrp_ext);
proto_tree_add_boolean(nhrp_tree, hf_nhrp_ext_C, tvb, offset, 2, extTypeC);
proto_tree_add_item(nhrp_tree, hf_nhrp_ext_type, tvb, offset, 2, FALSE);
@@ -803,12 +814,13 @@ void dissect_nhrp_ext(tvbuff_t *tvb,
case NHRP_EXT_FWD_RECORD:
case NHRP_EXT_REV_RECORD:
case NHRP_EXT_NAT_ADDRESS:
- dissect_cie_list(tvb, nhrp_tree, offset, offset + len, 0);
+ dissect_cie_list(tvb, nhrp_tree,
+ offset, offset + len, hdr, 0);
break;
default:
proto_tree_add_text(nhrp_tree, tvb, offset, len,
- "Extension Value: %s",
- tvb_bytes_to_str(tvb, offset, len));
+ "Extension Value: %s",
+ tvb_bytes_to_str(tvb, offset, len));
break;
}
offset += len;
@@ -854,12 +866,12 @@ void dissect_nhrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissect_nhrp_hdr(tvb, pinfo, nhrp_tree, &offset, &mandLen, &extLen,
&oui_info, &hdr);
if (mandLen) {
- dissect_nhrp_mand(tvb, pinfo, nhrp_tree, &offset, oui_info,
- &hdr, mandLen);
+ dissect_nhrp_mand(tvb, pinfo, nhrp_tree, &offset, mandLen,
+ oui_info, &hdr);
}
if (extLen) {
- dissect_nhrp_ext(tvb, nhrp_tree, &offset, extLen);
+ dissect_nhrp_ext(tvb, nhrp_tree, &offset, extLen, &hdr);
}
}
@@ -1018,4 +1030,5 @@ proto_reg_handoff_nhrp(void)
nhrp_handle = create_dissector_handle(dissect_nhrp, proto_nhrp);
dissector_add("ip.proto", IP_PROTO_NARP, nhrp_handle);
dissector_add("gre.proto", GRE_NHRP, nhrp_handle);
+ dissector_add("llc.iana_pid", IANA_PID_MARS_NHRP_CONTROL, nhrp_handle);
}
diff --git a/epan/iana_snap_pid.h b/epan/iana_snap_pid.h
new file mode 100644
index 0000000000..f3f2993bb7
--- /dev/null
+++ b/epan/iana_snap_pid.h
@@ -0,0 +1,33 @@
+/* iana-snap-pid.h
+ * SNAP PIDs for the IANA's OUI 00:00:5e
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ */
+
+#define IANA_PID_MARS_DATA_SHORT 0x0001 /* RFC 2022 */
+#define IANA_PID_NHRP_RESERVED 0x0002 /* RFC 2332 */
+#define IANA_PID_MARS_NHRP_CONTROL 0x0003 /* RFC 2022, RFC 2332 */
+#define IANA_PID_MARS_DATA_LONG 0x0004 /* RFC 2022 */
+#define IANA_PID_SCSP 0x0005 /* RFC 2334 */
+#define IANA_PID_VRID 0x0006
+#define IANA_PID_L2TP 0x0007 /* RFC 3070 */
+#define IANA_PID_VPN_ID 0x0008 /* RFC 2684 */
+#define IANA_PID_MSDP_GRE_PROTO_TYPE 0x0009
diff --git a/epan/oui.h b/epan/oui.h
index 0ebc199023..90e860b47f 100644
--- a/epan/oui.h
+++ b/epan/oui.h
@@ -38,6 +38,7 @@
#define OUI_ENCAP_ETHER 0x000000 /* encapsulated Ethernet */
#define OUI_XEROX 0x000006 /* Xerox */
#define OUI_CISCO 0x00000C /* Cisco (future use) */
+#define OUI_IANA 0x00005E /* the IANA */
#define OUI_NORTEL 0x000081 /* Nortel SONMP */
#define OUI_CISCO_90 0x0000F8 /* Cisco (IOS 9.0 and above?) */
#define OUI_FORCE10 0x0001E8 /* Force10 */