From: Guy Harris Date: Mon, 13 Sep 2021 21:50:43 +0000 (-0700) Subject: Merge pull request #926 from gokulkumar792/print_Block_Ack_TA_field X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/cdca504371641e71ca82f4ae3e43c88d43287578?hp=-c Merge pull request #926 from gokulkumar792/print_Block_Ack_TA_field IEEE 802.11: include the "TA" field while printing Block Ack Control frame --- cdca504371641e71ca82f4ae3e43c88d43287578 diff --combined print-802_11.c index 5d9080cd,7864fb27..d52a0338 --- a/print-802_11.c +++ b/print-802_11.c @@@ -236,11 -236,6 +236,11 @@@ struct tim_t uint8_t bitmap[251]; }; +struct meshid_t { + u_int length; + u_char meshid[33]; /* 32 + 1 for null */ +}; + #define E_SSID 0 #define E_RATES 1 #define E_FH 2 @@@ -265,7 -260,6 +265,7 @@@ /* reserved 19 */ /* reserved 16 */ /* reserved 16 */ +#define E_MESHID 114 struct mgmt_body_t { @@@ -293,8 -287,6 +293,8 @@@ struct fh_t fh; int tim_present; struct tim_t tim; + int meshid_present; + struct meshid_t meshid; }; struct ctrl_control_wrapper_hdr_t { @@@ -370,9 -362,11 +370,11 @@@ struct ctrl_ba_hdr_t nd_uint16_t fc; nd_uint16_t duration; nd_mac_addr ra; + nd_mac_addr ta; }; - #define CTRL_BA_HDRLEN (IEEE802_11_FC_LEN+IEEE802_11_DUR_LEN+IEEE802_11_RA_LEN) + #define CTRL_BA_HDRLEN (IEEE802_11_FC_LEN+IEEE802_11_DUR_LEN+\ + IEEE802_11_RA_LEN+IEEE802_11_TA_LEN) struct ctrl_bar_hdr_t { nd_uint16_t fc; @@@ -428,13 -422,6 +430,13 @@@ struct meshcntl_t ND_PRINT("%s", \ CAPABILITY_PRIVACY(p.capability_info) ? ", PRIVACY" : ""); +#define PRINT_MESHID(p) \ + if (p.meshid_present) { \ + ND_PRINT(" (MESHID: "); \ + fn_print_str(ndo, p.meshid.meshid); \ + ND_PRINT(")"); \ + } + #define MAX_MCS_INDEX 76 /* @@@ -1153,7 -1140,6 +1155,7 @@@ parse_elements(netdissect_options *ndo struct ds_t ds; struct cf_t cf; struct tim_t tim; + struct meshid_t meshid; /* * We haven't seen any elements yet. @@@ -1164,7 -1150,6 +1166,7 @@@ pbody->ds_present = 0; pbody->cf_present = 0; pbody->tim_present = 0; + pbody->meshid_present = 0; while (length != 0) { /* Make sure we at least have the element ID and length. */ @@@ -1353,30 -1338,6 +1355,30 @@@ pbody->tim_present = 1; } break; + case E_MESHID: + meshid.length = elementlen; + offset += 2; + length -= 2; + if (meshid.length != 0) { + if (meshid.length > sizeof(meshid.meshid) - 1) + return 0; + memcpy(&meshid.meshid, p + offset, meshid.length); + offset += meshid.length; + length -= meshid.length; + } + meshid.meshid[meshid.length] = '\0'; + /* + * Present and not truncated. + * + * If we haven't already seen a MESHID IE, + * copy this one, otherwise ignore this one, + * so we later report the first one we saw. + */ + if (!pbody->meshid_present) { + pbody->meshid = meshid; + pbody->meshid_present = 1; + } + break; default: #if 0 ND_PRINT("(1) unhandled element_id (%u) ", @@@ -1430,7 -1391,6 +1432,7 @@@ handle_beacon(netdissect_options *ndo ND_PRINT(" %s", CAPABILITY_ESS(pbody.capability_info) ? "ESS" : "IBSS"); PRINT_DS_CHANNEL(pbody); + PRINT_MESHID(pbody); return ret; trunc: @@@ -1595,7 -1555,6 +1597,7 @@@ handle_probe_response(netdissect_option PRINT_SSID(pbody); PRINT_RATES(pbody); PRINT_DS_CHANNEL(pbody); + PRINT_MESHID(pbody); return ret; trunc: @@@ -2062,8 -2021,9 +2064,9 @@@ ctrl_header_print(netdissect_options *n GET_LE_U_2(((const struct ctrl_bar_hdr_t *)p)->seq)); break; case CTRL_BA: - ND_PRINT("RA:%s ", - GET_ETHERADDR_STRING(((const struct ctrl_ba_hdr_t *)p)->ra)); + ND_PRINT("RA:%s TA:%s ", + GET_ETHERADDR_STRING(((const struct ctrl_ba_hdr_t *)p)->ra), + GET_ETHERADDR_STRING(((const struct ctrl_ba_hdr_t *)p)->ta)); break; case CTRL_PS_POLL: ND_PRINT("BSSID:%s TA:%s ",