Skip to content

Commit 05cd3c1

Browse files
author
=
committed
print warning if active monitor mode is not supported as requested
1 parent 15440d2 commit 05cd3c1

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

hcxdumptool.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/nl80211.h>
1919
#include <linux/rtnetlink.h>
2020
#include <linux/version.h>
21+
#include <sys/socket.h>
2122
#include <net/ethernet.h>
2223
#include <net/if.h>
2324
#include <pwd.h>
@@ -4067,15 +4068,19 @@ nla->nla_len = 8;
40674068
nla->nla_type = NL80211_ATTR_IFTYPE;
40684069
*(u32*)nla_data(nla) = NL80211_IFTYPE_MONITOR;
40694070
i += 8;
4070-
if(((ifakttype & IFTYPEMONACT) == IFTYPEMONACT) && (activemonitorflag == true))
4071-
{
4072-
nla = (struct nlattr*)(nltxbuffer + i);
4073-
nla->nla_len = 8;
4074-
nla->nla_type = NL80211_ATTR_MNTR_FLAGS;
4075-
nla = (struct nlattr*)nla_data(nla);
4076-
nla->nla_len = 4;
4077-
nla->nla_type = NL80211_MNTR_FLAG_ACTIVE;
4078-
i += 8;
4071+
if(activemonitorflag == true)
4072+
{
4073+
if((ifakttype & IFTYPEMONACT) == IFTYPEMONACT)
4074+
{
4075+
nla = (struct nlattr*)(nltxbuffer + i);
4076+
nla->nla_len = 8;
4077+
nla->nla_type = NL80211_ATTR_MNTR_FLAGS;
4078+
nla = (struct nlattr*)nla_data(nla);
4079+
nla->nla_len = 4;
4080+
nla->nla_type = NL80211_MNTR_FLAG_ACTIVE;
4081+
i += 8;
4082+
}
4083+
else fprintf(stderr, "\nWarning: active monitor mode requested by user, but not supported by driver!\n");
40794084
}
40804085
nlh->nlmsg_len = i;
40814086
if((write(fd_socket_nl, nltxbuffer, i)) != i) return false;

0 commit comments

Comments
 (0)