| 4851 | } |
| 4852 | |
| 4853 | static void |
| 4854 | ieee80211_status(int s) |
| 4855 | { |
| 4856 | static const uint8_t zerobssid[IEEE80211_ADDR_LEN]; |
| 4857 | enum ieee80211_opmode opmode = get80211opmode(s); |
| 4858 | int i, num, wpa, wme, bgscan, bgscaninterval, val, len, wepmode; |
| 4859 | uint8_t data[32]; |
| 4860 | const struct ieee80211_channel *c; |
| 4861 | const struct ieee80211_roamparam *rp; |
| 4862 | const struct ieee80211_txparam *tp; |
| 4863 | |
| 4864 | if (getid(s, -1, data, sizeof(data), &len, 0) < 0) { |
| 4865 | /* If we can't get the SSID, this isn't an 802.11 device. */ |
| 4866 | return; |
| 4867 | } |
| 4868 | |
| 4869 | /* |
| 4870 | * Invalidate cached state so printing status for multiple |
| 4871 | * if's doesn't reuse the first interfaces' cached state. |
| 4872 | */ |
| 4873 | gotcurchan = 0; |
| 4874 | gotroam = 0; |
| 4875 | gottxparams = 0; |
| 4876 | gothtconf = 0; |
| 4877 | gotregdomain = 0; |
| 4878 | |
| 4879 | printf("\t"); |
| 4880 | if (opmode == IEEE80211_M_MBSS) { |
| 4881 | printf("meshid "); |
| 4882 | getid(s, 0, data, sizeof(data), &len, 1); |
| 4883 | print_string(data, len); |
| 4884 | } else { |
| 4885 | if (get80211val(s, IEEE80211_IOC_NUMSSIDS, &num) < 0) |
| 4886 | num = 0; |
| 4887 | printf("ssid "); |
| 4888 | if (num > 1) { |
| 4889 | for (i = 0; i < num; i++) { |
| 4890 | if (getid(s, i, data, sizeof(data), &len, 0) >= 0 && len > 0) { |
| 4891 | printf(" %d:", i + 1); |
| 4892 | print_string(data, len); |
| 4893 | } |
| 4894 | } |
| 4895 | } else |
| 4896 | print_string(data, len); |
| 4897 | } |
| 4898 | c = getcurchan(s); |
| 4899 | if (c->ic_freq != IEEE80211_CHAN_ANY) { |
| 4900 | char buf[14]; |
| 4901 | printf(" channel %d (%u MHz%s)", c->ic_ieee, c->ic_freq, |
| 4902 | get_chaninfo(c, 1, buf, sizeof(buf))); |
| 4903 | } else if (verbose) |
| 4904 | printf(" channel UNDEF"); |
| 4905 | |
| 4906 | if (get80211(s, IEEE80211_IOC_BSSID, data, IEEE80211_ADDR_LEN) >= 0 && |
| 4907 | (memcmp(data, zerobssid, sizeof(zerobssid)) != 0 || verbose)) |
| 4908 | printf(" bssid %s", ether_ntoa((struct ether_addr *)data)); |
| 4909 | |
| 4910 | if (get80211len(s, IEEE80211_IOC_STATIONNAME, data, sizeof(data), &len) != -1) { |
nothing calls this directly
no test coverage detected