mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 14:49:24 +01:00
monitor: Use nl80211cmd_to_string
This commit is contained in:
parent
bb61e971e5
commit
7f0b169e71
@ -274,6 +274,7 @@ monitor_iwmon_SOURCES = monitor/main.c linux/nl80211.h \
|
|||||||
src/watchlist.h src/watchlist.c \
|
src/watchlist.h src/watchlist.c \
|
||||||
src/eapolutil.h src/eapolutil.c \
|
src/eapolutil.h src/eapolutil.c \
|
||||||
src/handshake.h src/handshake.c \
|
src/handshake.h src/handshake.c \
|
||||||
|
src/nl80211cmd.h src/nl80211cmd.c \
|
||||||
src/p2putil.c src/p2putil.h
|
src/p2putil.c src/p2putil.h
|
||||||
monitor_iwmon_LDADD = $(ell_ldadd)
|
monitor_iwmon_LDADD = $(ell_ldadd)
|
||||||
endif
|
endif
|
||||||
|
144
monitor/nlmon.c
144
monitor/nlmon.c
@ -53,6 +53,7 @@
|
|||||||
#include "src/eapol.h"
|
#include "src/eapol.h"
|
||||||
#include "src/util.h"
|
#include "src/util.h"
|
||||||
#include "src/p2putil.h"
|
#include "src/p2putil.h"
|
||||||
|
#include "src/nl80211cmd.h"
|
||||||
#include "monitor/pcap.h"
|
#include "monitor/pcap.h"
|
||||||
#include "monitor/display.h"
|
#include "monitor/display.h"
|
||||||
#include "monitor/nlmon.h"
|
#include "monitor/nlmon.h"
|
||||||
@ -4269,127 +4270,6 @@ static const struct attr_entry rekey_table[] = {
|
|||||||
#define NLA_DATA(nla) ((void*)(((char*)(nla)) + NLA_LENGTH(0)))
|
#define NLA_DATA(nla) ((void*)(((char*)(nla)) + NLA_LENGTH(0)))
|
||||||
#define NLA_PAYLOAD(nla) ((int)((nla)->nla_len - NLA_LENGTH(0)))
|
#define NLA_PAYLOAD(nla) ((int)((nla)->nla_len - NLA_LENGTH(0)))
|
||||||
|
|
||||||
static const struct {
|
|
||||||
uint8_t cmd;
|
|
||||||
const char *str;
|
|
||||||
} cmd_table[] = {
|
|
||||||
{ NL80211_CMD_GET_WIPHY, "Get Wiphy" },
|
|
||||||
{ NL80211_CMD_SET_WIPHY, "Set Wiphy" },
|
|
||||||
{ NL80211_CMD_NEW_WIPHY, "New Wiphy" },
|
|
||||||
{ NL80211_CMD_DEL_WIPHY, "Del Wiphy" },
|
|
||||||
{ NL80211_CMD_GET_INTERFACE, "Get Interface" },
|
|
||||||
{ NL80211_CMD_SET_INTERFACE, "Set Interface" },
|
|
||||||
{ NL80211_CMD_NEW_INTERFACE, "New Interface" },
|
|
||||||
{ NL80211_CMD_DEL_INTERFACE, "Del Interface" },
|
|
||||||
{ NL80211_CMD_GET_KEY, "Get Key" },
|
|
||||||
{ NL80211_CMD_SET_KEY, "Set Key" },
|
|
||||||
{ NL80211_CMD_NEW_KEY, "New Key" },
|
|
||||||
{ NL80211_CMD_DEL_KEY, "Del Key" },
|
|
||||||
{ NL80211_CMD_GET_BEACON, "Get Beacon" },
|
|
||||||
{ NL80211_CMD_SET_BEACON, "Set Beacon" },
|
|
||||||
{ NL80211_CMD_START_AP, "Start AP" },
|
|
||||||
{ NL80211_CMD_STOP_AP, "Stop AP" },
|
|
||||||
{ NL80211_CMD_GET_STATION, "Get Station" },
|
|
||||||
{ NL80211_CMD_SET_STATION, "Set Station" },
|
|
||||||
{ NL80211_CMD_NEW_STATION, "New Station" },
|
|
||||||
{ NL80211_CMD_DEL_STATION, "Del Station" },
|
|
||||||
{ NL80211_CMD_GET_MPATH, "Get Mesh Path" },
|
|
||||||
{ NL80211_CMD_SET_MPATH, "Set Mesh Path" },
|
|
||||||
{ NL80211_CMD_NEW_MPATH, "New Mesh Path" },
|
|
||||||
{ NL80211_CMD_DEL_MPATH, "Del Mesh Path" },
|
|
||||||
{ NL80211_CMD_SET_BSS, "Set BSS" },
|
|
||||||
{ NL80211_CMD_SET_REG, "Set Reg" },
|
|
||||||
{ NL80211_CMD_REQ_SET_REG, "Req Set Reg" },
|
|
||||||
{ NL80211_CMD_GET_MESH_CONFIG, "Get Mesh Config" },
|
|
||||||
{ NL80211_CMD_SET_MESH_CONFIG, "Set Mesh Config" },
|
|
||||||
{ NL80211_CMD_SET_MGMT_EXTRA_IE, "Mgmt Extra IE" },
|
|
||||||
{ NL80211_CMD_GET_REG, "Get Reg" },
|
|
||||||
{ NL80211_CMD_GET_SCAN, "Get Scan" },
|
|
||||||
{ NL80211_CMD_TRIGGER_SCAN, "Trigger Scan" },
|
|
||||||
{ NL80211_CMD_NEW_SCAN_RESULTS, "New Scan Results" },
|
|
||||||
{ NL80211_CMD_SCAN_ABORTED, "Scan Aborted" },
|
|
||||||
{ NL80211_CMD_REG_CHANGE, "Reg Change" },
|
|
||||||
{ NL80211_CMD_AUTHENTICATE, "Authenticate" },
|
|
||||||
{ NL80211_CMD_ASSOCIATE, "Associate" },
|
|
||||||
{ NL80211_CMD_DEAUTHENTICATE, "Deauthenticate" },
|
|
||||||
{ NL80211_CMD_DISASSOCIATE, "Disassociate" },
|
|
||||||
{ NL80211_CMD_MICHAEL_MIC_FAILURE, "Michael MIC Failure" },
|
|
||||||
{ NL80211_CMD_REG_BEACON_HINT, "Reg Beacon Hint" },
|
|
||||||
{ NL80211_CMD_JOIN_IBSS, "Join IBSS" },
|
|
||||||
{ NL80211_CMD_LEAVE_IBSS, "Leave IBSS" },
|
|
||||||
{ NL80211_CMD_TESTMODE, "Test Mode" },
|
|
||||||
{ NL80211_CMD_CONNECT, "Connect" },
|
|
||||||
{ NL80211_CMD_ROAM, "Roam" },
|
|
||||||
{ NL80211_CMD_DISCONNECT, "Disconnect" },
|
|
||||||
{ NL80211_CMD_SET_WIPHY_NETNS, "Set Wiphy Netns" },
|
|
||||||
{ NL80211_CMD_GET_SURVEY, "Get Survey" },
|
|
||||||
{ NL80211_CMD_NEW_SURVEY_RESULTS, "New Survey Results" },
|
|
||||||
{ NL80211_CMD_SET_PMKSA, "Set PMKSA" },
|
|
||||||
{ NL80211_CMD_DEL_PMKSA, "Del PMKSA" },
|
|
||||||
{ NL80211_CMD_FLUSH_PMKSA, "Flush PMKSA" },
|
|
||||||
{ NL80211_CMD_REMAIN_ON_CHANNEL, "Remain on Channel" },
|
|
||||||
{ NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL, "Cancel Remain on Channel"},
|
|
||||||
{ NL80211_CMD_SET_TX_BITRATE_MASK, "Set TX Bitrate Mask" },
|
|
||||||
{ NL80211_CMD_REGISTER_FRAME, "Register Frame" },
|
|
||||||
{ NL80211_CMD_FRAME, "Frame" },
|
|
||||||
{ NL80211_CMD_FRAME_TX_STATUS, "Frame TX Status" },
|
|
||||||
{ NL80211_CMD_SET_POWER_SAVE, "Set Power Save" },
|
|
||||||
{ NL80211_CMD_GET_POWER_SAVE, "Get Power Save" },
|
|
||||||
{ NL80211_CMD_SET_CQM, "Set CQM" },
|
|
||||||
{ NL80211_CMD_NOTIFY_CQM, "Notify CQM" },
|
|
||||||
{ NL80211_CMD_SET_CHANNEL, "Set Channel" },
|
|
||||||
{ NL80211_CMD_SET_WDS_PEER, "Set WDS Peer" },
|
|
||||||
{ NL80211_CMD_FRAME_WAIT_CANCEL, "Frame Wait Cancel" },
|
|
||||||
{ NL80211_CMD_JOIN_MESH, "Join Mesh" },
|
|
||||||
{ NL80211_CMD_LEAVE_MESH, "Leave Mesh" },
|
|
||||||
{ NL80211_CMD_UNPROT_DEAUTHENTICATE, "Unprot Deauthenticate" },
|
|
||||||
{ NL80211_CMD_UNPROT_DISASSOCIATE, "Unprot Disassociate" },
|
|
||||||
{ NL80211_CMD_NEW_PEER_CANDIDATE, "New Peer Candidate" },
|
|
||||||
{ NL80211_CMD_GET_WOWLAN, "Get WoWLAN" },
|
|
||||||
{ NL80211_CMD_SET_WOWLAN, "Set WoWLAN" },
|
|
||||||
{ NL80211_CMD_START_SCHED_SCAN, "Start Sched Scan" },
|
|
||||||
{ NL80211_CMD_STOP_SCHED_SCAN, "Stop Sched Scan" },
|
|
||||||
{ NL80211_CMD_SCHED_SCAN_RESULTS, "Sched Scan Results" },
|
|
||||||
{ NL80211_CMD_SCHED_SCAN_STOPPED, "Sched Scan Stopped" },
|
|
||||||
{ NL80211_CMD_SET_REKEY_OFFLOAD, "Set Rekey Offload" },
|
|
||||||
{ NL80211_CMD_PMKSA_CANDIDATE, "PMKSA Candidate" },
|
|
||||||
{ NL80211_CMD_TDLS_OPER, "TDLS Oper" },
|
|
||||||
{ NL80211_CMD_TDLS_MGMT, "TDLS Mgmt" },
|
|
||||||
{ NL80211_CMD_UNEXPECTED_FRAME, "Unexpected Frame" },
|
|
||||||
{ NL80211_CMD_PROBE_CLIENT, "Probe Client" },
|
|
||||||
{ NL80211_CMD_REGISTER_BEACONS, "Register Beacons" },
|
|
||||||
{ NL80211_CMD_UNEXPECTED_4ADDR_FRAME, "Unexpected 4addr Frame"},
|
|
||||||
{ NL80211_CMD_SET_NOACK_MAP, "Set NoAck Map" },
|
|
||||||
{ NL80211_CMD_CH_SWITCH_NOTIFY, "Channel Switch Notify" },
|
|
||||||
{ NL80211_CMD_START_P2P_DEVICE, "Start P2P Device" },
|
|
||||||
{ NL80211_CMD_STOP_P2P_DEVICE, "Stop P2P Device" },
|
|
||||||
{ NL80211_CMD_CONN_FAILED, "Conn Failed" },
|
|
||||||
{ NL80211_CMD_SET_MCAST_RATE, "Set Mcast Rate" },
|
|
||||||
{ NL80211_CMD_SET_MAC_ACL, "Set MAC ACL" },
|
|
||||||
{ NL80211_CMD_RADAR_DETECT, "Radar Detect" },
|
|
||||||
{ NL80211_CMD_GET_PROTOCOL_FEATURES, "Get Protocol Features" },
|
|
||||||
{ NL80211_CMD_UPDATE_FT_IES, "Update FT IEs" },
|
|
||||||
{ NL80211_CMD_FT_EVENT, "FT Event" },
|
|
||||||
{ NL80211_CMD_CRIT_PROTOCOL_START, "Crit Protocol Start" },
|
|
||||||
{ NL80211_CMD_CRIT_PROTOCOL_STOP, "Crit Protocol Stop" },
|
|
||||||
{ NL80211_CMD_GET_COALESCE, "Get Coalesce" },
|
|
||||||
{ NL80211_CMD_SET_COALESCE, "Set Coalesce" },
|
|
||||||
{ NL80211_CMD_CHANNEL_SWITCH, "Channel Switch" },
|
|
||||||
{ NL80211_CMD_VENDOR, "Vendor" },
|
|
||||||
{ NL80211_CMD_SET_QOS_MAP, "Set QoS Map" },
|
|
||||||
{ NL80211_CMD_ADD_TX_TS, "Add Traffic Stream" },
|
|
||||||
{ NL80211_CMD_DEL_TX_TS, "Delete Traffic Stream" },
|
|
||||||
{ NL80211_CMD_GET_MPP, "Get Mesh Proxy Path" },
|
|
||||||
{ NL80211_CMD_JOIN_OCB, "Join OCB Network" },
|
|
||||||
{ NL80211_CMD_LEAVE_OCB, "Leave OCB Network" },
|
|
||||||
{ NL80211_CMD_CH_SWITCH_STARTED_NOTIFY, "Channel Switch Notify" },
|
|
||||||
{ NL80211_CMD_TDLS_CHANNEL_SWITCH, "TDLS Channel Switch" },
|
|
||||||
{ NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH,
|
|
||||||
"Cancel TLDS Channel Switch" },
|
|
||||||
{ NL80211_CMD_WIPHY_REG_CHANGE, "Wiphy Reg Change" },
|
|
||||||
{ }
|
|
||||||
};
|
|
||||||
|
|
||||||
static void print_supported_commands(unsigned int level, const char *label,
|
static void print_supported_commands(unsigned int level, const char *label,
|
||||||
const void *data, uint16_t size)
|
const void *data, uint16_t size)
|
||||||
{
|
{
|
||||||
@ -4398,18 +4278,10 @@ static void print_supported_commands(unsigned int level, const char *label,
|
|||||||
print_attr(level, "%s:", label);
|
print_attr(level, "%s:", label);
|
||||||
|
|
||||||
for (nla = data; NLA_OK(nla, size); nla = NLA_NEXT(nla, size)) {
|
for (nla = data; NLA_OK(nla, size); nla = NLA_NEXT(nla, size)) {
|
||||||
const char *cmd_str = "Reserved";
|
|
||||||
uint32_t cmd = *((uint32_t *) NLA_DATA(nla));
|
uint32_t cmd = *((uint32_t *) NLA_DATA(nla));
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
for (i = 0; cmd_table[i].str; i++) {
|
print_attr(level + 1, "%s [%d]",
|
||||||
if (cmd_table[i].cmd == cmd) {
|
nl80211cmd_to_string(cmd), cmd);
|
||||||
cmd_str = cmd_table[i].str;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print_attr(level + 1, "%s [%d]", cmd_str, cmd);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5382,7 +5254,6 @@ static void print_message(struct nlmon *nlmon, const struct timeval *tv,
|
|||||||
const char *color = COLOR_OFF;
|
const char *color = COLOR_OFF;
|
||||||
const char *cmd_str;
|
const char *cmd_str;
|
||||||
bool out = false;
|
bool out = false;
|
||||||
int i;
|
|
||||||
|
|
||||||
if (nlmon->nowiphy && (cmd == NL80211_CMD_NEW_WIPHY))
|
if (nlmon->nowiphy && (cmd == NL80211_CMD_NEW_WIPHY))
|
||||||
return;
|
return;
|
||||||
@ -5415,14 +5286,7 @@ static void print_message(struct nlmon *nlmon, const struct timeval *tv,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_str = "Reserved";
|
cmd_str = nl80211cmd_to_string(cmd);
|
||||||
|
|
||||||
for (i = 0; cmd_table[i].str; i++) {
|
|
||||||
if (cmd_table[i].cmd == cmd) {
|
|
||||||
cmd_str = cmd_table[i].str;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
netlink_str(extra_str, sizeof(extra_str), cmd, flags, len);
|
netlink_str(extra_str, sizeof(extra_str), cmd, flags, len);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user