X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=contrib%2Fpackage%2Fiwinfo%2Fsrc%2Fiwinfo_wext.c;h=298fd931786399150aa24176bc6c52403c572f20;hp=8ea380204cab6492bae2381e451a8d2c54ced535;hb=66736c857476550c68720a4cf933ab2f6d04031d;hpb=653c9e782f54f3ab980b678227d0429259ce038b diff --git a/contrib/package/iwinfo/src/iwinfo_wext.c b/contrib/package/iwinfo/src/iwinfo_wext.c index 8ea380204..298fd9317 100644 --- a/contrib/package/iwinfo/src/iwinfo_wext.c +++ b/contrib/package/iwinfo/src/iwinfo_wext.c @@ -89,7 +89,10 @@ static int wext_ioctl(const char *ifname, int cmd, struct iwreq *wrq) { /* prepare socket */ if( ioctl_socket == -1 ) + { ioctl_socket = socket(AF_INET, SOCK_DGRAM, 0); + fcntl(ioctl_socket, F_SETFD, fcntl(ioctl_socket, F_GETFD) | FD_CLOEXEC); + } if( !strncmp(ifname, "mon.", 4) ) strncpy(wrq->ifr_name, &ifname[4], IFNAMSIZ); @@ -110,6 +113,14 @@ int wext_probe(const char *ifname) return 0; } +void wext_close(void) +{ + wext_scan_close(); + + if( ioctl_socket > -1 ) + close(ioctl_socket); +} + int wext_get_mode(const char *ifname, char *buf) { struct iwreq wrq; @@ -184,7 +195,7 @@ int wext_get_bssid(const char *ifname, char *buf) return 0; } - return -1; + return -1; } int wext_get_bitrate(const char *ifname, int *buf) @@ -197,7 +208,7 @@ int wext_get_bitrate(const char *ifname, int *buf) return 0; } - return -1; + return -1; } int wext_get_channel(const char *ifname, int *buf) @@ -235,7 +246,7 @@ int wext_get_channel(const char *ifname, int *buf) } } - return -1; + return -1; } int wext_get_frequency(const char *ifname, int *buf) @@ -273,7 +284,7 @@ int wext_get_frequency(const char *ifname, int *buf) } } - return -1; + return -1; } int wext_get_txpower(const char *ifname, int *buf) @@ -413,7 +424,7 @@ int wext_get_txpwrlist(const char *ifname, char *buf, int *len) return 0; } - return -1; + return -1; } int wext_get_freqlist(const char *ifname, char *buf, int *len) @@ -433,8 +444,9 @@ int wext_get_freqlist(const char *ifname, char *buf, int *len) for(i = 0; i < range.num_frequency; i++) { - entry.mhz = wext_freq2mhz(&range.freq[i]); - entry.channel = range.freq[i].i; + entry.mhz = wext_freq2mhz(&range.freq[i]); + entry.channel = range.freq[i].i; + entry.restricted = 0; memcpy(&buf[bl], &entry, sizeof(struct iwinfo_freqlist_entry)); bl += sizeof(struct iwinfo_freqlist_entry); @@ -447,6 +459,18 @@ int wext_get_freqlist(const char *ifname, char *buf, int *len) return -1; } +int wext_get_country(const char *ifname, char *buf) +{ + sprintf(buf, "00"); + return 0; +} + +int wext_get_countrylist(const char *ifname, char *buf, int *len) +{ + /* Stub */ + return -1; +} + int wext_get_encryption(const char *ifname, char *buf) { /* No reliable crypto info in wext */ @@ -458,4 +482,3 @@ int wext_get_mbssid_support(const char *ifname, int *buf) /* No multi bssid support atm */ return -1; } -