util: surround MAC_STR array access with ()
James Prestwood
PATCH 1/3 util: surround MAC_STR array access with ()
This allows printing from pointer offsets, for example:
MAC_STR(buf + 10)
--- src/util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/util.h +1 -1
@@ -29,7 +29,7 @@#define align_len (len, boundary) (((len)+(boundary)-1) & ~((boundary)-1))#define MAC "%02x:%02x:%02x:%02x:%02x:%02x" -#define MAC_STR (a) a[0], a[1], a[2], a[3], a[4], a[5] +#define MAC_STR (a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]const char *util_ssid_to_utf8 (size_t len,const uint8_t *ssid);bool util_ssid_is_utf8 (size_t len,const uint8_t *ssid);
Signature · 1 line
2.31.1
James Prestwood
PATCH 2/3 netdev: fix return value check for ft_over_ds_parse_action_ies
This returns a bool but was being treated as a signed int.
--- src/netdev.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
src/netdev.c +2 -3
@@ -4194,9 +4194,8 @@ static void netdev_ft_response_frame_event(const struct mmpdu_header *hdr, goto ft_error; } - ret =ft_over_ds_parse_action_ies (&info->super, netdev->handshake, - ies, ies_len); -if (ret <0 ) +if (!ft_over_ds_parse_action_ies (&info->super, netdev->handshake, + ies, ies_len)) goto ft_error; info->parsed = true;
Signature · 1 line
2.31.1
James Prestwood
PATCH 3/3 monitor: print FT Request/Response frames
In reply to James Prestwood--- monitor/nlmon.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+)
monitor/nlmon.c +65 -0
@@ -4767,6 +4767,68 @@ static void print_rm_action_frame(unsigned int level, const uint8_t *body, } } +static void print_ft_request (unsigned int level, +const uint8_t *body,size_t body_len) +{ +struct ie_tlv_iter iter; + +switch (body[0 ]) { +case 1 : +if (body_len <13 ) +return ; + +print_attr (level +1 ,"FT Request" ); +break ; +case 2 : +if (body_len <15 ) +return ; + +print_attr (level +1 ,"FT Response" ); +break ; +case 3 : +/* FT Confirm/Ack are not yet supported */ +print_attr (level +1 ,"FT Confirm" ); +return ; +case 4 : +print_attr (level +1 ,"FT ACK" ); +return ; + } + +print_attr (level +1 ,"STA Address: " MAC ,MAC_STR (body +1 )); +print_attr (level +1 ,"Target AP Address: " MAC ,MAC_STR (body +7 )); + +if (body[0 ] ==2 ) { +print_attr (level +1 ,"Status: %u" ,l_get_le16 (body +13 )); + body +=15 ; + body_len -=15 ; + }else { + body +=13 ; + body_len -=15 ; + } + +ie_tlv_iter_init (&iter, body, body_len); + +while (ie_tlv_iter_next (&iter)) { +uint8_t tag =ie_tlv_iter_get_tag (&iter); +size_t len =ie_tlv_iter_get_length (&iter); +const void *data =ie_tlv_iter_get_data (&iter); + +switch (tag) { +case IE_TYPE_RSN : +print_ie_rsn (level +1 ,"RSN" , data, len); +break ; +case IE_TYPE_MOBILITY_DOMAIN : +print_mobility_domain (level +1 ,"Mobility Domain" , + data, len); +break ; +case IE_TYPE_FAST_BSS_TRANSITION : +print_fast_bss_transition (level +1 , +"Fast BSS Transition" , + data, len); +break ; + } + } +}static void print_action_mgmt_frame (unsigned int level,const struct mmpdu_header *mmpdu,size_t total_len,bool no_ack)
@@ -4829,6 +4891,9 @@ static void print_action_mgmt_frame(unsigned int level,if (!memcmp (oui, wifi_alliance_oui,3 ) && oui[3 ] ==0x09 )print_p2p_action_frame (level +1 , body +5 , body_len -5 ); + }else if (body[0 ] ==6 ) { +print_ft_request (level, body +1 , body_len -1 ); +return ; }print_mpdu_frame_control (level +1 , &mmpdu->fc);
Signature · 1 line
2.31.1
Denis Kenzior
Hi James,
Quoted 7 lines · James Prestwood
This allows printing from pointer offsets, for example:
MAC_STR(buf + 10)--- src/util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
All applied, thanks.
Regards,
-Denis