]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Added libnl 2.0 compatibility code (CONFIG_LIBNL20=y in .config needed)
authorJouni Malinen <j@w1.fi>
Mon, 8 Dec 2008 20:40:58 +0000 (22:40 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 8 Dec 2008 20:40:58 +0000 (22:40 +0200)
Unfortunately, at least the current libnl git snapshot changes the API
in backwards incompatible way and in a way that makes it difficult to
to allow building against the latest libnl code.

hostapd/Makefile
hostapd/driver_nl80211.c

index 5061413b902ddcb3f4098c6162d6fbbe8e9bb9ed..666f91c2bfb2c6ac92193c1763510349824a1e01 100644 (file)
@@ -125,6 +125,10 @@ ifdef CONFIG_DRIVER_NL80211
 CFLAGS += -DCONFIG_DRIVER_NL80211
 OBJS += driver_nl80211.o radiotap.o
 LIBS += -lnl
+ifdef CONFIG_LIBNL20
+LIBS += -lnl-genl
+CFLAGS += -DCONFIG_LIBNL20
+endif
 endif
 
 ifdef CONFIG_DRIVER_BSD
index e59f5cdf842e61b10e49c02d1f61a3560af460ed..496b1796991c0e66b9f99e41c129396b0e7607d1 100644 (file)
 #include "radiotap.h"
 #include "radiotap_iter.h"
 
+#ifdef CONFIG_LIBNL20
+/* libnl 2.0 compatibility code */
+#define nl_handle_alloc_cb nl_socket_alloc_cb
+#define nl_handle_destroy nl_socket_free
+#endif /* CONFIG_LIBNL20 */
+
 enum ieee80211_msg_type {
        ieee80211_msg_normal = 0,
        ieee80211_msg_tx_callback_ack = 1,
@@ -2044,11 +2050,18 @@ static int i802_init_sockets(struct i802_driver_data *drv, const u8 *bssid)
                return -1;
        }
 
+#ifdef CONFIG_LIBNL20
+       if (genl_ctrl_alloc_cache(drv->nl_handle, &drv->nl_cache) < 0) {
+               printf("Failed to allocate generic netlink cache.\n");
+               return -1;
+       }
+#else /* CONFIG_LIBNL20 */
        drv->nl_cache = genl_ctrl_alloc_cache(drv->nl_handle);
        if (!drv->nl_cache) {
                printf("Failed to allocate generic netlink cache.\n");
                return -1;
        }
+#endif /* CONFIG_LIBNL20 */
 
        drv->nl80211 = genl_ctrl_search_by_name(drv->nl_cache, "nl80211");
        if (!drv->nl80211) {