iw: add bpf fd support

this is a bit dumb for now - need to execve() it from another
program and pass a valid fd across, which isn't easy ...
diff --git a/interface.c b/interface.c
index a19c83f..06519f6 100644
--- a/interface.c
+++ b/interface.c
@@ -645,6 +645,26 @@
 	NL80211_CMD_SET_MCAST_RATE, 0, CIB_NETDEV, set_mcast_rate,
 	"Set the multicast bitrate.");
 
+static int set_filter(struct nl80211_state *state, struct nl_msg *msg,
+		      int argc, char **argv, enum id_input id)
+{
+	int fd;
+	char *end;
+
+	if (argc != 1)
+		return 1;
+
+	fd = strtol(argv[0], &end, 0);
+	if (*end)
+		return 1;
+	NLA_PUT_U32(msg, NL80211_ATTR_BPF_FD, fd);
+	return 0;
+nla_put_failure:
+	return -ENOBUFS;
+}
+COMMAND(set, filter, "<fd>",
+	NL80211_CMD_SET_INTERFACE, 0, CIB_NETDEV, set_filter,
+	"set monitor interface filter FD");
 
 static int handle_chanfreq(struct nl80211_state *state, struct nl_msg *msg,
 			   bool chan, int argc, char **argv,
diff --git a/nl80211.h b/nl80211.h
index cd4dfef..4a33cac 100644
--- a/nl80211.h
+++ b/nl80211.h
@@ -2012,6 +2012,8 @@
  *	u32 attribute with an &enum nl80211_timeout_reason value. This is used,
  *	e.g., with %NL80211_CMD_CONNECT event.
  *
+ * @NL80211_ATTR_BPF_FD: BPF file descriptor (s32), use -1 to remove a program
+ *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2423,6 +2425,8 @@
 
 	NL80211_ATTR_TIMEOUT_REASON,
 
+	NL80211_ATTR_BPF_FD,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
@@ -3942,10 +3946,7 @@
  * @__NL80211_ATTR_CQM_INVALID: invalid
  * @NL80211_ATTR_CQM_RSSI_THOLD: RSSI threshold in dBm. This value specifies
  *	the threshold for the RSSI level at which an event will be sent. Zero
- *	to disable.  Alternatively, if %NL80211_EXT_FEATURE_CQM_RSSI_LIST is
- *	set, multiple values can be supplied as a low-to-high sorted array of
- *	threshold values in dBm.  Events will be sent when the RSSI value
- *	crosses any of the thresholds.
+ *	to disable.
  * @NL80211_ATTR_CQM_RSSI_HYST: RSSI hysteresis in dBm. This value specifies
  *	the minimum amount the RSSI level must change after an event before a
  *	new event may be issued (to reduce effects of RSSI oscillation).
@@ -4756,9 +4757,8 @@
  * @NL80211_EXT_FEATURE_SCHED_SCAN_RELATIVE_RSSI: The driver supports sched_scan
  *	for reporting BSSs with better RSSI than the current connected BSS
  *	(%NL80211_ATTR_SCHED_SCAN_RELATIVE_RSSI).
- * @NL80211_EXT_FEATURE_CQM_RSSI_LIST: With this driver the
- *	%NL80211_ATTR_CQM_RSSI_THOLD attribute accepts a list of zero or more
- *	RSSI threshold values to monitor rather than exactly one threshold.
+ * @NL80211_EXT_FEATURE_WIFIMON_BPF: supports running BPF filter programs
+ *	for frames seen on monitor interfaces
  *
  * @NUM_NL80211_EXT_FEATURES: number of extended features.
  * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
@@ -4777,7 +4777,7 @@
 	NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA,
 	NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA_CONNECTED,
 	NL80211_EXT_FEATURE_SCHED_SCAN_RELATIVE_RSSI,
-	NL80211_EXT_FEATURE_CQM_RSSI_LIST,
+	NL80211_EXT_FEATURE_WIFIMON_BPF,
 
 	/* add new features before the definition below */
 	NUM_NL80211_EXT_FEATURES,
@@ -4913,17 +4913,12 @@
  *	change to the channel status.
  * @NL80211_RADAR_NOP_FINISHED: The Non-Occupancy Period for this channel is
  *	over, channel becomes usable.
- * @NL80211_RADAR_PRE_CAC_EXPIRED: Channel Availability Check done on this
- *	non-operating channel is expired and no longer valid. New CAC must
- *	be done on this channel before starting the operation. This is not
- *	applicable for ETSI dfs domain where pre-CAC is valid for ever.
  */
 enum nl80211_radar_event {
 	NL80211_RADAR_DETECTED,
 	NL80211_RADAR_CAC_FINISHED,
 	NL80211_RADAR_CAC_ABORTED,
 	NL80211_RADAR_NOP_FINISHED,
-	NL80211_RADAR_PRE_CAC_EXPIRED,
 };
 
 /**