aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/mac80211.h20
-rw-r--r--net/mac80211/cfg.c16
-rw-r--r--net/mac80211/driver-ops.h10
-rw-r--r--net/mac80211/driver-trace.h49
-rw-r--r--net/mac80211/key.c12
5 files changed, 107 insertions, 0 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 4703c0f07ba4..2474019f47d3 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1700,6 +1700,12 @@ enum ieee80211_ampdu_mlme_action {
1700 * which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY. 1700 * which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY.
1701 * The callback must be atomic. 1701 * The callback must be atomic.
1702 * 1702 *
1703 * @set_rekey_data: If the device supports GTK rekeying, for example while the
1704 * host is suspended, it can assign this callback to retrieve the data
1705 * necessary to do GTK rekeying, this is the KEK, KCK and replay counter.
1706 * After rekeying was done it should (for example during resume) notify
1707 * userspace of the new replay counter using ieee80211_gtk_rekey_notify().
1708 *
1703 * @hw_scan: Ask the hardware to service the scan request, no need to start 1709 * @hw_scan: Ask the hardware to service the scan request, no need to start
1704 * the scan state machine in stack. The scan must honour the channel 1710 * the scan state machine in stack. The scan must honour the channel
1705 * configuration done by the regulatory agent in the wiphy's 1711 * configuration done by the regulatory agent in the wiphy's
@@ -1912,6 +1918,9 @@ struct ieee80211_ops {
1912 struct ieee80211_key_conf *conf, 1918 struct ieee80211_key_conf *conf,
1913 struct ieee80211_sta *sta, 1919 struct ieee80211_sta *sta,
1914 u32 iv32, u16 *phase1key); 1920 u32 iv32, u16 *phase1key);
1921 void (*set_rekey_data)(struct ieee80211_hw *hw,
1922 struct ieee80211_vif *vif,
1923 struct cfg80211_gtk_rekey_data *data);
1915 int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1924 int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1916 struct cfg80211_scan_request *req); 1925 struct cfg80211_scan_request *req);
1917 void (*cancel_hw_scan)(struct ieee80211_hw *hw, 1926 void (*cancel_hw_scan)(struct ieee80211_hw *hw,
@@ -2585,6 +2594,17 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
2585void ieee80211_get_tkip_key(struct ieee80211_key_conf *keyconf, 2594void ieee80211_get_tkip_key(struct ieee80211_key_conf *keyconf,
2586 struct sk_buff *skb, 2595 struct sk_buff *skb,
2587 enum ieee80211_tkip_key_type type, u8 *key); 2596 enum ieee80211_tkip_key_type type, u8 *key);
2597
2598/**
2599 * ieee80211_gtk_rekey_notify - notify userspace supplicant of rekeying
2600 * @vif: virtual interface the rekeying was done on
2601 * @bssid: The BSSID of the AP, for checking association
2602 * @replay_ctr: the new replay counter after GTK rekeying
2603 * @gfp: allocation flags
2604 */
2605void ieee80211_gtk_rekey_notify(struct ieee80211_vif *vif, const u8 *bssid,
2606 const u8 *replay_ctr, gfp_t gfp);
2607
2588/** 2608/**
2589 * ieee80211_wake_queue - wake specific queue 2609 * ieee80211_wake_queue - wake specific queue
2590 * @hw: pointer as obtained from ieee80211_alloc_hw(). 2610 * @hw: pointer as obtained from ieee80211_alloc_hw().
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 9fe22cc393c8..295ab747663f 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2101,6 +2101,21 @@ static void ieee80211_get_ringparam(struct wiphy *wiphy,
2101 drv_get_ringparam(local, tx, tx_max, rx, rx_max); 2101 drv_get_ringparam(local, tx, tx_max, rx, rx_max);
2102} 2102}
2103 2103
2104static int ieee80211_set_rekey_data(struct wiphy *wiphy,
2105 struct net_device *dev,
2106 struct cfg80211_gtk_rekey_data *data)
2107{
2108 struct ieee80211_local *local = wiphy_priv(wiphy);
2109 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2110
2111 if (!local->ops->set_rekey_data)
2112 return -EOPNOTSUPP;
2113
2114 drv_set_rekey_data(local, sdata, data);
2115
2116 return 0;
2117}
2118
2104struct cfg80211_ops mac80211_config_ops = { 2119struct cfg80211_ops mac80211_config_ops = {
2105 .add_virtual_intf = ieee80211_add_iface, 2120 .add_virtual_intf = ieee80211_add_iface,
2106 .del_virtual_intf = ieee80211_del_iface, 2121 .del_virtual_intf = ieee80211_del_iface,
@@ -2163,4 +2178,5 @@ struct cfg80211_ops mac80211_config_ops = {
2163 .get_antenna = ieee80211_get_antenna, 2178 .get_antenna = ieee80211_get_antenna,
2164 .set_ringparam = ieee80211_set_ringparam, 2179 .set_ringparam = ieee80211_set_ringparam,
2165 .get_ringparam = ieee80211_get_ringparam, 2180 .get_ringparam = ieee80211_get_ringparam,
2181 .set_rekey_data = ieee80211_set_rekey_data,
2166}; 2182};
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 0e7e4268ddf6..edd2dd79c9be 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -647,4 +647,14 @@ static inline int drv_set_bitrate_mask(struct ieee80211_local *local,
647 return ret; 647 return ret;
648} 648}
649 649
650static inline void drv_set_rekey_data(struct ieee80211_local *local,
651 struct ieee80211_sub_if_data *sdata,
652 struct cfg80211_gtk_rekey_data *data)
653{
654 trace_drv_set_rekey_data(local, sdata, data);
655 if (local->ops->set_rekey_data)
656 local->ops->set_rekey_data(&local->hw, &sdata->vif, data);
657 trace_drv_return_void(local);
658}
659
650#endif /* __MAC80211_DRIVER_OPS */ 660#endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h
index 3cb6795e926d..31a9dfa81f65 100644
--- a/net/mac80211/driver-trace.h
+++ b/net/mac80211/driver-trace.h
@@ -1024,6 +1024,34 @@ TRACE_EVENT(drv_set_bitrate_mask,
1024 ) 1024 )
1025); 1025);
1026 1026
1027TRACE_EVENT(drv_set_rekey_data,
1028 TP_PROTO(struct ieee80211_local *local,
1029 struct ieee80211_sub_if_data *sdata,
1030 struct cfg80211_gtk_rekey_data *data),
1031
1032 TP_ARGS(local, sdata, data),
1033
1034 TP_STRUCT__entry(
1035 LOCAL_ENTRY
1036 VIF_ENTRY
1037 __array(u8, kek, NL80211_KEK_LEN)
1038 __array(u8, kck, NL80211_KCK_LEN)
1039 __array(u8, replay_ctr, NL80211_REPLAY_CTR_LEN)
1040 ),
1041
1042 TP_fast_assign(
1043 LOCAL_ASSIGN;
1044 VIF_ASSIGN;
1045 memcpy(__entry->kek, data->kek, NL80211_KEK_LEN);
1046 memcpy(__entry->kck, data->kck, NL80211_KCK_LEN);
1047 memcpy(__entry->replay_ctr, data->replay_ctr,
1048 NL80211_REPLAY_CTR_LEN);
1049 ),
1050
1051 TP_printk(LOCAL_PR_FMT VIF_PR_FMT,
1052 LOCAL_PR_ARG, VIF_PR_ARG)
1053);
1054
1027/* 1055/*
1028 * Tracing for API calls that drivers call. 1056 * Tracing for API calls that drivers call.
1029 */ 1057 */
@@ -1293,6 +1321,27 @@ DEFINE_EVENT(local_only_evt, api_remain_on_channel_expired,
1293 TP_ARGS(local) 1321 TP_ARGS(local)
1294); 1322);
1295 1323
1324TRACE_EVENT(api_gtk_rekey_notify,
1325 TP_PROTO(struct ieee80211_sub_if_data *sdata,
1326 const u8 *bssid, const u8 *replay_ctr),
1327
1328 TP_ARGS(sdata, bssid, replay_ctr),
1329
1330 TP_STRUCT__entry(
1331 VIF_ENTRY
1332 __array(u8, bssid, ETH_ALEN)
1333 __array(u8, replay_ctr, NL80211_REPLAY_CTR_LEN)
1334 ),
1335
1336 TP_fast_assign(
1337 VIF_ASSIGN;
1338 memcpy(__entry->bssid, bssid, ETH_ALEN);
1339 memcpy(__entry->replay_ctr, replay_ctr, NL80211_REPLAY_CTR_LEN);
1340 ),
1341
1342 TP_printk(VIF_PR_FMT, VIF_PR_ARG)
1343);
1344
1296/* 1345/*
1297 * Tracing for internal functions 1346 * Tracing for internal functions
1298 * (which may also be called in response to driver calls) 1347 * (which may also be called in response to driver calls)
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index fcab5fe726a1..1208a7878bfd 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -613,3 +613,15 @@ void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata)
613 613
614 mutex_unlock(&sdata->local->key_mtx); 614 mutex_unlock(&sdata->local->key_mtx);
615} 615}
616
617
618void ieee80211_gtk_rekey_notify(struct ieee80211_vif *vif, const u8 *bssid,
619 const u8 *replay_ctr, gfp_t gfp)
620{
621 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
622
623 trace_api_gtk_rekey_notify(sdata, bssid, replay_ctr);
624
625 cfg80211_gtk_rekey_notify(sdata->dev, bssid, replay_ctr, gfp);
626}
627EXPORT_SYMBOL_GPL(ieee80211_gtk_rekey_notify);