mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2025-05-09 06:43:06 +00:00
rtl8188eu: Backport kernel version
This driver was added to the kernel with version 3.12. The changes in that version are now brought back to the GitHub repo. Essentually all of the code is updated. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
868a407435
commit
19db43ecbd
89 changed files with 2026 additions and 5957 deletions
|
@ -89,7 +89,7 @@ static inline int __nat25_add_pppoe_tag(struct sk_buff *skb, struct pppoe_tag *t
|
|||
struct pppoe_hdr *ph = (struct pppoe_hdr *)(skb->data + ETH_HLEN);
|
||||
int data_len;
|
||||
|
||||
data_len = tag->tag_len + TAG_HDR_LEN;
|
||||
data_len = be16_to_cpu(tag->tag_len) + TAG_HDR_LEN;
|
||||
if (skb_tailroom(skb) < data_len) {
|
||||
_DEBUG_ERR("skb_tailroom() failed in add SID tag!\n");
|
||||
return -1;
|
||||
|
@ -155,44 +155,53 @@ static inline void __nat25_generate_ipv4_network_addr(unsigned char *networkAddr
|
|||
|
||||
|
||||
static inline void __nat25_generate_ipx_network_addr_with_node(unsigned char *networkAddr,
|
||||
unsigned int *ipxNetAddr, unsigned char *ipxNodeAddr)
|
||||
__be32 *ipxNetAddr, unsigned char *ipxNodeAddr)
|
||||
{
|
||||
u32 cpu_netaddr = be32_to_cpu(*ipxNetAddr);
|
||||
|
||||
memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
|
||||
|
||||
networkAddr[0] = NAT25_IPX;
|
||||
memcpy(networkAddr+1, (unsigned char *)ipxNetAddr, 4);
|
||||
memcpy(networkAddr+1, &cpu_netaddr, 4);
|
||||
memcpy(networkAddr+5, ipxNodeAddr, 6);
|
||||
}
|
||||
|
||||
|
||||
static inline void __nat25_generate_ipx_network_addr_with_socket(unsigned char *networkAddr,
|
||||
unsigned int *ipxNetAddr, unsigned short *ipxSocketAddr)
|
||||
__be32 *ipxNetAddr, __be16 *ipxSocketAddr)
|
||||
{
|
||||
u32 cpu_netaddr = be32_to_cpu(*ipxNetAddr);
|
||||
u16 cpu_sockaddr = be16_to_cpu(*ipxSocketAddr);
|
||||
|
||||
memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
|
||||
|
||||
networkAddr[0] = NAT25_IPX;
|
||||
memcpy(networkAddr+1, (unsigned char *)ipxNetAddr, 4);
|
||||
memcpy(networkAddr+5, (unsigned char *)ipxSocketAddr, 2);
|
||||
memcpy(networkAddr+1, &cpu_netaddr, 4);
|
||||
memcpy(networkAddr+5, &cpu_sockaddr, 2);
|
||||
}
|
||||
|
||||
|
||||
static inline void __nat25_generate_apple_network_addr(unsigned char *networkAddr,
|
||||
unsigned short *network, unsigned char *node)
|
||||
__be16 *network, unsigned char *node)
|
||||
{
|
||||
u16 cpu_net = be16_to_cpu(*network);
|
||||
|
||||
memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
|
||||
|
||||
networkAddr[0] = NAT25_APPLE;
|
||||
memcpy(networkAddr+1, (unsigned char *)network, 2);
|
||||
memcpy(networkAddr+1, &cpu_net, 2);
|
||||
networkAddr[3] = *node;
|
||||
}
|
||||
|
||||
static inline void __nat25_generate_pppoe_network_addr(unsigned char *networkAddr,
|
||||
unsigned char *ac_mac, unsigned short *sid)
|
||||
unsigned char *ac_mac, __be16 *sid)
|
||||
{
|
||||
u16 cpu_sid = be16_to_cpu(*sid);
|
||||
|
||||
memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
|
||||
|
||||
networkAddr[0] = NAT25_PPPOE;
|
||||
memcpy(networkAddr+1, (unsigned char *)sid, 2);
|
||||
memcpy(networkAddr+1, &cpu_sid, 2);
|
||||
memcpy(networkAddr+3, (unsigned char *)ac_mac, 6);
|
||||
}
|
||||
|
||||
|
@ -281,17 +290,6 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void convert_ipv6_mac_to_mc(struct sk_buff *skb)
|
||||
{
|
||||
struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + ETH_HLEN);
|
||||
unsigned char *dst_mac = skb->data;
|
||||
|
||||
/*modified by qinjunjie, ipv6 multicast address ix 0x33-33-xx-xx-xx-xx*/
|
||||
dst_mac[0] = 0x33;
|
||||
dst_mac[1] = 0x33;
|
||||
memcpy(&dst_mac[2], &iph->daddr.s6_addr32[3], 4);
|
||||
}
|
||||
|
||||
static inline int __nat25_network_hash(unsigned char *networkAddr)
|
||||
{
|
||||
if (networkAddr[0] == NAT25_IPV4) {
|
||||
|
@ -471,7 +469,7 @@ void nat25_db_cleanup(struct adapter *priv)
|
|||
priv->scdb_entry = NULL;
|
||||
}
|
||||
__network_hash_unlink(f);
|
||||
rtw_mfree((u8 *) f, sizeof(struct nat25_network_db_entry));
|
||||
kfree(f);
|
||||
f = g;
|
||||
}
|
||||
}
|
||||
|
@ -500,7 +498,7 @@ void nat25_db_expire(struct adapter *priv)
|
|||
priv->scdb_entry = NULL;
|
||||
}
|
||||
__network_hash_unlink(f);
|
||||
rtw_mfree((u8 *) f, sizeof(struct nat25_network_db_entry));
|
||||
kfree(f);
|
||||
}
|
||||
}
|
||||
f = g;
|
||||
|
@ -690,6 +688,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
|
|||
if (!memcmp(skb->data+ETH_ALEN, ipx->ipx_source.node, ETH_ALEN))
|
||||
DEBUG_INFO("NAT25: Check IPX skb_copy\n");
|
||||
return 0;
|
||||
return -1;
|
||||
case NAT25_INSERT:
|
||||
DEBUG_INFO("NAT25: Insert IPX, Dest =%08x,%02x%02x%02x%02x%02x%02x,%04x Source =%08x,%02x%02x%02x%02x%02x%02x,%04x\n",
|
||||
ipx->ipx_dest.net,
|
||||
|
@ -822,7 +821,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
|
|||
/* Handle PPPoE frame */
|
||||
/*---------------------------------------------------*/
|
||||
struct pppoe_hdr *ph = (struct pppoe_hdr *)(skb->data + ETH_HLEN);
|
||||
unsigned short *pMagic;
|
||||
__be16 *pMagic;
|
||||
|
||||
switch (method) {
|
||||
case NAT25_CHECK:
|
||||
|
@ -860,7 +859,7 @@ int nat25_db_handle(struct 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 = (__be16 *)tag->tag_data;
|
||||
*pMagic = htons(MAGIC_CODE);
|
||||
memcpy(tag->tag_data+MAGIC_CODE_LEN, skb->data+ETH_ALEN, ETH_ALEN);
|
||||
|
||||
|
@ -923,8 +922,8 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
|
|||
return -1;
|
||||
}
|
||||
|
||||
pMagic = (unsigned short *)tag->tag_data;
|
||||
if (ntohs(*pMagic) != MAGIC_CODE) {
|
||||
pMagic = (__be16 *)tag->tag_data;
|
||||
if (be16_to_cpu(*pMagic) != MAGIC_CODE) {
|
||||
DEBUG_ERR("Can't find MAGIC_CODE in %s packet!\n",
|
||||
(ph->code == PADO_CODE ? "PADO" : "PADS"));
|
||||
return -1;
|
||||
|
@ -1029,11 +1028,12 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
|
|||
if (update_nd_link_layer_addr(skb->data + ETH_HLEN + sizeof(*iph),
|
||||
skb->len - ETH_HLEN - sizeof(*iph), GET_MY_HWADDR(priv))) {
|
||||
struct icmp6hdr *hdr = (struct icmp6hdr *)(skb->data + ETH_HLEN + sizeof(*iph));
|
||||
u32 len = __be16_to_cpu(iph->payload_len);
|
||||
hdr->icmp6_cksum = 0;
|
||||
hdr->icmp6_cksum = csum_ipv6_magic(&iph->saddr, &iph->daddr,
|
||||
iph->payload_len,
|
||||
len,
|
||||
IPPROTO_ICMPV6,
|
||||
csum_partial((__u8 *)hdr, iph->payload_len, 0));
|
||||
csum_partial((__u8 *)hdr, len, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1128,7 +1128,7 @@ struct dhcpMessage {
|
|||
u_int8_t hops;
|
||||
u_int32_t xid;
|
||||
u_int16_t secs;
|
||||
u_int16_t flags;
|
||||
__be16 flags;
|
||||
u_int32_t ciaddr;
|
||||
u_int32_t yiaddr;
|
||||
u_int32_t siaddr;
|
||||
|
@ -1136,7 +1136,7 @@ struct dhcpMessage {
|
|||
u_int8_t chaddr[16];
|
||||
u_int8_t sname[64];
|
||||
u_int8_t file[128];
|
||||
u_int32_t cookie;
|
||||
__be32 cookie;
|
||||
u_int8_t options[308]; /* 312 - cookie */
|
||||
};
|
||||
|
||||
|
@ -1163,17 +1163,17 @@ void dhcp_flag_bcast(struct adapter *priv, struct sk_buff *skb)
|
|||
if (cookie == DHCP_MAGIC) { /* match magic word */
|
||||
if (!(dhcph->flags & htons(BROADCAST_FLAG))) {
|
||||
/* if not broadcast */
|
||||
register int sum = 0;
|
||||
register int sum;
|
||||
|
||||
DEBUG_INFO("DHCP: change flag of DHCP request to broadcast.\n");
|
||||
/* or BROADCAST flag */
|
||||
dhcph->flags |= htons(BROADCAST_FLAG);
|
||||
/* recalculate checksum */
|
||||
sum = ~(udph->check) & 0xffff;
|
||||
sum = (__force int)(~(udph->check)) & 0xffff;
|
||||
sum += be16_to_cpu(dhcph->flags);
|
||||
while (sum >> 16)
|
||||
sum = (sum & 0xffff) + (sum >> 16);
|
||||
udph->check = ~sum;
|
||||
udph->check = (__force __sum16)~sum;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue