mac80211: Encrypt "Group addressed privacy" action frames
[carl9170fw.git] / include / linux / ieee80211.h
index 7bc9f831972294ed6205c18eab456ffa9a2236aa..a004aca7c631e046de1bc604dff6d43446f7215d 100644 (file)
@@ -2491,6 +2491,28 @@ static inline bool ieee80211_is_public_action(struct ieee80211_hdr *hdr,
        return mgmt->u.action.category == WLAN_CATEGORY_PUBLIC;
 }
 
+static inline bool is_multicast_ether_addr(const u8 *a)
+{
+        return 0x01 & a[0];
+}
+
+/**
+ * _ieee80211_is_group_privacy_action - check if frame is a group addressed
+ * privacy action frame
+ * @hdr: the frame
+ */
+static inline bool ieee80211_is_group_privacy_action(struct ieee80211_hdr *hdr)
+{
+       struct ieee80211_mgmt *mgmt = (void *)hdr;
+
+       if (!ieee80211_is_action(hdr->frame_control) ||
+           !is_multicast_ether_addr(hdr->addr1))
+               return false;
+
+       return mgmt->u.action.category == WLAN_CATEGORY_MESH_ACTION ||
+              mgmt->u.action.category == WLAN_CATEGORY_MULTIHOP_ACTION;
+}
+
 /**
  * ieee80211_tu_to_usec - convert time units (TU) to microseconds
  * @tu: the TUs