Add support for libnl-3, patches picked from upstream commits:
61627e6ff61b6636c7b80f261fd95328f8857672
27049d0edf7c20b777129a1636d1b0530e3a289a
892029531bf748a973599d29763a523d31f67a6c
53c3f4ac17be30a89a3d53cf8c85d0cf90b169df
2e1f9afae4054d8a37a90da126051a1c5be11e7c
2a3c9d80b2121db5602d1b7dcf49d0eb3b13810c

Index: kismet-debian/Makefile.in
===================================================================
--- kismet-debian.orig/Makefile.in	2013-02-22 01:10:02.496660127 +0100
+++ kismet-debian/Makefile.in	2013-02-22 01:10:03.472660169 +0100
@@ -90,7 +90,7 @@
 	$(LD) $(LDFLAGS) -o $(PS) $(PSO) $(LIBS) $(CXXLIBS) $(PCAPLNK) $(KSLIBS)
 
 $(CS):	$(CSO)
-	$(LD) $(LDFLAGS) -o $(CS) $(CSO) $(LIBS) $(CXXLIBS) $(PCAPLNK) $(CAPLIBS)
+	$(LD) $(LDFLAGS) -o $(CS) $(CSO) $(LIBS) $(CXXLIBS) $(PCAPLNK) $(CAPLIBS) $(KSLIBS)
 
 $(DRONE):	$(DRONEO) $(CS)
 	$(LD) $(LDFLAGS) -o $(DRONE) $(DRONEO) $(LIBS) $(CXXLIBS) $(PCAPLNK) $(KSLIBS)
Index: kismet-debian/config.h.in
===================================================================
--- kismet-debian.orig/config.h.in	2013-02-22 01:10:02.496660127 +0100
+++ kismet-debian/config.h.in	2013-02-22 01:10:03.472660169 +0100
@@ -12,9 +12,6 @@
 /* libairpcap header */
 #undef HAVE_AIRPCAP_H
 
-/* Define to 1 if you have the <asm/types.h> header file. */
-#undef HAVE_ASM_TYPES_H
-
 /* BSD radiotap packet headers */
 #undef HAVE_BSD_SYS_RADIOTAP
 
@@ -57,6 +54,9 @@
 /* libnl-2.0 netlink library */
 #undef HAVE_LIBNL20
 
+/* libnl-3.0 netlink library */
+#undef HAVE_LIBNL30
+
 /* Panel terminal lib */
 #undef HAVE_LIBPANEL
 
@@ -69,24 +69,15 @@
 /* Define to 1 if you have the <libutil.h> header file. */
 #undef HAVE_LIBUTIL_H
 
-/* Define to 1 if you have the <linux/if_arp.h> header file. */
-#undef HAVE_LINUX_IF_ARP_H
-
 /* Linux wireless iwfreq.flag */
 #undef HAVE_LINUX_IWFREQFLAG
 
 /* Netlink works */
 #undef HAVE_LINUX_NETLINK
 
-/* Define to 1 if you have the <linux/nl80211.h> header file. */
-#undef HAVE_LINUX_NL80211_H
-
 /* Linux wireless extentions present */
 #undef HAVE_LINUX_WIRELESS
 
-/* Define to 1 if you have the <linux/wireless.h> header file. */
-#undef HAVE_LINUX_WIRELESS_H
-
 /* local radiotap packet headers */
 #undef HAVE_LOCAL_RADIOTAP
 
@@ -99,24 +90,6 @@
 /* Define to 1 if you have the <netdb.h> header file. */
 #undef HAVE_NETDB_H
 
-/* Netlink headers are there */
-#undef HAVE_NETLINKHEADERS
-
-/* Define to 1 if you have the <netlink/attr.h> header file. */
-#undef HAVE_NETLINK_ATTR_H
-
-/* Define to 1 if you have the <netlink/genl/ctrl.h> header file. */
-#undef HAVE_NETLINK_GENL_CTRL_H
-
-/* Define to 1 if you have the <netlink/genl/family.h> header file. */
-#undef HAVE_NETLINK_GENL_FAMILY_H
-
-/* Define to 1 if you have the <netlink/genl/genl.h> header file. */
-#undef HAVE_NETLINK_GENL_GENL_H
-
-/* Define to 1 if you have the <netlink/msg.h> header file. */
-#undef HAVE_NETLINK_MSG_H
-
 /* pcap/pcap.h */
 #undef HAVE_PCAPPCAP_H
 
Index: kismet-debian/configure.in
===================================================================
--- kismet-debian.orig/configure.in	2013-02-22 01:10:02.496660127 +0100
+++ kismet-debian/configure.in	2013-02-22 01:10:03.476660169 +0100
@@ -844,14 +844,14 @@
 	radiotaploc="system (BSD)"
 fi
 
-havenetlink=no
+# havenetlink=no
 if test "$linux" = "yes"; then
+# havenetlink=yes
+# 	AC_CHECK_HEADERS([asm/types.h netlink/genl/genl.h netlink/genl/family.h netlink/genl/ctrl.h netlink/msg.h netlink/attr.h linux/nl80211.h linux/if_arp.h linux/wireless.h], 
+# 	AC_DEFINE(HAVE_NETLINKHEADERS, 1, Netlink headers are there), 
+# 	havenetlink=no,
+# 	[#include <sys/socket.h>])
 havenetlink=yes
-	AC_CHECK_HEADERS([asm/types.h netlink/genl/genl.h netlink/genl/family.h netlink/genl/ctrl.h netlink/msg.h netlink/attr.h linux/nl80211.h linux/if_arp.h linux/wireless.h], 
-	AC_DEFINE(HAVE_NETLINKHEADERS, 1, Netlink headers are there), 
-	havenetlink=no,
-	[#include <sys/socket.h>])
-
 
 #if test "$havenetlink" = "yes"; then
 #	AC_CHECK_LIB([nl], [nl_handle_alloc],
@@ -860,24 +860,48 @@
 #	AC_MSG_WARN(Missing libnl or libnl too old support will not be able to control mac80211 vaps)
 #fi
 
+AC_CHECK_PROG(havepkgconfig, [pkg-config], yes, no)
+if test "$havepkgconfig" = "no"; then
+  AC_MSG_WARN(Missing pkg-config will lead to multiple other checks failing)
+fi
+
+NLLIBS=""
+NLCFLAGS=""
+nlname=""
+
 if test "$havenetlink" = "yes"; then
+	PKG_CHECK_MODULES(libnl30, [libnl-3.0], libnl30=yes, libnl30=no)
+	PKG_CHECK_MODULES(libnlgenl30, [libnl-genl-3.0], libnlgenl30=yes, libnlgenl30=no)
 	PKG_CHECK_MODULES(libnl20, [libnl-2.0], libnl20=yes, libnl20=no)
 	PKG_CHECK_MODULES(libnl1, [libnl-1], libnl1=yes, libnl1=no)
-	if test "$libnl20" = "yes"; then
+
+	if test "$libnl30" = "yes" -a "$libnlgenl30" = "yes"; then
+		AC_DEFINE(HAVE_LIBNL, 1, libnl netlink library)
+		AC_DEFINE(HAVE_LIBNL30, 1, libnl-3.0 netlink library)
+		nlname="libnl-3.0 libnl-genl-3.0"
+	elif test "$libnl20" = "yes"; then
 		AC_DEFINE(HAVE_LIBNL, 1, libnl netlink library)
 		AC_DEFINE(HAVE_LIBNL20, 1, libnl-2.0 netlink library)
-		NLLIBS="-lnl-genl -lnl"
+		nlname="libnl-2.0"
 	elif test "$libnl1" = "yes"; then
 		AC_DEFINE(HAVE_LIBNL, 1, libnl netlink library)
-		NLLIBS="-lnl"
+		nlname="libnl-1"
 	else
 		havenetlink="no"
 	fi
+
+	if test "$nlname" != ""; then
+		NLLIBS=`pkg-config --libs $nlname`
+		NLCFLAGS=`pkg-config --cflags $nlname`
+	fi
 fi
 
 if test "$havenetlink" = "yes"; then
 	OLIBS="$LIBS"
 	LIBS="$LIBS $NLLIBS"
+	OCFL="$CPPFLAGS"
+	CPPFLAGS="$CPPFLAGS $NLCFLAGS"
+
 	AC_MSG_CHECKING(For mac80211 support in netlink library)
 	AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 			#include <stdio.h>
@@ -894,7 +918,9 @@
 			NL80211_IFTYPE_MONITOR;
 			NL80211_CMD_NEW_INTERFACE;
 			return 0;
-			]])],[havenetlink=yes],[havenetlink=no LIBS="$OLIBS"])
+			]])],[havenetlink=yes KSLIBS="$KSLIBS $NLLIBS"],[havenetlink=no])
+	
+	LIBS="$OLIBS"
 else
 	AC_MSG_WARN(Missing libnl netlink library will not be able to control mac80211 vaps)
 	havenetlink=no
