Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions core/rtw_br_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
#include <linux/atalk.h>
#include <linux/udp.h>
#include <linux/if_pppox.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 9, 0))
#define pppoe_tag_data(tag) ((char *)(tag) + sizeof(struct pppoe_tag))
#define pppoe_hdr_tag(ph) ((struct pppoe_tag *)((char *)(ph) + sizeof(struct pppoe_hdr)))
#else
#define pppoe_tag_data(tag) ((tag)->tag_data)
#define pppoe_hdr_tag(ph) ((ph)->tag)
#endif
#endif

#if 1 /* rtw_wifi_driver */
Expand Down Expand Up @@ -88,7 +95,7 @@ static unsigned char *__nat25_find_pppoe_tag(struct pppoe_hdr *ph, unsigned shor
unsigned char *cur_ptr, *start_ptr;
unsigned short tagLen, tagType;

start_ptr = cur_ptr = (unsigned char *)ph->tag;
start_ptr = cur_ptr = (unsigned char *)pppoe_hdr_tag(ph);
while ((cur_ptr - start_ptr) < ntohs(ph->length)) {
/* prevent un-alignment access */
tagType = (unsigned short)((cur_ptr[0] << 8) + cur_ptr[1]);
Expand All @@ -114,9 +121,9 @@ static int __nat25_add_pppoe_tag(struct sk_buff *skb, struct pppoe_tag *tag)

skb_put(skb, data_len);
/* have a room for new tag */
memmove(((unsigned char *)ph->tag + data_len), (unsigned char *)ph->tag, ntohs(ph->length));
memmove(((unsigned char *)pppoe_hdr_tag(ph) + data_len), (unsigned char *)pppoe_hdr_tag(ph), ntohs(ph->length));
ph->length = htons(ntohs(ph->length) + data_len);
memcpy((unsigned char *)ph->tag, tag, data_len);
memcpy((unsigned char *)pppoe_hdr_tag(ph), tag, data_len);
return data_len;
}

Expand Down Expand Up @@ -1143,8 +1150,8 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
return -1;
}

memcpy(tag->tag_data + MAGIC_CODE_LEN + RTL_RELAY_TAG_LEN,
pOldTag->tag_data, old_tag_len);
memcpy(pppoe_tag_data(tag) + MAGIC_CODE_LEN + RTL_RELAY_TAG_LEN,
pppoe_tag_data(pOldTag), old_tag_len);

if (skb_pull_and_merge(skb, (unsigned char *)pOldTag, TAG_HDR_LEN + old_tag_len) < 0) {
DEBUG_ERR("call skb_pull_and_merge() failed in PADI/R packet!\n");
Expand All @@ -1157,9 +1164,9 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
tag->tag_len = htons(MAGIC_CODE_LEN + RTL_RELAY_TAG_LEN + old_tag_len);

/* insert the magic_code+client mac in relay tag */
pMagic = (unsigned short *)tag->tag_data;
pMagic = (unsigned short *)pppoe_tag_data(tag);
*pMagic = htons(MAGIC_CODE);
memcpy(tag->tag_data + MAGIC_CODE_LEN, skb->data + ETH_ALEN, ETH_ALEN);
memcpy(pppoe_tag_data(tag) + MAGIC_CODE_LEN, skb->data + ETH_ALEN, ETH_ALEN);

/* Add relay tag */
if (__nat25_add_pppoe_tag(skb, tag) < 0)
Expand Down Expand Up @@ -1220,14 +1227,14 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
return -1;
}

pMagic = (unsigned short *)tag->tag_data;
pMagic = (unsigned short *)pppoe_tag_data(tag);
if (ntohs(*pMagic) != MAGIC_CODE) {
DEBUG_ERR("Can't find MAGIC_CODE in %s packet!\n",
(ph->code == PADO_CODE ? "PADO" : "PADS"));
return -1;
}

memcpy(skb->data, tag->tag_data + MAGIC_CODE_LEN, ETH_ALEN);
memcpy(skb->data, pppoe_tag_data(tag) + MAGIC_CODE_LEN, ETH_ALEN);

if (tagLen > MAGIC_CODE_LEN + RTL_RELAY_TAG_LEN)
offset = TAG_HDR_LEN;
Expand Down
42 changes: 33 additions & 9 deletions os_dep/linux/ioctl_cfg80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
#include <hal_data.h>

#ifdef CONFIG_IOCTL_CFG80211
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0))
#define RTW_WDEV_ARG struct wireless_dev *wdev
#define RTW_WDEV_GET struct net_device *ndev = wdev->netdev
#else
#define RTW_WDEV_ARG struct net_device *ndev
#define RTW_WDEV_GET
#endif

#ifndef DBG_RTW_CFG80211_STA_PARAM
#define DBG_RTW_CFG80211_STA_PARAM 0
Expand Down Expand Up @@ -1700,7 +1707,7 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param
return ret;
}

static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev
static int cfg80211_rtw_add_key(struct wiphy *wiphy, RTW_WDEV_ARG
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
,int link_id
#endif
Expand All @@ -1710,6 +1717,7 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev
#endif
, const u8 *mac_addr, struct key_params *params)
{
RTW_WDEV_GET;
char *alg_name;
u32 param_len;
struct ieee_param *param = NULL;
Expand Down Expand Up @@ -1847,7 +1855,7 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev

}

static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev
static int cfg80211_rtw_get_key(struct wiphy *wiphy, RTW_WDEV_ARG
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
,int link_id
#endif
Expand All @@ -1858,6 +1866,7 @@ static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev
, const u8 *mac_addr, void *cookie
, void (*callback)(void *cookie, struct key_params *))
{
RTW_WDEV_GET;
#define GET_KEY_PARAM_FMT_S " keyid=%d"
#define GET_KEY_PARAM_ARG_S , keyid
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
Expand Down Expand Up @@ -2015,7 +2024,7 @@ static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev
return ret;
}

