hostapd: add support for Realtek driver

Message ID 20170914110811.1670-1-alexander.i.mukhin@gmail.com
State Accepted
Headers show
Series
  • hostapd: add support for Realtek driver
Related show

Commit Message

Alexander Mukhin Sept. 14, 2017, 11:08 a.m.
Since kernel drivers for Realtek wireless chips use non-standard
interfaces, upstream hostapd does not support them. One have to apply
an external patch for hostapd to work with these chips. See:
https://github.com/pritambaral/hostapd-rtl871xdrv

A configuration option is added to enable support for Realtek chips,
and it's turned off by default.

Signed-off-by: Alexander Mukhin <alexander.i.mukhin@gmail.com>
---
 DEVELOPERS                   | 3 +++
 package/hostapd/Config.in    | 5 +++++
 package/hostapd/hostapd.hash | 1 +
 package/hostapd/hostapd.mk   | 5 +++++
 4 files changed, 14 insertions(+)

Comments

Angelo Compagnucci Nov. 3, 2017, 4:17 p.m. | #1
2017-09-14 13:08 GMT+02:00 Alexander Mukhin <alexander.i.mukhin@gmail.com>:
> Since kernel drivers for Realtek wireless chips use non-standard
> interfaces, upstream hostapd does not support them. One have to apply
> an external patch for hostapd to work with these chips. See:
> https://github.com/pritambaral/hostapd-rtl871xdrv
>
> A configuration option is added to enable support for Realtek chips,
> and it's turned off by default.
>
> Signed-off-by: Alexander Mukhin <alexander.i.mukhin@gmail.com>
> ---
>  DEVELOPERS                   | 3 +++
>  package/hostapd/Config.in    | 5 +++++
>  package/hostapd/hostapd.hash | 1 +
>  package/hostapd/hostapd.mk   | 5 +++++
>  4 files changed, 14 insertions(+)
>
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 21eafc9d2..57fc74c25 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -68,6 +68,9 @@ F:    package/putty/
>  N:     Alexander Lukichev <alexander.lukichev@espotel.com>
>  F:     package/openpgm/
>
> +N:     Alexander Mukhin <alexander.i.mukhin@gmail.com>
> +F:     package/hostapd/
> +
>  N:     Alexander Varnin <fenixk19@mail.ru>
>  F:     package/liblog4c-localtime/
>
> diff --git a/package/hostapd/Config.in b/package/hostapd/Config.in
> index 62fbb66d6..cec2a123e 100644
> --- a/package/hostapd/Config.in
> +++ b/package/hostapd/Config.in
> @@ -14,6 +14,11 @@ config BR2_PACKAGE_HOSTAPD
>
>  if BR2_PACKAGE_HOSTAPD
>
> +config BR2_PACKAGE_HOSTAPD_DRIVER_RTW
> +       bool "Enable rtl871xdrv driver"
> +       help
> +         Enable support for Realtek wireless chips.
> +
>  config BR2_PACKAGE_HOSTAPD_ACS
>         bool "Enable ACS"
>         default y
> diff --git a/package/hostapd/hostapd.hash b/package/hostapd/hostapd.hash
> index fb891476b..83bfd0e7e 100644
> --- a/package/hostapd/hostapd.hash
> +++ b/package/hostapd/hostapd.hash
> @@ -1,2 +1,3 @@
>  # Locally calculated
>  sha256  01526b90c1d23bec4b0f052039cc4456c2fd19347b4d830d1d58a0a6aea7117d  hostapd-2.6.tar.gz
> +sha256  e204da659d0583c71af23cb9b55536fe99598ee26a44104344f456e4d17350c6  rtlxdrv.patch
> diff --git a/package/hostapd/hostapd.mk b/package/hostapd/hostapd.mk
> index dc28d1323..40e28ee67 100644
> --- a/package/hostapd/hostapd.mk
> +++ b/package/hostapd/hostapd.mk
> @@ -44,6 +44,11 @@ HOSTAPD_CONFIG_DISABLE += CONFIG_EAP_PWD
>  HOSTAPD_CONFIG_EDITS += 's/\#\(CONFIG_TLS=\).*/\1internal/'
>  endif
>
> +ifeq ($(BR2_PACKAGE_HOSTAPD_DRIVER_RTW),y)
> +HOSTAPD_PATCH = https://github.com/pritambaral/hostapd-rtl871xdrv/raw/master/rtlxdrv.patch
> +HOSTAPD_CONFIG_SET += CONFIG_DRIVER_RTW
> +endif
> +
>  ifeq ($(BR2_PACKAGE_HOSTAPD_ACS),y)
>  HOSTAPD_CONFIG_ENABLE += CONFIG_ACS
>  endif
> --
> 2.11.0