@@ -903,8 +929,6 @@
 if test "$havenetlink" = "yes"; then
 	AC_MSG_RESULT(yes)
 	AC_DEFINE(HAVE_LINUX_NETLINK, 1, Netlink works) 
-else
-	AC_MSG_RESULT(libnl detected but no support for mac80211 your kernel is probably too old for mac80211 or nl80211 upgrade your kernel then reinstall the latest netlink to get mac80211 support.)
 fi
 
 fi
@@ -1034,7 +1058,7 @@
 
 printf "         Linux Netlink: "
 if test "$havenetlink" = "yes"; then
-	echo "yes (mac80211 VAP creation)";
+	echo "yes (mac80211 VAP creation) - $nlname";
 elif test "$linux" != "yes"; then
 	echo "n/a (only Linux)"
 else
@@ -1069,6 +1093,13 @@
 	echo "libpcap-dev or libpcap-devel by most distributions)."
 fi
 
+if test "$havepkgconfig" = "no"; then
+	echo
+	echo "pkg-config was missing.  Without it, configure cannot detect "
+	echo "several libraries Kismet needs.  Install pkg-config and re-run"
+	echo "configure."
+fi
+
 if test "$havenetlink" != "yes" -a "$linux" = "yes"; then
 	echo "*** WARNING ***"
 	echo "LibNL/nl80211 support was not found.  Kismet uses libnl to control "
@@ -1077,6 +1108,12 @@
 	echo "older drivers, you need libnl."
 	echo "You need both the libnl libraries and development headers (called "
 	echo "libnl-dev or libnl-devel by most distributions)."
+
+	if test "$havepkgconfig" = "no"; then
+		echo "You do not have the pkg-config utility installed.  Kismet needs "
+		echo "this to find the options libnl uses.  If libnl is installed but "
+		echo "pkg-config is not, Kismet will not detect libnl!"
+	fi
 fi
 
 if test "`echo $host_os | grep linux`" = ""; then
Index: kismet-debian/nl80211_control.cc
===================================================================
--- kismet-debian.orig/nl80211_control.cc	2013-02-22 01:10:02.496660127 +0100
+++ kismet-debian/nl80211_control.cc	2013-02-22 01:10:03.476660169 +0100
@@ -18,6 +18,10 @@
 
 #include "config.h"
 
+#if defined(HAVE_LIBNL20) || defined(HAVE_LIBNL30)
+#define HAVE_LIBNL_NG
+#endif
+
 #ifdef SYS_LINUX
 
 #ifdef HAVE_LINUX_NETLINK
@@ -29,6 +33,7 @@
 #include <netlink/msg.h>
 #include <netlink/attr.h>
 #include <netlink/netlink.h>
+#include <netlink/socket.h>
 #include "nl80211.h"
 #include <net/if.h>
 #endif
@@ -44,7 +49,7 @@
 #include "nl80211_control.h"
 
 // Libnl1->Libnl2 compatability mode since the API changed, cribbed from 'iw'
