diff mbox

wpa_supplicant: fix libnl-tiny support

Message ID 20160305174856.60b28c5f736da7da490e4f56@dimakrasner.com
State Changes Requested
Headers show

Commit Message

Dima Krasner March 5, 2016, 3:48 p.m. UTC
On Wed, 02 Mar 2016 15:00:32 +0100
Johannes Berg <johannes@sipsolutions.net> wrote:

> the code already has the ability to deal with libnl 1.1
> (or compatible) API, so you don't need to redefine everything afaict.

It's compatible with 2.0 and 3.x, not with 1.1 as far as I see.

Here's a cleaner patch, more in line with the coding style:

Signed-off-by: Dima Krasner <dima@dimakrasner.com>
---
 src/drivers/driver_nl80211.h | 7 +++++++
 src/drivers/drivers.mak      | 2 ++
 2 files changed, 9 insertions(+)

Comments

Jouni Malinen March 5, 2016, 4:52 p.m. UTC | #1
On Sat, Mar 05, 2016 at 05:48:56PM +0200, Dima Krasner wrote:
> On Wed, 02 Mar 2016 15:00:32 +0100
> Johannes Berg <johannes@sipsolutions.net> wrote:
> 
> > the code already has the ability to deal with libnl 1.1
> > (or compatible) API, so you don't need to redefine everything afaict.
> 
> It's compatible with 2.0 and 3.x, not with 1.1 as far as I see.

Which version of libnl-tiny are you using? The build option for
libnl-tiny was added originally in 2010 and it did not need any extra
defines at the time. If here are now number of different versions of
this with different libnl API support, I'm not sure it is good to assume
that only one API can be hardcoded whenever CONFIG_LIBNL_TINY=y is used.

> Here's a cleaner patch, more in line with the coding style:

> diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
> @@ -17,6 +17,13 @@
> +#ifdef CONFIG_LIBNL_TINY
> +/* libnl-tiny compatibility code */
> +#define nl_handle nl_sock
> +#define nl_handle_alloc_cb nl_socket_alloc_cb
> +#define nl_handle_destroy nl_socket_free
> +#endif
> +
>  #ifdef CONFIG_LIBNL20
>  /* libnl 2.0 compatibility code */
>  #define nl_handle nl_sock

Wouldn't it be enough to define CONFIG_LIBNL20 and use the existing
libnl 2.0 compatibility defines here?

This in .config should do that:

CONFIG_LIBNL_TINY=y
CONFIG_LIBNL20=y

And if there are issues with nl-genl not being available, following
could be used instead:

CONFIG_LIBNL_TINY=y
CFLAGS += -DCONFIG_LIBNL20
diff mbox

Patch

diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
index 4fa7d5f..b385fb9 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -17,6 +17,13 @@ 
 #include "utils/list.h"
 #include "driver.h"
 
+#ifdef CONFIG_LIBNL_TINY
+/* libnl-tiny compatibility code */
+#define nl_handle nl_sock
+#define nl_handle_alloc_cb nl_socket_alloc_cb
+#define nl_handle_destroy nl_socket_free
+#endif
+
 #ifdef CONFIG_LIBNL20
 /* libnl 2.0 compatibility code */
 #define nl_handle nl_sock
diff --git a/src/drivers/drivers.mak b/src/drivers/drivers.mak
index c4f5f97..d3b8185 100644
--- a/src/drivers/drivers.mak
+++ b/src/drivers/drivers.mak
@@ -56,6 +56,7 @@  endif
 else
   ifdef CONFIG_LIBNL_TINY
     DRV_LIBS += -lnl-tiny
+    DRV_CFLAGS += -DCONFIG_LIBNL_TINY
   else
     ifndef CONFIG_OSX
       DRV_LIBS += -lnl
@@ -172,6 +173,7 @@  ifdef CONFIG_LIBNL32
 else
   ifdef CONFIG_LIBNL_TINY
     DRV_LIBS += -lnl-tiny
+    DRV_CFLAGS += -DCONFIG_LIBNL_TINY
   else
     DRV_LIBS += -lnl
   endif