Tested-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>

>
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Thomas Petazzoni Nov. 24, 2017, 8:58 p.m. | #2
Hello,

On Thu, 14 Sep 2017 14:08:11 +0300, Alexander Mukhin wrote:
> Since kernel drivers for Realtek wireless chips use non-standard
> interfaces, upstream hostapd does not support them. One have to apply
> an external patch for hostapd to work with these chips. See:
> https://github.com/pritambaral/hostapd-rtl871xdrv
> 
> A configuration option is added to enable support for Realtek chips,
> and it's turned off by default.
> 
> Signed-off-by: Alexander Mukhin <alexander.i.mukhin@gmail.com>
> ---
>  DEVELOPERS                   | 3 +++
>  package/hostapd/Config.in    | 5 +++++
>  package/hostapd/hostapd.hash | 1 +
>  package/hostapd/hostapd.mk   | 5 +++++
>  4 files changed, 14 insertions(+)

To be honest, I was about to reject your patch: it's basically adding a
feature patch to a package, which we normally don't do, and the patch
is very likely to break when we update to newer versions of hostapd.

But I saw that both Peter and Arnout had a look at the problem, and the
overall feeling is that there really isn't a better solution.

So, I've applied to next. We'll see how often it breaks hostapd (or
not).

Thanks!

Thomas
Alexander Mukhin Nov. 25, 2017, 10:32 a.m. | #3
Hello,

On Fri, Nov 24, 2017 at 09:58:28PM +0100, Thomas Petazzoni wrote:
> To be honest, I was about to reject your patch: it's basically adding a
> feature patch to a package, which we normally don't do, and the patch
> is very likely to break when we update to newer versions of hostapd.
> 
> But I saw that both Peter and Arnout had a look at the problem, and the
> overall feeling is that there really isn't a better solution.
> 
> So, I've applied to next. We'll see how often it breaks hostapd (or
> not).

My patch as it was submitted two months ago will not apply to the
current buildroot tree because of the other patches applied to hostapd
since then. I'll send the updated version.

There's no problem in rejecting the patch. One can easily get by without
it by adding local changes to external.mk:

HOSTAPD_PATCH += https://github.com/pritambaral/hostapd-rtl871xdrv/raw/master/rtlxdrv.patch
BR_NO_CHECK_HASH_FOR += rtlxdrv.patch
HOSTAPD_CONFIG_SET += CONFIG_DRIVER_RTW
Thomas Petazzoni Nov. 25, 2017, 10:46 a.m. | #4
Hello,

On Sat, 25 Nov 2017 13:32:52 +0300, Alexander Mukhin wrote:

> > So, I've applied to next. We'll see how often it breaks hostapd (or
> > not).  
> 
> My patch as it was submitted two months ago will not apply to the
> current buildroot tree because of the other patches applied to hostapd
> since then. I'll send the updated version.

I have already applied your patch. So if any fix is needed, please base
your new patch on top of the "next" branch.

But I did test the build of hostapd with the realtek driver support
applied, and it built fine for me. So I'm not sure why you say it
doesn't apply.

