Deleted Added
full compact
ifieee80211.c (299264) ifieee80211.c (299873)
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 299264 2016-05-09 16:15:52Z avos $
27 * $FreeBSD: head/sbin/ifconfig/ifieee80211.c 299873 2016-05-16 00:25:24Z truckman $
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,

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

3361 int sroute;
3362
3363 sroute = socket(PF_ROUTE, SOCK_RAW, 0);
3364 if (sroute < 0) {
3365 perror("socket(PF_ROUTE,SOCK_RAW)");
3366 return;
3367 }
3368 (void) memset(&ireq, 0, sizeof(ireq));
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,

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

3361 int sroute;
3362
3363 sroute = socket(PF_ROUTE, SOCK_RAW, 0);
3364 if (sroute < 0) {
3365 perror("socket(PF_ROUTE,SOCK_RAW)");
3366 return;
3367 }
3368 (void) memset(&ireq, 0, sizeof(ireq));
3369 (void) strncpy(ireq.i_name, name, sizeof(ireq.i_name));
3369 (void) strlcpy(ireq.i_name, name, sizeof(ireq.i_name));
3370 ireq.i_type = IEEE80211_IOC_SCAN_REQ;
3371
3372 memset(&sr, 0, sizeof(sr));
3373 sr.sr_flags = IEEE80211_IOC_SCAN_ACTIVE
3374 | IEEE80211_IOC_SCAN_BGSCAN
3375 | IEEE80211_IOC_SCAN_NOPICK
3376 | IEEE80211_IOC_SCAN_ONCE;
3377 sr.sr_duration = IEEE80211_IOC_SCAN_FOREVER;

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

