diff options
| author | Jouni Malinen <jouni@qca.qualcomm.com> | 2015-08-13 13:03:23 +0000 |
|---|---|---|
| committer | Linux Build Service Account <lnxbuild@localhost> | 2015-10-06 03:20:06 -0600 |
| commit | 7cd598a02d5d1ed0a231bbe05e79609abce5205d (patch) | |
| tree | 1dde0f39a89f5cc900d0b290306e1c4d7ba20bc6 /src/drivers | |
| parent | a7435c662174b9fc4d3db99f1ea8999be4e7a0b8 (diff) | |
| download | android_external_wpa_supplicant_8-7cd598a02d5d1ed0a231bbe05e79609abce5205d.tar.gz android_external_wpa_supplicant_8-7cd598a02d5d1ed0a231bbe05e79609abce5205d.tar.bz2 android_external_wpa_supplicant_8-7cd598a02d5d1ed0a231bbe05e79609abce5205d.zip | |
nl80211: Use nla_put_nested() to set NL80211_ATTR_MAC_ADDRS
This allows an empty nested list (i.e., no MAC addresses) to be included
in the NL80211_CMD_SET_MAC_ACL message unlike with
nla_nest_start()/nla_nest_end() where the current libnl implementation
removes the "empty" attribute and causes cfg80211 to reject the command.
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Git-commit: f429ec443f4166c747fbf31944f05b51fffbc735
Git-repo : git://w1.fi/srv/git/hostap.git
Change-Id: I68be7d7ddee575509c3354ad8f0ddb38b59c7c03
CRs-fixed: 898046
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/driver_nl80211.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 9011646c..43a49f24 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -3258,7 +3258,7 @@ static int wpa_driver_nl80211_set_acl(void *priv, struct i802_bss *bss = priv; struct wpa_driver_nl80211_data *drv = bss->drv; struct nl_msg *msg; - struct nlattr *acl; + struct nl_msg *acl; unsigned int i; int ret; @@ -3271,23 +3271,26 @@ static int wpa_driver_nl80211_set_acl(void *priv, wpa_printf(MSG_DEBUG, "nl80211: Set %s ACL (num_mac_acl=%u)", params->acl_policy ? "Accept" : "Deny", params->num_mac_acl); + acl = nlmsg_alloc(); + if (!acl) + return -ENOMEM; + for (i = 0; i < params->num_mac_acl; i++) { + if (nla_put(acl, i + 1, ETH_ALEN, params->mac_acl[i].addr)) { + nlmsg_free(acl); + return -ENOMEM; + } + } + if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_SET_MAC_ACL)) || nla_put_u32(msg, NL80211_ATTR_ACL_POLICY, params->acl_policy ? NL80211_ACL_POLICY_DENY_UNLESS_LISTED : NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED) || - (acl = nla_nest_start(msg, NL80211_ATTR_MAC_ADDRS)) == NULL) { + nla_put_nested(msg, NL80211_ATTR_MAC_ADDRS, acl)) { nlmsg_free(msg); + nlmsg_free(acl); return -ENOMEM; } - - for (i = 0; i < params->num_mac_acl; i++) { - if (nla_put(msg, i + 1, ETH_ALEN, params->mac_acl[i].addr)) { - nlmsg_free(msg); - return -ENOMEM; - } - } - - nla_nest_end(msg, acl); + nlmsg_free(acl); ret = send_and_recv_msgs(drv, msg, NULL, NULL); if (ret) { |
