FreeBSD Bugzilla – Attachment 180253 Details for
Bug 217317
[patch] ifconfig extend printwpsie() to display more WPS attributes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch to extend WPS IE display for more attributes
ifieee80211.c.diff2 (text/plain), 14.79 KB, created by
J.R. Oldroyd
on 2017-02-24 01:58:28 UTC
(
hide
)
Description:
patch to extend WPS IE display for more attributes
Filename:
MIME Type:
Creator:
J.R. Oldroyd
Created:
2017-02-24 01:58:28 UTC
Size:
14.79 KB
patch
obsolete
>Index: sbin/ifconfig/ifieee80211.c >=================================================================== >--- sbin/ifconfig/ifieee80211.c (revision 314110) >+++ sbin/ifconfig/ifieee80211.c (working copy) >@@ -75,6 +75,7 @@ > #include <net80211/ieee80211_superg.h> > #include <net80211/ieee80211_tdma.h> > #include <net80211/ieee80211_mesh.h> >+#include <net80211/ieee80211_wps.h> > > #include <assert.h> > #include <ctype.h> >@@ -2960,13 +2961,6 @@ > } > } > >-/* XXX move to a public include file */ >-#define IEEE80211_WPS_DEV_PASS_ID 0x1012 >-#define IEEE80211_WPS_SELECTED_REG 0x1041 >-#define IEEE80211_WPS_SETUP_STATE 0x1044 >-#define IEEE80211_WPS_UUID_E 0x1047 >-#define IEEE80211_WPS_VERSION 0x104a >- > #define BE_READ_2(p) \ > ((u_int16_t) \ > ((((const u_int8_t *)(p))[1] ) | \ >@@ -2988,6 +2982,7 @@ > "R" /* Registrar-specified */ > }; > int n; >+ int f; > > ie +=6, len -= 4; /* NB: len is payload only */ > >@@ -3008,30 +3004,193 @@ > ie += 4, len -= 4; > > switch (tlv_type) { >- case IEEE80211_WPS_VERSION: >+ case IEEE80211_WPS_ATTR_VERSION: > printf("v:%d.%d", *ie >> 4, *ie & 0xf); > break; >- case IEEE80211_WPS_SETUP_STATE: >- /* Only 1 and 2 are valid */ >- if (*ie == 0 || *ie >= 3) >- printf(" state:B"); >- else >- printf(" st:%s", *ie == 1 ? "N" : "C"); >+ case IEEE80211_WPS_ATTR_AP_SETUP_LOCKED: >+ printf(" ap_setup:%s", *ie ? "locked" : >+ "unlocked"); > break; >- case IEEE80211_WPS_SELECTED_REG: >- printf(" sel:%s", *ie ? "T" : "F"); >+ case IEEE80211_WPS_ATTR_CONFIG_METHODS: >+ printf(" cfg_mthd:"); >+ goto wps_attr_config_methods_common; >+ case IEEE80211_WPS_ATTR_SELECTED_REGISTRAR_CONFIG_METHODS: >+ printf(" sel_reg_cfg_mthd:"); >+ wps_attr_config_methods_common: >+ cfg_mthd = BE_READ_2(ie); >+ f = 0; >+ for (n = 15; n >= 0; n--) { >+ if (f) { >+ printf(","); >+ f = 0; >+ } >+ switch (cfg_mthd & (1 << n)) { >+ case 0: >+ break; >+ case IEEE80211_WPS_CONFIG_USBA: >+ printf("usba"); >+ f++; >+ break; >+ case IEEE80211_WPS_CONFIG_ETHERNET: >+ printf("ethernet"); >+ f++; >+ break; >+ case IEEE80211_WPS_CONFIG_LABEL: >+ printf("label"); >+ f++; >+ break; >+ case IEEE80211_WPS_CONFIG_DISPLAY: >+ if (!(cfg_mthd & >+ (IEEE80211_WPS_CONFIG_VIRT_DISPLAY | >+ IEEE80211_WPS_CONFIG_PHY_DISPLAY))) >+ { >+ printf("display"); >+ f++; >+ } >+ break; >+ case IEEE80211_WPS_CONFIG_EXT_NFC_TOKEN: >+ printf("ext_nfc_tokenk"); >+ f++; >+ break; >+ case IEEE80211_WPS_CONFIG_INT_NFC_TOKEN: >+ printf("int_nfc_token"); >+ f++; >+ break; >+ case IEEE80211_WPS_CONFIG_NFC_INTERFACE: >+ printf("nfc_interface"); >+ f++; >+ break; >+ case IEEE80211_WPS_CONFIG_PUSHBUTTON: >+ if (!(cfg_mthd & >+ (IEEE80211_WPS_CONFIG_VIRT_PUSHBUTTON | >+ IEEE80211_WPS_CONFIG_PHY_PUSHBUTTON))) { >+ printf("push_button"); >+ f++; >+ } >+ break; >+ case IEEE80211_WPS_CONFIG_KEYPAD: >+ printf("keypad"); >+ f++; >+ break; >+ case IEEE80211_WPS_CONFIG_VIRT_PUSHBUTTON: >+ printf("virtual_push_button"); >+ f++; >+ break; >+ case IEEE80211_WPS_CONFIG_PHY_PUSHBUTTON: >+ printf("physical_push_button"); >+ f++; >+ break; >+ case IEEE80211_WPS_CONFIG_P2PS: >+ printf("p2ps"); >+ f++; >+ break; >+ case IEEE80211_WPS_CONFIG_VIRT_DISPLAY: >+ printf("virtual_display"); >+ f++; >+ break; >+ case IEEE80211_WPS_CONFIG_PHY_DISPLAY: >+ printf("physical_display"); >+ f++; >+ break; >+ default: >+ printf("unknown_wps_config<%04x>", >+ cfg_mthd & (1 << n)); >+ f++; >+ break; >+ } >+ } > break; >- case IEEE80211_WPS_DEV_PASS_ID: >+ case IEEE80211_WPS_ATTR_DEV_NAME: >+ printf(" device_name:<%*s>", tlv_len, ie); >+ break; >+ case IEEE80211_WPS_ATTR_DEV_PASSWORD_ID: > n = LE_READ_2(ie); > if (n < nitems(dev_pass_id)) > printf(" dpi:%s", dev_pass_id[n]); > break; >- case IEEE80211_WPS_UUID_E: >+ case IEEE80211_WPS_ATTR_MANUFACTURER: >+ printf(" manufacturer:<%*s>", tlv_len, ie); >+ break; >+ case IEEE80211_WPS_ATTR_MODEL_NAME: >+ printf(" model_name:<%*s>", tlv_len, ie); >+ break; >+ case IEEE80211_WPS_ATTR_MODEL_NUMBER: >+ printf(" model_number:<%*s>", tlv_len, ie); >+ break; >+ case IEEE80211_WPS_ATTR_PRIMARY_DEV_TYPE: >+ printf(" prim_dev:<"); >+ for (n = 0; n < tlv_len; n++) >+ printf("%02x", ie[n]); >+ printf(">"); >+ break; >+ case IEEE80211_WPS_ATTR_RF_BANDS: >+ printf(" rf:"); >+ f = 0; >+ for (n = 7; n >= 0; n--) { >+ if (f) { >+ printf(","); >+ f = 0; >+ } >+ switch (*ie & (1 << n)) { >+ case 0: >+ break; >+ case IEEE80211_WPS_RF_BAND_24GHZ: >+ printf("2.4Ghz"); >+ f++; >+ break; >+ case IEEE80211_WPS_RF_BAND_50GHZ: >+ printf("5Ghz"); >+ f++; >+ break; >+ case IEEE80211_WPS_RF_BAND_600GHZ: >+ printf("60Ghz"); >+ f++; >+ break; >+ default: >+ printf("unknown<%02x>", >+ *ie & (1 << n)); >+ f++; >+ break; >+ } >+ } >+ break; >+ case IEEE80211_WPS_ATTR_RESPONSE_TYPE: >+ printf(" resp_type:0x%02x", *ie); >+ break; >+ case IEEE80211_WPS_ATTR_SELECTED_REGISTRAR: >+ printf(" sel:%s", *ie ? "T" : "F"); >+ break; >+ case IEEE80211_WPS_ATTR_SERIAL_NUMBER: >+ printf(" serial_number:<%*s>", tlv_len, ie); >+ break; >+ case IEEE80211_WPS_ATTR_UUID_E: > printf(" uuid-e:"); > for (n = 0; n < (tlv_len - 1); n++) > printf("%02x-", ie[n]); > printf("%02x", ie[n]); > break; >+ case IEEE80211_WPS_ATTR_VENDOR_EXT: >+ printf(" vendor:<"); >+ for (n = 0; n < tlv_len; n++) >+ printf("%02x", ie[n]); >+ printf(">"); >+ break; >+ case IEEE80211_WPS_ATTR_WPS_STATE: >+ switch (*ie) { >+ case IEEE80211_WPS_STATE_NOT_CONFIGURED: >+ printf(" state:N"); >+ break; >+ case IEEE80211_WPS_STATE_CONFIGURED: >+ printf(" state:C"); >+ break; >+ default: >+ printf(" state:B<%02x>", *ie); >+ break; >+ } >+ break; >+ default: >+ printf(" unknown_wps_attr:<0x%x>", tlv_type); >+ break; > } > ie += tlv_len, len -= tlv_len; > } >@@ -3181,6 +3340,7 @@ > return frm[1] > 3 && LE_READ_4(frm+2) == ((WPS_OUI_TYPE<<24)|WPA_OUI); > } > >+char iename_buf[64]; > static const char * > iename(int elemid) > { >@@ -3201,10 +3361,20 @@ > case IEEE80211_ELEMID_MEASREP: return " MEASREP"; > case IEEE80211_ELEMID_QUIET: return " QUIET"; > case IEEE80211_ELEMID_IBSSDFS: return " IBSSDFS"; >+ case IEEE80211_ELEMID_RESERVED_47: >+ return " RESERVED_47"; >+ case IEEE80211_ELEMID_MOBILITY_DOMAIN: >+ return " MOBILITY_DOMAIN"; >+ case IEEE80211_ELEMID_RRM_ENACAPS: >+ return " RRM_ENCAPS"; >+ case IEEE80211_ELEMID_OVERLAP_BSS_SCAN_PARAM: >+ return " OVERLAP_BSS"; > case IEEE80211_ELEMID_TPC: return " TPC"; > case IEEE80211_ELEMID_CCKM: return " CCKM"; >+ case IEEE80211_ELEMID_EXTCAP: return " EXTCAP"; > } >- return " ???"; >+ sprintf(iename_buf, " UNKNOWN_ELEMID_%d", elemid); >+ return (const char *) iename_buf; > } > > static void >Index: sys/net80211/ieee80211.h >=================================================================== >--- sys/net80211/ieee80211.h (revision 314110) >+++ sys/net80211/ieee80211.h (working copy) >@@ -893,9 +893,11 @@ > IEEE80211_ELEMID_ERP = 42, > IEEE80211_ELEMID_HTCAP = 45, > IEEE80211_ELEMID_QOS = 46, >+ IEEE80211_ELEMID_RESERVED_47 = 47, > IEEE80211_ELEMID_RSN = 48, > IEEE80211_ELEMID_XRATES = 50, > IEEE80211_ELEMID_APCHANREP = 51, >+ IEEE80211_ELEMID_MOBILITY_DOMAIN = 54, > IEEE80211_ELEMID_HTINFO = 61, > IEEE80211_ELEMID_SECCHAN_OFFSET = 62, > IEEE80211_ELEMID_RRM_ENACAPS = 70, >Index: sys/net80211/ieee80211_wps.h >=================================================================== >--- sys/net80211/ieee80211_wps.h (nonexistent) >+++ sys/net80211/ieee80211_wps.h (working copy) >@@ -0,0 +1,147 @@ >+/*- >+ * Copyright (c) 2017 J.R. Oldroyd, Open Advisors Limited >+ * All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR >+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES >+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. >+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, >+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT >+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF >+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ * >+ * $FreeBSD$ >+ */ >+#ifndef _NET80211_IEEE80211_WPS_H_ >+#define _NET80211_IEEE80211_WPS_H_ >+ >+/* >+ * 802.11 WPS implementation definitions. >+ */ >+ >+#define IEEE80211_WPS_ATTR_AP_CHANNEL 0x1001 >+#define IEEE80211_WPS_ATTR_ASSOC_STATE 0x1002 >+#define IEEE80211_WPS_ATTR_AUTH_TYPE 0x1003 >+#define IEEE80211_WPS_ATTR_AUTH_TYPE_FLAGS 0x1004 >+#define IEEE80211_WPS_ATTR_AUTHENTICATOR 0x1005 >+#define IEEE80211_WPS_ATTR_CONFIG_METHODS 0x1008 >+#define IEEE80211_WPS_ATTR_CONFIG_ERROR 0x1009 >+#define IEEE80211_WPS_ATTR_CONFIRM_URL4 0x100a >+#define IEEE80211_WPS_ATTR_CONFIRM_URL6 0x100b >+#define IEEE80211_WPS_ATTR_CONN_TYPE 0x100c >+#define IEEE80211_WPS_ATTR_CONN_TYPE_FLAGS 0x100d >+#define IEEE80211_WPS_ATTR_CRED 0x100e >+#define IEEE80211_WPS_ATTR_ENCR_TYPE 0x100f >+#define IEEE80211_WPS_ATTR_ENCR_TYPE_FLAGS 0x1010 >+#define IEEE80211_WPS_ATTR_DEV_NAME 0x1011 >+#define IEEE80211_WPS_ATTR_DEV_PASSWORD_ID 0x1012 >+#define IEEE80211_WPS_ATTR_E_HASH1 0x1014 >+#define IEEE80211_WPS_ATTR_E_HASH2 0x1015 >+#define IEEE80211_WPS_ATTR_E_SNONCE1 0x1016 >+#define IEEE80211_WPS_ATTR_E_SNONCE2 0x1017 >+#define IEEE80211_WPS_ATTR_ENCR_SETTINGS 0x1018 >+#define IEEE80211_WPS_ATTR_ENROLLEE_NONCE 0x101a >+#define IEEE80211_WPS_ATTR_FEATURE_ID 0x101b >+#define IEEE80211_WPS_ATTR_IDENTITY 0x101c >+#define IEEE80211_WPS_ATTR_IDENTITY_PROOF 0x101d >+#define IEEE80211_WPS_ATTR_KEY_WRAP_AUTH 0x101e >+#define IEEE80211_WPS_ATTR_KEY_ID 0x101f >+#define IEEE80211_WPS_ATTR_MAC_ADDR 0x1020 >+#define IEEE80211_WPS_ATTR_MANUFACTURER 0x1021 >+#define IEEE80211_WPS_ATTR_MSG_TYPE 0x1022 >+#define IEEE80211_WPS_ATTR_MODEL_NAME 0x1023 >+#define IEEE80211_WPS_ATTR_MODEL_NUMBER 0x1024 >+#define IEEE80211_WPS_ATTR_NETWORK_INDEX 0x1026 >+#define IEEE80211_WPS_ATTR_NETWORK_KEY 0x1027 >+#define IEEE80211_WPS_ATTR_NETWORK_KEY_INDEX 0x1028 >+#define IEEE80211_WPS_ATTR_NEW_DEVICE_NAME 0x1029 >+#define IEEE80211_WPS_ATTR_NEW_PASSWORD 0x102a >+#define IEEE80211_WPS_ATTR_OOB_DEVICE_PASSWORD 0x102c >+#define IEEE80211_WPS_ATTR_OS_VERSION 0x102d >+#define IEEE80211_WPS_ATTR_POWER_LEVEL 0x102f >+#define IEEE80211_WPS_ATTR_PSK_CURRENT 0x1030 >+#define IEEE80211_WPS_ATTR_PSK_MAX 0x1031 >+#define IEEE80211_WPS_ATTR_PUBLIC_KEY 0x1032 >+#define IEEE80211_WPS_ATTR_RADIO_ENABLE 0x1033 >+#define IEEE80211_WPS_ATTR_REBOOT 0x1034 >+#define IEEE80211_WPS_ATTR_REGISTRAR_CURRENT 0x1035 >+#define IEEE80211_WPS_ATTR_REGISTRAR_ESTBLSHD 0x1036 >+#define IEEE80211_WPS_ATTR_REGISTRAR_LIST 0x1037 >+#define IEEE80211_WPS_ATTR_REGISTRAR_MAX 0x1038 >+#define IEEE80211_WPS_ATTR_REGISTRAR_NONCE 0x1039 >+#define IEEE80211_WPS_ATTR_REQUEST_TYPE 0x103a >+#define IEEE80211_WPS_ATTR_RESPONSE_TYPE 0x103b >+#define IEEE80211_WPS_ATTR_RF_BANDS 0x103c >+#define IEEE80211_WPS_ATTR_R_HASH1 0x103d >+#define IEEE80211_WPS_ATTR_R_HASH2 0x103e >+#define IEEE80211_WPS_ATTR_R_SNONCE1 0x103f >+#define IEEE80211_WPS_ATTR_R_SNONCE2 0x1040 >+#define IEEE80211_WPS_ATTR_SELECTED_REGISTRAR 0x1041 >+#define IEEE80211_WPS_ATTR_SERIAL_NUMBER 0x1042 >+#define IEEE80211_WPS_ATTR_WPS_STATE 0x1044 >+#define IEEE80211_WPS_ATTR_SSID 0x1045 >+#define IEEE80211_WPS_ATTR_TOTAL_NETWORKS 0x1046 >+#define IEEE80211_WPS_ATTR_UUID_E 0x1047 >+#define IEEE80211_WPS_ATTR_UUID_R 0x1048 >+#define IEEE80211_WPS_ATTR_VENDOR_EXT 0x1049 >+#define IEEE80211_WPS_ATTR_VERSION 0x104a >+#define IEEE80211_WPS_ATTR_X509_CERT_REQ 0x104b >+#define IEEE80211_WPS_ATTR_X509_CERT 0x104c >+#define IEEE80211_WPS_ATTR_EAP_IDENTITY 0x104d >+#define IEEE80211_WPS_ATTR_MSG_COUNTER 0x104e >+#define IEEE80211_WPS_ATTR_PUBKEY_HASH 0x104f >+#define IEEE80211_WPS_ATTR_REKEY_KEY 0x1050 >+#define IEEE80211_WPS_ATTR_KEY_LIFETIME 0x1051 >+#define IEEE80211_WPS_ATTR_PERMITTED_CONFIG_METHODS 0x1052 >+#define IEEE80211_WPS_ATTR_SELECTED_REGISTRAR_CONFIG_METHODS 0x1053 >+#define IEEE80211_WPS_ATTR_PRIMARY_DEV_TYPE 0x1054 >+#define IEEE80211_WPS_ATTR_SECONDARY_DEV_TYPE_LIST 0x1055 >+#define IEEE80211_WPS_ATTR_PORTABLE_DEV 0x1056 >+#define IEEE80211_WPS_ATTR_AP_SETUP_LOCKED 0x1057 >+#define IEEE80211_WPS_ATTR_APPLICATION_EXT 0x1058 >+#define IEEE80211_WPS_ATTR_EAP_TYPE 0x1059 >+#define IEEE80211_WPS_ATTR_IV 0x1060 >+#define IEEE80211_WPS_ATTR_KEY_PROVIDED_AUTO 0x1061 >+#define IEEE80211_WPS_ATTR_802_1X_ENABLED 0x1062 >+#define IEEE80211_WPS_ATTR_AP_SESSION_KEY 0x1063 >+#define IEEE80211_WPS_ATTR_WEP_TRANSMIT_KEY 0x1064 >+#define IEEE80211_WPS_ATTR_REQUESTED_DEV_TYPE 0x106a >+#define IEEE80211_WPS_ATTR_EXTENSIBILITY_TEST 0x10fa /* _NOT_ defined in the spec */ >+ >+/* RF bands bitmask */ >+#define IEEE80211_WPS_RF_BAND_24GHZ 0x01 >+#define IEEE80211_WPS_RF_BAND_50GHZ 0x02 >+#define IEEE80211_WPS_RF_BAND_600GHZ 0x04 >+ >+/* Config methods bitmask */ >+#define IEEE80211_WPS_CONFIG_USBA 0x0001 >+#define IEEE80211_WPS_CONFIG_ETHERNET 0x0002 >+#define IEEE80211_WPS_CONFIG_LABEL 0x0004 >+#define IEEE80211_WPS_CONFIG_DISPLAY 0x0008 >+#define IEEE80211_WPS_CONFIG_EXT_NFC_TOKEN 0x0010 >+#define IEEE80211_WPS_CONFIG_INT_NFC_TOKEN 0x0020 >+#define IEEE80211_WPS_CONFIG_NFC_INTERFACE 0x0040 >+#define IEEE80211_WPS_CONFIG_PUSHBUTTON 0x0080 >+#define IEEE80211_WPS_CONFIG_KEYPAD 0x0100 >+#define IEEE80211_WPS_CONFIG_VIRT_PUSHBUTTON 0x0200 >+#define IEEE80211_WPS_CONFIG_PHY_PUSHBUTTON 0x0400 >+#define IEEE80211_WPS_CONFIG_P2PS 0x1000 >+#define IEEE80211_WPS_CONFIG_VIRT_DISPLAY 0x2000 >+#define IEEE80211_WPS_CONFIG_PHY_DISPLAY 0x4000 >+ >+/* Wi-Fi Protected Setup state */ >+#define IEEE80211_WPS_STATE_NOT_CONFIGURED 0x01 >+#define IEEE80211_WPS_STATE_CONFIGURED 0x02 >+#endif /* _NET80211_IEEE80211_WPS_H_ */ > >Property changes on: sys/net80211/ieee80211_wps.h >___________________________________________________________________ >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:keywords >## -0,0 +1 ## >+FreeBSD=%H >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 217317
: 180253