Search Linux Wireless

Re: [RFC] cfg80211: Android P2P-Device workaround

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Johannes,

> Android requires a "p2p0" netdev to exist for P2P Device
> functionality, and will even set it "UP" to start the P2P
> Device functionality.
> 
> This is a hack to provide it so not only is Android happy
> but also the current version of wpa_supplicant can work
> with P2P-Device functionality without needing changes to
> support the P2P-Device commands, just a little bit to not
> attempt to change the interface type to station.
> 
> Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx>
> ---
> net/wireless/Kconfig   |   7 +++
> net/wireless/Makefile  |   1 +
> net/wireless/android.c | 148 +++++++++++++++++++++++++++++++++++++++++++++++++
> net/wireless/core.c    |  15 ++++-
> net/wireless/core.h    |   7 +++
> net/wireless/nl80211.c |  28 +++++++++-
> 6 files changed, 204 insertions(+), 2 deletions(-)
> create mode 100644 net/wireless/android.c
> 
> diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig
> index 16d08b3..7c2981c 100644
> --- a/net/wireless/Kconfig
> +++ b/net/wireless/Kconfig
> @@ -139,6 +139,13 @@ config CFG80211_WEXT
> 	  Enable this option if you need old userspace for wireless
> 	  extensions with cfg80211-based drivers.
> 
> +config CFG80211_ANDROID_P2P_HACK
> +	bool "Android P2P netdevice hack"
> +	depends on CFG80211
> +	depends on !CFG80211_WEXT
> +	help
> +	  Enable this option for Android P2P w/ P2P Device.
> +

do you really think this is a good idea? Wouldn't it be better if Android just gets its userspace fixed. This way, they never will and you carry this workaround forever.

Has anybody actually looked into what it would take to just fix Android userspace to use nl80211 to bring up P2P. I just see tons of #ifdef added to the kernel.

<snip>

> @@ -8362,7 +8383,12 @@ static int nl80211_pre_doit(struct genl_ops *ops, struct sk_buff *skb,
> 		rdev = wiphy_to_dev(wdev->wiphy);
> 
> 		if (ops->internal_flags & NL80211_FLAG_NEED_NETDEV) {
> -			if (!dev) {
> +			if (!dev
> +#ifdef CONFIG_CFG80211_ANDROID_P2P_HACK
> +			    || (wdev->iftype == NL80211_IFTYPE_P2P_DEVICE &&
> +				info->genlhdr->cmd != NL80211_CMD_SET_INTERFACE)
> +#endif
> +			) {
> 				mutex_unlock(&cfg80211_mutex);
> 				if (rtnl)
> 					rtnl_unlock();

And doing an #ifdef in the middle of if-clause doesn't ring any alarm bells that this might be a really bad idea ;)

When I am looking at the USB gadget handling, I see a lot of progress in establishing a standard kernel interface and changing Android userspace to work with that instead.

Regards

Marcel

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux