@@ -1290,6 +1290,7 @@ struct cfg80211_crypto_settings {
bool control_port_no_encrypt;
bool control_port_over_nl80211;
bool control_port_no_preauth;
+ u16 control_port_vlan_id;
const u8 *psk;
const u8 *sae_pwd;
u8 sae_pwd_len;
@@ -4963,7 +4964,7 @@ struct cfg80211_ops {
const u8 *buf, size_t len,
const u8 *dest, const __be16 proto,
const bool noencrypt, int link_id,
- u64 *cookie);
+ u64 *cookie, u16 vlan_id);
int (*get_ftm_responder_stats)(struct wiphy *wiphy,
struct net_device *dev,
@@ -2899,6 +2899,9 @@ enum nl80211_commands {
* APs Support". Drivers may set additional flags that they support
* in the kernel or device.
*
+ * @NL80211_ATTR_CONTROL_PORT_VLAN_ID: 16-bit VLAN ID used for 8021Q when
+ * we would like to receive/send tagged control protocol frames.
+ *
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3456,6 +3459,8 @@ enum nl80211_attrs {
NL80211_ATTR_ASSOC_MLD_EXT_CAPA_OPS,
+ NL80211_ATTR_CONTROL_PORT_VLAN_ID,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
@@ -851,6 +851,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
[NL80211_ATTR_MLO_RECONF_REM_LINKS] = { .type = NLA_U16 },
[NL80211_ATTR_EPCS] = { .type = NLA_FLAG },
[NL80211_ATTR_ASSOC_MLD_EXT_CAPA_OPS] = { .type = NLA_U16 },
+ [NL80211_ATTR_CONTROL_PORT_VLAN_ID] = { .type = NLA_U16 },
};
/* policy for the key attributes */
@@ -11004,6 +11005,10 @@ static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,
} else
settings->control_port_ethertype = cpu_to_be16(ETH_P_PAE);
+ if (info->attrs[NL80211_ATTR_CONTROL_PORT_VLAN_ID])
+ settings->control_port_vlan_id = nla_get_u16(
+ info->attrs[NL80211_ATTR_CONTROL_PORT_VLAN_ID]);
+
if (info->attrs[NL80211_ATTR_CONTROL_PORT_OVER_NL80211]) {
int r = validate_pae_over_nl80211(rdev, info);
@@ -15795,6 +15800,7 @@ static int nl80211_tx_control_port(struct sk_buff *skb, struct genl_info *info)
u8 *dest;
u16 proto;
bool noencrypt;
+ u16 vlan_id = 0;
u64 cookie = 0;
int link_id;
int err;
@@ -15840,9 +15846,12 @@ static int nl80211_tx_control_port(struct sk_buff *skb, struct genl_info *info)
link_id = nl80211_link_id_or_invalid(info->attrs);
+ if (info->attrs[NL80211_ATTR_CONTROL_PORT_VLAN_ID])
+ vlan_id = nla_get_u16(info->attrs[NL80211_ATTR_CONTROL_PORT_VLAN_ID]);
+
err = rdev_tx_control_port(rdev, dev, buf, len,
dest, cpu_to_be16(proto), noencrypt, link_id,
- dont_wait_for_ack ? NULL : &cookie);
+ dont_wait_for_ack ? NULL : &cookie, vlan_id);
if (!err && !dont_wait_for_ack)
nl_set_extack_cookie_u64(info->extack, cookie);
return err;
@@ -769,13 +769,14 @@ static inline int rdev_tx_control_port(struct cfg80211_registered_device *rdev,
const void *buf, size_t len,
const u8 *dest, __be16 proto,
const bool noencrypt, int link,
- u64 *cookie)
+ u64 *cookie, u16 vlan_id)
{
int ret;
trace_rdev_tx_control_port(&rdev->wiphy, dev, buf, len,
dest, proto, noencrypt, link);
ret = rdev->ops->tx_control_port(&rdev->wiphy, dev, buf, len,
- dest, proto, noencrypt, link, cookie);
+ dest, proto, noencrypt, link,
+ cookie, vlan_id);
if (cookie)
trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
else
Allow to setup 8021Q VLAN ID when handle control port packets. When set for tx direction lower layer should also add 8021Q header when send control packet. For rx direction lower layer should remove 8021Q header. Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com> --- include/net/cfg80211.h | 3 ++- include/uapi/linux/nl80211.h | 5 +++++ net/wireless/nl80211.c | 11 ++++++++++- net/wireless/rdev-ops.h | 5 +++-- 4 files changed, 20 insertions(+), 4 deletions(-)