net: wireless: redpine: add enhancement for MAC Spoofing

Signed-off-by: default avatarAngus Ainslie (Purism) <angus@akkea.ca>
parent 0e54df32
...@@ -142,6 +142,10 @@ int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff *skb) ...@@ -142,6 +142,10 @@ int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff *skb)
wh = (struct ieee80211_hdr *)&skb->data[header_size]; wh = (struct ieee80211_hdr *)&skb->data[header_size];
seq_num = le16_to_cpu(IEEE80211_SEQ_TO_SN(wh->seq_ctrl)); seq_num = le16_to_cpu(IEEE80211_SEQ_TO_SN(wh->seq_ctrl));
vif = rsi_get_vif(adapter, wh->addr2); vif = rsi_get_vif(adapter, wh->addr2);
if(!vif) {
status = -ENOSPC;
goto err;
}
vap_id = ((struct vif_priv *)vif->drv_priv)->vap_id; vap_id = ((struct vif_priv *)vif->drv_priv)->vap_id;
frame_desc[2] = cpu_to_le16(header_size - FRAME_DESC_SZ); frame_desc[2] = cpu_to_le16(header_size - FRAME_DESC_SZ);
......
...@@ -215,6 +215,20 @@ static struct reg_map rsi_caracalla_reg_db[MAX_REG_COUNTRIES] = { ...@@ -215,6 +215,20 @@ static struct reg_map rsi_caracalla_reg_db[MAX_REG_COUNTRIES] = {
{"MA", NL80211_DFS_WORLD}, {"NL", NL80211_DFS_ETSI}, {"MA", NL80211_DFS_WORLD}, {"NL", NL80211_DFS_ETSI},
}; };
#endif #endif
static int rsi_validate_mac_addr(struct rsi_common *common, u8 *addr_t)
{
u8 addr[ETH_ALEN] = {0};
if (!memcmp(addr, addr_t, ETH_ALEN)) {
rsi_dbg(ERR_ZONE, "%s: MAC addr is NULL \n", __func__);
return -1;
} else if (memcmp(common->mac_addr, addr_t, ETH_ALEN)) {
memcpy(common->mac_addr, addr_t, ETH_ALEN);
}
return 0;
}
static int rsi_mac80211_get_chan_survey(struct ieee80211_hw *hw, static int rsi_mac80211_get_chan_survey(struct ieee80211_hw *hw,
int idx, struct survey_info *survey) int idx, struct survey_info *survey)
{ {
...@@ -412,6 +426,8 @@ static int rsi_mac80211_hw_scan_start(struct ieee80211_hw *hw, ...@@ -412,6 +426,8 @@ static int rsi_mac80211_hw_scan_start(struct ieee80211_hw *hw,
/* Scan already in progress. So return */ /* Scan already in progress. So return */
if (common->bgscan_en || common->scan_in_prog) if (common->bgscan_en || common->scan_in_prog)
return -EBUSY; return -EBUSY;
if(rsi_validate_mac_addr(common, vif->addr))
return -ENODEV;
cancel_work_sync(&common->scan_work); cancel_work_sync(&common->scan_work);
mutex_lock(&common->mutex); mutex_lock(&common->mutex);
...@@ -606,9 +622,7 @@ static void rsi_mac80211_tx(struct ieee80211_hw *hw, ...@@ -606,9 +622,7 @@ static void rsi_mac80211_tx(struct ieee80211_hw *hw,
struct ieee80211_bss_conf *bss = &adapter->vifs[0]->bss_conf; struct ieee80211_bss_conf *bss = &adapter->vifs[0]->bss_conf;
#ifndef CONFIG_REDPINE_P2P #ifndef CONFIG_REDPINE_P2P
if ((memcmp(common->mac_addr, wlh->addr2, ETH_ALEN))) { if (rsi_validate_mac_addr(common, wlh->addr2)) {
rsi_dbg(ERR_ZONE,
"%s: MAC ID is not found and dropping this packets\n", __func__);
ieee80211_free_txskb(common->priv->hw, skb); ieee80211_free_txskb(common->priv->hw, skb);
return; return;
} }
......
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