3827}
3828
3829static int
3830get80211wme(int s, int param, int ac, int *val)
3831{
3832 struct ieee80211req ireq;
3833
3834 (void) memset(&ireq, 0, sizeof(ireq));
3370 ireq.i_type = IEEE80211_IOC_SCAN_REQ;
3371
3372 memset(&sr, 0, sizeof(sr));
3373 sr.sr_flags = IEEE80211_IOC_SCAN_ACTIVE
3374 | IEEE80211_IOC_SCAN_BGSCAN
3375 | IEEE80211_IOC_SCAN_NOPICK
3376 | IEEE80211_IOC_SCAN_ONCE;
3377 sr.sr_duration = IEEE80211_IOC_SCAN_FOREVER;

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

3827}
3828
3829static int
3830get80211wme(int s, int param, int ac, int *val)
3831{
3832 struct ieee80211req ireq;
3833
3834 (void) memset(&ireq, 0, sizeof(ireq));
3835 (void) strncpy(ireq.i_name, name, sizeof(ireq.i_name));
3835 (void) strlcpy(ireq.i_name, name, sizeof(ireq.i_name));
3836 ireq.i_type = param;
3837 ireq.i_len = ac;
3838 if (ioctl(s, SIOCG80211, &ireq) < 0) {
3839 warn("cannot get WME parameter %d, ac %d%s",
3840 param, ac & IEEE80211_WMEPARAM_VAL,
3841 ac & IEEE80211_WMEPARAM_BSS ? " (BSS)" : "");
3842 return -1;
3843 }

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

4008{
4009 struct ieee80211req ireq;
4010 struct ieee80211req_maclist *acllist;
4011 int i, nacls, policy, len;
4012 uint8_t *data;
4013 char c;
4014
4015 (void) memset(&ireq, 0, sizeof(ireq));
3836 ireq.i_type = param;
3837 ireq.i_len = ac;
3838 if (ioctl(s, SIOCG80211, &ireq) < 0) {
3839 warn("cannot get WME parameter %d, ac %d%s",
3840 param, ac & IEEE80211_WMEPARAM_VAL,
3841 ac & IEEE80211_WMEPARAM_BSS ? " (BSS)" : "");
3842 return -1;
3843 }

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

4008{
4009 struct ieee80211req ireq;
4010 struct ieee80211req_maclist *acllist;
4011 int i, nacls, policy, len;
4012 uint8_t *data;
4013 char c;
4014
4015 (void) memset(&ireq, 0, sizeof(ireq));
4016 (void) strncpy(ireq.i_name, name, sizeof(ireq.i_name)); /* XXX ?? */
4016 (void) strlcpy(ireq.i_name, name, sizeof(ireq.i_name)); /* XXX ?? */
4017 ireq.i_type = IEEE80211_IOC_MACCMD;
4018 ireq.i_val = IEEE80211_MACCMD_POLICY;
4019 if (ioctl(s, SIOCG80211, &ireq) < 0) {
4020 if (errno == EINVAL) {
4021 printf("No acl policy loaded\n");
4022 return;
4023 }
4024 err(1, "unable to get mac policy");

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

4114static void
4115list_mesh(int s)
4116{
4117 struct ieee80211req ireq;
4118 struct ieee80211req_mesh_route routes[128];
4119 struct ieee80211req_mesh_route *rt;
4120
4121 (void) memset(&ireq, 0, sizeof(ireq));
4017 ireq.i_type = IEEE80211_IOC_MACCMD;
4018 ireq.i_val = IEEE80211_MACCMD_POLICY;
4019 if (ioctl(s, SIOCG80211, &ireq) < 0) {
4020 if (errno == EINVAL) {
4021 printf("No acl policy loaded\n");
4022 return;
4023 }
4024 err(1, "unable to get mac policy");

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

4114static void
4115list_mesh(int s)
4116{
4117 struct ieee80211req ireq;
4118 struct ieee80211req_mesh_route routes[128];
4119 struct ieee80211req_mesh_route *rt;
4120
4121 (void) memset(&ireq, 0, sizeof(ireq));
4122 (void) strncpy(ireq.i_name, name, sizeof(ireq.i_name));
4122 (void) strlcpy(ireq.i_name, name, sizeof(ireq.i_name));
4123 ireq.i_type = IEEE80211_IOC_MESH_RTCMD;
4124 ireq.i_val = IEEE80211_MESH_RTCMD_LIST;
4125 ireq.i_data = &routes;
4126 ireq.i_len = sizeof(routes);
4127 if (ioctl(s, SIOCG80211, &ireq) < 0)
4128 err(1, "unable to get the Mesh routing table");
4129
4130 printf("%-17.17s %-17.17s %4s %4s %4s %6s %s\n"

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

4196}
4197
4198static enum ieee80211_opmode
4199get80211opmode(int s)
4200{
4201 struct ifmediareq ifmr;
4202
4203 (void) memset(&ifmr, 0, sizeof(ifmr));
4123 ireq.i_type = IEEE80211_IOC_MESH_RTCMD;
4124 ireq.i_val = IEEE80211_MESH_RTCMD_LIST;
4125 ireq.i_data = &routes;
4126 ireq.i_len = sizeof(routes);
4127 if (ioctl(s, SIOCG80211, &ireq) < 0)
4128 err(1, "unable to get the Mesh routing table");
4129
4130 printf("%-17.17s %-17.17s %4s %4s %4s %6s %s\n"

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

4196}
4197
4198static enum ieee80211_opmode
4199get80211opmode(int s)
4200{
4201 struct ifmediareq ifmr;
4202
4203 (void) memset(&ifmr, 0, sizeof(ifmr));
4204 (void) strncpy(ifmr.ifm_name, name, sizeof(ifmr.ifm_name));
4204 (void) strlcpy(ifmr.ifm_name, name, sizeof(ifmr.ifm_name));
4205
4206 if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) >= 0) {
4207 if (ifmr.ifm_current & IFM_IEEE80211_ADHOC) {
4208 if (ifmr.ifm_current & IFM_FLAG0)
4209 return IEEE80211_M_AHDEMO;
4210 else
4211 return IEEE80211_M_IBSS;
4212 }

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

4342}
4343
4344static int
4345getid(int s, int ix, void *data, size_t len, int *plen, int mesh)
4346{
4347 struct ieee80211req ireq;
4348
4349 (void) memset(&ireq, 0, sizeof(ireq));
4205
4206 if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) >= 0) {
4207 if (ifmr.ifm_current & IFM_IEEE80211_ADHOC) {
4208 if (ifmr.ifm_current & IFM_FLAG0)
4209 return IEEE80211_M_AHDEMO;
4210 else
4211 return IEEE80211_M_IBSS;
4212 }

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

4342}
4343
4344static int
4345getid(int s, int ix, void *data, size_t len, int *plen, int mesh)
4346{
4347 struct ieee80211req ireq;
4348
4349 (void) memset(&ireq, 0, sizeof(ireq));
4350 (void) strncpy(ireq.i_name, name, sizeof(ireq.i_name));
4350 (void) strlcpy(ireq.i_name, name, sizeof(ireq.i_name));
4351 ireq.i_type = (!mesh) ? IEEE80211_IOC_SSID : IEEE80211_IOC_MESH_ID;
4352 ireq.i_val = ix;
4353 ireq.i_data = data;
4354 ireq.i_len = len;
4355 if (ioctl(s, SIOCG80211, &ireq) < 0)
4356 return -1;
4357 *plen = ireq.i_len;
4358 return 0;

--- 1090 unchanged lines hidden ---
4351 ireq.i_type = (!mesh) ? IEEE80211_IOC_SSID : IEEE80211_IOC_MESH_ID;
4352 ireq.i_val = ix;
4353 ireq.i_data = data;
4354 ireq.i_len = len;
4355 if (ioctl(s, SIOCG80211, &ireq) < 0)
4356 return -1;
4357 *plen = ireq.i_len;
4358 return 0;

--- 1090 unchanged lines hidden ---