mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2024-11-29 07:33:39 +00:00
rtl8188eu: Remove CL_IPV6_PASS - defined
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
3025b4d1ac
commit
2155b974f3
2 changed files with 12 additions and 118 deletions
|
@ -38,14 +38,12 @@
|
||||||
#include <net/ip6_checksum.h>
|
#include <net/ip6_checksum.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CL_IPV6_PASS
|
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
#include <linux/ipv6.h>
|
#include <linux/ipv6.h>
|
||||||
#include <linux/icmpv6.h>
|
#include <linux/icmpv6.h>
|
||||||
#include <net/ndisc.h>
|
#include <net/ndisc.h>
|
||||||
#include <net/checksum.h>
|
#include <net/checksum.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#define NAT25_IPV4 01
|
#define NAT25_IPV4 01
|
||||||
#define NAT25_IPV6 02
|
#define NAT25_IPV6 02
|
||||||
|
@ -204,8 +202,6 @@ static __inline__ void __nat25_generate_pppoe_network_addr(unsigned char *networ
|
||||||
memcpy(networkAddr+3, (unsigned char *)ac_mac, 6);
|
memcpy(networkAddr+3, (unsigned char *)ac_mac, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef CL_IPV6_PASS
|
|
||||||
static void __nat25_generate_ipv6_network_addr(unsigned char *networkAddr,
|
static void __nat25_generate_ipv6_network_addr(unsigned char *networkAddr,
|
||||||
unsigned int *ipAddr)
|
unsigned int *ipAddr)
|
||||||
{
|
{
|
||||||
|
@ -215,7 +211,6 @@ static void __nat25_generate_ipv6_network_addr(unsigned char *networkAddr,
|
||||||
memcpy(networkAddr+1, (unsigned char *)ipAddr, 16);
|
memcpy(networkAddr+1, (unsigned char *)ipAddr, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static unsigned char *scan_tlv(unsigned char *data, int len, unsigned char tag, unsigned char len8b)
|
static unsigned char *scan_tlv(unsigned char *data, int len, unsigned char tag, unsigned char len8b)
|
||||||
{
|
{
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
|
@ -228,7 +223,6 @@ static unsigned char *scan_tlv(unsigned char *data, int len, unsigned char tag,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char *replace_mac)
|
static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char *replace_mac)
|
||||||
{
|
{
|
||||||
struct icmp6hdr *icmphdr = (struct icmp6hdr *)data;
|
struct icmp6hdr *icmphdr = (struct icmp6hdr *)data;
|
||||||
|
@ -245,8 +239,7 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (icmphdr->icmp6_type == NDISC_ROUTER_ADVERTISEMENT) {
|
||||||
else if (icmphdr->icmp6_type == NDISC_ROUTER_ADVERTISEMENT) {
|
|
||||||
if (len >= 16) {
|
if (len >= 16) {
|
||||||
mac = scan_tlv(&data[16], len-16, 1, 1);
|
mac = scan_tlv(&data[16], len-16, 1, 1);
|
||||||
if (mac) {
|
if (mac) {
|
||||||
|
@ -257,8 +250,7 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (icmphdr->icmp6_type == NDISC_NEIGHBOUR_SOLICITATION) {
|
||||||
else if (icmphdr->icmp6_type == NDISC_NEIGHBOUR_SOLICITATION) {
|
|
||||||
if (len >= 24) {
|
if (len >= 24) {
|
||||||
mac = scan_tlv(&data[24], len-24, 1, 1);
|
mac = scan_tlv(&data[24], len-24, 1, 1);
|
||||||
if (mac) {
|
if (mac) {
|
||||||
|
@ -269,8 +261,7 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (icmphdr->icmp6_type == NDISC_NEIGHBOUR_ADVERTISEMENT) {
|
||||||
else if (icmphdr->icmp6_type == NDISC_NEIGHBOUR_ADVERTISEMENT) {
|
|
||||||
if (len >= 24) {
|
if (len >= 24) {
|
||||||
mac = scan_tlv(&data[24], len-24, 2, 1);
|
mac = scan_tlv(&data[24], len-24, 2, 1);
|
||||||
if (mac) {
|
if (mac) {
|
||||||
|
@ -281,8 +272,7 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (icmphdr->icmp6_type == NDISC_REDIRECT) {
|
||||||
else if (icmphdr->icmp6_type == NDISC_REDIRECT) {
|
|
||||||
if (len >= 40) {
|
if (len >= 40) {
|
||||||
mac = scan_tlv(&data[40], len-40, 2, 1);
|
mac = scan_tlv(&data[40], len-40, 2, 1);
|
||||||
if (mac) {
|
if (mac) {
|
||||||
|
@ -297,14 +287,11 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void convert_ipv6_mac_to_mc(struct sk_buff *skb)
|
static void convert_ipv6_mac_to_mc(struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + ETH_HLEN);
|
struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + ETH_HLEN);
|
||||||
unsigned char *dst_mac = skb->data;
|
unsigned char *dst_mac = skb->data;
|
||||||
|
|
||||||
/* dst_mac[0] = 0xff; */
|
|
||||||
/* dst_mac[1] = 0xff; */
|
|
||||||
/*modified by qinjunjie,ipv6 multicast address ix 0x33-33-xx-xx-xx-xx*/
|
/*modified by qinjunjie,ipv6 multicast address ix 0x33-33-xx-xx-xx-xx*/
|
||||||
dst_mac[0] = 0x33;
|
dst_mac[0] = 0x33;
|
||||||
dst_mac[1] = 0x33;
|
dst_mac[1] = 0x33;
|
||||||
|
@ -314,8 +301,6 @@ static void convert_ipv6_mac_to_mc(struct sk_buff *skb)
|
||||||
skb->pkt_type = PACKET_MULTICAST;
|
skb->pkt_type = PACKET_MULTICAST;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* CL_IPV6_PASS */
|
|
||||||
|
|
||||||
|
|
||||||
static __inline__ int __nat25_network_hash(unsigned char *networkAddr)
|
static __inline__ int __nat25_network_hash(unsigned char *networkAddr)
|
||||||
{
|
{
|
||||||
|
@ -351,10 +336,7 @@ static __inline__ int __nat25_network_hash(unsigned char *networkAddr)
|
||||||
x = networkAddr[0] ^ networkAddr[1] ^ networkAddr[2] ^ networkAddr[3] ^ networkAddr[4] ^ networkAddr[5] ^ networkAddr[6] ^ networkAddr[7] ^ networkAddr[8];
|
x = networkAddr[0] ^ networkAddr[1] ^ networkAddr[2] ^ networkAddr[3] ^ networkAddr[4] ^ networkAddr[5] ^ networkAddr[6] ^ networkAddr[7] ^ networkAddr[8];
|
||||||
|
|
||||||
return x & (NAT25_HASH_SIZE - 1);
|
return x & (NAT25_HASH_SIZE - 1);
|
||||||
}
|
} else if (networkAddr[0] == NAT25_IPV6) {
|
||||||
#ifdef CL_IPV6_PASS
|
|
||||||
else if (networkAddr[0] == NAT25_IPV6)
|
|
||||||
{
|
|
||||||
unsigned long x;
|
unsigned long x;
|
||||||
|
|
||||||
x = networkAddr[1] ^ networkAddr[2] ^ networkAddr[3] ^ networkAddr[4] ^ networkAddr[5] ^
|
x = networkAddr[1] ^ networkAddr[2] ^ networkAddr[3] ^ networkAddr[4] ^ networkAddr[5] ^
|
||||||
|
@ -363,10 +345,7 @@ static __inline__ int __nat25_network_hash(unsigned char *networkAddr)
|
||||||
networkAddr[16];
|
networkAddr[16];
|
||||||
|
|
||||||
return x & (NAT25_HASH_SIZE - 1);
|
return x & (NAT25_HASH_SIZE - 1);
|
||||||
}
|
} else {
|
||||||
#endif
|
|
||||||
else
|
|
||||||
{
|
|
||||||
unsigned long x = 0;
|
unsigned long x = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -377,7 +356,6 @@ static __inline__ int __nat25_network_hash(unsigned char *networkAddr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static __inline__ void __network_hash_link(_adapter *priv,
|
static __inline__ void __network_hash_link(_adapter *priv,
|
||||||
struct nat25_network_db_entry *ent, int hash)
|
struct nat25_network_db_entry *ent, int hash)
|
||||||
{
|
{
|
||||||
|
@ -429,7 +407,6 @@ static int __nat25_db_network_lookup_and_replace(_adapter *priv,
|
||||||
memcpy(skb->data, db->macAddr, ETH_ALEN);
|
memcpy(skb->data, db->macAddr, ETH_ALEN);
|
||||||
atomic_inc(&db->use_count);
|
atomic_inc(&db->use_count);
|
||||||
|
|
||||||
#ifdef CL_IPV6_PASS
|
|
||||||
DEBUG_INFO("NAT25: Lookup M:%02x%02x%02x%02x%02x%02x N:%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
|
DEBUG_INFO("NAT25: Lookup M:%02x%02x%02x%02x%02x%02x N:%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
|
||||||
"%02x%02x%02x%02x%02x%02x\n",
|
"%02x%02x%02x%02x%02x%02x\n",
|
||||||
db->macAddr[0],
|
db->macAddr[0],
|
||||||
|
@ -455,26 +432,6 @@ static int __nat25_db_network_lookup_and_replace(_adapter *priv,
|
||||||
db->networkAddr[14],
|
db->networkAddr[14],
|
||||||
db->networkAddr[15],
|
db->networkAddr[15],
|
||||||
db->networkAddr[16]);
|
db->networkAddr[16]);
|
||||||
#else
|
|
||||||
DEBUG_INFO("NAT25: Lookup M:%02x%02x%02x%02x%02x%02x N:%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n",
|
|
||||||
db->macAddr[0],
|
|
||||||
db->macAddr[1],
|
|
||||||
db->macAddr[2],
|
|
||||||
db->macAddr[3],
|
|
||||||
db->macAddr[4],
|
|
||||||
db->macAddr[5],
|
|
||||||
db->networkAddr[0],
|
|
||||||
db->networkAddr[1],
|
|
||||||
db->networkAddr[2],
|
|
||||||
db->networkAddr[3],
|
|
||||||
db->networkAddr[4],
|
|
||||||
db->networkAddr[5],
|
|
||||||
db->networkAddr[6],
|
|
||||||
db->networkAddr[7],
|
|
||||||
db->networkAddr[8],
|
|
||||||
db->networkAddr[9],
|
|
||||||
db->networkAddr[10]);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
_exit_critical_bh(&priv->br_ext_lock, &irqL);
|
_exit_critical_bh(&priv->br_ext_lock, &irqL);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -487,7 +444,6 @@ static int __nat25_db_network_lookup_and_replace(_adapter *priv,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void __nat25_db_network_insert(_adapter *priv,
|
static void __nat25_db_network_insert(_adapter *priv,
|
||||||
unsigned char *macAddr, unsigned char *networkAddr)
|
unsigned char *macAddr, unsigned char *networkAddr)
|
||||||
{
|
{
|
||||||
|
@ -548,7 +504,6 @@ static void __nat25_db_print(_adapter *priv)
|
||||||
|
|
||||||
while (db != NULL)
|
while (db != NULL)
|
||||||
{
|
{
|
||||||
#ifdef CL_IPV6_PASS
|
|
||||||
panic_printk("NAT25: DB(%d) H(%02d) C(%d) M:%02x%02x%02x%02x%02x%02x N:%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
|
panic_printk("NAT25: DB(%d) H(%02d) C(%d) M:%02x%02x%02x%02x%02x%02x N:%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
|
||||||
"%02x%02x%02x%02x%02x%02x\n",
|
"%02x%02x%02x%02x%02x%02x\n",
|
||||||
j,
|
j,
|
||||||
|
@ -577,29 +532,6 @@ static void __nat25_db_print(_adapter *priv)
|
||||||
db->networkAddr[14],
|
db->networkAddr[14],
|
||||||
db->networkAddr[15],
|
db->networkAddr[15],
|
||||||
db->networkAddr[16]);
|
db->networkAddr[16]);
|
||||||
#else
|
|
||||||
panic_printk("NAT25: DB(%d) H(%02d) C(%d) M:%02x%02x%02x%02x%02x%02x N:%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n",
|
|
||||||
j,
|
|
||||||
i,
|
|
||||||
atomic_read(&db->use_count),
|
|
||||||
db->macAddr[0],
|
|
||||||
db->macAddr[1],
|
|
||||||
db->macAddr[2],
|
|
||||||
db->macAddr[3],
|
|
||||||
db->macAddr[4],
|
|
||||||
db->macAddr[5],
|
|
||||||
db->networkAddr[0],
|
|
||||||
db->networkAddr[1],
|
|
||||||
db->networkAddr[2],
|
|
||||||
db->networkAddr[3],
|
|
||||||
db->networkAddr[4],
|
|
||||||
db->networkAddr[5],
|
|
||||||
db->networkAddr[6],
|
|
||||||
db->networkAddr[7],
|
|
||||||
db->networkAddr[8],
|
|
||||||
db->networkAddr[9],
|
|
||||||
db->networkAddr[10]);
|
|
||||||
#endif
|
|
||||||
j++;
|
j++;
|
||||||
|
|
||||||
db = db->next_hash;
|
db = db->next_hash;
|
||||||
|
@ -671,7 +603,6 @@ void nat25_db_expire(_adapter *priv)
|
||||||
if (atomic_dec_and_test(&f->use_count))
|
if (atomic_dec_and_test(&f->use_count))
|
||||||
{
|
{
|
||||||
#ifdef BR_EXT_DEBUG
|
#ifdef BR_EXT_DEBUG
|
||||||
#ifdef CL_IPV6_PASS
|
|
||||||
panic_printk("NAT25 Expire H(%02d) M:%02x%02x%02x%02x%02x%02x N:%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
|
panic_printk("NAT25 Expire H(%02d) M:%02x%02x%02x%02x%02x%02x N:%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
|
||||||
"%02x%02x%02x%02x%02x%02x\n",
|
"%02x%02x%02x%02x%02x%02x\n",
|
||||||
i,
|
i,
|
||||||
|
@ -698,31 +629,8 @@ void nat25_db_expire(_adapter *priv)
|
||||||
f->networkAddr[14],
|
f->networkAddr[14],
|
||||||
f->networkAddr[15],
|
f->networkAddr[15],
|
||||||
f->networkAddr[16]);
|
f->networkAddr[16]);
|
||||||
#else
|
|
||||||
|
|
||||||
panic_printk("NAT25 Expire H(%02d) M:%02x%02x%02x%02x%02x%02x N:%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n",
|
|
||||||
i,
|
|
||||||
f->macAddr[0],
|
|
||||||
f->macAddr[1],
|
|
||||||
f->macAddr[2],
|
|
||||||
f->macAddr[3],
|
|
||||||
f->macAddr[4],
|
|
||||||
f->macAddr[5],
|
|
||||||
f->networkAddr[0],
|
|
||||||
f->networkAddr[1],
|
|
||||||
f->networkAddr[2],
|
|
||||||
f->networkAddr[3],
|
|
||||||
f->networkAddr[4],
|
|
||||||
f->networkAddr[5],
|
|
||||||
f->networkAddr[6],
|
|
||||||
f->networkAddr[7],
|
|
||||||
f->networkAddr[8],
|
|
||||||
f->networkAddr[9],
|
|
||||||
f->networkAddr[10]);
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
if (priv->scdb_entry == f) {
|
||||||
if (priv->scdb_entry == f)
|
|
||||||
{
|
|
||||||
memset(priv->scdb_mac, 0, ETH_ALEN);
|
memset(priv->scdb_mac, 0, ETH_ALEN);
|
||||||
memset(priv->scdb_ip, 0, 4);
|
memset(priv->scdb_ip, 0, 4);
|
||||||
priv->scdb_entry = NULL;
|
priv->scdb_entry = NULL;
|
||||||
|
@ -731,7 +639,6 @@ void nat25_db_expire(_adapter *priv)
|
||||||
rtw_mfree((u8 *) f, sizeof(struct nat25_network_db_entry));
|
rtw_mfree((u8 *) f, sizeof(struct nat25_network_db_entry));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
f = g;
|
f = g;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1361,7 +1268,6 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
||||||
/*---------------------------------------------------*/
|
/*---------------------------------------------------*/
|
||||||
/* Handle IPV6 frame */
|
/* Handle IPV6 frame */
|
||||||
/*---------------------------------------------------*/
|
/*---------------------------------------------------*/
|
||||||
#ifdef CL_IPV6_PASS
|
|
||||||
else if (protocol == ETH_P_IPV6)
|
else if (protocol == ETH_P_IPV6)
|
||||||
{
|
{
|
||||||
struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + ETH_HLEN);
|
struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + ETH_HLEN);
|
||||||
|
@ -1426,12 +1332,9 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* CL_IPV6_PASS */
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int nat25_handle_frame(_adapter *priv, struct sk_buff *skb)
|
int nat25_handle_frame(_adapter *priv, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
#ifdef BR_EXT_DEBUG
|
#ifdef BR_EXT_DEBUG
|
||||||
|
|
|
@ -20,36 +20,27 @@
|
||||||
#ifndef _RTW_BR_EXT_H_
|
#ifndef _RTW_BR_EXT_H_
|
||||||
#define _RTW_BR_EXT_H_
|
#define _RTW_BR_EXT_H_
|
||||||
|
|
||||||
#if 1 // rtw_wifi_driver
|
|
||||||
#define CL_IPV6_PASS 1
|
|
||||||
#define MACADDRLEN 6
|
#define MACADDRLEN 6
|
||||||
#define _DEBUG_ERR DBG_88E
|
#define _DEBUG_ERR DBG_88E
|
||||||
#define _DEBUG_INFO //DBG_88E
|
#define _DEBUG_INFO //DBG_88E
|
||||||
#define DEBUG_WARN DBG_88E
|
#define DEBUG_WARN DBG_88E
|
||||||
#define DEBUG_INFO //DBG_88E
|
#define DEBUG_INFO //DBG_88E
|
||||||
#define DEBUG_ERR DBG_88E
|
#define DEBUG_ERR DBG_88E
|
||||||
//#define GET_MY_HWADDR ((GET_MIB(priv))->dot11OperationEntry.hwaddr)
|
|
||||||
#define GET_MY_HWADDR(padapter) ((padapter)->eeprompriv.mac_addr)
|
#define GET_MY_HWADDR(padapter) ((padapter)->eeprompriv.mac_addr)
|
||||||
#endif // rtw_wifi_driver
|
|
||||||
|
|
||||||
#define NAT25_HASH_BITS 4
|
#define NAT25_HASH_BITS 4
|
||||||
#define NAT25_HASH_SIZE (1 << NAT25_HASH_BITS)
|
#define NAT25_HASH_SIZE (1 << NAT25_HASH_BITS)
|
||||||
#define NAT25_AGEING_TIME 300
|
#define NAT25_AGEING_TIME 300
|
||||||
|
|
||||||
#ifdef CL_IPV6_PASS
|
|
||||||
#define MAX_NETWORK_ADDR_LEN 17
|
#define MAX_NETWORK_ADDR_LEN 17
|
||||||
#else
|
|
||||||
#define MAX_NETWORK_ADDR_LEN 11
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct nat25_network_db_entry
|
struct nat25_network_db_entry {
|
||||||
{
|
|
||||||
struct nat25_network_db_entry *next_hash;
|
struct nat25_network_db_entry *next_hash;
|
||||||
struct nat25_network_db_entry **pprev_hash;
|
struct nat25_network_db_entry **pprev_hash;
|
||||||
atomic_t use_count;
|
atomic_t use_count;
|
||||||
unsigned char macAddr[6];
|
unsigned char macAddr[6];
|
||||||
unsigned long ageing_timer;
|
unsigned long ageing_timer;
|
||||||
unsigned char networkAddr[MAX_NETWORK_ADDR_LEN];
|
unsigned char networkAddr[MAX_NETWORK_ADDR_LEN];
|
||||||
};
|
};
|
||||||
|
|
||||||
enum NAT25_METHOD {
|
enum NAT25_METHOD {
|
||||||
|
|
Loading…
Reference in a new issue