Deleted Added
full compact
ifieee80211.c (246505) ifieee80211.c (288305)
1/*
2 * Copyright 2001 The Aerospace Corporation. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
1/*
2 * Copyright 2001 The Aerospace Corporation. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: head/sbin/ifconfig/ifieee80211.c 246505 2013-02-07 21:23:03Z monthadar $
27 * $FreeBSD: head/sbin/ifconfig/ifieee80211.c 288305 2015-09-27 07:51:18Z ngie $
28 */
29
30/*-
31 * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
32 * All rights reserved.
33 *
34 * This code is derived from software contributed to The NetBSD Foundation
35 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,

--- 2815 unchanged lines hidden (view full) ---

2851#define BE_READ_2(p) \
2852 ((u_int16_t) \
2853 ((((const u_int8_t *)(p))[1] ) | \
2854 (((const u_int8_t *)(p))[0] << 8)))
2855
2856static void
2857printwpsie(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
2858{
28 */
29
30/*-
31 * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
32 * All rights reserved.
33 *
34 * This code is derived from software contributed to The NetBSD Foundation
35 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,

--- 2815 unchanged lines hidden (view full) ---

2851#define BE_READ_2(p) \
2852 ((u_int16_t) \
2853 ((((const u_int8_t *)(p))[1] ) | \
2854 (((const u_int8_t *)(p))[0] << 8)))
2855
2856static void
2857printwpsie(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
2858{
2859#define N(a) (sizeof(a) / sizeof(a[0]))
2860 u_int8_t len = ie[1];
2861
2862 printf("%s", tag);
2863 if (verbose) {
2864 static const char *dev_pass_id[] = {
2865 "D", /* Default (PIN) */
2866 "U", /* User-specified */
2867 "M", /* Machine-specified */

--- 24 unchanged lines hidden (view full) ---

