summaryrefslogtreecommitdiff
path: root/proto_80211_mac_hdr.c
diff options
context:
space:
mode:
authorJames McCoy <vega.james@gmail.com>2014-05-01 11:14:31 -0400
committerTobias Klauser <tklauser@distanz.ch>2014-05-03 13:36:36 +0200
commit7aa9f970e88382f2508ee55122e27cdcfd8cdbda (patch)
tree03ff36cfad0f1cc88c92b7764fd3b8145207d651 /proto_80211_mac_hdr.c
parent7231039ec891acee246549410c70f1151a0c0175 (diff)
all: Use macros for printf/scanf format specifiers
Any types that are fixed width should use the standard format specifier macros (PRI... for printf-type functions, SCN... for scanf-type functions) to ensure proper data access. Prior to this ifpps was crashing in 32-bit environments due to the following call mvwprintw(screen, (*voff)++, 2, "%s,%s %s (%s%s), t=%lums, cpus=%u%s/%u" " ", uts.release, machine, ifname, drvinf.driver, buff, ms_interval, top_cpus, top_cpus > 0 && top_cpus < cpus ? "+1" : "", cpus); since ms_interval is a uint64_t but %lu expects an unsigned long, which is only 32 bits. Signed-off-by: James McCoy <vega.james@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'proto_80211_mac_hdr.c')
-rw-r--r--proto_80211_mac_hdr.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/proto_80211_mac_hdr.c b/proto_80211_mac_hdr.c
index 23f9c7a..b3cc3ca 100644
--- a/proto_80211_mac_hdr.c
+++ b/proto_80211_mac_hdr.c
@@ -10,6 +10,7 @@
* with respect to endianess (little / big)
*/
+#include <inttypes.h>
#include <stdio.h>
#include <stdint.h>
#include <netinet/in.h> /* for ntohs() */
@@ -1741,7 +1742,7 @@ static int8_t inf_meas_req(struct pkt_buff *pkt, u8 *id)
}
tprintf("Ch Nr: %uus, ", basic->ch_nr);
- tprintf("Meas Start Time: %lu, ",
+ tprintf("Meas Start Time: %"PRIu64", ",
le64_to_cpu(basic->start));
tprintf("Meas Duration: %fs",
le16_to_cpu(basic->dur) * TU);
@@ -1762,7 +1763,7 @@ static int8_t inf_meas_req(struct pkt_buff *pkt, u8 *id)
}
tprintf("Ch Nr: %uus, ", cca->ch_nr);
- tprintf("Meas Start Time: %lu, ",
+ tprintf("Meas Start Time: %"PRIu64", ",
le64_to_cpu(cca->start));
tprintf("Meas Duration: %fs",
le16_to_cpu(cca->dur) * TU);
@@ -1782,7 +1783,7 @@ static int8_t inf_meas_req(struct pkt_buff *pkt, u8 *id)
}
tprintf("Ch Nr: %uus, ", rpi->ch_nr);
- tprintf("Meas Start Time: %lu, ",
+ tprintf("Meas Start Time: %"PRIu64", ",
le64_to_cpu(rpi->start));
tprintf("Meas Duration: %fs",
le16_to_cpu(rpi->dur) * TU);
@@ -2119,7 +2120,7 @@ static int8_t inf_meas_rep(struct pkt_buff *pkt, u8 *id)
}
tprintf("Ch Nr: %uus, ", basic->ch_nr);
- tprintf("Meas Start Time: %lu, ",
+ tprintf("Meas Start Time: %"PRIu64", ",
le64_to_cpu(basic->start));
tprintf("Meas Duration: %fs",
le16_to_cpu(basic->dur) * TU);
@@ -2140,7 +2141,7 @@ static int8_t inf_meas_rep(struct pkt_buff *pkt, u8 *id)
}
tprintf("Ch Nr: %uus, ", cca->ch_nr);
- tprintf("Meas Start Time: %lu, ",
+ tprintf("Meas Start Time: %"PRIu64", ",
le64_to_cpu(cca->start));
tprintf("Meas Duration: %fs",
le16_to_cpu(cca->dur) * TU);
@@ -2160,7 +2161,7 @@ static int8_t inf_meas_rep(struct pkt_buff *pkt, u8 *id)
}
tprintf("Ch Nr: %uus, ", rpi->ch_nr);
- tprintf("Meas Start Time: %lu, ",
+ tprintf("Meas Start Time: %"PRIu64", ",
le64_to_cpu(rpi->start));
tprintf("Meas Duration: %fs",
le16_to_cpu(rpi->dur) * TU);
@@ -2918,7 +2919,7 @@ static int8_t beacon(struct pkt_buff *pkt)
if (beacon == NULL)
return 0;
- tprintf("Timestamp 0x%.16lx, ", le64_to_cpu(beacon->timestamp));
+ tprintf("Timestamp 0x%.16"PRIx64", ", le64_to_cpu(beacon->timestamp));
tprintf("Beacon Interval (%fs), ", le16_to_cpu(beacon->beacon_int)*TU);
tprintf("Capabilities (0x%x <->", le16_to_cpu(beacon->capab_info));
cap_field(le16_to_cpu(beacon->capab_info));