History

Revert "nl80211: add src and dst addr attributes for control port tx/rx"

This reverts commit 8c3ed7aa2b9ef666195b789e9b02e28383243fa8. As Jouni points out, there's really no need for this, since the RSN pre-authentication frames are normal data frames, not port control frames (locally). We can still revert this now since it hasn't actually gone beyond -next.

Johannes Berg committed 6 years ago

Commit 8d74a621 parent 8079e4f7 files · +21 −57Browse files

Unified · Split

7 files
  1. include/net/cfg80211.h +1 −2
  2. include/uapi/linux/nl80211.h +1 −15
  3. net/mac80211/ieee80211_i.h +1 −2
  4. net/mac80211/tx.c +1 −2
  5. net/wireless/nl80211.c +3 −15
  6. net/wireless/rdev-ops.h +4 −4
  7. net/wireless/trace.h +10 −17
include/net/cfg80211.h+1−2
@@ -3974,8 +3974,7 @@ struct cfg80211_ops { · 3973 unmodified lines
3974 int (*tx_control_port)(struct wiphy *wiphy,3974 int (*tx_control_port)(struct wiphy *wiphy,
3975 struct net_device *dev,3975 struct net_device *dev,
3976 const u8 *buf, size_t len,3976 const u8 *buf, size_t len,
3977 const u8 *dest, const u8 *src,3977 const u8 *dest, const __be16 proto,
3978 const __be16 proto,
3979 const bool noencrypt);3978 const bool noencrypt);
3980 3979
3981 int (*get_ftm_responder_stats)(struct wiphy *wiphy,3980 int (*get_ftm_responder_stats)(struct wiphy *wiphy,
include/uapi/linux/nl80211.h+1−15
@@ -1039,14 +1039,11 @@ · 1038 unmodified lines
1039 * a control port frame and as a notification that a control port frame1039 * a control port frame and as a notification that a control port frame
1040 * has been received. %NL80211_ATTR_FRAME is used to specify the1040 * has been received. %NL80211_ATTR_FRAME is used to specify the
1041 * frame contents. The frame is the raw EAPoL data, without ethernet or1041 * frame contents. The frame is the raw EAPoL data, without ethernet or
1042 * 802.11 headers. An optional %NL80211_ATTR_SRC_MAC can be used to send1042 * 802.11 headers.
1043 * pre-auth frames to STAs on behalf of other APs.
1044 * When used as an event indication %NL80211_ATTR_CONTROL_PORT_ETHERTYPE,1043 * When used as an event indication %NL80211_ATTR_CONTROL_PORT_ETHERTYPE,
1045 * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT and %NL80211_ATTR_MAC are added1044 * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT and %NL80211_ATTR_MAC are added
1046 * indicating the protocol type of the received frame; whether the frame1045 * indicating the protocol type of the received frame; whether the frame
1047 * was received unencrypted and the MAC address of the peer respectively.1046 * was received unencrypted and the MAC address of the peer respectively.
1048 * %NL80211_ATTR_DST_MAC can be used to forward pre-auth frames in
1049 * userspace while using AP mode.
1050 *1047 *
1051 * @NL80211_CMD_RELOAD_REGDB: Request that the regdb firmware file is reloaded.1048 * @NL80211_CMD_RELOAD_REGDB: Request that the regdb firmware file is reloaded.
1052 *1049 *
@@ -2412,9 +2409,6 @@ enum nl80211_commands { · 1359 unmodified lines
2412 * %NL80211_ATTR_AKM_SUITES are default capabilities if AKM suites not2409 * %NL80211_ATTR_AKM_SUITES are default capabilities if AKM suites not
2413 * advertised for a specific interface type.2410 * advertised for a specific interface type.
2414 *2411 *
2415 * @NL80211_ATTR_SRC_MAC: MAC address used in control port over nl80211 transmit
2416 * @NL80211_ATTR_DST_MAC: MAC address used in control port over nl80211 receive
2417 *
2418 * @NUM_NL80211_ATTR: total number of nl80211_attrs available2412 * @NUM_NL80211_ATTR: total number of nl80211_attrs available
2419 * @NL80211_ATTR_MAX: highest attribute number currently defined2413 * @NL80211_ATTR_MAX: highest attribute number currently defined
2420 * @__NL80211_ATTR_AFTER_LAST: internal use2414 * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2883,9 +2877,6 @@ enum nl80211_attrs { · 462 unmodified lines
2883 2877
2884 NL80211_ATTR_IFTYPE_AKM_SUITES,2878 NL80211_ATTR_IFTYPE_AKM_SUITES,
2885 2879
2886 NL80211_ATTR_SRC_MAC,
2887 NL80211_ATTR_DST_MAC,
2888
2889 /* add attributes here, update the policy in nl80211.c */2880 /* add attributes here, update the policy in nl80211.c */
2890 2881
2891 __NL80211_ATTR_AFTER_LAST,2882 __NL80211_ATTR_AFTER_LAST,
@@ -5548,10 +5539,6 @@ enum nl80211_feature_flags { · 2656 unmodified lines
5548 * feature, which prevents bufferbloat by using the expected transmission5539 * feature, which prevents bufferbloat by using the expected transmission
5549 * time to limit the amount of data buffered in the hardware.5540 * time to limit the amount of data buffered in the hardware.
5550 *5541 *
5551 * @NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211_MAC_ADDRS: The driver
5552 * can use src and dst MAC addresses with control port over nl80211 rx
5553 * and tx operations.
5554 *
5555 * @NUM_NL80211_EXT_FEATURES: number of extended features.5542 * @NUM_NL80211_EXT_FEATURES: number of extended features.
5556 * @MAX_NL80211_EXT_FEATURES: highest extended feature index.5543 * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
5557 */5544 */
@@ -5599,7 +5586,6 @@ enum nl80211_ext_feature_index { · 41 unmodified lines
5599 NL80211_EXT_FEATURE_SAE_OFFLOAD,5586 NL80211_EXT_FEATURE_SAE_OFFLOAD,
5600 NL80211_EXT_FEATURE_VLAN_OFFLOAD,5587 NL80211_EXT_FEATURE_VLAN_OFFLOAD,
5601 NL80211_EXT_FEATURE_AQL,5588 NL80211_EXT_FEATURE_AQL,
5602 NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211_MAC_ADDRS,
5603 5589
5604 /* add new features before the definition below */5590 /* add new features before the definition below */
5605 NUM_NL80211_EXT_FEATURES,5591 NUM_NL80211_EXT_FEATURES,
net/mac80211/ieee80211_i.h+1−2
@@ -1792,8 +1792,7 @@ void ieee80211_check_fast_xmit_iface(struct ieee80211_sub_if_data *sdata); · 1791 unmodified lines
1792void ieee80211_clear_fast_xmit(struct sta_info *sta);1792void ieee80211_clear_fast_xmit(struct sta_info *sta);
1793int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,1793int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
1794 const u8 *buf, size_t len,1794 const u8 *buf, size_t len,
1795 const u8 *dest, const u8 *src, __be16 proto,1795 const u8 *dest, __be16 proto, bool unencrypted);
1796 bool unencrypted);
1797int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev,1796int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev,
1798 const u8 *buf, size_t len);1797 const u8 *buf, size_t len);
1799 1798
net/mac80211/tx.c+1−2
@@ -5283,8 +5283,7 @@ void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata, · 5282 unmodified lines
5283 5283
5284int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,5284int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
5285 const u8 *buf, size_t len,5285 const u8 *buf, size_t len,
5286 const u8 *dest, const u8 *src, __be16 proto,5286 const u8 *dest, __be16 proto, bool unencrypted)
5287 bool unencrypted)
5288{5287{
5289 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);5288 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
5290 struct ieee80211_local *local = sdata->local;5289 struct ieee80211_local *local = sdata->local;
net/wireless/nl80211.c+3−15
@@ -634,8 +634,6 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { · 633 unmodified lines
634 [NL80211_ATTR_HE_OBSS_PD] = NLA_POLICY_NESTED(he_obss_pd_policy),634 [NL80211_ATTR_HE_OBSS_PD] = NLA_POLICY_NESTED(he_obss_pd_policy),
635 [NL80211_ATTR_VLAN_ID] = NLA_POLICY_RANGE(NLA_U16, 1, VLAN_N_VID - 2),635 [NL80211_ATTR_VLAN_ID] = NLA_POLICY_RANGE(NLA_U16, 1, VLAN_N_VID - 2),
636 [NL80211_ATTR_HE_BSS_COLOR] = NLA_POLICY_NESTED(he_bss_color_policy),636 [NL80211_ATTR_HE_BSS_COLOR] = NLA_POLICY_NESTED(he_bss_color_policy),
637 [NL80211_ATTR_SRC_MAC] = NLA_POLICY_ETH_ADDR,
638 [NL80211_ATTR_DST_MAC] = NLA_POLICY_ETH_ADDR,
639};637};
640 638
641/* policy for the key attributes */639/* policy for the key attributes */
@@ -13698,7 +13696,6 @@ static int nl80211_tx_control_port(struct sk_buff *skb, struct genl_info *info) · 13056 unmodified lines
13698 const u8 *buf;13696 const u8 *buf;
13699 size_t len;13697 size_t len;
13700 u8 *dest;13698 u8 *dest;
13701 u8 src[ETH_ALEN];
13702 u16 proto;13699 u16 proto;
13703 bool noencrypt;13700 bool noencrypt;
13704 int err;13701 int err;
@@ -13736,13 +13733,6 @@ static int nl80211_tx_control_port(struct sk_buff *skb, struct genl_info *info) · 31 unmodified lines
13736 goto out;13733 goto out;
13737 }13734 }
13738 13735
13739 /* copy src address under wdev_lock, as we may copy wdev_address */
13740 if (info->attrs[NL80211_ATTR_SRC_MAC])
13741 ether_addr_copy(src,
13742 nla_data(info->attrs[NL80211_ATTR_SRC_MAC]));
13743 else
13744 ether_addr_copy(src, wdev_address(wdev));
13745
13746 wdev_unlock(wdev);13736 wdev_unlock(wdev);
13747 13737
13748 buf = nla_data(info->attrs[NL80211_ATTR_FRAME]);13738 buf = nla_data(info->attrs[NL80211_ATTR_FRAME]);
@@ -13753,7 +13743,7 @@ static int nl80211_tx_control_port(struct sk_buff *skb, struct genl_info *info) · 4 unmodified lines
13753 nla_get_flag(info->attrs[NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT]);13743 nla_get_flag(info->attrs[NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT]);
13754 13744
13755 return rdev_tx_control_port(rdev, dev, buf, len,13745 return rdev_tx_control_port(rdev, dev, buf, len,
13756 dest, src, cpu_to_be16(proto), noencrypt);13746 dest, cpu_to_be16(proto), noencrypt);
13757 13747
13758 out:13748 out:
13759 wdev_unlock(wdev);13749 wdev_unlock(wdev);
@@ -16010,8 +16000,7 @@ static int __nl80211_rx_control_port(struct net_device *dev, · 2250 unmodified lines
16010 struct wireless_dev *wdev = dev->ieee80211_ptr;16000 struct wireless_dev *wdev = dev->ieee80211_ptr;
16011 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);16001 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
16012 struct ethhdr *ehdr = eth_hdr(skb);16002 struct ethhdr *ehdr = eth_hdr(skb);
16013 const u8 *daddr = ehdr->h_dest;16003 const u8 *addr = ehdr->h_source;
16014 const u8 *saddr = ehdr->h_source;
16015 u16 proto = be16_to_cpu(skb->protocol);16004 u16 proto = be16_to_cpu(skb->protocol);
16016 struct sk_buff *msg;16005 struct sk_buff *msg;
16017 void *hdr;16006 void *hdr;
@@ -16036,8 +16025,7 @@ static int __nl80211_rx_control_port(struct net_device *dev, · 18 unmodified lines
16036 nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) ||16025 nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) ||
16037 nla_put_u64_64bit(msg, NL80211_ATTR_WDEV, wdev_id(wdev),16026 nla_put_u64_64bit(msg, NL80211_ATTR_WDEV, wdev_id(wdev),
16038 NL80211_ATTR_PAD) ||16027 NL80211_ATTR_PAD) ||
16039 nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, saddr) ||16028 nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr) ||
16040 nla_put(msg, NL80211_ATTR_DST_MAC, ETH_ALEN, daddr) ||
16041 nla_put_u16(msg, NL80211_ATTR_CONTROL_PORT_ETHERTYPE, proto) ||16029 nla_put_u16(msg, NL80211_ATTR_CONTROL_PORT_ETHERTYPE, proto) ||
16042 (unencrypted && nla_put_flag(msg,16030 (unencrypted && nla_put_flag(msg,
16043 NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT)))16031 NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT)))
net/wireless/rdev-ops.h+4−4
@@ -734,14 +734,14 @@ static inline int rdev_mgmt_tx(struct cfg80211_registered_device *rdev, · 733 unmodified lines
734static inline int rdev_tx_control_port(struct cfg80211_registered_device *rdev,734static inline int rdev_tx_control_port(struct cfg80211_registered_device *rdev,
735 struct net_device *dev,735 struct net_device *dev,
736 const void *buf, size_t len,736 const void *buf, size_t len,
737 const u8 *dest, const u8 *src,737 const u8 *dest, __be16 proto,
738 __be16 proto, const bool noencrypt)738 const bool noencrypt)
739{739{
740 int ret;740 int ret;
741 trace_rdev_tx_control_port(&rdev->wiphy, dev, buf, len,741 trace_rdev_tx_control_port(&rdev->wiphy, dev, buf, len,
742 dest, src, proto, noencrypt);742 dest, proto, noencrypt);
743 ret = rdev->ops->tx_control_port(&rdev->wiphy, dev, buf, len,743 ret = rdev->ops->tx_control_port(&rdev->wiphy, dev, buf, len,
744 dest, src, proto, noencrypt);744 dest, proto, noencrypt);
745 trace_rdev_return_int(&rdev->wiphy, ret);745 trace_rdev_return_int(&rdev->wiphy, ret);
746 return ret;746 return ret;
747}747}
net/wireless/trace.h+10−17
@@ -1928,31 +1928,27 @@ TRACE_EVENT(rdev_mgmt_tx, · 1927 unmodified lines
1928 1928
1929TRACE_EVENT(rdev_tx_control_port,1929TRACE_EVENT(rdev_tx_control_port,
1930 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,1930 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
1931 const u8 *buf, size_t len,1931 const u8 *buf, size_t len, const u8 *dest, __be16 proto,
1932 const u8 *dest, const u8 *src, __be16 proto,
1933 bool unencrypted),1932 bool unencrypted),
1934 TP_ARGS(wiphy, netdev, buf, len, dest, src, proto, unencrypted),1933 TP_ARGS(wiphy, netdev, buf, len, dest, proto, unencrypted),
1935 TP_STRUCT__entry(1934 TP_STRUCT__entry(
1936 WIPHY_ENTRY1935 WIPHY_ENTRY
1937 NETDEV_ENTRY1936 NETDEV_ENTRY
1938 MAC_ENTRY(dest)1937 MAC_ENTRY(dest)
1939 MAC_ENTRY(src)1938 __field(__be16, proto)
1940 __field(u16, proto)
1941 __field(bool, unencrypted)1939 __field(bool, unencrypted)
1942 ),1940 ),
1943 TP_fast_assign(1941 TP_fast_assign(
1944 WIPHY_ASSIGN;1942 WIPHY_ASSIGN;
1945 NETDEV_ASSIGN;1943 NETDEV_ASSIGN;
1946 MAC_ASSIGN(dest, dest);1944 MAC_ASSIGN(dest, dest);
1947 MAC_ASSIGN(src, src);1945 __entry->proto = proto;
1948 __entry->proto = be16_to_cpu(proto);
1949 __entry->unencrypted = unencrypted;1946 __entry->unencrypted = unencrypted;
1950 ),1947 ),
1951 TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", dest: " MAC_PR_FMT1948 TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " MAC_PR_FMT ","
1952 ", src: " MAC_PR_FMT ", proto: 0x%x, unencrypted: %s",1949 " proto: 0x%x, unencrypted: %s",
1953 WIPHY_PR_ARG, NETDEV_PR_ARG,1950 WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(dest),
1954 MAC_PR_ARG(dest), MAC_PR_ARG(src),1951 be16_to_cpu(__entry->proto),
1955 __entry->proto,
1956 BOOL_TO_STR(__entry->unencrypted))1952 BOOL_TO_STR(__entry->unencrypted))
1957);1953);
1958 1954
@@ -2844,7 +2840,6 @@ TRACE_EVENT(cfg80211_rx_control_port, · 885 unmodified lines
2844 TP_STRUCT__entry(2840 TP_STRUCT__entry(
2845 NETDEV_ENTRY2841 NETDEV_ENTRY
2846 __field(int, len)2842 __field(int, len)
2847 MAC_ENTRY(to)
2848 MAC_ENTRY(from)2843 MAC_ENTRY(from)
2849 __field(u16, proto)2844 __field(u16, proto)
2850 __field(bool, unencrypted)2845 __field(bool, unencrypted)
@@ -2852,14 +2847,12 @@ TRACE_EVENT(cfg80211_rx_control_port, · 1 unmodified line
2852 TP_fast_assign(2847 TP_fast_assign(
2853 NETDEV_ASSIGN;2848 NETDEV_ASSIGN;
2854 __entry->len = skb->len;2849 __entry->len = skb->len;
2855 MAC_ASSIGN(to, eth_hdr(skb)->h_dest);
2856 MAC_ASSIGN(from, eth_hdr(skb)->h_source);2850 MAC_ASSIGN(from, eth_hdr(skb)->h_source);
2857 __entry->proto = be16_to_cpu(skb->protocol);2851 __entry->proto = be16_to_cpu(skb->protocol);
2858 __entry->unencrypted = unencrypted;2852 __entry->unencrypted = unencrypted;
2859 ),2853 ),
2860 TP_printk(NETDEV_PR_FMT ", len=%d, dest: " MAC_PR_FMT2854 TP_printk(NETDEV_PR_FMT ", len=%d, " MAC_PR_FMT ", proto: 0x%x, unencrypted: %s",
2861 ", src: " MAC_PR_FMT ", proto: 0x%x, unencrypted: %s",2855 NETDEV_PR_ARG, __entry->len, MAC_PR_ARG(from),
2862 NETDEV_PR_ARG, __entry->len, MAC_PR_ARG(to), MAC_PR_ARG(from),
2863 __entry->proto, BOOL_TO_STR(__entry->unencrypted))2856 __entry->proto, BOOL_TO_STR(__entry->unencrypted))
2864);2857);
2865 2858