Commit e3da574a authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

cfg80211: allow wext to remove keys that don't exist

Some applications using wireless extensions expect to be able to
remove a key that doesn't exist. One example is wpa_supplicant
which doesn't actually change behaviour when running into an
error while trying to do that, but it prints an error message
which users interpret as wpa_supplicant having problems.

The safe thing to do is not change the behaviour of wireless
extensions any more, so when the driver reports -ENOENT let
the wext bridge code return success to userspace. To guarantee
this, also document that drivers should return -ENOENT when the
key doesn't exist.
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 73606d00
...@@ -781,10 +781,11 @@ enum wiphy_params_flags { ...@@ -781,10 +781,11 @@ enum wiphy_params_flags {
* @get_key: get information about the key with the given parameters. * @get_key: get information about the key with the given parameters.
* @mac_addr will be %NULL when requesting information for a group * @mac_addr will be %NULL when requesting information for a group
* key. All pointers given to the @callback function need not be valid * key. All pointers given to the @callback function need not be valid
* after it returns. * after it returns. This function should return an error if it is
* not possible to retrieve the key, -ENOENT if it doesn't exist.
* *
* @del_key: remove a key given the @mac_addr (%NULL for a group key) * @del_key: remove a key given the @mac_addr (%NULL for a group key)
* and @key_index * and @key_index, return -ENOENT if the key doesn't exist.
* *
* @set_default_key: set the default key on an interface * @set_default_key: set the default key on an interface
* *
......
...@@ -504,6 +504,13 @@ static int cfg80211_set_encryption(struct cfg80211_registered_device *rdev, ...@@ -504,6 +504,13 @@ static int cfg80211_set_encryption(struct cfg80211_registered_device *rdev,
else if (idx == wdev->wext.default_mgmt_key) else if (idx == wdev->wext.default_mgmt_key)
wdev->wext.default_mgmt_key = -1; wdev->wext.default_mgmt_key = -1;
} }
/*
* Applications using wireless extensions expect to be
* able to delete keys that don't exist, so allow that.
*/
if (err == -ENOENT)
return 0;
return err; return err;
} else { } else {
if (addr) if (addr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment