aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2011-01-09 17:54:50 (GMT)
committerJouni Malinen <j@w1.fi>2011-01-09 17:54:50 (GMT)
commit60ea8187c9db60694d15d5abbd292b3b6016f9c0 (patch)
treec53d80a690e0439a8f6da370f3d64efce8d28c64 /src
parent0382097ef3530497950c53cb5bb1866cbbe82b7b (diff)
downloadhostap-60ea8187c9db60694d15d5abbd292b3b6016f9c0.zip
hostap-60ea8187c9db60694d15d5abbd292b3b6016f9c0.tar.gz
hostap-60ea8187c9db60694d15d5abbd292b3b6016f9c0.tar.bz2
nl80211: Set NL80211_ATTR_KEY_DEFAULT_TYPES based on set_key addr
This allows mac80211 to configure default keys properly for RSN IBSS mode.
Diffstat (limited to 'src')
-rw-r--r--src/drivers/driver_nl80211.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 8197fdb..acb8f33 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -2649,6 +2649,19 @@ static int wpa_driver_nl80211_set_key(const char *ifname, void *priv,
NLA_PUT_U32(msg, NL80211_ATTR_KEY_TYPE,
NL80211_KEYTYPE_GROUP);
}
+ } else if (addr && is_broadcast_ether_addr(addr)) {
+ struct nl_msg *types;
+ int err;
+ wpa_printf(MSG_DEBUG, " broadcast key");
+ types = nlmsg_alloc();
+ if (!types)
+ goto nla_put_failure;
+ NLA_PUT_FLAG(types, NL80211_KEY_DEFAULT_TYPE_MULTICAST);
+ err = nla_put_nested(msg, NL80211_ATTR_KEY_DEFAULT_TYPES,
+ types);
+ nlmsg_free(types);
+ if (err)
+ goto nla_put_failure;
}
NLA_PUT_U8(msg, NL80211_ATTR_KEY_IDX, key_idx);
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, ifindex);
@@ -2682,6 +2695,31 @@ static int wpa_driver_nl80211_set_key(const char *ifname, void *priv,
NLA_PUT_FLAG(msg, NL80211_ATTR_KEY_DEFAULT_MGMT);
else
NLA_PUT_FLAG(msg, NL80211_ATTR_KEY_DEFAULT);
+ if (addr && is_broadcast_ether_addr(addr)) {
+ struct nl_msg *types;
+ int err;
+ types = nlmsg_alloc();
+ if (!types)
+ goto nla_put_failure;
+ NLA_PUT_FLAG(types, NL80211_KEY_DEFAULT_TYPE_MULTICAST);
+ err = nla_put_nested(msg, NL80211_ATTR_KEY_DEFAULT_TYPES,
+ types);
+ nlmsg_free(types);
+ if (err)
+ goto nla_put_failure;
+ } else if (addr) {
+ struct nl_msg *types;
+ int err;
+ types = nlmsg_alloc();
+ if (!types)
+ goto nla_put_failure;
+ NLA_PUT_FLAG(types, NL80211_KEY_DEFAULT_TYPE_UNICAST);
+ err = nla_put_nested(msg, NL80211_ATTR_KEY_DEFAULT_TYPES,
+ types);
+ nlmsg_free(types);
+ if (err)
+ goto nla_put_failure;
+ }
ret = send_and_recv_msgs(drv, msg, NULL, NULL);
if (ret == -ENOENT)