#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(")"); \
}
"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 "
}
}
-#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,
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 {
return 0;
trunc:
- ND_PRINT("%s", tstr);
+ nd_print_trunc(ndo);
return rc;
}
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;
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;
}
ndo->ndo_protocol = "prism_if";
if (caplen < 4) {
- ND_PRINT("%s", tstr);
+ nd_print_trunc(ndo);
return 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;
}