Skip to content

Commit

Permalink
cfg80211/mac80211: add connected to auth server to meshconf
Browse files Browse the repository at this point in the history
Besides information about num of peerings and gate connectivity,
the mesh formation byte also contains a flag for authentication
server connectivity, that currently cannot be set in the mesh conf.
This patch adds this capability, which is necessary to implement
802.1X authentication in mesh mode.

Signed-off-by: Markus Theil <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Johannes Berg <[email protected]>
  • Loading branch information
thillux authored and jmberg-intel committed Jul 31, 2020
1 parent e3718a6 commit 184eebe
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -1895,6 +1895,7 @@ struct mesh_config {
u16 dot11MeshHWMPnetDiameterTraversalTime;
u8 dot11MeshHWMPRootMode;
bool dot11MeshConnectedToMeshGate;
bool dot11MeshConnectedToAuthServer;
u16 dot11MeshHWMPRannInterval;
bool dot11MeshGateAnnouncementProtocol;
bool dot11MeshForwarding;
Expand Down
5 changes: 5 additions & 0 deletions include/uapi/linux/nl80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -4242,6 +4242,10 @@ enum nl80211_mesh_power_mode {
* better. So if using this setting you will likely also want to disable
* dot11MeshForwarding and use another mesh routing protocol on top.
*
* @NL80211_MESHCONF_CONNECTED_TO_AS: If set to true then this mesh STA
* will advertise that it is connected to a authentication server
* in the mesh formation field.
*
* @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
*/
enum nl80211_meshconf_params {
Expand Down Expand Up @@ -4276,6 +4280,7 @@ enum nl80211_meshconf_params {
NL80211_MESHCONF_PLINK_TIMEOUT,
NL80211_MESHCONF_CONNECTED_TO_GATE,
NL80211_MESHCONF_NOLEARN,
NL80211_MESHCONF_CONNECTED_TO_AS,

/* keep last */
__NL80211_MESHCONF_ATTR_AFTER_LAST,
Expand Down
3 changes: 3 additions & 0 deletions net/mac80211/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2128,6 +2128,9 @@ static int ieee80211_update_mesh_config(struct wiphy *wiphy,
nconf->dot11MeshConnectedToMeshGate;
if (_chg_mesh_attr(NL80211_MESHCONF_NOLEARN, mask))
conf->dot11MeshNolearn = nconf->dot11MeshNolearn;
if (_chg_mesh_attr(NL80211_MESHCONF_CONNECTED_TO_AS, mask))
conf->dot11MeshConnectedToAuthServer =
nconf->dot11MeshConnectedToAuthServer;
ieee80211_mbss_info_change_notify(sdata, BSS_CHANGED_BEACON);
return 0;
}
Expand Down
3 changes: 3 additions & 0 deletions net/mac80211/debugfs_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,8 @@ IEEE80211_IF_FILE(dot11MeshAwakeWindowDuration,
IEEE80211_IF_FILE(dot11MeshConnectedToMeshGate,
u.mesh.mshcfg.dot11MeshConnectedToMeshGate, DEC);
IEEE80211_IF_FILE(dot11MeshNolearn, u.mesh.mshcfg.dot11MeshNolearn, DEC);
IEEE80211_IF_FILE(dot11MeshConnectedToAuthServer,
u.mesh.mshcfg.dot11MeshConnectedToAuthServer, DEC);
#endif

#define DEBUGFS_ADD_MODE(name, mode) \
Expand Down Expand Up @@ -764,6 +766,7 @@ static void add_mesh_config(struct ieee80211_sub_if_data *sdata)
MESHPARAMS_ADD(dot11MeshAwakeWindowDuration);
MESHPARAMS_ADD(dot11MeshConnectedToMeshGate);
MESHPARAMS_ADD(dot11MeshNolearn);
MESHPARAMS_ADD(dot11MeshConnectedToAuthServer);
#undef MESHPARAMS_ADD
}
#endif
Expand Down
5 changes: 4 additions & 1 deletion net/mac80211/mesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ int mesh_add_meshconf_ie(struct ieee80211_sub_if_data *sdata,
bool is_connected_to_gate = ifmsh->num_gates > 0 ||
ifmsh->mshcfg.dot11MeshGateAnnouncementProtocol ||
ifmsh->mshcfg.dot11MeshConnectedToMeshGate;
bool is_connected_to_as = ifmsh->mshcfg.dot11MeshConnectedToAuthServer;

if (skb_tailroom(skb) < 2 + meshconf_len)
return -ENOMEM;
Expand All @@ -284,7 +285,9 @@ int mesh_add_meshconf_ie(struct ieee80211_sub_if_data *sdata,
/* Mesh Formation Info - number of neighbors */
neighbors = atomic_read(&ifmsh->estab_plinks);
neighbors = min_t(int, neighbors, IEEE80211_MAX_MESH_PEERINGS);
*pos++ = (neighbors << 1) | is_connected_to_gate;
*pos++ = (is_connected_to_as << 7) |
(neighbors << 1) |
is_connected_to_gate;
/* Mesh capability */
*pos = 0x00;
*pos |= ifmsh->mshcfg.dot11MeshForwarding ?
Expand Down
8 changes: 7 additions & 1 deletion net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -6887,7 +6887,9 @@ static int nl80211_get_mesh_config(struct sk_buff *skb,
nla_put_u8(msg, NL80211_MESHCONF_CONNECTED_TO_GATE,
cur_params.dot11MeshConnectedToMeshGate) ||
nla_put_u8(msg, NL80211_MESHCONF_NOLEARN,
cur_params.dot11MeshNolearn))
cur_params.dot11MeshNolearn) ||
nla_put_u8(msg, NL80211_MESHCONF_CONNECTED_TO_AS,
cur_params.dot11MeshConnectedToAuthServer))
goto nla_put_failure;
nla_nest_end(msg, pinfoattr);
genlmsg_end(msg, hdr);
Expand Down Expand Up @@ -6946,6 +6948,7 @@ nl80211_meshconf_params_policy[NL80211_MESHCONF_ATTR_MAX+1] = {
[NL80211_MESHCONF_PLINK_TIMEOUT] = { .type = NLA_U32 },
[NL80211_MESHCONF_CONNECTED_TO_GATE] = NLA_POLICY_RANGE(NLA_U8, 0, 1),
[NL80211_MESHCONF_NOLEARN] = NLA_POLICY_RANGE(NLA_U8, 0, 1),
[NL80211_MESHCONF_CONNECTED_TO_AS] = NLA_POLICY_RANGE(NLA_U8, 0, 1),
};

static const struct nla_policy
Expand Down Expand Up @@ -7058,6 +7061,9 @@ do { \
FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshConnectedToMeshGate, mask,
NL80211_MESHCONF_CONNECTED_TO_GATE,
nla_get_u8);
FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshConnectedToAuthServer, mask,
NL80211_MESHCONF_CONNECTED_TO_AS,
nla_get_u8);
/*
* Check HT operation mode based on
* IEEE 802.11-2016 9.4.2.57 HT Operation element.
Expand Down

0 comments on commit 184eebe

Please sign in to comment.