dawn_iwinfo: filter out global interface

This commit is contained in:
twy_2000 2020-05-17 19:23:13 +08:00 committed by Polynomialdivision
parent b78a01bfb5
commit 42c4e6e0b0

View file

@ -45,6 +45,8 @@ int compare_essid_iwinfo(uint8_t *bssid_addr, uint8_t *bssid_addr_to_compare) {
while ((entry = readdir(dirp)) != NULL && (essid == NULL || essid_to_compare == NULL)) { while ((entry = readdir(dirp)) != NULL && (essid == NULL || essid_to_compare == NULL)) {
if (entry->d_type == DT_SOCK) { if (entry->d_type == DT_SOCK) {
if (strcmp(entry->d_name, "global") == 0)
continue;
iw = iwinfo_backend(entry->d_name); iw = iwinfo_backend(entry->d_name);
@ -111,7 +113,8 @@ int get_bandwidth(const char *ifname, uint8_t *client_addr, float *rx_rate, floa
char buf[IWINFO_BUFSIZE]; char buf[IWINFO_BUFSIZE];
struct iwinfo_assoclist_entry *e; struct iwinfo_assoclist_entry *e;
const struct iwinfo_ops *iw; const struct iwinfo_ops *iw;
if (strcmp(ifname, "global") == 0)
return 0;
iw = iwinfo_backend(ifname); iw = iwinfo_backend(ifname);
if (iw->assoclist(ifname, buf, &len)) { if (iw->assoclist(ifname, buf, &len)) {
@ -166,7 +169,8 @@ int get_rssi(const char *ifname, uint8_t *client_addr) {
char buf[IWINFO_BUFSIZE]; char buf[IWINFO_BUFSIZE];
struct iwinfo_assoclist_entry *e; struct iwinfo_assoclist_entry *e;
const struct iwinfo_ops *iw; const struct iwinfo_ops *iw;
if (strcmp(ifname, "global") == 0)
return INT_MIN;
iw = iwinfo_backend(ifname); iw = iwinfo_backend(ifname);
if (iw->assoclist(ifname, buf, &len)) { if (iw->assoclist(ifname, buf, &len)) {
@ -219,7 +223,8 @@ int get_expected_throughput(const char *ifname, uint8_t *client_addr) {
char buf[IWINFO_BUFSIZE]; char buf[IWINFO_BUFSIZE];
struct iwinfo_assoclist_entry *e; struct iwinfo_assoclist_entry *e;
const struct iwinfo_ops *iw; const struct iwinfo_ops *iw;
if (strcmp(ifname, "global") == 0)
return INT_MIN;
iw = iwinfo_backend(ifname); iw = iwinfo_backend(ifname);
if (iw->assoclist(ifname, buf, &len)) { if (iw->assoclist(ifname, buf, &len)) {
@ -245,7 +250,8 @@ int get_expected_throughput(const char *ifname, uint8_t *client_addr) {
int get_bssid(const char *ifname, uint8_t *bssid_addr) { int get_bssid(const char *ifname, uint8_t *bssid_addr) {
const struct iwinfo_ops *iw; const struct iwinfo_ops *iw;
if (strcmp(ifname, "global") == 0)
return 0;
iw = iwinfo_backend(ifname); iw = iwinfo_backend(ifname);
static char buf[18] = { 0 }; static char buf[18] = { 0 };
@ -262,7 +268,8 @@ int get_bssid(const char *ifname, uint8_t *bssid_addr) {
int get_ssid(const char *ifname, char* ssid) { int get_ssid(const char *ifname, char* ssid) {
const struct iwinfo_ops *iw; const struct iwinfo_ops *iw;
char buf[IWINFO_ESSID_MAX_SIZE+1] = { 0 }; char buf[IWINFO_ESSID_MAX_SIZE+1] = { 0 };
if (strcmp(ifname, "global") == 0)
return 0;
iw = iwinfo_backend(ifname); iw = iwinfo_backend(ifname);
if (iw->ssid(ifname, buf)) if (iw->ssid(ifname, buf))
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
@ -279,7 +286,8 @@ int get_channel_utilization(const char *ifname, uint64_t *last_channel_time, uin
char buf[IWINFO_BUFSIZE]; char buf[IWINFO_BUFSIZE];
struct iwinfo_survey_entry *e; struct iwinfo_survey_entry *e;
int ret = 0; int ret = 0;
if (strcmp(ifname, "global") == 0)
return 0;
iw = iwinfo_backend(ifname); iw = iwinfo_backend(ifname);
int freq; int freq;
@ -323,7 +331,8 @@ int get_channel_utilization(const char *ifname, uint64_t *last_channel_time, uin
int support_ht(const char *ifname) { int support_ht(const char *ifname) {
const struct iwinfo_ops *iw; const struct iwinfo_ops *iw;
if (strcmp(ifname, "global") == 0)
return 0;
iw = iwinfo_backend(ifname); iw = iwinfo_backend(ifname);
int htmodes = 0; int htmodes = 0;
@ -341,7 +350,8 @@ int support_ht(const char *ifname) {
int support_vht(const char *ifname) { int support_vht(const char *ifname) {
const struct iwinfo_ops *iw; const struct iwinfo_ops *iw;
if (strcmp(ifname, "global") == 0)
return 0;
iw = iwinfo_backend(ifname); iw = iwinfo_backend(ifname);
int htmodes = 0; int htmodes = 0;