Hi Eddie, RadiotapDecap was broken for me on big endian. Please find patch attached.
It now works at least to the point that it pulls the correct number of bytes from the packet. I am not 100% sure if the changes for RX and TX flags is correct, perhaps someone else can comment? Alastair
From 0b258605968f1048d83a304425501938861e2096 Mon Sep 17 00:00:00 2001 From: Alastair McKinley <[email protected]> Date: Sat, 24 Jan 2009 16:06:03 +0000 Subject: [PATCH] RadiotapDecap.cc endianness fixes --- elements/wifi/radiotapdecap.cc | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/elements/wifi/radiotapdecap.cc b/elements/wifi/radiotapdecap.cc index 7fc98af..0fef073 100644 --- a/elements/wifi/radiotapdecap.cc +++ b/elements/wifi/radiotapdecap.cc @@ -65,7 +65,7 @@ static int rt_check_header(struct ieee80211_radiotap_header *th, int len) return 0; } - if (th->it_len < sizeof(struct ieee80211_radiotap_header)) { + if (le16_to_cpu(th->it_len) < sizeof(struct ieee80211_radiotap_header)) { return 0; } @@ -74,11 +74,11 @@ static int rt_check_header(struct ieee80211_radiotap_header *th, int len) bytes += radiotap_elem_to_bytes[x]; } - if (th->it_len < sizeof(struct ieee80211_radiotap_header) + bytes) { + if (le16_to_cpu(th->it_len) < sizeof(struct ieee80211_radiotap_header) + bytes) { return 0; } - if (th->it_len > len) { + if (le16_to_cpu(th->it_len) > len) { return 0; } @@ -141,13 +141,13 @@ RadiotapDecap::simple_action(Packet *p) ceh->silence = *((u_int8_t *) rt_el_offset(th, IEEE80211_RADIOTAP_DB_ANTNOISE)); if (rt_el_present(th, IEEE80211_RADIOTAP_RX_FLAGS)) { - u_int16_t flags = *((u_int16_t *) rt_el_offset(th, IEEE80211_RADIOTAP_RX_FLAGS)); + u_int16_t flags = le16_to_cpu(*((u_int16_t *) rt_el_offset(th, IEEE80211_RADIOTAP_RX_FLAGS))); if (flags & IEEE80211_RADIOTAP_F_RX_BADFCS) ceh->flags |= WIFI_EXTRA_RX_ERR; } if (rt_el_present(th, IEEE80211_RADIOTAP_TX_FLAGS)) { - u_int16_t flags = *((u_int16_t *) rt_el_offset(th, IEEE80211_RADIOTAP_TX_FLAGS)); + u_int16_t flags = le16_to_cpu(*((u_int16_t *) rt_el_offset(th, IEEE80211_RADIOTAP_TX_FLAGS))); ceh->flags |= WIFI_EXTRA_TX; if (flags & IEEE80211_RADIOTAP_F_TX_FAIL) ceh->flags |= WIFI_EXTRA_TX_FAIL; -- 1.5.4.3
_______________________________________________ click mailing list [email protected] https://amsterdam.lcs.mit.edu/mailman/listinfo/click
