ieee80211_ioctl.c (218092) | ieee80211_ioctl.c (223145) |
---|---|
1/*- 2 * Copyright (c) 2001 Atsushi Onoe 3 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001 Atsushi Onoe 3 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_ioctl.c 218092 2011-01-30 14:05:21Z bschmidt $"); | 28__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_ioctl.c 223145 2011-06-16 09:37:20Z kevlo $"); |
29 30/* 31 * IEEE 802.11 ioctl support (FreeBSD-specific) 32 */ 33 34#include "opt_inet.h" 35#include "opt_ipx.h" 36#include "opt_wlan.h" --- 101 unchanged lines hidden (view full) --- 138 ireq->i_len = sizeof(ic->ic_chan_active); 139 return copyout(&ic->ic_chan_active, ireq->i_data, ireq->i_len); 140} 141 142static __noinline int 143ieee80211_ioctl_getchaninfo(struct ieee80211vap *vap, struct ieee80211req *ireq) 144{ 145 struct ieee80211com *ic = vap->iv_ic; | 29 30/* 31 * IEEE 802.11 ioctl support (FreeBSD-specific) 32 */ 33 34#include "opt_inet.h" 35#include "opt_ipx.h" 36#include "opt_wlan.h" --- 101 unchanged lines hidden (view full) --- 138 ireq->i_len = sizeof(ic->ic_chan_active); 139 return copyout(&ic->ic_chan_active, ireq->i_data, ireq->i_len); 140} 141 142static __noinline int 143ieee80211_ioctl_getchaninfo(struct ieee80211vap *vap, struct ieee80211req *ireq) 144{ 145 struct ieee80211com *ic = vap->iv_ic; |
146 int space; | 146 uint32_t space; |
147 148 space = __offsetof(struct ieee80211req_chaninfo, 149 ic_chans[ic->ic_nchans]); 150 if (space > ireq->i_len) 151 space = ireq->i_len; 152 /* XXX assumes compatible layout */ 153 return copyout(&ic->ic_nchans, ireq->i_data, space); 154} --- 47 unchanged lines hidden (view full) --- 202 return copyout(&wpaie, ireq->i_data, ireq->i_len); 203} 204 205static __noinline int 206ieee80211_ioctl_getstastats(struct ieee80211vap *vap, struct ieee80211req *ireq) 207{ 208 struct ieee80211_node *ni; 209 uint8_t macaddr[IEEE80211_ADDR_LEN]; | 147 148 space = __offsetof(struct ieee80211req_chaninfo, 149 ic_chans[ic->ic_nchans]); 150 if (space > ireq->i_len) 151 space = ireq->i_len; 152 /* XXX assumes compatible layout */ 153 return copyout(&ic->ic_nchans, ireq->i_data, space); 154} --- 47 unchanged lines hidden (view full) --- 202 return copyout(&wpaie, ireq->i_data, ireq->i_len); 203} 204 205static __noinline int 206ieee80211_ioctl_getstastats(struct ieee80211vap *vap, struct ieee80211req *ireq) 207{ 208 struct ieee80211_node *ni; 209 uint8_t macaddr[IEEE80211_ADDR_LEN]; |
210 const int off = __offsetof(struct ieee80211req_sta_stats, is_stats); | 210 const size_t off = __offsetof(struct ieee80211req_sta_stats, is_stats); |
211 int error; 212 213 if (ireq->i_len < off) 214 return EINVAL; 215 error = copyin(ireq->i_data, macaddr, IEEE80211_ADDR_LEN); 216 if (error != 0) 217 return error; 218 ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap, macaddr); --- 99 unchanged lines hidden (view full) --- 318 return EFAULT; 319 320 error = 0; 321 req.space = 0; 322 ieee80211_scan_iterate(vap, get_scan_space, &req); 323 if (req.space > ireq->i_len) 324 req.space = ireq->i_len; 325 if (req.space > 0) { | 211 int error; 212 213 if (ireq->i_len < off) 214 return EINVAL; 215 error = copyin(ireq->i_data, macaddr, IEEE80211_ADDR_LEN); 216 if (error != 0) 217 return error; 218 ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap, macaddr); --- 99 unchanged lines hidden (view full) --- 318 return EFAULT; 319 320 error = 0; 321 req.space = 0; 322 ieee80211_scan_iterate(vap, get_scan_space, &req); 323 if (req.space > ireq->i_len) 324 req.space = ireq->i_len; 325 if (req.space > 0) { |
326 size_t space; | 326 uint32_t space; |
327 void *p; 328 329 space = req.space; 330 /* XXX M_WAITOK after driver lock released */ 331 p = malloc(space, M_TEMP, M_NOWAIT | M_ZERO); 332 if (p == NULL) 333 return ENOMEM; 334 req.sr = p; --- 118 unchanged lines hidden (view full) --- 453 } 454 455 req->si = (struct ieee80211req_sta_info *)(((uint8_t *)si) + len); 456 req->space -= len; 457} 458 459static __noinline int 460getstainfo_common(struct ieee80211vap *vap, struct ieee80211req *ireq, | 327 void *p; 328 329 space = req.space; 330 /* XXX M_WAITOK after driver lock released */ 331 p = malloc(space, M_TEMP, M_NOWAIT | M_ZERO); 332 if (p == NULL) 333 return ENOMEM; 334 req.sr = p; --- 118 unchanged lines hidden (view full) --- 453 } 454 455 req->si = (struct ieee80211req_sta_info *)(((uint8_t *)si) + len); 456 req->space -= len; 457} 458 459static __noinline int 460getstainfo_common(struct ieee80211vap *vap, struct ieee80211req *ireq, |
461 struct ieee80211_node *ni, int off) | 461 struct ieee80211_node *ni, size_t off) |
462{ 463 struct ieee80211com *ic = vap->iv_ic; 464 struct stainforeq req; 465 size_t space; 466 void *p; 467 int error; 468 469 error = 0; --- 28 unchanged lines hidden (view full) --- 498 ieee80211_free_node(ni); 499 return error; 500} 501 502static __noinline int 503ieee80211_ioctl_getstainfo(struct ieee80211vap *vap, struct ieee80211req *ireq) 504{ 505 uint8_t macaddr[IEEE80211_ADDR_LEN]; | 462{ 463 struct ieee80211com *ic = vap->iv_ic; 464 struct stainforeq req; 465 size_t space; 466 void *p; 467 int error; 468 469 error = 0; --- 28 unchanged lines hidden (view full) --- 498 ieee80211_free_node(ni); 499 return error; 500} 501 502static __noinline int 503ieee80211_ioctl_getstainfo(struct ieee80211vap *vap, struct ieee80211req *ireq) 504{ 505 uint8_t macaddr[IEEE80211_ADDR_LEN]; |
506 const int off = __offsetof(struct ieee80211req_sta_req, info); | 506 const size_t off = __offsetof(struct ieee80211req_sta_req, info); |
507 struct ieee80211_node *ni; 508 int error; 509 510 if (ireq->i_len < sizeof(struct ieee80211req_sta_req)) 511 return EFAULT; 512 error = copyin(ireq->i_data, macaddr, IEEE80211_ADDR_LEN); 513 if (error != 0) 514 return error; --- 2881 unchanged lines hidden --- | 507 struct ieee80211_node *ni; 508 int error; 509 510 if (ireq->i_len < sizeof(struct ieee80211req_sta_req)) 511 return EFAULT; 512 error = copyin(ireq->i_data, macaddr, IEEE80211_ADDR_LEN); 513 if (error != 0) 514 return error; --- 2881 unchanged lines hidden --- |