Changeset View
Changeset View
Standalone View
Standalone View
sys/net80211/ieee80211_ioctl.c
Show First 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | if (kid == IEEE80211_KEYIX_NONE) { | ||||
ni = NULL; | ni = NULL; | ||||
} | } | ||||
cip = wk->wk_cipher; | cip = wk->wk_cipher; | ||||
ik.ik_type = cip->ic_cipher; | ik.ik_type = cip->ic_cipher; | ||||
ik.ik_keylen = wk->wk_keylen; | ik.ik_keylen = wk->wk_keylen; | ||||
ik.ik_flags = wk->wk_flags & (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV); | ik.ik_flags = wk->wk_flags & (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV); | ||||
if (wk->wk_keyix == vap->iv_def_txkey) | if (wk->wk_keyix == vap->iv_def_txkey) | ||||
ik.ik_flags |= IEEE80211_KEY_DEFAULT; | ik.ik_flags |= IEEE80211_KEY_DEFAULT; | ||||
if (priv_check(curthread, PRIV_NET80211_GETKEY) == 0) { | /* XXX TODO: move priv check to ieee80211_freebsd.c */ | ||||
if (priv_check(curthread, PRIV_NET80211_VAP_GETKEY) == 0) { | |||||
/* NB: only root can read key data */ | /* NB: only root can read key data */ | ||||
ik.ik_keyrsc = wk->wk_keyrsc[IEEE80211_NONQOS_TID]; | ik.ik_keyrsc = wk->wk_keyrsc[IEEE80211_NONQOS_TID]; | ||||
ik.ik_keytsc = wk->wk_keytsc; | ik.ik_keytsc = wk->wk_keytsc; | ||||
memcpy(ik.ik_keydata, wk->wk_key, wk->wk_keylen); | memcpy(ik.ik_keydata, wk->wk_key, wk->wk_keylen); | ||||
if (cip->ic_cipher == IEEE80211_CIPHER_TKIP) { | if (cip->ic_cipher == IEEE80211_CIPHER_TKIP) { | ||||
memcpy(ik.ik_keydata+wk->wk_keylen, | memcpy(ik.ik_keydata+wk->wk_keylen, | ||||
wk->wk_key + IEEE80211_KEYBUF_SIZE, | wk->wk_key + IEEE80211_KEYBUF_SIZE, | ||||
IEEE80211_MICBUF_SIZE); | IEEE80211_MICBUF_SIZE); | ||||
▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
size_t len; | size_t len; | ||||
*ielen = se->se_ies.len; | *ielen = se->se_ies.len; | ||||
/* | /* | ||||
* NB: ie's can be no more than 255 bytes and the max 802.11 | * NB: ie's can be no more than 255 bytes and the max 802.11 | ||||
* packet is <3Kbytes so we are sure this doesn't overflow | * packet is <3Kbytes so we are sure this doesn't overflow | ||||
* 16-bits; if this is a concern we can drop the ie's. | * 16-bits; if this is a concern we can drop the ie's. | ||||
* | |||||
* XXX TODO: should really double check this! | |||||
bz: This seems unrelated noise and should not be part of that commit. | |||||
adrianAuthorUnsubmitted Done Inline ActionsYeah, this is a left-over from other work in this tree. adrian: Yeah, this is a left-over from other work in this tree. | |||||
*/ | */ | ||||
len = sizeof(struct ieee80211req_scan_result) + se->se_ssid[1] + | len = sizeof(struct ieee80211req_scan_result) + se->se_ssid[1] + | ||||
se->se_meshid[1] + *ielen; | se->se_meshid[1] + *ielen; | ||||
return roundup(len, sizeof(uint32_t)); | return roundup(len, sizeof(uint32_t)); | ||||
} | } | ||||
static void | static void | ||||
get_scan_space(void *arg, const struct ieee80211_scan_entry *se) | get_scan_space(void *arg, const struct ieee80211_scan_entry *se) | ||||
▲ Show 20 Lines • Show All 552 Lines • ▼ Show 20 Lines | else | ||||
ireq->i_val = IEEE80211_WEP_MIXED; | ireq->i_val = IEEE80211_WEP_MIXED; | ||||
break; | break; | ||||
case IEEE80211_IOC_WEPKEY: | case IEEE80211_IOC_WEPKEY: | ||||
kid = (u_int) ireq->i_val; | kid = (u_int) ireq->i_val; | ||||
if (kid >= IEEE80211_WEP_NKID) | if (kid >= IEEE80211_WEP_NKID) | ||||
return EINVAL; | return EINVAL; | ||||
len = (u_int) vap->iv_nw_keys[kid].wk_keylen; | len = (u_int) vap->iv_nw_keys[kid].wk_keylen; | ||||
/* NB: only root can read WEP keys */ | /* NB: only root can read WEP keys */ | ||||
if (priv_check(curthread, PRIV_NET80211_GETKEY) == 0) { | /* XXX TODO: move priv check to ieee80211_freebsd.c */ | ||||
if (priv_check(curthread, PRIV_NET80211_VAP_GETKEY) == 0) { | |||||
bcopy(vap->iv_nw_keys[kid].wk_key, tmpkey, len); | bcopy(vap->iv_nw_keys[kid].wk_key, tmpkey, len); | ||||
} else { | } else { | ||||
bzero(tmpkey, len); | bzero(tmpkey, len); | ||||
} | } | ||||
ireq->i_len = len; | ireq->i_len = len; | ||||
error = copyout(tmpkey, ireq->i_data, len); | error = copyout(tmpkey, ireq->i_data, len); | ||||
break; | break; | ||||
case IEEE80211_IOC_NUMWEPKEYS: | case IEEE80211_IOC_NUMWEPKEYS: | ||||
▲ Show 20 Lines • Show All 2,804 Lines • ▼ Show 20 Lines | case SIOCGIFMEDIA: | ||||
ifr = (struct ifreq *)data; | ifr = (struct ifreq *)data; | ||||
error = ifmedia_ioctl(ifp, ifr, &vap->iv_media, cmd); | error = ifmedia_ioctl(ifp, ifr, &vap->iv_media, cmd); | ||||
break; | break; | ||||
case SIOCG80211: | case SIOCG80211: | ||||
error = ieee80211_ioctl_get80211(vap, cmd, | error = ieee80211_ioctl_get80211(vap, cmd, | ||||
(struct ieee80211req *) data); | (struct ieee80211req *) data); | ||||
break; | break; | ||||
case SIOCS80211: | case SIOCS80211: | ||||
error = priv_check(curthread, PRIV_NET80211_MANAGE); | /* XXX TODO: move priv check to ieee80211_freebsd.c */ | ||||
error = priv_check(curthread, PRIV_NET80211_VAP_MANAGE); | |||||
if (error == 0) | if (error == 0) | ||||
error = ieee80211_ioctl_set80211(vap, cmd, | error = ieee80211_ioctl_set80211(vap, cmd, | ||||
(struct ieee80211req *) data); | (struct ieee80211req *) data); | ||||
break; | break; | ||||
case SIOCG80211STATS: | case SIOCG80211STATS: | ||||
ifr = (struct ifreq *)data; | ifr = (struct ifreq *)data; | ||||
copyout(&vap->iv_stats, ifr_data_get_ptr(ifr), | copyout(&vap->iv_stats, ifr_data_get_ptr(ifr), | ||||
sizeof (vap->iv_stats)); | sizeof (vap->iv_stats)); | ||||
Show All 28 Lines | #endif | ||||
default: | default: | ||||
if ((ifp->if_flags & IFF_UP) == 0) { | if ((ifp->if_flags & IFF_UP) == 0) { | ||||
ifp->if_flags |= IFF_UP; | ifp->if_flags |= IFF_UP; | ||||
ifp->if_init(ifp->if_softc); | ifp->if_init(ifp->if_softc); | ||||
} | } | ||||
break; | break; | ||||
} | } | ||||
break; | break; | ||||
case SIOCSIFLLADDR: | |||||
/* XXX TODO: move priv check to ieee80211_freebsd.c */ | |||||
error = priv_check(curthread, PRIV_NET80211_VAP_SETMAC); | |||||
if (error == 0) | |||||
break; | |||||
/* Fallthrough */ | |||||
default: | default: | ||||
/* | /* | ||||
* Pass unknown ioctls first to the driver, and if it | * Pass unknown ioctls first to the driver, and if it | ||||
* returns ENOTTY, then to the generic Ethernet handler. | * returns ENOTTY, then to the generic Ethernet handler. | ||||
*/ | */ | ||||
if (ic->ic_ioctl != NULL && | if (ic->ic_ioctl != NULL && | ||||
(error = ic->ic_ioctl(ic, cmd, data)) != ENOTTY) | (error = ic->ic_ioctl(ic, cmd, data)) != ENOTTY) | ||||
break; | break; | ||||
Show All 9 Lines |
This seems unrelated noise and should not be part of that commit.