1998-09-16 02:39:15 +00:00
|
|
|
/* packet-arp.c
|
|
|
|
* Routines for ARP packet disassembly
|
|
|
|
*
|
2000-04-16 22:59:37 +00:00
|
|
|
* $Id: packet-arp.c,v 1.28 2000/04/16 22:59:36 guy Exp $
|
1998-09-16 03:22:19 +00:00
|
|
|
*
|
1998-09-16 02:39:15 +00:00
|
|
|
* Ethereal - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@zing.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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
# include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
|
1999-03-23 03:14:46 +00:00
|
|
|
#include <glib.h>
|
1998-09-16 02:39:15 +00:00
|
|
|
#include "packet.h"
|
1999-11-27 04:48:14 +00:00
|
|
|
#include "packet-arp.h"
|
1998-09-16 02:39:15 +00:00
|
|
|
#include "etypes.h"
|
|
|
|
|
1999-07-29 05:47:07 +00:00
|
|
|
static int proto_arp = -1;
|
1999-10-03 17:12:15 +00:00
|
|
|
static int hf_arp_hard_type = -1;
|
|
|
|
static int hf_arp_proto_type = -1;
|
|
|
|
static int hf_arp_hard_size = -1;
|
1999-11-27 04:01:43 +00:00
|
|
|
static int hf_atmarp_shtl = -1;
|
|
|
|
static int hf_atmarp_ssl = -1;
|
1999-10-03 17:12:15 +00:00
|
|
|
static int hf_arp_proto_size = -1;
|
|
|
|
static int hf_arp_opcode = -1;
|
1999-11-27 04:01:43 +00:00
|
|
|
static int hf_atmarp_spln = -1;
|
|
|
|
static int hf_atmarp_thtl = -1;
|
|
|
|
static int hf_atmarp_tsl = -1;
|
|
|
|
static int hf_atmarp_tpln = -1;
|
1999-10-03 17:12:15 +00:00
|
|
|
static int hf_arp_src_ether = -1;
|
|
|
|
static int hf_arp_src_proto = -1;
|
|
|
|
static int hf_arp_dst_ether = -1;
|
|
|
|
static int hf_arp_dst_proto = -1;
|
1999-11-27 04:48:14 +00:00
|
|
|
static int hf_atmarp_src_atm_num_e164 = -1;
|
|
|
|
static int hf_atmarp_src_atm_num_nsap = -1;
|
1999-11-27 04:01:43 +00:00
|
|
|
static int hf_atmarp_src_atm_subaddr = -1;
|
1999-11-27 04:48:14 +00:00
|
|
|
static int hf_atmarp_dst_atm_num_e164 = -1;
|
|
|
|
static int hf_atmarp_dst_atm_num_nsap = -1;
|
1999-11-27 04:01:43 +00:00
|
|
|
static int hf_atmarp_dst_atm_subaddr = -1;
|
1999-07-29 05:47:07 +00:00
|
|
|
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint ett_arp = -1;
|
1999-11-27 04:48:14 +00:00
|
|
|
static gint ett_atmarp_nsap = -1;
|
1999-11-16 11:44:20 +00:00
|
|
|
|
1998-11-03 07:45:10 +00:00
|
|
|
/* Definitions taken from Linux "linux/if_arp.h" header file, and from
|
|
|
|
|
|
|
|
http://www.isi.edu/in-notes/iana/assignments/arp-parameters
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* ARP protocol HARDWARE identifiers. */
|
|
|
|
#define ARPHRD_NETROM 0 /* from KA9Q: NET/ROM pseudo */
|
|
|
|
#define ARPHRD_ETHER 1 /* Ethernet 10Mbps */
|
|
|
|
#define ARPHRD_EETHER 2 /* Experimental Ethernet */
|
|
|
|
#define ARPHRD_AX25 3 /* AX.25 Level 2 */
|
|
|
|
#define ARPHRD_PRONET 4 /* PROnet token ring */
|
|
|
|
#define ARPHRD_CHAOS 5 /* Chaosnet */
|
|
|
|
#define ARPHRD_IEEE802 6 /* IEEE 802.2 Ethernet/TR/TB */
|
|
|
|
#define ARPHRD_ARCNET 7 /* ARCnet */
|
|
|
|
#define ARPHRD_HYPERCH 8 /* Hyperchannel */
|
|
|
|
#define ARPHRD_LANSTAR 9 /* Lanstar */
|
|
|
|
#define ARPHRD_AUTONET 10 /* Autonet Short Address */
|
|
|
|
#define ARPHRD_LOCALTLK 11 /* Localtalk */
|
|
|
|
#define ARPHRD_LOCALNET 12 /* LocalNet (IBM PCNet/Sytek LocalNET) */
|
|
|
|
#define ARPHRD_ULTRALNK 13 /* Ultra link */
|
|
|
|
#define ARPHRD_SMDS 14 /* SMDS */
|
|
|
|
#define ARPHRD_DLCI 15 /* Frame Relay DLCI */
|
|
|
|
#define ARPHRD_ATM 16 /* ATM */
|
|
|
|
#define ARPHRD_HDLC 17 /* HDLC */
|
|
|
|
#define ARPHRD_FIBREC 18 /* Fibre Channel */
|
|
|
|
#define ARPHRD_ATM2225 19 /* ATM (RFC 2225) */
|
|
|
|
#define ARPHRD_SERIAL 20 /* Serial Line */
|
|
|
|
#define ARPHRD_ATM2 21 /* ATM */
|
|
|
|
#define ARPHRD_MS188220 22 /* MIL-STD-188-220 */
|
|
|
|
#define ARPHRD_METRICOM 23 /* Metricom STRIP */
|
|
|
|
#define ARPHRD_IEEE1394 24 /* IEEE 1394.1995 */
|
|
|
|
#define ARPHRD_MAPOS 25 /* MAPOS */
|
|
|
|
#define ARPHRD_TWINAX 26 /* Twinaxial */
|
|
|
|
#define ARPHRD_EUI_64 27 /* EUI-64 */
|
|
|
|
|
1999-03-23 03:14:46 +00:00
|
|
|
/* ARP / RARP structs and definitions */
|
|
|
|
#ifndef ARPOP_REQUEST
|
|
|
|
#define ARPOP_REQUEST 1 /* ARP request. */
|
|
|
|
#endif
|
|
|
|
#ifndef ARPOP_REPLY
|
|
|
|
#define ARPOP_REPLY 2 /* ARP reply. */
|
|
|
|
#endif
|
|
|
|
/* Some OSes have different names, or don't define these at all */
|
|
|
|
#ifndef ARPOP_RREQUEST
|
|
|
|
#define ARPOP_RREQUEST 3 /* RARP request. */
|
|
|
|
#endif
|
|
|
|
#ifndef ARPOP_RREPLY
|
|
|
|
#define ARPOP_RREPLY 4 /* RARP reply. */
|
|
|
|
#endif
|
1999-11-27 04:01:43 +00:00
|
|
|
#ifndef ARPOP_IREQUEST
|
|
|
|
#define ARPOP_IREQUEST 8 /* Inverse ARP (RFC 1293) request. */
|
|
|
|
#endif
|
|
|
|
#ifndef ARPOP_IREPLY
|
|
|
|
#define ARPOP_IREPLY 9 /* Inverse ARP reply. */
|
|
|
|
#endif
|
|
|
|
#ifndef ATMARPOP_NAK
|
|
|
|
#define ATMARPOP_NAK 10 /* ATMARP NAK. */
|
|
|
|
#endif
|
1999-03-23 03:14:46 +00:00
|
|
|
|
1999-11-04 08:15:38 +00:00
|
|
|
static const value_string op_vals[] = {
|
1999-12-07 15:38:20 +00:00
|
|
|
{ARPOP_REQUEST, "request" },
|
|
|
|
{ARPOP_REPLY, "reply" },
|
|
|
|
{ARPOP_RREQUEST, "reverse request"},
|
|
|
|
{ARPOP_RREPLY, "reverse reply" },
|
|
|
|
{ARPOP_IREQUEST, "inverse request"},
|
|
|
|
{ARPOP_IREPLY, "inverse reply" },
|
1999-11-27 04:01:43 +00:00
|
|
|
{0, NULL } };
|
|
|
|
|
|
|
|
static const value_string atmop_vals[] = {
|
1999-12-07 15:38:20 +00:00
|
|
|
{ARPOP_REQUEST, "request" },
|
|
|
|
{ARPOP_REPLY, "reply" },
|
|
|
|
{ARPOP_IREQUEST, "inverse request"},
|
|
|
|
{ARPOP_IREPLY, "inverse reply" },
|
|
|
|
{ATMARPOP_NAK, "nak" },
|
1999-11-04 08:15:38 +00:00
|
|
|
{0, NULL } };
|
|
|
|
|
1999-11-27 04:01:43 +00:00
|
|
|
#define ATMARP_IS_E164 0x40 /* bit in shtl/thtl for E.164 format */
|
|
|
|
#define ATMARP_LEN_MASK 0x3F /* length of address in shtl/thtl */
|
|
|
|
|
1999-01-28 21:29:36 +00:00
|
|
|
gchar *
|
1999-11-27 04:01:43 +00:00
|
|
|
arphrdaddr_to_str(guint8 *ad, int ad_len, guint16 type)
|
|
|
|
{
|
|
|
|
if (ad_len == 0)
|
|
|
|
return "<No address>";
|
1999-01-28 21:29:36 +00:00
|
|
|
if ((type == ARPHRD_ETHER || type == ARPHRD_EETHER || type == ARPHRD_IEEE802)
|
|
|
|
&& ad_len == 6) {
|
|
|
|
/* Ethernet address (or Experimental 3Mb Ethernet, or IEEE 802.x
|
|
|
|
address, which are the same type of address). */
|
1998-11-03 07:45:10 +00:00
|
|
|
return ether_to_str(ad);
|
|
|
|
}
|
1999-05-11 08:21:39 +00:00
|
|
|
return bytes_to_str(ad, ad_len);
|
1998-11-03 07:45:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
1999-11-27 04:01:43 +00:00
|
|
|
arpproaddr_to_str(guint8 *ad, int ad_len, guint16 type)
|
|
|
|
{
|
|
|
|
if (ad_len == 0)
|
|
|
|
return "<No address>";
|
1998-11-03 07:45:10 +00:00
|
|
|
if (type == ETHERTYPE_IP && ad_len == 4) {
|
1999-11-27 04:01:43 +00:00
|
|
|
/* IPv4 address. */
|
1998-11-03 07:45:10 +00:00
|
|
|
return ip_to_str(ad);
|
|
|
|
}
|
1999-05-11 08:21:39 +00:00
|
|
|
return bytes_to_str(ad, ad_len);
|
1998-11-03 07:45:10 +00:00
|
|
|
}
|
|
|
|
|
1999-11-27 04:48:14 +00:00
|
|
|
#define N_ATMARPNUM_TO_STR_STRINGS 2
|
|
|
|
#define MAX_E164_STR_LEN 20
|
1999-11-27 04:01:43 +00:00
|
|
|
static gchar *
|
|
|
|
atmarpnum_to_str(guint8 *ad, int ad_tl)
|
|
|
|
{
|
1999-11-27 04:48:14 +00:00
|
|
|
int ad_len = ad_tl & ATMARP_LEN_MASK;
|
|
|
|
static gchar str[N_ATMARPNUM_TO_STR_STRINGS][MAX_E164_STR_LEN+3+1];
|
|
|
|
static int cur_idx;
|
|
|
|
gchar *cur;
|
1999-11-27 04:01:43 +00:00
|
|
|
|
|
|
|
if (ad_len == 0)
|
|
|
|
return "<No address>";
|
|
|
|
|
1999-11-27 04:48:14 +00:00
|
|
|
if (ad_tl & ATMARP_IS_E164) {
|
|
|
|
/*
|
|
|
|
* I'm assuming this means it's an ASCII (IA5) string.
|
|
|
|
*/
|
|
|
|
cur_idx++;
|
|
|
|
if (cur_idx >= N_ATMARPNUM_TO_STR_STRINGS)
|
|
|
|
cur_idx = 0;
|
|
|
|
cur = &str[cur_idx][0];
|
|
|
|
if (ad_len > MAX_E164_STR_LEN) {
|
|
|
|
/* Can't show it all. */
|
|
|
|
memcpy(cur, ad, MAX_E164_STR_LEN);
|
|
|
|
strcpy(&cur[MAX_E164_STR_LEN], "...");
|
|
|
|
} else {
|
|
|
|
memcpy(cur, ad, ad_len);
|
|
|
|
cur[ad_len + 1] = '\0';
|
|
|
|
}
|
|
|
|
return cur;
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* NSAP.
|
|
|
|
*
|
|
|
|
* XXX - break down into subcomponents.
|
|
|
|
*/
|
|
|
|
return bytes_to_str(ad, ad_len);
|
|
|
|
}
|
1999-11-27 04:01:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
|
|
|
atmarpsubaddr_to_str(guint8 *ad, int ad_len)
|
|
|
|
{
|
|
|
|
if (ad_len == 0)
|
|
|
|
return "<No address>";
|
|
|
|
|
|
|
|
/*
|
|
|
|
* XXX - break down into subcomponents?
|
|
|
|
*/
|
|
|
|
return bytes_to_str(ad, ad_len);
|
|
|
|
}
|
|
|
|
|
1999-11-04 08:15:38 +00:00
|
|
|
static const value_string hrd_vals[] = {
|
|
|
|
{ARPHRD_NETROM, "NET/ROM pseudo" },
|
|
|
|
{ARPHRD_ETHER, "Ethernet" },
|
|
|
|
{ARPHRD_EETHER, "Experimental Ethernet"},
|
|
|
|
{ARPHRD_AX25, "AX.25" },
|
|
|
|
{ARPHRD_PRONET, "ProNET" },
|
|
|
|
{ARPHRD_CHAOS, "Chaos" },
|
|
|
|
{ARPHRD_IEEE802, "IEEE 802" },
|
|
|
|
{ARPHRD_ARCNET, "ARCNET" },
|
|
|
|
{ARPHRD_HYPERCH, "Hyperchannel" },
|
|
|
|
{ARPHRD_LANSTAR, "Lanstar" },
|
|
|
|
{ARPHRD_AUTONET, "Autonet Short Address"},
|
|
|
|
{ARPHRD_LOCALTLK, "Localtalk" },
|
|
|
|
{ARPHRD_LOCALNET, "LocalNet" },
|
|
|
|
{ARPHRD_ULTRALNK, "Ultra link" },
|
|
|
|
{ARPHRD_SMDS, "SMDS" },
|
|
|
|
{ARPHRD_DLCI, "Frame Relay DLCI" },
|
|
|
|
{ARPHRD_ATM, "ATM" },
|
|
|
|
{ARPHRD_HDLC, "HDLC" },
|
|
|
|
{ARPHRD_FIBREC, "Fibre Channel" },
|
|
|
|
{ARPHRD_ATM2225, "ATM (RFC 2225)" },
|
|
|
|
{ARPHRD_SERIAL, "Serial Line" },
|
|
|
|
{ARPHRD_ATM2, "ATM" },
|
|
|
|
{ARPHRD_MS188220, "MIL-STD-188-220" },
|
|
|
|
{ARPHRD_METRICOM, "Metricom STRIP" },
|
|
|
|
{ARPHRD_IEEE1394, "IEEE 1394.1995" },
|
|
|
|
{ARPHRD_MAPOS, "MAPOS" },
|
|
|
|
{ARPHRD_TWINAX, "Twinaxial" },
|
|
|
|
{ARPHRD_EUI_64, "EUI-64" },
|
|
|
|
{0, NULL } };
|
|
|
|
|
1999-01-28 21:29:36 +00:00
|
|
|
gchar *
|
|
|
|
arphrdtype_to_str(guint16 hwtype, const char *fmt) {
|
|
|
|
return val_to_str(hwtype, hrd_vals, fmt);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Offsets of fields within an ARP packet. */
|
|
|
|
#define AR_HRD 0
|
|
|
|
#define AR_PRO 2
|
|
|
|
#define AR_HLN 4
|
|
|
|
#define AR_PLN 5
|
|
|
|
#define AR_OP 6
|
1999-10-03 17:12:15 +00:00
|
|
|
#define MIN_ARP_HEADER_SIZE 8
|
1999-01-28 21:29:36 +00:00
|
|
|
|
1999-11-27 04:01:43 +00:00
|
|
|
/* Offsets of fields within an ATMARP packet. */
|
|
|
|
#define ATM_AR_HRD 0
|
|
|
|
#define ATM_AR_PRO 2
|
|
|
|
#define ATM_AR_SHTL 4
|
|
|
|
#define ATM_AR_SSL 5
|
|
|
|
#define ATM_AR_OP 6
|
|
|
|
#define ATM_AR_SPLN 8
|
|
|
|
#define ATM_AR_THTL 9
|
|
|
|
#define ATM_AR_TSL 10
|
|
|
|
#define ATM_AR_TPLN 11
|
|
|
|
#define MIN_ATMARP_HEADER_SIZE 12
|
|
|
|
|
1999-11-27 04:48:14 +00:00
|
|
|
static void
|
|
|
|
dissect_atm_number(const u_char *pd, int offset, int tl, int hf_e164,
|
|
|
|
int hf_nsap, proto_tree *tree)
|
|
|
|
{
|
|
|
|
int len = tl & ATMARP_LEN_MASK;
|
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *nsap_tree;
|
|
|
|
|
|
|
|
if (tl & ATMARP_IS_E164)
|
|
|
|
proto_tree_add_item(tree, hf_e164, offset, len, &pd[offset]);
|
|
|
|
else {
|
|
|
|
ti = proto_tree_add_item(tree, hf_nsap, offset, len,
|
|
|
|
&pd[offset]);
|
|
|
|
if (len >= 20) {
|
|
|
|
nsap_tree = proto_item_add_subtree(ti, ett_atmarp_nsap);
|
|
|
|
dissect_atm_nsap(pd, offset, len, nsap_tree);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
dissect_atm_nsap(const u_char *pd, int offset, int len, proto_tree *tree)
|
|
|
|
{
|
|
|
|
switch (pd[offset]) {
|
|
|
|
|
|
|
|
case 0x39: /* DCC ATM format */
|
|
|
|
case 0xBD: /* DCC ATM group format */
|
|
|
|
proto_tree_add_text(tree, offset + 0, 3,
|
|
|
|
"Data Country Code%s: 0x%04X",
|
|
|
|
(pd[offset] == 0xBD) ? " (group)" : "",
|
|
|
|
pntohs(&pd[offset + 1]));
|
|
|
|
proto_tree_add_text(tree, offset + 3, 10,
|
|
|
|
"High Order DSP: %s",
|
|
|
|
bytes_to_str(&pd[offset + 3], 10));
|
|
|
|
proto_tree_add_text(tree, offset + 13, 6,
|
|
|
|
"End System Identifier: %s",
|
|
|
|
bytes_to_str(&pd[offset + 13], 6));
|
|
|
|
proto_tree_add_text(tree, offset + 19, 1,
|
|
|
|
"Selector: 0x%02X", pd[offset + 19]);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x47: /* ICD ATM format */
|
|
|
|
case 0xC5: /* ICD ATM group format */
|
|
|
|
proto_tree_add_text(tree, offset + 0, 3,
|
|
|
|
"International Code Designator%s: 0x%04X",
|
|
|
|
(pd[offset] == 0xC5) ? " (group)" : "",
|
|
|
|
pntohs(&pd[offset + 1]));
|
|
|
|
proto_tree_add_text(tree, offset + 3, 10,
|
|
|
|
"High Order DSP: %s",
|
|
|
|
bytes_to_str(&pd[offset + 3], 10));
|
|
|
|
proto_tree_add_text(tree, offset + 13, 6,
|
|
|
|
"End System Identifier: %s",
|
|
|
|
bytes_to_str(&pd[offset + 13], 6));
|
|
|
|
proto_tree_add_text(tree, offset + 19, 1,
|
|
|
|
"Selector: 0x%02X", pd[offset + 19]);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x45: /* E.164 ATM format */
|
|
|
|
case 0xC3: /* E.164 ATM group format */
|
|
|
|
proto_tree_add_text(tree, offset + 0, 9,
|
|
|
|
"E.164 ISDN%s: %s",
|
|
|
|
(pd[offset] == 0xC3) ? " (group)" : "",
|
|
|
|
bytes_to_str(&pd[offset + 1], 8));
|
|
|
|
proto_tree_add_text(tree, offset + 9, 4,
|
|
|
|
"High Order DSP: %s",
|
|
|
|
bytes_to_str(&pd[offset + 3], 10));
|
|
|
|
proto_tree_add_text(tree, offset + 13, 6,
|
|
|
|
"End System Identifier: %s",
|
|
|
|
bytes_to_str(&pd[offset + 13], 6));
|
|
|
|
proto_tree_add_text(tree, offset + 19, 1,
|
|
|
|
"Selector: 0x%02X", pd[offset + 19]);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
proto_tree_add_text(tree, offset, 1,
|
|
|
|
"Unknown AFI: 0x%02X", pd[offset]);
|
|
|
|
proto_tree_add_text(tree, offset + 1, len - 1,
|
|
|
|
"Rest of address: %s",
|
|
|
|
bytes_to_str(&pd[offset + 1], len - 1));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-11-27 04:01:43 +00:00
|
|
|
/*
|
|
|
|
* RFC 2225 ATMARP - it's just like ARP, except where it isn't.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
dissect_atmarp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
|
|
|
|
{
|
|
|
|
guint16 ar_hrd;
|
|
|
|
guint16 ar_pro;
|
|
|
|
guint8 ar_shtl;
|
|
|
|
guint8 ar_sht;
|
|
|
|
guint8 ar_shl;
|
|
|
|
guint8 ar_ssl;
|
|
|
|
guint16 ar_op;
|
|
|
|
guint8 ar_spln;
|
|
|
|
guint8 ar_thtl;
|
|
|
|
guint8 ar_tht;
|
|
|
|
guint8 ar_thl;
|
|
|
|
guint8 ar_tsl;
|
|
|
|
guint8 ar_tpln;
|
|
|
|
int tot_len;
|
|
|
|
proto_tree *arp_tree;
|
|
|
|
proto_item *ti;
|
|
|
|
gchar *op_str;
|
|
|
|
int sha_offset, ssa_offset, spa_offset;
|
|
|
|
int tha_offset, tsa_offset, tpa_offset;
|
|
|
|
gchar *sha_str, *ssa_str, *spa_str;
|
|
|
|
gchar *tha_str, *tsa_str, *tpa_str;
|
|
|
|
|
|
|
|
if (!BYTES_ARE_IN_FRAME(offset, MIN_ATMARP_HEADER_SIZE)) {
|
|
|
|
dissect_data(pd, offset, fd, tree);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ar_hrd = pntohs(&pd[offset + ATM_AR_HRD]);
|
|
|
|
ar_pro = pntohs(&pd[offset + ATM_AR_PRO]);
|
|
|
|
ar_shtl = (guint8) pd[offset + ATM_AR_SHTL];
|
|
|
|
ar_sht = ar_shtl & ATMARP_IS_E164;
|
|
|
|
ar_shl = ar_shtl & ATMARP_LEN_MASK;
|
|
|
|
ar_ssl = (guint8) pd[offset + ATM_AR_SSL];
|
|
|
|
ar_op = pntohs(&pd[offset + AR_OP]);
|
|
|
|
ar_spln = (guint8) pd[offset + ATM_AR_SPLN];
|
|
|
|
ar_thtl = (guint8) pd[offset + ATM_AR_THTL];
|
|
|
|
ar_tht = ar_thtl & ATMARP_IS_E164;
|
|
|
|
ar_thl = ar_thtl & ATMARP_LEN_MASK;
|
|
|
|
ar_tsl = (guint8) pd[offset + ATM_AR_TSL];
|
|
|
|
ar_tpln = (guint8) pd[offset + ATM_AR_TPLN];
|
|
|
|
|
|
|
|
tot_len = MIN_ATMARP_HEADER_SIZE + ar_shtl + ar_ssl + ar_spln +
|
|
|
|
ar_thtl + ar_tsl + ar_tpln;
|
|
|
|
if (!BYTES_ARE_IN_FRAME(offset, tot_len)) {
|
|
|
|
dissect_data(pd, offset, fd, tree);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Extract the addresses. */
|
|
|
|
sha_offset = offset + MIN_ATMARP_HEADER_SIZE;
|
|
|
|
if (ar_shl != 0)
|
|
|
|
sha_str = atmarpnum_to_str((guint8 *) &pd[sha_offset], ar_shtl);
|
|
|
|
else
|
|
|
|
sha_str = "<No address>";
|
|
|
|
ssa_offset = sha_offset + ar_shl;
|
|
|
|
if (ar_ssl != 0)
|
|
|
|
ssa_str = atmarpsubaddr_to_str((guint8 *) &pd[ssa_offset], ar_ssl);
|
|
|
|
else
|
|
|
|
ssa_str = NULL;
|
|
|
|
spa_offset = ssa_offset + ar_ssl;
|
|
|
|
spa_str = arpproaddr_to_str((guint8 *) &pd[spa_offset], ar_spln, ar_pro);
|
|
|
|
tha_offset = spa_offset + ar_spln;
|
|
|
|
if (ar_thl != 0)
|
|
|
|
tha_str = atmarpnum_to_str((guint8 *) &pd[tha_offset], ar_thtl);
|
|
|
|
else
|
|
|
|
tha_str = "<No address>";
|
|
|
|
tsa_offset = tha_offset + ar_thl;
|
|
|
|
if (ar_tsl != 0)
|
|
|
|
tsa_str = atmarpsubaddr_to_str((guint8 *) &pd[tsa_offset], ar_tsl);
|
|
|
|
else
|
|
|
|
tsa_str = NULL;
|
|
|
|
tpa_offset = tsa_offset + ar_tsl;
|
|
|
|
tpa_str = arpproaddr_to_str((guint8 *) &pd[tpa_offset], ar_tpln, ar_pro);
|
|
|
|
|
|
|
|
if (check_col(fd, COL_PROTOCOL)) {
|
|
|
|
switch (ar_op) {
|
|
|
|
|
|
|
|
case ARPOP_REQUEST:
|
|
|
|
case ARPOP_REPLY:
|
|
|
|
case ATMARPOP_NAK:
|
|
|
|
default:
|
|
|
|
col_add_str(fd, COL_PROTOCOL, "ATMARP");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ARPOP_RREQUEST:
|
|
|
|
case ARPOP_RREPLY:
|
|
|
|
col_add_str(fd, COL_PROTOCOL, "ATMRARP");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ARPOP_IREQUEST:
|
|
|
|
case ARPOP_IREPLY:
|
|
|
|
col_add_str(fd, COL_PROTOCOL, "Inverse ATMARP");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (check_col(fd, COL_INFO)) {
|
|
|
|
switch (ar_op) {
|
|
|
|
case ARPOP_REQUEST:
|
|
|
|
col_add_fstr(fd, COL_INFO, "Who has %s? Tell %s", tpa_str, spa_str);
|
|
|
|
break;
|
|
|
|
case ARPOP_REPLY:
|
|
|
|
col_add_fstr(fd, COL_INFO, "%s is at %s%s%s", spa_str, sha_str,
|
|
|
|
((ssa_str != NULL) ? "," : ""),
|
|
|
|
((ssa_str != NULL) ? ssa_str : ""));
|
|
|
|
break;
|
|
|
|
case ARPOP_IREQUEST:
|
|
|
|
col_add_fstr(fd, COL_INFO, "Who is %s%s%s? Tell %s%s%s", tha_str,
|
|
|
|
((tsa_str != NULL) ? "," : ""),
|
|
|
|
((tsa_str != NULL) ? tsa_str : ""),
|
|
|
|
sha_str,
|
|
|
|
((ssa_str != NULL) ? "," : ""),
|
|
|
|
((ssa_str != NULL) ? ssa_str : ""));
|
|
|
|
break;
|
|
|
|
case ARPOP_IREPLY:
|
|
|
|
col_add_fstr(fd, COL_INFO, "%s%s%s is at %s", sha_str,
|
|
|
|
((ssa_str != NULL) ? "," : ""),
|
|
|
|
((ssa_str != NULL) ? ssa_str : ""),
|
|
|
|
spa_str);
|
|
|
|
break;
|
|
|
|
case ATMARPOP_NAK:
|
|
|
|
col_add_fstr(fd, COL_INFO, "I don't know where %s is", spa_str);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
col_add_fstr(fd, COL_INFO, "Unknown ATMARP opcode 0x%04x", ar_op);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
if ((op_str = match_strval(ar_op, atmop_vals)))
|
2000-03-12 04:48:32 +00:00
|
|
|
ti = proto_tree_add_protocol_format(tree, proto_arp, offset, tot_len,
|
1999-12-07 15:38:20 +00:00
|
|
|
"ATM Address Resolution Protocol (%s)",
|
|
|
|
op_str);
|
1999-11-27 04:01:43 +00:00
|
|
|
else
|
2000-03-12 04:48:32 +00:00
|
|
|
ti = proto_tree_add_protocol_format(tree, proto_arp, offset, tot_len,
|
1999-12-07 15:38:20 +00:00
|
|
|
"ATM Address Resolution Protocol (opcode 0x%04x)", ar_op);
|
1999-11-27 04:01:43 +00:00
|
|
|
arp_tree = proto_item_add_subtree(ti, ett_arp);
|
|
|
|
proto_tree_add_item(arp_tree, hf_arp_hard_type, offset + ATM_AR_HRD, 2,
|
|
|
|
ar_hrd);
|
|
|
|
proto_tree_add_item(arp_tree, hf_arp_proto_type, offset + ATM_AR_PRO, 2,
|
|
|
|
ar_pro);
|
|
|
|
proto_tree_add_item(arp_tree, hf_atmarp_shtl, offset + ATM_AR_SHTL, 1,
|
|
|
|
ar_shtl);
|
|
|
|
proto_tree_add_item(arp_tree, hf_atmarp_ssl, offset + ATM_AR_SSL, 1,
|
|
|
|
ar_ssl);
|
|
|
|
proto_tree_add_item(arp_tree, hf_arp_opcode, offset + AR_OP, 2,
|
|
|
|
ar_op);
|
|
|
|
proto_tree_add_item(arp_tree, hf_atmarp_spln, offset + ATM_AR_SPLN, 1,
|
|
|
|
ar_spln);
|
|
|
|
proto_tree_add_item(arp_tree, hf_atmarp_thtl, offset + ATM_AR_THTL, 1,
|
|
|
|
ar_thtl);
|
|
|
|
proto_tree_add_item(arp_tree, hf_atmarp_tsl, offset + ATM_AR_TSL, 1,
|
|
|
|
ar_tsl);
|
|
|
|
proto_tree_add_item(arp_tree, hf_atmarp_tpln, offset + ATM_AR_TPLN, 1,
|
|
|
|
ar_tpln);
|
|
|
|
if (ar_shl != 0)
|
1999-11-27 04:48:14 +00:00
|
|
|
dissect_atm_number(pd, sha_offset, ar_shtl, hf_atmarp_src_atm_num_e164,
|
|
|
|
hf_atmarp_src_atm_num_nsap, arp_tree);
|
1999-11-27 04:01:43 +00:00
|
|
|
if (ar_ssl != 0)
|
2000-03-12 04:48:32 +00:00
|
|
|
proto_tree_add_bytes_format(arp_tree, hf_atmarp_src_atm_subaddr, ssa_offset,
|
1999-11-27 04:01:43 +00:00
|
|
|
ar_ssl,
|
|
|
|
&pd[ssa_offset],
|
|
|
|
"Sender ATM subaddress: %s", ssa_str);
|
|
|
|
if (ar_spln != 0)
|
2000-03-12 04:48:32 +00:00
|
|
|
proto_tree_add_bytes_format(arp_tree, hf_arp_src_proto, spa_offset, ar_spln,
|
1999-11-27 04:01:43 +00:00
|
|
|
&pd[spa_offset],
|
|
|
|
"Sender protocol address: %s", spa_str);
|
|
|
|
if (ar_thl != 0)
|
1999-11-27 04:48:14 +00:00
|
|
|
dissect_atm_number(pd, tha_offset, ar_thtl, hf_atmarp_dst_atm_num_e164,
|
|
|
|
hf_atmarp_dst_atm_num_nsap, arp_tree);
|
1999-11-27 04:01:43 +00:00
|
|
|
if (ar_tsl != 0)
|
2000-03-12 04:48:32 +00:00
|
|
|
proto_tree_add_bytes_format(arp_tree, hf_atmarp_dst_atm_subaddr, tsa_offset,
|
1999-11-27 04:01:43 +00:00
|
|
|
ar_tsl,
|
|
|
|
&pd[tsa_offset],
|
|
|
|
"Target ATM subaddress: %s", tsa_str);
|
|
|
|
if (ar_tpln != 0)
|
2000-03-12 04:48:32 +00:00
|
|
|
proto_tree_add_bytes_format(arp_tree, hf_arp_dst_proto, tpa_offset, ar_tpln,
|
1999-11-27 04:01:43 +00:00
|
|
|
&pd[tpa_offset],
|
|
|
|
"Target protocol address: %s", tpa_str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-04-16 22:59:37 +00:00
|
|
|
static void
|
1999-11-27 04:01:43 +00:00
|
|
|
dissect_arp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
|
|
|
|
{
|
1999-01-28 21:29:36 +00:00
|
|
|
guint16 ar_hrd;
|
|
|
|
guint16 ar_pro;
|
|
|
|
guint8 ar_hln;
|
|
|
|
guint8 ar_pln;
|
|
|
|
guint16 ar_op;
|
1999-11-27 04:01:43 +00:00
|
|
|
int tot_len;
|
1999-03-23 03:14:46 +00:00
|
|
|
proto_tree *arp_tree;
|
|
|
|
proto_item *ti;
|
1999-01-28 21:29:36 +00:00
|
|
|
gchar *op_str;
|
|
|
|
int sha_offset, spa_offset, tha_offset, tpa_offset;
|
|
|
|
gchar *sha_str, *spa_str, *tha_str, *tpa_str;
|
|
|
|
|
1999-10-03 17:12:15 +00:00
|
|
|
if (!BYTES_ARE_IN_FRAME(offset, MIN_ARP_HEADER_SIZE)) {
|
|
|
|
dissect_data(pd, offset, fd, tree);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1998-11-03 07:45:10 +00:00
|
|
|
ar_hrd = pntohs(&pd[offset + AR_HRD]);
|
1999-11-27 04:01:43 +00:00
|
|
|
if (ar_hrd == ARPHRD_ATM2225) {
|
|
|
|
dissect_atmarp(pd, offset, fd, tree);
|
|
|
|
return;
|
|
|
|
}
|
1998-11-03 07:45:10 +00:00
|
|
|
ar_pro = pntohs(&pd[offset + AR_PRO]);
|
|
|
|
ar_hln = (guint8) pd[offset + AR_HLN];
|
|
|
|
ar_pln = (guint8) pd[offset + AR_PLN];
|
|
|
|
ar_op = pntohs(&pd[offset + AR_OP]);
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1999-11-27 04:01:43 +00:00
|
|
|
tot_len = MIN_ARP_HEADER_SIZE + ar_hln*2 + ar_pln*2;
|
|
|
|
if (!BYTES_ARE_IN_FRAME(offset, tot_len)) {
|
1999-10-03 17:12:15 +00:00
|
|
|
dissect_data(pd, offset, fd, tree);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1998-11-03 07:45:10 +00:00
|
|
|
/* Extract the addresses. */
|
1999-10-03 17:12:15 +00:00
|
|
|
sha_offset = offset + MIN_ARP_HEADER_SIZE;
|
1998-11-03 07:45:10 +00:00
|
|
|
sha_str = arphrdaddr_to_str((guint8 *) &pd[sha_offset], ar_hln, ar_hrd);
|
|
|
|
spa_offset = sha_offset + ar_hln;
|
|
|
|
spa_str = arpproaddr_to_str((guint8 *) &pd[spa_offset], ar_pln, ar_pro);
|
|
|
|
tha_offset = spa_offset + ar_pln;
|
|
|
|
tha_str = arphrdaddr_to_str((guint8 *) &pd[tha_offset], ar_hln, ar_hrd);
|
|
|
|
tpa_offset = tha_offset + ar_hln;
|
|
|
|
tpa_str = arpproaddr_to_str((guint8 *) &pd[tpa_offset], ar_pln, ar_pro);
|
|
|
|
|
1998-11-17 04:29:13 +00:00
|
|
|
if (check_col(fd, COL_PROTOCOL)) {
|
1999-09-12 06:11:51 +00:00
|
|
|
switch (ar_op) {
|
|
|
|
|
|
|
|
case ARPOP_REQUEST:
|
|
|
|
case ARPOP_REPLY:
|
|
|
|
default:
|
1998-11-17 04:29:13 +00:00
|
|
|
col_add_str(fd, COL_PROTOCOL, "ARP");
|
1999-09-12 06:11:51 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ARPOP_RREQUEST:
|
|
|
|
case ARPOP_RREPLY:
|
|
|
|
col_add_str(fd, COL_PROTOCOL, "RARP");
|
|
|
|
break;
|
1999-11-27 04:01:43 +00:00
|
|
|
|
|
|
|
case ARPOP_IREQUEST:
|
|
|
|
case ARPOP_IREPLY:
|
|
|
|
col_add_str(fd, COL_PROTOCOL, "Inverse ARP");
|
|
|
|
break;
|
1999-09-12 06:11:51 +00:00
|
|
|
}
|
1998-11-17 04:29:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (check_col(fd, COL_INFO)) {
|
1998-11-03 07:45:10 +00:00
|
|
|
switch (ar_op) {
|
|
|
|
case ARPOP_REQUEST:
|
1999-11-04 08:15:38 +00:00
|
|
|
col_add_fstr(fd, COL_INFO, "Who has %s? Tell %s", tpa_str, spa_str);
|
1998-11-03 07:45:10 +00:00
|
|
|
break;
|
|
|
|
case ARPOP_REPLY:
|
1998-11-17 04:29:13 +00:00
|
|
|
col_add_fstr(fd, COL_INFO, "%s is at %s", spa_str, sha_str);
|
1998-11-03 07:45:10 +00:00
|
|
|
break;
|
|
|
|
case ARPOP_RREQUEST:
|
1999-11-27 04:01:43 +00:00
|
|
|
case ARPOP_IREQUEST:
|
1999-11-04 08:15:38 +00:00
|
|
|
col_add_fstr(fd, COL_INFO, "Who is %s? Tell %s", tha_str, sha_str);
|
1998-11-03 07:45:10 +00:00
|
|
|
break;
|
|
|
|
case ARPOP_RREPLY:
|
1999-11-27 04:01:43 +00:00
|
|
|
case ARPOP_IREPLY:
|
1998-11-17 04:29:13 +00:00
|
|
|
col_add_fstr(fd, COL_INFO, "%s is at %s", sha_str, spa_str);
|
1998-11-03 07:45:10 +00:00
|
|
|
break;
|
|
|
|
default:
|
1998-11-17 04:29:13 +00:00
|
|
|
col_add_fstr(fd, COL_INFO, "Unknown ARP opcode 0x%04x", ar_op);
|
1998-11-03 07:45:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
if ((op_str = match_strval(ar_op, op_vals)))
|
2000-03-12 04:48:32 +00:00
|
|
|
ti = proto_tree_add_protocol_format(tree, proto_arp, offset, tot_len,
|
1999-12-07 15:38:20 +00:00
|
|
|
"Address Resolution Protocol (%s)", op_str);
|
1998-11-03 07:45:10 +00:00
|
|
|
else
|
2000-03-12 04:48:32 +00:00
|
|
|
ti = proto_tree_add_protocol_format(tree, proto_arp, offset, tot_len,
|
1999-12-07 15:38:20 +00:00
|
|
|
"Address Resolution Protocol (opcode 0x%04x)", ar_op);
|
1999-11-16 11:44:20 +00:00
|
|
|
arp_tree = proto_item_add_subtree(ti, ett_arp);
|
1999-11-04 08:15:38 +00:00
|
|
|
proto_tree_add_item(arp_tree, hf_arp_hard_type, offset + AR_HRD, 2,
|
|
|
|
ar_hrd);
|
|
|
|
proto_tree_add_item(arp_tree, hf_arp_proto_type, offset + AR_PRO, 2,
|
|
|
|
ar_pro);
|
1999-10-16 08:37:30 +00:00
|
|
|
proto_tree_add_item(arp_tree, hf_arp_hard_size, offset + AR_HLN, 1,
|
1999-11-04 08:15:38 +00:00
|
|
|
ar_hln);
|
1999-10-16 08:37:30 +00:00
|
|
|
proto_tree_add_item(arp_tree, hf_arp_proto_size, offset + AR_PLN, 1,
|
1999-11-04 08:15:38 +00:00
|
|
|
ar_pln);
|
|
|
|
proto_tree_add_item(arp_tree, hf_arp_opcode, offset + AR_OP, 2,
|
|
|
|
ar_op);
|
1999-11-27 04:01:43 +00:00
|
|
|
if (ar_hln != 0)
|
2000-03-12 04:48:32 +00:00
|
|
|
proto_tree_add_bytes_format(arp_tree, hf_arp_src_ether, sha_offset, ar_hln,
|
1999-11-04 08:15:38 +00:00
|
|
|
&pd[sha_offset],
|
1999-10-03 17:12:15 +00:00
|
|
|
"Sender hardware address: %s", sha_str);
|
1999-11-27 04:01:43 +00:00
|
|
|
if (ar_pln != 0)
|
2000-03-12 04:48:32 +00:00
|
|
|
proto_tree_add_bytes_format(arp_tree, hf_arp_src_proto, spa_offset, ar_pln,
|
1999-10-03 17:12:15 +00:00
|
|
|
&pd[spa_offset],
|
|
|
|
"Sender protocol address: %s", spa_str);
|
1999-11-27 04:01:43 +00:00
|
|
|
if (ar_hln != 0)
|
2000-03-12 04:48:32 +00:00
|
|
|
proto_tree_add_bytes_format(arp_tree, hf_arp_dst_ether, tha_offset, ar_hln,
|
1999-10-03 17:12:15 +00:00
|
|
|
&pd[tha_offset],
|
|
|
|
"Target hardware address: %s", tha_str);
|
1999-11-27 04:01:43 +00:00
|
|
|
if (ar_pln != 0)
|
2000-03-12 04:48:32 +00:00
|
|
|
proto_tree_add_bytes_format(arp_tree, hf_arp_dst_proto, tpa_offset, ar_pln,
|
1999-10-03 17:12:15 +00:00
|
|
|
&pd[tpa_offset],
|
|
|
|
"Target protocol address: %s", tpa_str);
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
|
|
|
}
|
1999-07-29 05:47:07 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_arp(void)
|
|
|
|
{
|
1999-10-03 17:12:15 +00:00
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_arp_hard_type,
|
1999-10-16 08:37:30 +00:00
|
|
|
{ "Hardware type", "arp.hw.type",
|
1999-11-04 08:15:38 +00:00
|
|
|
FT_UINT16, BASE_HEX, VALS(hrd_vals), 0x0,
|
1999-10-12 06:21:15 +00:00
|
|
|
"" }},
|
|
|
|
|
1999-10-03 17:12:15 +00:00
|
|
|
{ &hf_arp_proto_type,
|
1999-10-16 08:37:30 +00:00
|
|
|
{ "Protocol type", "arp.proto.type",
|
1999-11-04 08:15:38 +00:00
|
|
|
FT_UINT16, BASE_HEX, VALS(etype_vals), 0x0,
|
1999-10-12 06:21:15 +00:00
|
|
|
"" }},
|
|
|
|
|
1999-10-03 17:12:15 +00:00
|
|
|
{ &hf_arp_hard_size,
|
1999-11-27 04:01:43 +00:00
|
|
|
{ "Hardware size", "arp.hw.size",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
"" }},
|
|
|
|
|
|
|
|
{ &hf_atmarp_shtl,
|
|
|
|
{ "Sender ATM number type and length", "arp.src.htl",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
"" }},
|
|
|
|
|
|
|
|
{ &hf_atmarp_ssl,
|
|
|
|
{ "Sender ATM subaddress length", "arp.src.slen",
|
1999-10-16 08:37:30 +00:00
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
1999-10-12 06:21:15 +00:00
|
|
|
"" }},
|
|
|
|
|
1999-10-03 17:12:15 +00:00
|
|
|
{ &hf_arp_proto_size,
|
1999-10-16 08:37:30 +00:00
|
|
|
{ "Protocol size", "arp.proto.size",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
1999-10-12 06:21:15 +00:00
|
|
|
"" }},
|
|
|
|
|
1999-10-03 17:12:15 +00:00
|
|
|
{ &hf_arp_opcode,
|
1999-10-16 08:37:30 +00:00
|
|
|
{ "Opcode", "arp.opcode",
|
1999-11-04 08:15:38 +00:00
|
|
|
FT_UINT16, BASE_HEX, VALS(op_vals), 0x0,
|
1999-10-12 06:21:15 +00:00
|
|
|
"" }},
|
|
|
|
|
1999-11-27 04:01:43 +00:00
|
|
|
{ &hf_atmarp_spln,
|
|
|
|
{ "Sender protocol size", "arp.src.pln",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
"" }},
|
|
|
|
|
|
|
|
{ &hf_atmarp_thtl,
|
|
|
|
{ "Target ATM number type and length", "arp.dst.htl",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
"" }},
|
|
|
|
|
|
|
|
{ &hf_atmarp_tsl,
|
|
|
|
{ "Target ATM subaddress length", "arp.dst.slen",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
"" }},
|
|
|
|
|
|
|
|
{ &hf_atmarp_tpln,
|
|
|
|
{ "Target protocol size", "arp.dst.pln",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
"" }},
|
|
|
|
|
1999-10-03 17:12:15 +00:00
|
|
|
{ &hf_arp_src_ether,
|
1999-10-16 08:37:30 +00:00
|
|
|
{ "Sender hardware address", "arp.src.hw",
|
|
|
|
FT_BYTES, BASE_NONE, NULL, 0x0,
|
1999-10-12 06:21:15 +00:00
|
|
|
"" }},
|
|
|
|
|
1999-11-27 04:48:14 +00:00
|
|
|
{ &hf_atmarp_src_atm_num_e164,
|
|
|
|
{ "Sender ATM number (E.164)", "arp.src.atm_num_e164",
|
|
|
|
FT_STRING, BASE_NONE, NULL, 0x0,
|
|
|
|
"" }},
|
|
|
|
|
|
|
|
{ &hf_atmarp_src_atm_num_nsap,
|
|
|
|
{ "Sender ATM number (NSAP)", "arp.src.atm_num_nsap",
|
1999-11-27 04:01:43 +00:00
|
|
|
FT_BYTES, BASE_NONE, NULL, 0x0,
|
|
|
|
"" }},
|
|
|
|
|
|
|
|
{ &hf_atmarp_src_atm_subaddr,
|
|
|
|
{ "Sender ATM subaddress", "arp.src.atm_subaddr",
|
|
|
|
FT_BYTES, BASE_NONE, NULL, 0x0,
|
|
|
|
"" }},
|
|
|
|
|
1999-10-03 17:12:15 +00:00
|
|
|
{ &hf_arp_src_proto,
|
1999-10-16 08:37:30 +00:00
|
|
|
{ "Sender protocol address", "arp.src.proto",
|
|
|
|
FT_BYTES, BASE_NONE, NULL, 0x0,
|
1999-10-12 06:21:15 +00:00
|
|
|
"" }},
|
|
|
|
|
1999-10-03 17:12:15 +00:00
|
|
|
{ &hf_arp_dst_ether,
|
1999-10-16 08:37:30 +00:00
|
|
|
{ "Target hardware address", "arp.dst.hw",
|
|
|
|
FT_BYTES, BASE_NONE, NULL, 0x0,
|
1999-10-12 06:21:15 +00:00
|
|
|
"" }},
|
|
|
|
|
1999-11-27 04:48:14 +00:00
|
|
|
{ &hf_atmarp_dst_atm_num_e164,
|
|
|
|
{ "Target ATM number (E.164)", "arp.dst.atm_num_e164",
|
|
|
|
FT_STRING, BASE_NONE, NULL, 0x0,
|
|
|
|
"" }},
|
|
|
|
|
|
|
|
{ &hf_atmarp_dst_atm_num_nsap,
|
|
|
|
{ "Target ATM number (NSAP)", "arp.dst.atm_num_nsap",
|
1999-11-27 04:01:43 +00:00
|
|
|
FT_BYTES, BASE_NONE, NULL, 0x0,
|
|
|
|
"" }},
|
|
|
|
|
|
|
|
{ &hf_atmarp_dst_atm_subaddr,
|
|
|
|
{ "Target ATM subaddress", "arp.dst.atm_subaddr",
|
|
|
|
FT_BYTES, BASE_NONE, NULL, 0x0,
|
|
|
|
"" }},
|
|
|
|
|
1999-10-03 17:12:15 +00:00
|
|
|
{ &hf_arp_dst_proto,
|
1999-10-16 08:37:30 +00:00
|
|
|
{ "Target protocol address", "arp.dst.proto",
|
|
|
|
FT_BYTES, BASE_NONE, NULL, 0x0,
|
1999-10-12 06:21:15 +00:00
|
|
|
"" }}
|
1999-10-03 17:12:15 +00:00
|
|
|
};
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_arp,
|
1999-11-27 04:48:14 +00:00
|
|
|
&ett_atmarp_nsap,
|
1999-11-16 11:44:20 +00:00
|
|
|
};
|
1999-07-29 05:47:07 +00:00
|
|
|
|
1999-10-03 17:12:15 +00:00
|
|
|
proto_arp = proto_register_protocol("Address Resolution Protocol", "arp");
|
|
|
|
proto_register_field_array(proto_arp, hf, array_length(hf));
|
1999-11-16 11:44:20 +00:00
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
1999-07-29 05:47:07 +00:00
|
|
|
}
|
Change the sub-dissector handoff registration routines so that the
sub-dissector table is not stored in the header_field_info struct, but
in a separate namespace. Dissector tables are now registered by name
and not by field ID. For example:
udp_dissector_table = register_dissector_table("udp.port");
Because of this different namespace, dissector tables can have names
that are not field names. This is useful for ethertype, since multiple
fields are "ethertypes".
packet-ethertype.c replaces ethertype.c (the name was changed so that it
would be named in the same fashion as all the filenames passed to make-reg-dotc)
Although it registers no protocol or field, it registers one dissector table:
ethertype_dissector_table = register_dissector_table("ethertype");
All protocols that can be called because of an ethertype field now register
that fact with dissector_add() calls.
In this way, one dissector_table services all ethertype fields
(hf_eth_type, hf_llc_type, hf_null_etype, hf_vlan_etype)
Furthermore, the code allows for names of protocols to exist in the
etype_vals, yet a dissector for that protocol doesn't exist. The name
of the dissector is printed in COL_INFO. You're welcome, Richard. :-)
svn path=/trunk/; revision=1848
2000-04-13 18:18:56 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_arp(void)
|
|
|
|
{
|
|
|
|
dissector_add("ethertype", ETHERTYPE_ARP, dissect_arp);
|
|
|
|
dissector_add("ethertype", ETHERTYPE_REVARP, dissect_arp);
|
|
|
|
}
|