tcpdump mailing list archives

[PATCH] libpcap: Add datalink-type to match IEEE 802.15.4 ARP hardware type


From: Luca Bruno <lucab () debian org>
Date: Thu, 8 Apr 2010 22:25:11 +0200

Since Linux 2.6.30, IEEE 802.15.4 interfaces got assigned a proper
ARP hardware type (ARPHRD_IEEE802154 - 804).
This patch introduces the relevant code to match it with its own
DLT type.
There are currently three different types for it, but DLT_IEEE802_15_4
is the safest standard choice.

Signed-off-by: Luca Bruno <lucab () debian org>
---
 pcap-linux.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/pcap-linux.c b/pcap-linux.c
index af12543..782c0cc 100644
--- a/pcap-linux.c
+++ b/pcap-linux.c
@@ -2628,6 +2628,18 @@ static void map_arphrd_to_dlt(pcap_t *handle, int arptype, int cooked_ok)
                //handle->md.cooked = 1;
                break;
 
+#ifndef ARPHRD_IEEE802154
+#define ARPHRD_IEEE802154      804 /* From Linux 2.6.30 */
+#endif
+       case ARPHRD_IEEE802154:
+               /* You may choose between:
+                *  - DLT_IEEE802_15_4_LINUX
+                *  - DLT_IEEE802_15_4_NONASK_PHY
+                *  - DLT_IEEE802_15_4
+                * The last one is the safest default */
+               handle->linktype = DLT_IEEE802_15_4;
+               break;
+
        /* ARPHRD_LAPD is unofficial and randomly allocated, if reallocation
         * is needed, please report it to <daniele () orlandi com> */
 #ifndef ARPHRD_LAPD
-- 
1.7.0.4

-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: