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 190384 2009-03-24 17:57:48Z sam $");
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"
--- 542 unchanged lines hidden (view full) ---
579static __noinline int
580ieee80211_ioctl_getmaccmd(struct ieee80211vap *vap, struct ieee80211req *ireq)
581{
582 const struct ieee80211_aclator *acl = vap->iv_acl;
583
584 return (acl == NULL ? EINVAL : acl->iac_getioctl(vap, ireq));
585}
586
587/*
588 * Return the current ``state'' of an Atheros capbility.
589 * If associated in station mode report the negotiated
590 * setting. Otherwise report the current setting.
591 */
592static int
593getathcap(struct ieee80211vap *vap, int cap)
594{
595 if (vap->iv_opmode == IEEE80211_M_STA &&
596 vap->iv_state == IEEE80211_S_RUN)
597 return IEEE80211_ATH_CAP(vap, vap->iv_bss, cap) != 0;
598 else
599 return (vap->iv_flags & cap) != 0;
600}
601
602static __noinline int
603ieee80211_ioctl_getcurchan(struct ieee80211vap *vap, struct ieee80211req *ireq)
604{
605 struct ieee80211com *ic = vap->iv_ic;
606 struct ieee80211_channel *c;
607
608 if (ireq->i_len != sizeof(struct ieee80211_channel))
609 return EINVAL;
--- 359 unchanged lines hidden (view full) ---
969 break;
970 case IEEE80211_IOC_BEACON_INTERVAL:
971 /* NB: get from ic_bss for station mode */
972 ireq->i_val = vap->iv_bss->ni_intval;
973 break;
974 case IEEE80211_IOC_PUREG:
975 ireq->i_val = (vap->iv_flags & IEEE80211_F_PUREG) != 0;
976 break;
977 case IEEE80211_IOC_FF:
978 ireq->i_val = getathcap(vap, IEEE80211_F_FF);
979 break;
980 case IEEE80211_IOC_TURBOP:
981 ireq->i_val = getathcap(vap, IEEE80211_F_TURBOP);
982 break;
983 case IEEE80211_IOC_BGSCAN:
984 ireq->i_val = (vap->iv_flags & IEEE80211_F_BGSCAN) != 0;
985 break;
986 case IEEE80211_IOC_BGSCAN_IDLE:
987 ireq->i_val = vap->iv_bgscanidle*hz/1000; /* ms */
988 break;
989 case IEEE80211_IOC_BGSCAN_INTERVAL:
990 ireq->i_val = vap->iv_bgscanintvl/hz; /* seconds */
--- 1893 unchanged lines hidden (view full) ---
2884 if (ireq->i_val)
2885 vap->iv_flags |= IEEE80211_F_PUREG;
2886 else
2887 vap->iv_flags &= ~IEEE80211_F_PUREG;
2888 /* NB: reset only if we're operating on an 11g channel */
2889 if (isvap11g(vap))
2890 error = ENETRESET;
2891 break;
2892 case IEEE80211_IOC_FF:
2893 if (ireq->i_val) {
2894 if ((vap->iv_caps & IEEE80211_C_FF) == 0)
2895 return EOPNOTSUPP;
2896 vap->iv_flags |= IEEE80211_F_FF;
2897 } else
2898 vap->iv_flags &= ~IEEE80211_F_FF;
2899 error = ERESTART;
2900 break;
2901 case IEEE80211_IOC_TURBOP:
2902 if (ireq->i_val) {
2903 if ((vap->iv_caps & IEEE80211_C_TURBOP) == 0)
2904 return EOPNOTSUPP;
2905 vap->iv_flags |= IEEE80211_F_TURBOP;
2906 } else
2907 vap->iv_flags &= ~IEEE80211_F_TURBOP;
2908 error = ENETRESET;
2909 break;
2910 case IEEE80211_IOC_BGSCAN:
2911 if (ireq->i_val) {
2912 if ((vap->iv_caps & IEEE80211_C_BGSCAN) == 0)
2913 return EOPNOTSUPP;
2914 vap->iv_flags |= IEEE80211_F_BGSCAN;
2915 } else
2916 vap->iv_flags &= ~IEEE80211_F_BGSCAN;
2917 break;
--- 454 unchanged lines hidden ---
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 190384 2009-03-24 17:57:48Z sam $");
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"
--- 542 unchanged lines hidden (view full) ---
579static __noinline int
580ieee80211_ioctl_getmaccmd(struct ieee80211vap *vap, struct ieee80211req *ireq)
581{
582 const struct ieee80211_aclator *acl = vap->iv_acl;
583
584 return (acl == NULL ? EINVAL : acl->iac_getioctl(vap, ireq));
585}
586
587/*
588 * Return the current ``state'' of an Atheros capbility.
589 * If associated in station mode report the negotiated
590 * setting. Otherwise report the current setting.
591 */
592static int
593getathcap(struct ieee80211vap *vap, int cap)
594{
595 if (vap->iv_opmode == IEEE80211_M_STA &&
596 vap->iv_state == IEEE80211_S_RUN)
597 return IEEE80211_ATH_CAP(vap, vap->iv_bss, cap) != 0;
598 else
599 return (vap->iv_flags & cap) != 0;
600}
601
602static __noinline int
603ieee80211_ioctl_getcurchan(struct ieee80211vap *vap, struct ieee80211req *ireq)
604{
605 struct ieee80211com *ic = vap->iv_ic;
606 struct ieee80211_channel *c;
607
608 if (ireq->i_len != sizeof(struct ieee80211_channel))
609 return EINVAL;
--- 359 unchanged lines hidden (view full) ---
969 break;
970 case IEEE80211_IOC_BEACON_INTERVAL:
971 /* NB: get from ic_bss for station mode */
972 ireq->i_val = vap->iv_bss->ni_intval;
973 break;
974 case IEEE80211_IOC_PUREG:
975 ireq->i_val = (vap->iv_flags & IEEE80211_F_PUREG) != 0;
976 break;
977 case IEEE80211_IOC_FF:
978 ireq->i_val = getathcap(vap, IEEE80211_F_FF);
979 break;
980 case IEEE80211_IOC_TURBOP:
981 ireq->i_val = getathcap(vap, IEEE80211_F_TURBOP);
982 break;
983 case IEEE80211_IOC_BGSCAN:
984 ireq->i_val = (vap->iv_flags & IEEE80211_F_BGSCAN) != 0;
985 break;
986 case IEEE80211_IOC_BGSCAN_IDLE:
987 ireq->i_val = vap->iv_bgscanidle*hz/1000; /* ms */
988 break;
989 case IEEE80211_IOC_BGSCAN_INTERVAL:
990 ireq->i_val = vap->iv_bgscanintvl/hz; /* seconds */
--- 1893 unchanged lines hidden (view full) ---
2884 if (ireq->i_val)
2885 vap->iv_flags |= IEEE80211_F_PUREG;
2886 else
2887 vap->iv_flags &= ~IEEE80211_F_PUREG;
2888 /* NB: reset only if we're operating on an 11g channel */
2889 if (isvap11g(vap))
2890 error = ENETRESET;
2891 break;
2892 case IEEE80211_IOC_FF:
2893 if (ireq->i_val) {
2894 if ((vap->iv_caps & IEEE80211_C_FF) == 0)
2895 return EOPNOTSUPP;
2896 vap->iv_flags |= IEEE80211_F_FF;
2897 } else
2898 vap->iv_flags &= ~IEEE80211_F_FF;
2899 error = ERESTART;
2900 break;
2901 case IEEE80211_IOC_TURBOP:
2902 if (ireq->i_val) {
2903 if ((vap->iv_caps & IEEE80211_C_TURBOP) == 0)
2904 return EOPNOTSUPP;
2905 vap->iv_flags |= IEEE80211_F_TURBOP;
2906 } else
2907 vap->iv_flags &= ~IEEE80211_F_TURBOP;
2908 error = ENETRESET;
2909 break;
2910 case IEEE80211_IOC_BGSCAN:
2911 if (ireq->i_val) {
2912 if ((vap->iv_caps & IEEE80211_C_BGSCAN) == 0)
2913 return EOPNOTSUPP;
2914 vap->iv_flags |= IEEE80211_F_BGSCAN;
2915 } else
2916 vap->iv_flags &= ~IEEE80211_F_BGSCAN;
2917 break;
--- 454 unchanged lines hidden ---