[PATCH] nl80211: Do not assume the device is rf-killed before trying to set it up

Tomasz Bursztyka tomasz.bursztyka
Mon Apr 28 00:36:01 PDT 2014


Hi Ilan,

>> +		} else {
>> +			wpa_printf(MSG_ERROR, "nl80211: Could not %s "
>> +				   "interface '%s' UP",
>> +				   nlmode == NL80211_IFTYPE_P2P_DEVICE ?
>> +				   "start P2P" : "set", bss->ifname);
>> +			return -1;
> Can use "return ret;"

No need to, actually there is only one time the return code of 
wpa_driver_nl80211_finish_drv_init() is checked
to be different than 0 and that's it. The ret variable is only used for 
the part below on which you have a comment.

>
>>   		}
>> -		if (nlmode == NL80211_IFTYPE_P2P_DEVICE)
>> -			return ret;
>> -	} else {
>> -		wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
>> -			   "interface '%s' due to rfkill", bss->ifname);
>> -		if (nlmode == NL80211_IFTYPE_P2P_DEVICE)
>> -			return 0;
>> -		drv->if_disabled = 1;
>> -		send_rfkill_event = 1;
>> +	}
>> +
>> +	if (nlmode == NL80211_IFTYPE_P2P_DEVICE) {
>> +		nl80211_get_macaddr(bss);
>> +		return ret;
> Returning here is problematic as the wpa_driver_nl80211_send_rfkill() will not be called, and the INTERFACE_DISABLED event will not be fired.
>

That logic was present before my patch and before Moshe's one.

So you mean we can continue here? Then there would be no need of ret 
variable at all.

Tomasz



More information about the Hostap mailing list