2892 else
2893 printf(" st:%s", *ie == 1 ? "N" : "C");
2894 break;
2895 case IEEE80211_WPS_SELECTED_REG:
2896 printf(" sel:%s", *ie ? "T" : "F");
2897 break;
2898 case IEEE80211_WPS_DEV_PASS_ID:
2899 n = LE_READ_2(ie);
2859 u_int8_t len = ie[1];
2860
2861 printf("%s", tag);
2862 if (verbose) {
2863 static const char *dev_pass_id[] = {
2864 "D", /* Default (PIN) */
2865 "U", /* User-specified */
2866 "M", /* Machine-specified */

--- 24 unchanged lines hidden (view full) ---

2891 else
2892 printf(" st:%s", *ie == 1 ? "N" : "C");
2893 break;
2894 case IEEE80211_WPS_SELECTED_REG:
2895 printf(" sel:%s", *ie ? "T" : "F");
2896 break;
2897 case IEEE80211_WPS_DEV_PASS_ID:
2898 n = LE_READ_2(ie);
2900 if (n < N(dev_pass_id))
2899 if (n < nitems(dev_pass_id))
2901 printf(" dpi:%s", dev_pass_id[n]);
2902 break;
2903 case IEEE80211_WPS_UUID_E:
2904 printf(" uuid-e:");
2905 for (n = 0; n < (tlv_len - 1); n++)
2906 printf("%02x-", ie[n]);
2907 printf("%02x", ie[n]);
2908 break;
2909 }
2910 ie += tlv_len, len -= tlv_len;
2911 }
2912 printf(">");
2913 }
2900 printf(" dpi:%s", dev_pass_id[n]);
2901 break;
2902 case IEEE80211_WPS_UUID_E:
2903 printf(" uuid-e:");
2904 for (n = 0; n < (tlv_len - 1); n++)
2905 printf("%02x-", ie[n]);
2906 printf("%02x", ie[n]);
2907 break;
2908 }
2909 ie += tlv_len, len -= tlv_len;
2910 }
2911 printf(">");
2912 }
2914#undef N
2915}
2916
2917static void
2918printtdmaie(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
2919{
2920 printf("%s", tag);
2921 if (verbose && ielen >= sizeof(struct ieee80211_tdma_param)) {
2922 const struct ieee80211_tdma_param *tdma =

--- 490 unchanged lines hidden (view full) ---

3413 printf("\n");
3414 cp += si->isi_len, len -= si->isi_len;
3415 } while (len >= sizeof(struct ieee80211req_sta_info));
3416}
3417
3418static const char *
3419mesh_linkstate_string(uint8_t state)
3420{
2913}
2914
2915static void
2916printtdmaie(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
2917{
2918 printf("%s", tag);
2919 if (verbose && ielen >= sizeof(struct ieee80211_tdma_param)) {
2920 const struct ieee80211_tdma_param *tdma =

--- 490 unchanged lines hidden (view full) ---

3411 printf("\n");
3412 cp += si->isi_len, len -= si->isi_len;
3413 } while (len >= sizeof(struct ieee80211req_sta_info));
3414}
3415
3416static const char *
3417mesh_linkstate_string(uint8_t state)
3418{
3421#define N(a) (sizeof(a) / sizeof(a[0]))
3422 static const char *state_names[] = {
3423 [0] = "IDLE",
3424 [1] = "OPEN-TX",
3425 [2] = "OPEN-RX",
3426 [3] = "CONF-RX",
3427 [4] = "ESTAB",
3428 [5] = "HOLDING",
3429 };
3430
3419 static const char *state_names[] = {
3420 [0] = "IDLE",
3421 [1] = "OPEN-TX",
3422 [2] = "OPEN-RX",
3423 [3] = "CONF-RX",
3424 [4] = "ESTAB",
3425 [5] = "HOLDING",
3426 };
3427
3431 if (state >= N(state_names)) {
3428 if (state >= nitems(state_names)) {
3432 static char buf[10];
3433 snprintf(buf, sizeof(buf), "#%u", state);
3434 return buf;
3435 } else
3436 return state_names[state];
3429 static char buf[10];
3430 snprintf(buf, sizeof(buf), "#%u", state);
3431 return buf;
3432 } else
3433 return state_names[state];
3437#undef N
3438}
3439
3440static const char *
3441get_chaninfo(const struct ieee80211_channel *c, int precise,
3442 char buf[], size_t bsize)
3443{
3444 buf[0] = '\0';
3445 if (IEEE80211_IS_CHAN_FHSS(c))

--- 1869 unchanged lines hidden (view full) ---

5315 .af_name = "af_ieee80211",
5316 .af_af = AF_UNSPEC,
5317 .af_other_status = ieee80211_status,
5318};
5319
5320static __constructor void
5321ieee80211_ctor(void)
5322{
3434}
3435
3436static const char *
3437get_chaninfo(const struct ieee80211_channel *c, int precise,
3438 char buf[], size_t bsize)
3439{
3440 buf[0] = '\0';
3441 if (IEEE80211_IS_CHAN_FHSS(c))

--- 1869 unchanged lines hidden (view full) ---

5311 .af_name = "af_ieee80211",
5312 .af_af = AF_UNSPEC,
5313 .af_other_status = ieee80211_status,
5314};
5315
5316static __constructor void
5317ieee80211_ctor(void)
5318{
5323#define N(a) (sizeof(a) / sizeof(a[0]))
5324 int i;
5325
5319 int i;
5320
5326 for (i = 0; i < N(ieee80211_cmds); i++)
5321 for (i = 0; i < nitems(ieee80211_cmds); i++)
5327 cmd_register(&ieee80211_cmds[i]);
5328 af_register(&af_ieee80211);
5329 clone_setdefcallback("wlan", wlan_create);
5322 cmd_register(&ieee80211_cmds[i]);
5323 af_register(&af_ieee80211);
5324 clone_setdefcallback("wlan", wlan_create);
5330#undef N
5331}
5325}