-#if !defined(HAVE_LIBNL20) && defined(HAVE_LINUX_NETLINK)
+#if !defined(HAVE_LIBNL_NG)
 #define nl_sock nl_handle
 
 static inline struct nl_handle *nl_socket_alloc(void) {
Index: kismet-debian/configure
===================================================================
--- kismet-debian.orig/configure	2013-02-22 01:10:02.496660127 +0100
+++ kismet-debian/configure	2013-02-22 01:10:03.492660169 +0100
@@ -629,9 +629,14 @@
 libnl1_CFLAGS
 libnl20_LIBS
 libnl20_CFLAGS
+libnlgenl30_LIBS
+libnlgenl30_CFLAGS
+libnl30_LIBS
+libnl30_CFLAGS
 PKG_CONFIG_LIBDIR
 PKG_CONFIG_PATH
 PKG_CONFIG
+havepkgconfig
 pcap
 pcaplnk
 wantpcap
@@ -740,6 +745,10 @@
 PKG_CONFIG
 PKG_CONFIG_PATH
 PKG_CONFIG_LIBDIR
+libnl30_CFLAGS
+libnl30_LIBS
+libnlgenl30_CFLAGS
+libnlgenl30_LIBS
 libnl20_CFLAGS
 libnl20_LIBS
 libnl1_CFLAGS
@@ -1388,6 +1397,14 @@
               directories to add to pkg-config's search path
   PKG_CONFIG_LIBDIR
               path overriding pkg-config's built-in search path
+  libnl30_CFLAGS
+              C compiler flags for libnl30, overriding pkg-config
+  libnl30_LIBS
+              linker flags for libnl30, overriding pkg-config
+  libnlgenl30_CFLAGS
+              C compiler flags for libnlgenl30, overriding pkg-config
+  libnlgenl30_LIBS
+              linker flags for libnlgenl30, overriding pkg-config
   libnl20_CFLAGS
               C compiler flags for libnl20, overriding pkg-config
   libnl20_LIBS
@@ -6635,28 +6652,14 @@
 	radiotaploc="system (BSD)"
 fi
 
-havenetlink=no
+# havenetlink=no
 if test "$linux" = "yes"; then
+# havenetlink=yes
+# 	AC_CHECK_HEADERS([asm/types.h netlink/genl/genl.h netlink/genl/family.h netlink/genl/ctrl.h netlink/msg.h netlink/attr.h linux/nl80211.h linux/if_arp.h linux/wireless.h],
+# 	AC_DEFINE(HAVE_NETLINKHEADERS, 1, Netlink headers are there),
+# 	havenetlink=no,
+# 	[#include <sys/socket.h>])
 havenetlink=yes
-	for ac_header in asm/types.h netlink/genl/genl.h netlink/genl/family.h netlink/genl/ctrl.h netlink/msg.h netlink/attr.h linux/nl80211.h linux/if_arp.h linux/wireless.h
-do :
-  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "#include <sys/socket.h>
-"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-$as_echo "#define HAVE_NETLINKHEADERS 1" >>confdefs.h
-
-else
-  havenetlink=no
-fi
-
-done
-
-
 
 #if test "$havenetlink" = "yes"; then
 #	AC_CHECK_LIB([nl], [nl_handle_alloc],
@@ -6665,6 +6668,53 @@
 #	AC_MSG_WARN(Missing libnl or libnl too old support will not be able to control mac80211 vaps)
 #fi
 
+# Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_havepkgconfig+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$havepkgconfig"; then
+  ac_cv_prog_havepkgconfig="$havepkgconfig" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_havepkgconfig="yes"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_prog_havepkgconfig" && ac_cv_prog_havepkgconfig="no"
+fi
+fi
+havepkgconfig=$ac_cv_prog_havepkgconfig
+if test -n "$havepkgconfig"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $havepkgconfig" >&5
+$as_echo "$havepkgconfig" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test "$havepkgconfig" = "no"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Missing pkg-config will lead to multiple other checks failing" >&5
+$as_echo "$as_me: WARNING: Missing pkg-config will lead to multiple other checks failing" >&2;}
+fi
+
+NLLIBS=""
+NLCFLAGS=""
+nlname=""
+
 if test "$havenetlink" = "yes"; then
 
 
@@ -6788,6 +6838,148 @@
 fi
 
 pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libnl30" >&5
+$as_echo_n "checking for libnl30... " >&6; }
+
+if test -n "$libnl30_CFLAGS"; then
+    pkg_cv_libnl30_CFLAGS="$libnl30_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnl-3.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libnl-3.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_libnl30_CFLAGS=`$PKG_CONFIG --cflags "libnl-3.0" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$libnl30_LIBS"; then
+    pkg_cv_libnl30_LIBS="$libnl30_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnl-3.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libnl-3.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_libnl30_LIBS=`$PKG_CONFIG --libs "libnl-3.0" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        libnl30_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libnl-3.0" 2>&1`
+        else
+	        libnl30_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libnl-3.0" 2>&1`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$libnl30_PKG_ERRORS" >&5
+
+	libnl30=no
+elif test $pkg_failed = untried; then
+     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+	libnl30=no
+else
+	libnl30_CFLAGS=$pkg_cv_libnl30_CFLAGS
+	libnl30_LIBS=$pkg_cv_libnl30_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	libnl30=yes
+fi
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libnlgenl30" >&5
+$as_echo_n "checking for libnlgenl30... " >&6; }
+
+if test -n "$libnlgenl30_CFLAGS"; then
+    pkg_cv_libnlgenl30_CFLAGS="$libnlgenl30_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnl-genl-3.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libnl-genl-3.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_libnlgenl30_CFLAGS=`$PKG_CONFIG --cflags "libnl-genl-3.0" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$libnlgenl30_LIBS"; then
+    pkg_cv_libnlgenl30_LIBS="$libnlgenl30_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnl-genl-3.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libnl-genl-3.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_libnlgenl30_LIBS=`$PKG_CONFIG --libs "libnl-genl-3.0" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        libnlgenl30_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libnl-genl-3.0" 2>&1`
+        else
+	        libnlgenl30_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libnl-genl-3.0" 2>&1`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$libnlgenl30_PKG_ERRORS" >&5
+
+	libnlgenl30=no
+elif test $pkg_failed = untried; then
+     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+	libnlgenl30=no
+else
+	libnlgenl30_CFLAGS=$pkg_cv_libnlgenl30_CFLAGS
+	libnlgenl30_LIBS=$pkg_cv_libnlgenl30_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	libnlgenl30=yes
+fi
+
+pkg_failed=no
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libnl20" >&5
 $as_echo_n "checking for libnl20... " >&6; }
 
