[Click] [Patch] fix endianess in radiotap encap

Roberto Riggio roberto.riggio at create-net.org
Tue May 11 14:12:18 EDT 2010


This patch fixes the following issues
1) len and flag must always be LE.
2) the radiotapencap element specifies that the data_retries entry
is present, however it does not check the parameter is really different
from zero. this is a problem on the ath9k driver that in this case does not
transmitt the frame

--
diff --git a/elements/wifi/radiotapencap.cc b/elements/wifi/radiotapencap.cc
index 37d2d69..d481f1c 100644
--- a/elements/wifi/radiotapencap.cc
+++ b/elements/wifi/radiotapencap.cc
@@ -88,14 +88,16 @@ RadiotapEncap::simple_action(Packet *p)
        memset(crh, 0, sizeof(struct click_radiotap_header));

        crh->wt_ihdr.it_version = 0;
-      crh->wt_ihdr.it_len = sizeof(struct click_radiotap_header);
-      crh->wt_ihdr.it_present = CLICK_RADIOTAP_PRESENT;
+      crh->wt_ihdr.it_len = cpu_to_le16(sizeof(struct 
click_radiotap_header));
+      crh->wt_ihdr.it_present = cpu_to_le32(CLICK_RADIOTAP_PRESENT);

        crh->wt_rate = ceh->rate;
        crh->wt_txpower = ceh->power;
        crh->wt_rts_retries = 0;
        if (ceh->max_tries > 0) {
            crh->wt_data_retries = ceh->max_tries - 1;
+      } else {
+          crh->wt_data_retries = WIFI_MAX_RETRIES+1;
        }
    }


More information about the click mailing list