The nl80211 driver patch contains the following changes:

- Convert inline error values from Linux to libc (FreeBSD) as otherwise
  wpa_supplicant might come to the wrong conclusions.

- Show RFKILL operations at INFO level (so that the always appear in the
  log) and generate a interface dis-/enable event that will be handled
  by the management layer.

- Remove netlink messages that rely on newer libnl versions, e.g. signed
  value where introduced in 3.2.27.

- Hardcode the I/O control socket rather than calling socket because it
  is not used anyway (see wpa_driver_nl80211/ioctl.cc).
--- a/src/drivers/driver_nl80211.c
+++ a/src/drivers/driver_nl80211.c
@@ -487,6 +487,8 @@
 }
 
 
+extern int convert_errno_from_linux(int linux_errno);
+
 int send_and_recv(struct nl80211_global *global,
 		  struct nl_sock *nl_handle, struct nl_msg *msg,
 		  int (*valid_handler)(struct nl_msg *, void *),
@@ -579,7 +581,7 @@
 	/* Always clear the message as it can potentially contain keys */
 	nl80211_nlmsg_clear(msg);
 	nlmsg_free(msg);
-	return err.err;
+	return convert_errno_from_linux(err.err);
 }
 
 
@@ -2088,13 +2090,13 @@
 {
 	struct wpa_driver_nl80211_data *drv = ctx;
 
-	wpa_printf(MSG_DEBUG, "nl80211: RFKILL blocked");
+	wpa_printf(MSG_INFO, "nl80211: RFKILL blocked");
 
 	/*
 	 * rtnetlink ifdown handler will report interfaces other than the P2P
 	 * Device interface as disabled.
 	 */
-	if (drv->nlmode == NL80211_IFTYPE_P2P_DEVICE)
+	// if (drv->nlmode == NL80211_IFTYPE_P2P_DEVICE)
 		wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_DISABLED, NULL);
 }
 
@@ -2102,7 +2104,7 @@
 static void wpa_driver_nl80211_rfkill_unblocked(void *ctx)
 {
 	struct wpa_driver_nl80211_data *drv = ctx;
-	wpa_printf(MSG_DEBUG, "nl80211: RFKILL unblocked");
+	wpa_printf(MSG_INFO, "nl80211: RFKILL unblocked");
 	if (i802_set_iface_flags(drv->first_bss, 1)) {
 		wpa_printf(MSG_DEBUG, "nl80211: Could not set interface UP "
 			   "after rfkill unblock");
@@ -2116,7 +2118,7 @@
 	 * rtnetlink ifup handler will report interfaces other than the P2P
 	 * Device interface as enabled.
 	 */
-	if (drv->nlmode == NL80211_IFTYPE_P2P_DEVICE)
+	// if (drv->nlmode == NL80211_IFTYPE_P2P_DEVICE)
 		wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_ENABLED, NULL);
 }
 
@@ -7826,7 +7828,7 @@
 		[NL80211_STA_INFO_BEACON_SIGNAL_AVG] = { .type = NLA_U8},
 		[NL80211_STA_INFO_RX_DURATION] = { .type = NLA_U64 },
 		[NL80211_STA_INFO_ACK_SIGNAL] = { .type = NLA_U8 },
-		[NL80211_STA_INFO_ACK_SIGNAL_AVG] = { .type = NLA_S8 },
+		[NL80211_STA_INFO_ACK_SIGNAL_AVG] = { .type = NLA_U8 },
 		[NL80211_STA_INFO_RX_MPDUS] = { .type = NLA_U32 },
 		[NL80211_STA_INFO_FCS_ERROR_COUNT] = { .type = NLA_U32 },
 		[NL80211_STA_INFO_TX_DURATION] = { .type = NLA_U64 },
@@ -7930,9 +7932,9 @@
 			nla_get_u8(stats[NL80211_STA_INFO_ACK_SIGNAL]);
 		data->flags |= STA_DRV_DATA_LAST_ACK_RSSI;
 	}
-	if (stats[NL80211_STA_INFO_ACK_SIGNAL_AVG])
-		data->avg_ack_signal =
-			nla_get_s8(stats[NL80211_STA_INFO_ACK_SIGNAL_AVG]);
+	// if (stats[NL80211_STA_INFO_ACK_SIGNAL_AVG])
+	// 	data->avg_ack_signal =
+	// 		nla_get_s8(stats[NL80211_STA_INFO_ACK_SIGNAL_AVG]);
 	if (stats[NL80211_STA_INFO_RX_MPDUS])
 		data->rx_mpdus = nla_get_u32(stats[NL80211_STA_INFO_RX_MPDUS]);
 	if (stats[NL80211_STA_INFO_FCS_ERROR_COUNT])
@@ -9939,7 +9941,7 @@
 	if (wpa_driver_nl80211_init_nl_global(global) < 0)
 		goto err;
 
-	global->ioctl_sock = socket(PF_INET, SOCK_DGRAM, 0);
+	global->ioctl_sock = 12345; /* arbitrarily chosen number b/c it won't be used anyway */
 	if (global->ioctl_sock < 0) {
 		wpa_printf(MSG_ERROR, "nl80211: socket(PF_INET,SOCK_DGRAM) failed: %s",
 			   strerror(errno));
diff --git a/src/drivers/netlink.c b/src/drivers/netlink.c
index 0e960f4..38fb26c 100644
--- a/src/drivers/netlink.c
+++ b/src/drivers/netlink.c
@@ -13,6 +13,8 @@
 #include "priv_netlink.h"
 #include "netlink.h"
 
+#define PF_NETLINK 16
+#define AF_NETLINK PF_NETLINK
 
 struct netlink_data {
 	struct netlink_config *cfg;
diff --git a/src/utils/common.c b/src/utils/common.c
index 2c12751..e9047d5 100644
--- a/src/utils/common.c
+++ b/src/utils/common.c
@@ -509,12 +509,12 @@ void printf_encode(char *txt, size_t maxlen, const u8 *data, size_t len)
 			*txt++ = 't';
 			break;
 		default:
-			if (data[i] >= 32 && data[i] <= 126) {
+			// if (data[i] >= 32 && data[i] <= 126) {
 				*txt++ = data[i];
-			} else {
-				txt += os_snprintf(txt, end - txt, "\\x%02x",
-						   data[i]);
-			}
+			// } else {
+			// 	txt += os_snprintf(txt, end - txt, "\\x%02x",
+			// 			   data[i]);
+			// }
 			break;
 		}
 	}
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index bcd67fc..025ec8d 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -11447,7 +11447,7 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
 					 char *buf, size_t *resp_len)
 {
 	char *reply;
-	const int reply_size = 4096;
+	const int reply_size = 4096*8;
 	int reply_len;
 
 	if (os_strncmp(buf, WPA_CTRL_RSP, os_strlen(WPA_CTRL_RSP)) == 0 ||
