/* \summary: IEEE 802.11 printer */
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
-#include <netdissect-stdinc.h>
+#include "netdissect-stdinc.h"
#include <string.h>
#define E_SSID 0
#define E_RATES 1
-#define E_FH 2
+#define E_FH 2
#define E_DS 3
-#define E_CF 4
-#define E_TIM 5
+#define E_CF 4
+#define E_TIM 5
#define E_IBSS 6
/* reserved 7 */
/* reserved 8 */
#define PRINT_SSID(p) \
if (p.ssid_present) { \
ND_PRINT(" ("); \
- fn_print(ndo, p.ssid.ssid, NULL); \
+ fn_print_str(ndo, p.ssid.ssid); \
ND_PRINT(")"); \
}
*/
static const float ieee80211_float_htrates[MAX_MCS_INDEX+1][2][2] = {
/* MCS 0 */
- { /* 20 Mhz */ { 6.5, /* SGI */ 7.2, },
- /* 40 Mhz */ { 13.5, /* SGI */ 15.0, },
+ { /* 20 Mhz */ { 6.5f, /* SGI */ 7.2f, },
+ /* 40 Mhz */ { 13.5f, /* SGI */ 15.0f, },
},
/* MCS 1 */
- { /* 20 Mhz */ { 13.0, /* SGI */ 14.4, },
- /* 40 Mhz */ { 27.0, /* SGI */ 30.0, },
+ { /* 20 Mhz */ { 13.0f, /* SGI */ 14.4f, },
+ /* 40 Mhz */ { 27.0f, /* SGI */ 30.0f, },
},
/* MCS 2 */
- { /* 20 Mhz */ { 19.5, /* SGI */ 21.7, },
- /* 40 Mhz */ { 40.5, /* SGI */ 45.0, },
+ { /* 20 Mhz */ { 19.5f, /* SGI */ 21.7f, },
+ /* 40 Mhz */ { 40.5f, /* SGI */ 45.0f, },
},
/* MCS 3 */
- { /* 20 Mhz */ { 26.0, /* SGI */ 28.9, },
- /* 40 Mhz */ { 54.0, /* SGI */ 60.0, },
+ { /* 20 Mhz */ { 26.0f, /* SGI */ 28.9f, },
+ /* 40 Mhz */ { 54.0f, /* SGI */ 60.0f, },
},
/* MCS 4 */
- { /* 20 Mhz */ { 39.0, /* SGI */ 43.3, },
- /* 40 Mhz */ { 81.0, /* SGI */ 90.0, },
+ { /* 20 Mhz */ { 39.0f, /* SGI */ 43.3f, },
+ /* 40 Mhz */ { 81.0f, /* SGI */ 90.0f, },
},
/* MCS 5 */
- { /* 20 Mhz */ { 52.0, /* SGI */ 57.8, },
- /* 40 Mhz */ { 108.0, /* SGI */ 120.0, },
+ { /* 20 Mhz */ { 52.0f, /* SGI */ 57.8f, },
+ /* 40 Mhz */ { 108.0f, /* SGI */ 120.0f, },
},
/* MCS 6 */
- { /* 20 Mhz */ { 58.5, /* SGI */ 65.0, },
- /* 40 Mhz */ { 121.5, /* SGI */ 135.0, },
+ { /* 20 Mhz */ { 58.5f, /* SGI */ 65.0f, },
+ /* 40 Mhz */ { 121.5f, /* SGI */ 135.0f, },
},
/* MCS 7 */
- { /* 20 Mhz */ { 65.0, /* SGI */ 72.2, },
- /* 40 Mhz */ { 135.0, /* SGI */ 150.0, },
+ { /* 20 Mhz */ { 65.0f, /* SGI */ 72.2f, },
+ /* 40 Mhz */ { 135.0f, /* SGI */ 150.0f, },
},
/* MCS 8 */
- { /* 20 Mhz */ { 13.0, /* SGI */ 14.4, },
- /* 40 Mhz */ { 27.0, /* SGI */ 30.0, },
+ { /* 20 Mhz */ { 13.0f, /* SGI */ 14.4f, },
+ /* 40 Mhz */ { 27.0f, /* SGI */ 30.0f, },
},
/* MCS 9 */
- { /* 20 Mhz */ { 26.0, /* SGI */ 28.9, },
- /* 40 Mhz */ { 54.0, /* SGI */ 60.0, },
+ { /* 20 Mhz */ { 26.0f, /* SGI */ 28.9f, },
+ /* 40 Mhz */ { 54.0f, /* SGI */ 60.0f, },
},
/* MCS 10 */
- { /* 20 Mhz */ { 39.0, /* SGI */ 43.3, },
- /* 40 Mhz */ { 81.0, /* SGI */ 90.0, },
+ { /* 20 Mhz */ { 39.0f, /* SGI */ 43.3f, },
+ /* 40 Mhz */ { 81.0f, /* SGI */ 90.0f, },
},
/* MCS 11 */
- { /* 20 Mhz */ { 52.0, /* SGI */ 57.8, },
- /* 40 Mhz */ { 108.0, /* SGI */ 120.0, },
+ { /* 20 Mhz */ { 52.0f, /* SGI */ 57.8f, },
+ /* 40 Mhz */ { 108.0f, /* SGI */ 120.0f, },
},
/* MCS 12 */
- { /* 20 Mhz */ { 78.0, /* SGI */ 86.7, },
- /* 40 Mhz */ { 162.0, /* SGI */ 180.0, },
+ { /* 20 Mhz */ { 78.0f, /* SGI */ 86.7f, },
+ /* 40 Mhz */ { 162.0f, /* SGI */ 180.0f, },
},
/* MCS 13 */
- { /* 20 Mhz */ { 104.0, /* SGI */ 115.6, },
- /* 40 Mhz */ { 216.0, /* SGI */ 240.0, },
+ { /* 20 Mhz */ { 104.0f, /* SGI */ 115.6f, },
+ /* 40 Mhz */ { 216.0f, /* SGI */ 240.0f, },
},
/* MCS 14 */
- { /* 20 Mhz */ { 117.0, /* SGI */ 130.0, },
- /* 40 Mhz */ { 243.0, /* SGI */ 270.0, },
+ { /* 20 Mhz */ { 117.0f, /* SGI */ 130.0f, },
+ /* 40 Mhz */ { 243.0f, /* SGI */ 270.0f, },
},
/* MCS 15 */
- { /* 20 Mhz */ { 130.0, /* SGI */ 144.4, },
- /* 40 Mhz */ { 270.0, /* SGI */ 300.0, },
+ { /* 20 Mhz */ { 130.0f, /* SGI */ 144.4f, },
+ /* 40 Mhz */ { 270.0f, /* SGI */ 300.0f, },
},
/* MCS 16 */
- { /* 20 Mhz */ { 19.5, /* SGI */ 21.7, },
- /* 40 Mhz */ { 40.5, /* SGI */ 45.0, },
+ { /* 20 Mhz */ { 19.5f, /* SGI */ 21.7f, },
+ /* 40 Mhz */ { 40.5f, /* SGI */ 45.0f, },
},
/* MCS 17 */
- { /* 20 Mhz */ { 39.0, /* SGI */ 43.3, },
- /* 40 Mhz */ { 81.0, /* SGI */ 90.0, },
+ { /* 20 Mhz */ { 39.0f, /* SGI */ 43.3f, },
+ /* 40 Mhz */ { 81.0f, /* SGI */ 90.0f, },
},
/* MCS 18 */
- { /* 20 Mhz */ { 58.5, /* SGI */ 65.0, },
- /* 40 Mhz */ { 121.5, /* SGI */ 135.0, },
+ { /* 20 Mhz */ { 58.5f, /* SGI */ 65.0f, },
+ /* 40 Mhz */ { 121.5f, /* SGI */ 135.0f, },
},
/* MCS 19 */
- { /* 20 Mhz */ { 78.0, /* SGI */ 86.7, },
- /* 40 Mhz */ { 162.0, /* SGI */ 180.0, },
+ { /* 20 Mhz */ { 78.0f, /* SGI */ 86.7f, },
+ /* 40 Mhz */ { 162.0f, /* SGI */ 180.0f, },
},
/* MCS 20 */
- { /* 20 Mhz */ { 117.0, /* SGI */ 130.0, },
- /* 40 Mhz */ { 243.0, /* SGI */ 270.0, },
+ { /* 20 Mhz */ { 117.0f, /* SGI */ 130.0f, },
+ /* 40 Mhz */ { 243.0f, /* SGI */ 270.0f, },
},
/* MCS 21 */
- { /* 20 Mhz */ { 156.0, /* SGI */ 173.3, },
- /* 40 Mhz */ { 324.0, /* SGI */ 360.0, },
+ { /* 20 Mhz */ { 156.0f, /* SGI */ 173.3f, },
+ /* 40 Mhz */ { 324.0f, /* SGI */ 360.0f, },
},
/* MCS 22 */
- { /* 20 Mhz */ { 175.5, /* SGI */ 195.0, },
- /* 40 Mhz */ { 364.5, /* SGI */ 405.0, },
+ { /* 20 Mhz */ { 175.5f, /* SGI */ 195.0f, },
+ /* 40 Mhz */ { 364.5f, /* SGI */ 405.0f, },
},
/* MCS 23 */
- { /* 20 Mhz */ { 195.0, /* SGI */ 216.7, },
- /* 40 Mhz */ { 405.0, /* SGI */ 450.0, },
+ { /* 20 Mhz */ { 195.0f, /* SGI */ 216.7f, },
+ /* 40 Mhz */ { 405.0f, /* SGI */ 450.0f, },
},
/* MCS 24 */
- { /* 20 Mhz */ { 26.0, /* SGI */ 28.9, },
- /* 40 Mhz */ { 54.0, /* SGI */ 60.0, },
+ { /* 20 Mhz */ { 26.0f, /* SGI */ 28.9f, },
+ /* 40 Mhz */ { 54.0f, /* SGI */ 60.0f, },
},
/* MCS 25 */
- { /* 20 Mhz */ { 52.0, /* SGI */ 57.8, },
- /* 40 Mhz */ { 108.0, /* SGI */ 120.0, },
+ { /* 20 Mhz */ { 52.0f, /* SGI */ 57.8f, },
+ /* 40 Mhz */ { 108.0f, /* SGI */ 120.0f, },
},
/* MCS 26 */
- { /* 20 Mhz */ { 78.0, /* SGI */ 86.7, },
- /* 40 Mhz */ { 162.0, /* SGI */ 180.0, },
+ { /* 20 Mhz */ { 78.0f, /* SGI */ 86.7f, },
+ /* 40 Mhz */ { 162.0f, /* SGI */ 180.0f, },
},
/* MCS 27 */
- { /* 20 Mhz */ { 104.0, /* SGI */ 115.6, },
- /* 40 Mhz */ { 216.0, /* SGI */ 240.0, },
+ { /* 20 Mhz */ { 104.0f, /* SGI */ 115.6f, },
+ /* 40 Mhz */ { 216.0f, /* SGI */ 240.0f, },
},
/* MCS 28 */
- { /* 20 Mhz */ { 156.0, /* SGI */ 173.3, },
- /* 40 Mhz */ { 324.0, /* SGI */ 360.0, },
+ { /* 20 Mhz */ { 156.0f, /* SGI */ 173.3f, },
+ /* 40 Mhz */ { 324.0f, /* SGI */ 360.0f, },
},
/* MCS 29 */
- { /* 20 Mhz */ { 208.0, /* SGI */ 231.1, },
- /* 40 Mhz */ { 432.0, /* SGI */ 480.0, },
+ { /* 20 Mhz */ { 208.0f, /* SGI */ 231.1f, },
+ /* 40 Mhz */ { 432.0f, /* SGI */ 480.0f, },
},
/* MCS 30 */
- { /* 20 Mhz */ { 234.0, /* SGI */ 260.0, },
- /* 40 Mhz */ { 486.0, /* SGI */ 540.0, },
+ { /* 20 Mhz */ { 234.0f, /* SGI */ 260.0f, },
+ /* 40 Mhz */ { 486.0f, /* SGI */ 540.0f, },
},
/* MCS 31 */
- { /* 20 Mhz */ { 260.0, /* SGI */ 288.9, },
- /* 40 Mhz */ { 540.0, /* SGI */ 600.0, },
+ { /* 20 Mhz */ { 260.0f, /* SGI */ 288.9f, },
+ /* 40 Mhz */ { 540.0f, /* SGI */ 600.0f, },
},
/* MCS 32 */
- { /* 20 Mhz */ { 0.0, /* SGI */ 0.0, }, /* not valid */
- /* 40 Mhz */ { 6.0, /* SGI */ 6.7, },
+ { /* 20 Mhz */ { 0.0f, /* SGI */ 0.0f, }, /* not valid */
+ /* 40 Mhz */ { 6.0f, /* SGI */ 6.7f, },
},
/* MCS 33 */
- { /* 20 Mhz */ { 39.0, /* SGI */ 43.3, },
- /* 40 Mhz */ { 81.0, /* SGI */ 90.0, },
+ { /* 20 Mhz */ { 39.0f, /* SGI */ 43.3f, },
+ /* 40 Mhz */ { 81.0f, /* SGI */ 90.0f, },
},
/* MCS 34 */
- { /* 20 Mhz */ { 52.0, /* SGI */ 57.8, },
- /* 40 Mhz */ { 108.0, /* SGI */ 120.0, },
+ { /* 20 Mhz */ { 52.0f, /* SGI */ 57.8f, },
+ /* 40 Mhz */ { 108.0f, /* SGI */ 120.0f, },
},
/* MCS 35 */
- { /* 20 Mhz */ { 65.0, /* SGI */ 72.2, },
- /* 40 Mhz */ { 135.0, /* SGI */ 150.0, },
+ { /* 20 Mhz */ { 65.0f, /* SGI */ 72.2f, },
+ /* 40 Mhz */ { 135.0f, /* SGI */ 150.0f, },
},
/* MCS 36 */
- { /* 20 Mhz */ { 58.5, /* SGI */ 65.0, },
- /* 40 Mhz */ { 121.5, /* SGI */ 135.0, },
+ { /* 20 Mhz */ { 58.5f, /* SGI */ 65.0f, },
+ /* 40 Mhz */ { 121.5f, /* SGI */ 135.0f, },
},
/* MCS 37 */
- { /* 20 Mhz */ { 78.0, /* SGI */ 86.7, },
- /* 40 Mhz */ { 162.0, /* SGI */ 180.0, },
+ { /* 20 Mhz */ { 78.0f, /* SGI */ 86.7f, },
+ /* 40 Mhz */ { 162.0f, /* SGI */ 180.0f, },
},
/* MCS 38 */
- { /* 20 Mhz */ { 97.5, /* SGI */ 108.3, },
- /* 40 Mhz */ { 202.5, /* SGI */ 225.0, },
+ { /* 20 Mhz */ { 97.5f, /* SGI */ 108.3f, },
+ /* 40 Mhz */ { 202.5f, /* SGI */ 225.0f, },
},
/* MCS 39 */
- { /* 20 Mhz */ { 52.0, /* SGI */ 57.8, },
- /* 40 Mhz */ { 108.0, /* SGI */ 120.0, },
+ { /* 20 Mhz */ { 52.0f, /* SGI */ 57.8f, },
+ /* 40 Mhz */ { 108.0f, /* SGI */ 120.0f, },
},
/* MCS 40 */
- { /* 20 Mhz */ { 65.0, /* SGI */ 72.2, },
- /* 40 Mhz */ { 135.0, /* SGI */ 150.0, },
+ { /* 20 Mhz */ { 65.0f, /* SGI */ 72.2f, },
+ /* 40 Mhz */ { 135.0f, /* SGI */ 150.0f, },
},
/* MCS 41 */
- { /* 20 Mhz */ { 65.0, /* SGI */ 72.2, },
- /* 40 Mhz */ { 135.0, /* SGI */ 150.0, },
+ { /* 20 Mhz */ { 65.0f, /* SGI */ 72.2f, },
+ /* 40 Mhz */ { 135.0f, /* SGI */ 150.0f, },
},
/* MCS 42 */
- { /* 20 Mhz */ { 78.0, /* SGI */ 86.7, },
- /* 40 Mhz */ { 162.0, /* SGI */ 180.0, },
+ { /* 20 Mhz */ { 78.0f, /* SGI */ 86.7f, },
+ /* 40 Mhz */ { 162.0f, /* SGI */ 180.0f, },
},
/* MCS 43 */
- { /* 20 Mhz */ { 91.0, /* SGI */ 101.1, },
- /* 40 Mhz */ { 189.0, /* SGI */ 210.0, },
+ { /* 20 Mhz */ { 91.0f, /* SGI */ 101.1f, },
+ /* 40 Mhz */ { 189.0f, /* SGI */ 210.0f, },
},
/* MCS 44 */
- { /* 20 Mhz */ { 91.0, /* SGI */ 101.1, },
- /* 40 Mhz */ { 189.0, /* SGI */ 210.0, },
+ { /* 20 Mhz */ { 91.0f, /* SGI */ 101.1f, },
+ /* 40 Mhz */ { 189.0f, /* SGI */ 210.0f, },
},
/* MCS 45 */
- { /* 20 Mhz */ { 104.0, /* SGI */ 115.6, },
- /* 40 Mhz */ { 216.0, /* SGI */ 240.0, },
+ { /* 20 Mhz */ { 104.0f, /* SGI */ 115.6f, },
+ /* 40 Mhz */ { 216.0f, /* SGI */ 240.0f, },
},
/* MCS 46 */
- { /* 20 Mhz */ { 78.0, /* SGI */ 86.7, },
- /* 40 Mhz */ { 162.0, /* SGI */ 180.0, },
+ { /* 20 Mhz */ { 78.0f, /* SGI */ 86.7f, },
+ /* 40 Mhz */ { 162.0f, /* SGI */ 180.0f, },
},
/* MCS 47 */
- { /* 20 Mhz */ { 97.5, /* SGI */ 108.3, },
- /* 40 Mhz */ { 202.5, /* SGI */ 225.0, },
+ { /* 20 Mhz */ { 97.5f, /* SGI */ 108.3f, },
+ /* 40 Mhz */ { 202.5f, /* SGI */ 225.0f, },
},
/* MCS 48 */
- { /* 20 Mhz */ { 97.5, /* SGI */ 108.3, },
- /* 40 Mhz */ { 202.5, /* SGI */ 225.0, },
+ { /* 20 Mhz */ { 97.5f, /* SGI */ 108.3f, },
+ /* 40 Mhz */ { 202.5f, /* SGI */ 225.0f, },
},
/* MCS 49 */
- { /* 20 Mhz */ { 117.0, /* SGI */ 130.0, },
- /* 40 Mhz */ { 243.0, /* SGI */ 270.0, },
+ { /* 20 Mhz */ { 117.0f, /* SGI */ 130.0f, },
+ /* 40 Mhz */ { 243.0f, /* SGI */ 270.0f, },
},
/* MCS 50 */
- { /* 20 Mhz */ { 136.5, /* SGI */ 151.7, },
- /* 40 Mhz */ { 283.5, /* SGI */ 315.0, },
+ { /* 20 Mhz */ { 136.5f, /* SGI */ 151.7f, },
+ /* 40 Mhz */ { 283.5f, /* SGI */ 315.0f, },
},
/* MCS 51 */
- { /* 20 Mhz */ { 136.5, /* SGI */ 151.7, },
- /* 40 Mhz */ { 283.5, /* SGI */ 315.0, },
+ { /* 20 Mhz */ { 136.5f, /* SGI */ 151.7f, },
+ /* 40 Mhz */ { 283.5f, /* SGI */ 315.0f, },
},
/* MCS 52 */
- { /* 20 Mhz */ { 156.0, /* SGI */ 173.3, },
- /* 40 Mhz */ { 324.0, /* SGI */ 360.0, },
+ { /* 20 Mhz */ { 156.0f, /* SGI */ 173.3f, },
+ /* 40 Mhz */ { 324.0f, /* SGI */ 360.0f, },
},
/* MCS 53 */
- { /* 20 Mhz */ { 65.0, /* SGI */ 72.2, },
- /* 40 Mhz */ { 135.0, /* SGI */ 150.0, },
+ { /* 20 Mhz */ { 65.0f, /* SGI */ 72.2f, },
+ /* 40 Mhz */ { 135.0f, /* SGI */ 150.0f, },
},
/* MCS 54 */
- { /* 20 Mhz */ { 78.0, /* SGI */ 86.7, },
- /* 40 Mhz */ { 162.0, /* SGI */ 180.0, },
+ { /* 20 Mhz */ { 78.0f, /* SGI */ 86.7f, },
+ /* 40 Mhz */ { 162.0f, /* SGI */ 180.0f, },
},
/* MCS 55 */
- { /* 20 Mhz */ { 91.0, /* SGI */ 101.1, },
- /* 40 Mhz */ { 189.0, /* SGI */ 210.0, },
+ { /* 20 Mhz */ { 91.0f, /* SGI */ 101.1f, },
+ /* 40 Mhz */ { 189.0f, /* SGI */ 210.0f, },
},
/* MCS 56 */
- { /* 20 Mhz */ { 78.0, /* SGI */ 86.7, },
- /* 40 Mhz */ { 162.0, /* SGI */ 180.0, },
+ { /* 20 Mhz */ { 78.0f, /* SGI */ 86.7f, },
+ /* 40 Mhz */ { 162.0f, /* SGI */ 180.0f, },
},
/* MCS 57 */
- { /* 20 Mhz */ { 91.0, /* SGI */ 101.1, },
- /* 40 Mhz */ { 189.0, /* SGI */ 210.0, },
+ { /* 20 Mhz */ { 91.0f, /* SGI */ 101.1f, },
+ /* 40 Mhz */ { 189.0f, /* SGI */ 210.0f, },
},
/* MCS 58 */
- { /* 20 Mhz */ { 104.0, /* SGI */ 115.6, },
- /* 40 Mhz */ { 216.0, /* SGI */ 240.0, },
+ { /* 20 Mhz */ { 104.0f, /* SGI */ 115.6f, },
+ /* 40 Mhz */ { 216.0f, /* SGI */ 240.0f, },
},
/* MCS 59 */
- { /* 20 Mhz */ { 117.0, /* SGI */ 130.0, },
- /* 40 Mhz */ { 243.0, /* SGI */ 270.0, },
+ { /* 20 Mhz */ { 117.0f, /* SGI */ 130.0f, },
+ /* 40 Mhz */ { 243.0f, /* SGI */ 270.0f, },
},
/* MCS 60 */
- { /* 20 Mhz */ { 104.0, /* SGI */ 115.6, },
- /* 40 Mhz */ { 216.0, /* SGI */ 240.0, },
+ { /* 20 Mhz */ { 104.0f, /* SGI */ 115.6f, },
+ /* 40 Mhz */ { 216.0f, /* SGI */ 240.0f, },
},
/* MCS 61 */
- { /* 20 Mhz */ { 117.0, /* SGI */ 130.0, },
- /* 40 Mhz */ { 243.0, /* SGI */ 270.0, },
+ { /* 20 Mhz */ { 117.0f, /* SGI */ 130.0f, },
+ /* 40 Mhz */ { 243.0f, /* SGI */ 270.0f, },
},
/* MCS 62 */
- { /* 20 Mhz */ { 130.0, /* SGI */ 144.4, },
- /* 40 Mhz */ { 270.0, /* SGI */ 300.0, },
+ { /* 20 Mhz */ { 130.0f, /* SGI */ 144.4f, },
+ /* 40 Mhz */ { 270.0f, /* SGI */ 300.0f, },
},
/* MCS 63 */
- { /* 20 Mhz */ { 130.0, /* SGI */ 144.4, },
- /* 40 Mhz */ { 270.0, /* SGI */ 300.0, },
+ { /* 20 Mhz */ { 130.0f, /* SGI */ 144.4f, },
+ /* 40 Mhz */ { 270.0f, /* SGI */ 300.0f, },
},
/* MCS 64 */
- { /* 20 Mhz */ { 143.0, /* SGI */ 158.9, },
- /* 40 Mhz */ { 297.0, /* SGI */ 330.0, },
+ { /* 20 Mhz */ { 143.0f, /* SGI */ 158.9f, },
+ /* 40 Mhz */ { 297.0f, /* SGI */ 330.0f, },
},
/* MCS 65 */
- { /* 20 Mhz */ { 97.5, /* SGI */ 108.3, },
- /* 40 Mhz */ { 202.5, /* SGI */ 225.0, },
+ { /* 20 Mhz */ { 97.5f, /* SGI */ 108.3f, },
+ /* 40 Mhz */ { 202.5f, /* SGI */ 225.0f, },
},
/* MCS 66 */
- { /* 20 Mhz */ { 117.0, /* SGI */ 130.0, },
- /* 40 Mhz */ { 243.0, /* SGI */ 270.0, },
+ { /* 20 Mhz */ { 117.0f, /* SGI */ 130.0f, },
+ /* 40 Mhz */ { 243.0f, /* SGI */ 270.0f, },
},
/* MCS 67 */
- { /* 20 Mhz */ { 136.5, /* SGI */ 151.7, },
- /* 40 Mhz */ { 283.5, /* SGI */ 315.0, },
+ { /* 20 Mhz */ { 136.5f, /* SGI */ 151.7f, },
+ /* 40 Mhz */ { 283.5f, /* SGI */ 315.0f, },
},
/* MCS 68 */
- { /* 20 Mhz */ { 117.0, /* SGI */ 130.0, },
- /* 40 Mhz */ { 243.0, /* SGI */ 270.0, },
+ { /* 20 Mhz */ { 117.0f, /* SGI */ 130.0f, },
+ /* 40 Mhz */ { 243.0f, /* SGI */ 270.0f, },
},
/* MCS 69 */
- { /* 20 Mhz */ { 136.5, /* SGI */ 151.7, },
- /* 40 Mhz */ { 283.5, /* SGI */ 315.0, },
+ { /* 20 Mhz */ { 136.5f, /* SGI */ 151.7f, },
+ /* 40 Mhz */ { 283.5f, /* SGI */ 315.0f, },
},
/* MCS 70 */
- { /* 20 Mhz */ { 156.0, /* SGI */ 173.3, },
- /* 40 Mhz */ { 324.0, /* SGI */ 360.0, },
+ { /* 20 Mhz */ { 156.0f, /* SGI */ 173.3f, },
+ /* 40 Mhz */ { 324.0f, /* SGI */ 360.0f, },
},
/* MCS 71 */
- { /* 20 Mhz */ { 175.5, /* SGI */ 195.0, },
- /* 40 Mhz */ { 364.5, /* SGI */ 405.0, },
+ { /* 20 Mhz */ { 175.5f, /* SGI */ 195.0f, },
+ /* 40 Mhz */ { 364.5f, /* SGI */ 405.0f, },
},
/* MCS 72 */
- { /* 20 Mhz */ { 156.0, /* SGI */ 173.3, },
- /* 40 Mhz */ { 324.0, /* SGI */ 360.0, },
+ { /* 20 Mhz */ { 156.0f, /* SGI */ 173.3f, },
+ /* 40 Mhz */ { 324.0f, /* SGI */ 360.0f, },
},
/* MCS 73 */
- { /* 20 Mhz */ { 175.5, /* SGI */ 195.0, },
- /* 40 Mhz */ { 364.5, /* SGI */ 405.0, },
+ { /* 20 Mhz */ { 175.5f, /* SGI */ 195.0f, },
+ /* 40 Mhz */ { 364.5f, /* SGI */ 405.0f, },
},
/* MCS 74 */
- { /* 20 Mhz */ { 195.0, /* SGI */ 216.7, },
- /* 40 Mhz */ { 405.0, /* SGI */ 450.0, },
+ { /* 20 Mhz */ { 195.0f, /* SGI */ 216.7f, },
+ /* 40 Mhz */ { 405.0f, /* SGI */ 450.0f, },
},
/* MCS 75 */
- { /* 20 Mhz */ { 195.0, /* SGI */ 216.7, },
- /* 40 Mhz */ { 405.0, /* SGI */ 450.0, },
+ { /* 20 Mhz */ { 195.0f, /* SGI */ 216.7f, },
+ /* 40 Mhz */ { 405.0f, /* SGI */ 450.0f, },
},
/* MCS 76 */
- { /* 20 Mhz */ { 214.5, /* SGI */ 238.3, },
- /* 40 Mhz */ { 445.5, /* SGI */ 495.0, },
+ { /* 20 Mhz */ { 214.5f, /* SGI */ 238.3f, },
+ /* 40 Mhz */ { 445.5f, /* SGI */ 495.0f, },
},
};
static const char *auth_alg_text[]={"Open System","Shared Key","EAP"};
-#define NUM_AUTH_ALGS (sizeof auth_alg_text / sizeof auth_alg_text[0])
+#define NUM_AUTH_ALGS (sizeof(auth_alg_text) / sizeof(auth_alg_text[0]))
static const char *status_text[] = {
"Successful", /* 0 */
"Reserved", /* 8 */
"Reserved", /* 9 */
"Cannot Support all requested capabilities in the Capability "
- "Information field", /* 10 */
+ "Information field", /* 10 */
"Reassociation denied due to inability to confirm that association "
"exists", /* 11 */
"Association denied due to reason outside the scope of the "
"sequence number out of expected sequence", /* 14 */
"Authentication rejected because of challenge failure", /* 15 */
"Authentication rejected due to timeout waiting for next frame in "
- "sequence", /* 16 */
+ "sequence", /* 16 */
"Association denied because AP is unable to handle additional"
- "associated stations", /* 17 */
+ "associated stations", /* 17 */
"Association denied due to requesting station not supporting all of "
"the data rates in BSSBasicRateSet parameter", /* 18 */
"Association denied due to requesting station not supporting "
"The Destination STA is not a QSTA.", /* 50 */
};
-#define NUM_STATUSES (sizeof status_text / sizeof status_text[0])
+#define NUM_STATUSES (sizeof(status_text) / sizeof(status_text[0]))
static const char *reason_text[] = {
"Reserved", /* 0 */
"Association denied due to requesting STA not supporting HT "
"features", /* 46 */
};
-#define NUM_REASONS (sizeof reason_text / sizeof reason_text[0])
+#define NUM_REASONS (sizeof(reason_text) / sizeof(reason_text[0]))
static int
wep_print(netdissect_options *ndo,
offset += 2;
length -= 2;
if (rates.length != 0) {
- if (rates.length > sizeof rates.rate)
+ if (rates.length > sizeof(rates.rate))
return 0;
memcpy(&rates.rate, p + offset, rates.length);
offset += rates.length;
length -= tim.length;
break;
}
- if (tim.length - 3U > sizeof tim.bitmap)
+ if (tim.length - 3U > sizeof(tim.bitmap))
return 0;
memcpy(&tim.count, p + offset, 3);
offset += 3;
}
}
-#ifndef roundup2
-#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
-#endif
-
-static const char tstr[] = "[|802.11]";
-
static u_int
ieee802_11_print(netdissect_options *ndo,
const u_char *p, u_int length, u_int orig_caplen, int pad,
struct lladdr_info src, dst;
int llc_hdrlen;
+ ndo->ndo_protocol = "802.11";
caplen = orig_caplen;
/* Remove FCS, if present */
if (length < fcslen) {
- ND_PRINT("%s", tstr);
+ nd_print_trunc(ndo);
return caplen;
}
length -= fcslen;
}
if (caplen < IEEE802_11_FC_LEN) {
- ND_PRINT("%s", tstr);
+ nd_print_trunc(ndo);
return orig_caplen;
}
hdrlen = roundup2(hdrlen, 4);
if (ndo->ndo_Hflag && FC_TYPE(fc) == T_DATA &&
DATA_FRAME_IS_QOS(FC_SUBTYPE(fc))) {
+ if(!ND_TTEST_1(p + hdrlen)) {
+ nd_print_trunc(ndo);
+ return hdrlen;
+ }
meshdrlen = extract_mesh_header_length(p+hdrlen);
hdrlen += meshdrlen;
} else
meshdrlen = 0;
if (caplen < hdrlen) {
- ND_PRINT("%s", tstr);
+ nd_print_trunc(ndo);
return hdrlen;
}
case T_MGMT:
get_mgmt_src_dst_mac(p - hdrlen, &src.addr, &dst.addr);
if (!mgmt_body_print(ndo, fc, src.addr, p, length)) {
- ND_PRINT("%s", tstr);
+ nd_print_trunc(ndo);
return hdrlen;
}
break;
case T_CTRL:
if (!ctrl_body_print(ndo, fc, p - hdrlen)) {
- ND_PRINT("%s", tstr);
+ nd_print_trunc(ndo);
return hdrlen;
}
break;
if (FC_PROTECTED(fc)) {
ND_PRINT("Data");
if (!wep_print(ndo, p)) {
- ND_PRINT("%s", tstr);
+ nd_print_trunc(ndo);
return hdrlen;
}
} else {
ieee802_11_if_print(netdissect_options *ndo,
const struct pcap_pkthdr *h, const u_char *p)
{
+ ndo->ndo_protocol = "802.11_if";
return ieee802_11_print(ndo, p, h->len, h->caplen, 0, 0);
}
/*
* XXX On FreeBSD rate & 0x80 means we have an MCS. On
* Linux and AirPcap it does not. (What about
- * Mac OS X, NetBSD, OpenBSD, and DragonFly BSD?)
+ * macOS, NetBSD, OpenBSD, and DragonFly BSD?)
*
* This is an issue either for proprietary extensions
* to 11a or 11g, which do exist, or for 11n
return 0;
trunc:
- ND_PRINT("%s", tstr);
+ nd_print_trunc(ndo);
return rc;
}
int pad;
u_int fcslen;
+ ndo->ndo_protocol = "802.11_radio";
if (caplen < sizeof(*hdr)) {
- ND_PRINT("%s", tstr);
+ nd_print_trunc(ndo);
return caplen;
}
hdr = (const struct ieee80211_radiotap_header *)p;
len = EXTRACT_LE_U_2(hdr->it_len);
+ if (len < sizeof(*hdr)) {
+ /*
+ * The length is the length of the entire header, so
+ * it must be as large as the fixed-length part of
+ * the header.
+ */
+ nd_print_trunc(ndo);
+ return caplen;
+ }
/*
* If we don't have the entire radiotap header, just give up.
*/
if (caplen < len) {
- ND_PRINT("%s", tstr);
+ nd_print_trunc(ndo);
return caplen;
}
cpack_init(&cpacker, (const uint8_t *)hdr, len); /* align against header start */
/* are there more bitmap extensions than bytes in header? */
if ((const u_char*)(last_presentp + 1) > p + len) {
- ND_PRINT("%s", tstr);
+ nd_print_trunc(ndo);
return caplen;
}
bit0 = 0;
vendor_namespace = 1;
if ((cpack_align_and_reserve(&cpacker, 2)) == NULL) {
- ND_PRINT("%s", tstr);
+ nd_print_trunc(ndo);
break;
}
if (cpack_uint8(&cpacker, &vendor_oui[0]) != 0) {
- ND_PRINT("%s", tstr);
+ nd_print_trunc(ndo);
break;
}
if (cpack_uint8(&cpacker, &vendor_oui[1]) != 0) {
- ND_PRINT("%s", tstr);
+ nd_print_trunc(ndo);
break;
}
if (cpack_uint8(&cpacker, &vendor_oui[2]) != 0) {
- ND_PRINT("%s", tstr);
+ nd_print_trunc(ndo);
break;
}
if (cpack_uint8(&cpacker, &vendor_subnamespace) != 0) {
- ND_PRINT("%s", tstr);
+ nd_print_trunc(ndo);
break;
}
if (cpack_uint16(&cpacker, &skip_length) != 0) {
- ND_PRINT("%s", tstr);
+ nd_print_trunc(ndo);
break;
}
break;
}
static u_int
-ieee802_11_avs_radio_print(netdissect_options *ndo,
+ieee802_11_radio_avs_print(netdissect_options *ndo,
const u_char *p, u_int length, u_int caplen)
{
uint32_t caphdr_len;
+ ndo->ndo_protocol = "802.11_radio_avs";
if (caplen < 8) {
- ND_PRINT("%s", tstr);
+ nd_print_trunc(ndo);
return caplen;
}
* to be large enough to include even the version
* cookie or capture header length!
*/
- ND_PRINT("%s", tstr);
+ nd_print_trunc(ndo);
return caplen;
}
if (caplen < caphdr_len) {
- ND_PRINT("%s", tstr);
+ nd_print_trunc(ndo);
return caplen;
}
u_int length = h->len;
uint32_t msgcode;
+ ndo->ndo_protocol = "prism_if";
if (caplen < 4) {
- ND_PRINT("%s", tstr);
+ nd_print_trunc(ndo);
return caplen;
}
msgcode = EXTRACT_BE_U_4(p);
if (msgcode == WLANCAP_MAGIC_COOKIE_V1 ||
msgcode == WLANCAP_MAGIC_COOKIE_V2)
- return ieee802_11_avs_radio_print(ndo, p, length, caplen);
+ return ieee802_11_radio_avs_print(ndo, p, length, caplen);
if (caplen < PRISM_HDR_LEN) {
- ND_PRINT("%s", tstr);
+ nd_print_trunc(ndo);
return caplen;
}
ieee802_11_radio_if_print(netdissect_options *ndo,
const struct pcap_pkthdr *h, const u_char *p)
{
+ ndo->ndo_protocol = "802.11_radio_if";
return ieee802_11_radio_print(ndo, p, h->len, h->caplen);
}
ieee802_11_radio_avs_if_print(netdissect_options *ndo,
const struct pcap_pkthdr *h, const u_char *p)
{
- return ieee802_11_avs_radio_print(ndo, p, h->len, h->caplen);
+ ndo->ndo_protocol = "802.11_radio_avs_if";
+ return ieee802_11_radio_avs_print(ndo, p, h->len, h->caplen);
}