@@ -6928,27 +7120,44 @@
 $as_echo "yes" >&6; }
 	libnl1=yes
 fi
-	if test "$libnl20" = "yes"; then
+
+	if test "$libnl30" = "yes" -a "$libnlgenl30" = "yes"; then
+
+$as_echo "#define HAVE_LIBNL 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_LIBNL30 1" >>confdefs.h
+
+		nlname="libnl-3.0 libnl-genl-3.0"
+	elif test "$libnl20" = "yes"; then
 
 $as_echo "#define HAVE_LIBNL 1" >>confdefs.h
 
 
 $as_echo "#define HAVE_LIBNL20 1" >>confdefs.h
 
-		NLLIBS="-lnl-genl -lnl"
+		nlname="libnl-2.0"
 	elif test "$libnl1" = "yes"; then
 
 $as_echo "#define HAVE_LIBNL 1" >>confdefs.h
 
-		NLLIBS="-lnl"
+		nlname="libnl-1"
 	else
 		havenetlink="no"
 	fi
+
+	if test "$nlname" != ""; then
+		NLLIBS=`pkg-config --libs $nlname`
+		NLCFLAGS=`pkg-config --cflags $nlname`
+	fi
 fi
 
 if test "$havenetlink" = "yes"; then
 	OLIBS="$LIBS"
 	LIBS="$LIBS $NLLIBS"
+	OCFL="$CPPFLAGS"
+	CPPFLAGS="$CPPFLAGS $NLCFLAGS"
+
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking For mac80211 support in netlink library" >&5
 $as_echo_n "checking For mac80211 support in netlink library... " >&6; }
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -6978,12 +7187,14 @@
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  havenetlink=yes
+  havenetlink=yes KSLIBS="$KSLIBS $NLLIBS"
 else
-  havenetlink=no LIBS="$OLIBS"
+  havenetlink=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
+
+	LIBS="$OLIBS"
 else
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Missing libnl netlink library will not be able to control mac80211 vaps" >&5
 $as_echo "$as_me: WARNING: Missing libnl netlink library will not be able to control mac80211 vaps" >&2;}
@@ -6996,9 +7207,6 @@
 
 $as_echo "#define HAVE_LINUX_NETLINK 1" >>confdefs.h
 
-else
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: libnl detected but no support for mac80211 your kernel is probably too old for mac80211 or nl80211 upgrade your kernel then reinstall the latest netlink to get mac80211 support." >&5
-$as_echo "libnl detected but no support for mac80211 your kernel is probably too old for mac80211 or nl80211 upgrade your kernel then reinstall the latest netlink to get mac80211 support." >&6; }
 fi
 
 fi
@@ -8418,7 +8626,7 @@
 
 printf "         Linux Netlink: "
 if test "$havenetlink" = "yes"; then
-	echo "yes (mac80211 VAP creation)";
+	echo "yes (mac80211 VAP creation) - $nlname";
 elif test "$linux" != "yes"; then
 	echo "n/a (only Linux)"
 else
@@ -8453,6 +8661,13 @@
 	echo "libpcap-dev or libpcap-devel by most distributions)."
 fi
 
+if test "$havepkgconfig" = "no"; then
+	echo
+	echo "pkg-config was missing.  Without it, configure cannot detect "
+	echo "several libraries Kismet needs.  Install pkg-config and re-run"
+	echo "configure."
+fi
+
 if test "$havenetlink" != "yes" -a "$linux" = "yes"; then
 	echo "*** WARNING ***"
 	echo "LibNL/nl80211 support was not found.  Kismet uses libnl to control "
@@ -8461,6 +8676,12 @@
 	echo "older drivers, you need libnl."
 	echo "You need both the libnl libraries and development headers (called "
 	echo "libnl-dev or libnl-devel by most distributions)."
+
+	if test "$havepkgconfig" = "no"; then
+		echo "You do not have the pkg-config utility installed.  Kismet needs "
+		echo "this to find the options libnl uses.  If libnl is installed but "
+		echo "pkg-config is not, Kismet will not detect libnl!"
+	fi
 fi
 
 if test "`echo $host_os | grep linux`" = ""; then