static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev,
static int cfg80211_rtw_del_key(struct wiphy *wiphy, RTW_WDEV_ARG,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
int link_id,
#endif
Expand All @@ -2025,6 +2034,7 @@ static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev,
u8 key_index, const u8 *mac_addr)
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) */
{
RTW_WDEV_GET;
_adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
struct security_priv *psecuritypriv = &padapter->securitypriv;

Expand Down Expand Up @@ -2091,12 +2101,13 @@ static int cfg80211_rtw_set_default_key(struct wiphy *wiphy,

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30))
int cfg80211_rtw_set_default_mgmt_key(struct wiphy *wiphy,
struct net_device *ndev,
RTW_WDEV_ARG,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
int link_id,
#endif
u8 key_index)
{
RTW_WDEV_GET;
#define SET_DEF_KEY_PARAM_FMT " key_index=%d"
#define SET_DEF_KEY_PARAM_ARG , key_index

Expand Down Expand Up @@ -2241,14 +2252,15 @@ static void rtw_cfg80211_fill_mesh_only_sta_info(struct mesh_plink_ent *plink, s
#endif /* CONFIG_RTW_MESH */

static int cfg80211_rtw_get_station(struct wiphy *wiphy,
struct net_device *ndev,
RTW_WDEV_ARG,
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0))
u8 *mac,
#else
const u8 *mac,
#endif
struct station_info *sinfo)
{
RTW_WDEV_GET;
int ret = 0;
_adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
Expand Down Expand Up @@ -4401,7 +4413,11 @@ void rtw_cfg80211_indicate_sta_assoc(_adapter *padapter, u8 *pmgmt_frame, uint f
sinfo.filled = STATION_INFO_ASSOC_REQ_IES;
sinfo.assoc_req_ies = pmgmt_frame + WLAN_HDR_A3_LEN + ie_offset;
sinfo.assoc_req_ies_len = frame_len - WLAN_HDR_A3_LEN - ie_offset;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0))
cfg80211_new_sta(padapter->rtw_wdev, get_addr2_ptr(pmgmt_frame), &sinfo, GFP_ATOMIC);
#else
cfg80211_new_sta(ndev, get_addr2_ptr(pmgmt_frame), &sinfo, GFP_ATOMIC);
#endif
}
#else /* defined(RTW_USE_CFG80211_STA_EVENT) */
channel = pmlmeext->cur_channel;
Expand Down Expand Up @@ -4447,7 +4463,11 @@ void rtw_cfg80211_indicate_sta_disassoc(_adapter *padapter, const u8 *da, unsign
RTW_INFO(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));

#if defined(RTW_USE_CFG80211_STA_EVENT) || defined(COMPAT_KERNEL_RELEASE)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0))
cfg80211_del_sta(padapter->rtw_wdev, da, GFP_ATOMIC);
#else
cfg80211_del_sta(ndev, da, GFP_ATOMIC);
#endif
#else /* defined(RTW_USE_CFG80211_STA_EVENT) */
channel = pmlmeext->cur_channel;
freq = rtw_ch2freq(channel);
Expand Down Expand Up @@ -5368,14 +5388,15 @@ void dump_station_parameters(void *sel, struct wiphy *wiphy, const struct statio
#endif /* DBG_RTW_CFG80211_STA_PARAM */
}

static int cfg80211_rtw_add_station(struct wiphy *wiphy, struct net_device *ndev,
static int cfg80211_rtw_add_station(struct wiphy *wiphy, RTW_WDEV_ARG,
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0))
u8 *mac,
#else
const u8 *mac,
#endif
struct station_parameters *params)
{
RTW_WDEV_GET;
int ret = 0;
_adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
Comment on lines 5398 to 5401
#if defined(CONFIG_TDLS) || defined(CONFIG_RTW_MESH)
Expand Down Expand Up @@ -5536,7 +5557,7 @@ static int cfg80211_rtw_add_station(struct wiphy *wiphy, struct net_device *ndev
return ret;
}

static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev,
static int cfg80211_rtw_del_station(struct wiphy *wiphy, RTW_WDEV_ARG,
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0))
u8 *mac
#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0))
Expand All @@ -5546,6 +5567,7 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev
#endif
)
{
RTW_WDEV_GET;
int ret = 0;
_irqL irqL;
_list *phead, *plist;
Expand Down Expand Up @@ -5642,14 +5664,15 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev

}

static int cfg80211_rtw_change_station(struct wiphy *wiphy, struct net_device *ndev,
static int cfg80211_rtw_change_station(struct wiphy *wiphy, RTW_WDEV_ARG,
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0))
u8 *mac,
#else
const u8 *mac,
#endif
struct station_parameters *params)
{
RTW_WDEV_GET;
#ifdef CONFIG_RTW_MESH
_adapter *adapter = (_adapter *)rtw_netdev_priv(ndev);
struct sta_priv *stapriv = &adapter->stapriv;
Expand Down Expand Up @@ -5796,9 +5819,10 @@ struct sta_info *rtw_sta_info_get_by_idx(struct sta_priv *pstapriv, const int id
return psta;
}

static int cfg80211_rtw_dump_station(struct wiphy *wiphy, struct net_device *ndev,
static int cfg80211_rtw_dump_station(struct wiphy *wiphy, RTW_WDEV_ARG,
int idx, u8 *mac, struct station_info *sinfo)
{
RTW_WDEV_GET;
#define DBG_DUMP_STATION 0

int ret = 0;
Expand Down
Loading