summaryrefslogtreecommitdiff
path: root/epan
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-10-23 21:19:02 +0000
committerGuy Harris <guy@alum.mit.edu>2012-10-23 21:19:02 +0000
commit7c76ad78d3d2f891a4765cf619257437710f676f (patch)
treec524f975c43a44baa0ec3d2de5499cf35b16a209 /epan
parent31f7fee054c96c66b5e33fdbbde28fa9330cefe3 (diff)
downloadwireshark-7c76ad78d3d2f891a4765cf619257437710f676f.tar.gz
Add an AT_ value for 802.15.4 short addresses.
Note that, if you want EUI-64's to resolve the OUI in the display, hacking individual dissectors to do it themselves and use AT_STRINGZ is *not* the right way to do it. svn path=/trunk/; revision=45743
Diffstat (limited to 'epan')
-rw-r--r--epan/address.h41
-rw-r--r--epan/address_to_str.c8
-rw-r--r--epan/dissectors/packet-ieee802154.c24
3 files changed, 41 insertions, 32 deletions
diff --git a/epan/address.h b/epan/address.h
index e9626c27c8..8bdfebac45 100644
--- a/epan/address.h
+++ b/epan/address.h
@@ -38,26 +38,27 @@ extern "C" {
/* also be included in address_to_str_buf defined in to_str.c, for presentation purposes */
typedef enum {
- AT_NONE, /* no link-layer address */
- AT_ETHER, /* MAC (Ethernet, 802.x, FDDI) address */
- AT_IPv4, /* IPv4 */
- AT_IPv6, /* IPv6 */
- AT_IPX, /* IPX */
- AT_SNA, /* SNA */
- AT_ATALK, /* Appletalk DDP */
- AT_VINES, /* Banyan Vines */
- AT_OSI, /* OSI NSAP */
- AT_ARCNET, /* ARCNET */
- AT_FC, /* Fibre Channel */
- AT_SS7PC, /* SS7 Point Code */
- AT_STRINGZ, /* null-terminated string */
- AT_EUI64, /* IEEE EUI-64 */
- AT_URI, /* URI/URL/URN */
- AT_TIPC, /* TIPC Address Zone,Subnetwork,Processor */
- AT_IB, /* Infiniband GID/LID */
- AT_USB, /* USB Device address
- * (0xffffffff represents the host) */
- AT_AX25 /* AX.25 */
+ AT_NONE, /* no link-layer address */
+ AT_ETHER, /* MAC (Ethernet, 802.x, FDDI) address */
+ AT_IPv4, /* IPv4 */
+ AT_IPv6, /* IPv6 */
+ AT_IPX, /* IPX */
+ AT_SNA, /* SNA */
+ AT_ATALK, /* Appletalk DDP */
+ AT_VINES, /* Banyan Vines */
+ AT_OSI, /* OSI NSAP */
+ AT_ARCNET, /* ARCNET */
+ AT_FC, /* Fibre Channel */
+ AT_SS7PC, /* SS7 Point Code */
+ AT_STRINGZ, /* null-terminated string */
+ AT_EUI64, /* IEEE EUI-64 */
+ AT_URI, /* URI/URL/URN */
+ AT_TIPC, /* TIPC Address Zone,Subnetwork,Processor */
+ AT_IB, /* Infiniband GID/LID */
+ AT_USB, /* USB Device address
+ * (0xffffffff represents the host) */
+ AT_AX25, /* AX.25 */
+ AT_IEEE_802_15_4_SHORT /* IEEE 802.15.4 16-bit short address */
} address_type;
typedef enum {
diff --git a/epan/address_to_str.c b/epan/address_to_str.c
index 298287d635..e805a8fa2e 100644
--- a/epan/address_to_str.c
+++ b/epan/address_to_str.c
@@ -538,6 +538,7 @@ address_to_str_buf(const address *addr, gchar *buf, int buf_len)
{
const guint8 *addrdata;
struct atalk_ddp_addr ddp_addr;
+ guint16 ieee_802_15_4_short_addr;
char temp[32];
char *tempptr = temp;
@@ -615,6 +616,13 @@ address_to_str_buf(const address *addr, gchar *buf, int buf_len)
(addrdata[3] >> 1) & 0x7f, (addrdata[4] >> 1) & 0x7f, (addrdata[5] >> 1) & 0x7f,
(addrdata[6] >> 1) & 0x0f );
break;
+ case AT_IEEE_802_15_4_SHORT:
+ ieee_802_15_4_short_addr = pletohs(addr->data);
+ if (ieee_802_15_4_short_addr == 0xffff)
+ g_snprintf(buf, buf_len, "Broadcast");
+ else
+ g_snprintf(buf, buf_len, "0x%04x", ieee_802_15_4_short_addr);
+ break;
default:
g_assert_not_reached();
}
diff --git a/epan/dissectors/packet-ieee802154.c b/epan/dissectors/packet-ieee802154.c
index 05e67d863e..bbb47f563e 100644
--- a/epan/dissectors/packet-ieee802154.c
+++ b/epan/dissectors/packet-ieee802154.c
@@ -697,7 +697,7 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
/* Get destination address. */
if (packet->dst_addr_mode == IEEE802154_FCF_ADDR_SHORT) {
- static char dst_addr[32]; /* has to be static due to SET_ADDRESS */
+ char dst_addr[32];
/* Get the address. */
packet->dst16 = tvb_get_letohs(tvb, offset);
@@ -714,8 +714,8 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
ieee_hints->dst16 = packet->dst16;
}
- SET_ADDRESS(&pinfo->dl_dst, AT_STRINGZ, (int)strlen(dst_addr)+1, dst_addr);
- SET_ADDRESS(&pinfo->dst, AT_STRINGZ, (int)strlen(dst_addr)+1, dst_addr);
+ SET_ADDRESS(&pinfo->dl_dst, AT_IEEE_802_15_4_SHORT, 2, tvb_get_ptr(tvb, offset, 2));
+ SET_ADDRESS(&pinfo->dst, AT_IEEE_802_15_4_SHORT, 2, tvb_get_ptr(tvb, offset, 2));
if (tree) {
proto_tree_add_uint(ieee802154_tree, hf_ieee802154_dst16, tvb, offset, 2, packet->dst16);
@@ -737,9 +737,9 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
addr = pntoh64(&(packet->dst64));
/* Display the destination address. */
- /* NOTE: OUI resolution doesn't happen when displaying EUI64 addresses
- * might want to switch to AT_STRINZ type to display the OUI in
- * the address columns.
+ /* XXX - OUI resolution doesn't happen when displaying resolved
+ * EUI64 addresses; that should probably be fixed in
+ * epan/addr_resolv.c.
*/
SET_ADDRESS(&pinfo->dl_dst, AT_EUI64, 8, &addr);
SET_ADDRESS(&pinfo->dst, AT_EUI64, 8, &addr);
@@ -783,7 +783,7 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
/* Get short source address if present. */
if (packet->src_addr_mode == IEEE802154_FCF_ADDR_SHORT) {
- static char src_addr[32]; /* has to be static due to SET_ADDRESS */
+ char src_addr[32];
/* Get the address. */
packet->src16 = tvb_get_letohs(tvb, offset);
@@ -809,8 +809,8 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
}
}
- SET_ADDRESS(&pinfo->dl_src, AT_STRINGZ, (int)strlen(src_addr)+1, src_addr);
- SET_ADDRESS(&pinfo->src, AT_STRINGZ, (int)strlen(src_addr)+1, src_addr);
+ SET_ADDRESS(&pinfo->dl_src, AT_IEEE_802_15_4_SHORT, 2, tvb_get_ptr(tvb, offset, 2));
+ SET_ADDRESS(&pinfo->src, AT_IEEE_802_15_4_SHORT, 2, tvb_get_ptr(tvb, offset, 2));
/* Add the addressing info to the tree. */
if (tree) {
@@ -849,9 +849,9 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
addr = pntoh64(&(packet->src64));
/* Display the source address. */
- /* NOTE: OUI resolution doesn't happen when displaying EUI64 addresses
- * might want to switch to AT_STRINZ type to display the OUI in
- * the address columns.
+ /* XXX - OUI resolution doesn't happen when displaying resolved
+ * EUI64 addresses; that should probably be fixed in
+ * epan/addr_resolv.c.
*/
SET_ADDRESS(&pinfo->dl_src, AT_EUI64, 8, &addr);
SET_ADDRESS(&pinfo->src, AT_EUI64, 8, &addr);