> There's no problem in rejecting the patch. One can easily get by without
> it by adding local changes to external.mk:
> 
> HOSTAPD_PATCH += https://github.com/pritambaral/hostapd-rtl871xdrv/raw/master/rtlxdrv.patch
> BR_NO_CHECK_HASH_FOR += rtlxdrv.patch
> HOSTAPD_CONFIG_SET += CONFIG_DRIVER_RTW

If things turn out to be too annoying because it breaks too often, we
might end up doing that. But it's obviously nicer for users if the
feature is integrated in Buildroot itself.

Best regards,

Thomas
Alexander Mukhin Nov. 25, 2017, 11:18 a.m. | #5
Hello,

On Sat, Nov 25, 2017 at 11:46:43AM +0100, Thomas Petazzoni wrote:
> I have already applied your patch. So if any fix is needed, please base
> your new patch on top of the "next" branch.

When the original patch was submitted, it was the only patch applied to
hostapd. But the recent security fixes added two more patches. So we
need to replace HOSTAPD_PATCH= with HOSTAPD_PATCH+=.

I've just sent a correction patch based on the top of the 'next' branch.

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index 21eafc9d2..57fc74c25 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -68,6 +68,9 @@  F:	package/putty/
 N:	Alexander Lukichev <alexander.lukichev@espotel.com>
 F:	package/openpgm/
 
+N:	Alexander Mukhin <alexander.i.mukhin@gmail.com>
+F:	package/hostapd/
+
 N:	Alexander Varnin <fenixk19@mail.ru>
 F:	package/liblog4c-localtime/
 
diff --git a/package/hostapd/Config.in b/package/hostapd/Config.in
index 62fbb66d6..cec2a123e 100644
--- a/package/hostapd/Config.in
+++ b/package/hostapd/Config.in
@@ -14,6 +14,11 @@  config BR2_PACKAGE_HOSTAPD
 
 if BR2_PACKAGE_HOSTAPD
 
+config BR2_PACKAGE_HOSTAPD_DRIVER_RTW
+	bool "Enable rtl871xdrv driver"
+	help
+	  Enable support for Realtek wireless chips.
+
 config BR2_PACKAGE_HOSTAPD_ACS
 	bool "Enable ACS"
 	default y
diff --git a/package/hostapd/hostapd.hash b/package/hostapd/hostapd.hash
index fb891476b..83bfd0e7e 100644
--- a/package/hostapd/hostapd.hash
+++ b/package/hostapd/hostapd.hash
@@ -1,2 +1,3 @@ 
 # Locally calculated
 sha256  01526b90c1d23bec4b0f052039cc4456c2fd19347b4d830d1d58a0a6aea7117d  hostapd-2.6.tar.gz
+sha256  e204da659d0583c71af23cb9b55536fe99598ee26a44104344f456e4d17350c6  rtlxdrv.patch
diff --git a/package/hostapd/hostapd.mk b/package/hostapd/hostapd.mk
index dc28d1323..40e28ee67 100644
--- a/package/hostapd/hostapd.mk
+++ b/package/hostapd/hostapd.mk
@@ -44,6 +44,11 @@  HOSTAPD_CONFIG_DISABLE += CONFIG_EAP_PWD
 HOSTAPD_CONFIG_EDITS += 's/\#\(CONFIG_TLS=\).*/\1internal/'
 endif
 
+ifeq ($(BR2_PACKAGE_HOSTAPD_DRIVER_RTW),y)
+HOSTAPD_PATCH = https://github.com/pritambaral/hostapd-rtl871xdrv/raw/master/rtlxdrv.patch
+HOSTAPD_CONFIG_SET += CONFIG_DRIVER_RTW
+endif
+
 ifeq ($(BR2_PACKAGE_HOSTAPD_ACS),y)
 HOSTAPD_CONFIG_ENABLE += CONFIG_ACS
 endif