nl80211: Allow AP mode to be started without monitor interface

This is in preparation for supporting AP mode with SME/MLME in the
driver/firmware.
This commit is contained in:
Jouni Malinen 2011-06-28 21:59:44 +03:00 committed by Jouni Malinen
parent 7a2b53b4ef
commit 866af8b6bd

View file

@ -157,6 +157,7 @@ struct wpa_driver_nl80211_data {
int monitor_sock; int monitor_sock;
int monitor_ifidx; int monitor_ifidx;
int no_monitor_iface_capab;
int disable_11b_rates; int disable_11b_rates;
unsigned int pending_remain_on_chan:1; unsigned int pending_remain_on_chan:1;
@ -3635,6 +3636,12 @@ static int wpa_driver_nl80211_send_frame(struct wpa_driver_nl80211_data *drv,
if (encrypt) if (encrypt)
rtap_hdr[8] |= IEEE80211_RADIOTAP_F_WEP; rtap_hdr[8] |= IEEE80211_RADIOTAP_F_WEP;
if (drv->monitor_sock < 0) {
wpa_printf(MSG_DEBUG, "nl80211: No monitor socket available "
"for %s", __func__);
return -1;
}
res = sendmsg(drv->monitor_sock, &msg, 0); res = sendmsg(drv->monitor_sock, &msg, 0);
if (res < 0) { if (res < 0) {
wpa_printf(MSG_INFO, "nl80211: sendmsg: %s", strerror(errno)); wpa_printf(MSG_INFO, "nl80211: sendmsg: %s", strerror(errno));
@ -4273,6 +4280,12 @@ nl80211_create_monitor_interface(struct wpa_driver_nl80211_data *drv)
nl80211_create_iface(drv, buf, NL80211_IFTYPE_MONITOR, NULL, nl80211_create_iface(drv, buf, NL80211_IFTYPE_MONITOR, NULL,
0); 0);
if (drv->monitor_ifidx == -EOPNOTSUPP) {
wpa_printf(MSG_DEBUG, "nl80211: Driver does not support "
"monitor interface type - try to run without it");
drv->no_monitor_iface_capab = 1;
}
if (drv->monitor_ifidx < 0) if (drv->monitor_ifidx < 0)
return -1; return -1;
@ -4971,8 +4984,9 @@ static int wpa_driver_nl80211_set_mode(void *priv, int mode)
done: done:
if (!ret && nlmode == NL80211_IFTYPE_AP) { if (!ret && nlmode == NL80211_IFTYPE_AP) {
/* Setup additional AP mode functionality if needed */ /* Setup additional AP mode functionality if needed */
if (drv->monitor_ifidx < 0 && if (!drv->no_monitor_iface_capab && drv->monitor_ifidx < 0 &&
nl80211_create_monitor_interface(drv)) nl80211_create_monitor_interface(drv) &&
!drv->no_monitor_iface_capab)
return -1; return -1;
} else if (!ret && nlmode != NL80211_IFTYPE_AP) { } else if (!ret && nlmode != NL80211_IFTYPE_AP) {
/* Remove additional AP mode functionality */ /* Remove additional AP mode functionality */