mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2025-05-09 14:53:05 +00:00
Change "if(" to "if (" and the same changes for "while", "for", "switch" and "do"
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
124abebb96
commit
a55f866a62
105 changed files with 6893 additions and 6893 deletions
|
@ -90,11 +90,11 @@ static __inline__ unsigned char *__nat25_find_pppoe_tag(struct pppoe_hdr *ph, un
|
|||
unsigned short tagLen, tagType;
|
||||
|
||||
start_ptr = cur_ptr = (unsigned char *)ph->tag;
|
||||
while((cur_ptr - start_ptr) < ntohs(ph->length)) {
|
||||
while ((cur_ptr - start_ptr) < ntohs(ph->length)) {
|
||||
// prevent un-alignment access
|
||||
tagType = (unsigned short)((cur_ptr[0] << 8) + cur_ptr[1]);
|
||||
tagLen = (unsigned short)((cur_ptr[2] << 8) + cur_ptr[3]);
|
||||
if(tagType == type)
|
||||
if (tagType == type)
|
||||
return cur_ptr;
|
||||
cur_ptr = cur_ptr + TAG_HDR_LEN + tagLen;
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ static __inline__ unsigned long __nat25_timeout(_adapter *priv)
|
|||
static __inline__ int __nat25_has_expired(_adapter *priv,
|
||||
struct nat25_network_db_entry *fdb)
|
||||
{
|
||||
if(time_before_eq(fdb->ageing_timer, __nat25_timeout(priv)))
|
||||
if (time_before_eq(fdb->ageing_timer, __nat25_timeout(priv)))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
@ -330,7 +330,7 @@ static void convert_ipv6_mac_to_mc(struct sk_buff *skb)
|
|||
|
||||
static __inline__ int __nat25_network_hash(unsigned char *networkAddr)
|
||||
{
|
||||
if(networkAddr[0] == NAT25_IPV4)
|
||||
if (networkAddr[0] == NAT25_IPV4)
|
||||
{
|
||||
unsigned long x;
|
||||
|
||||
|
@ -338,7 +338,7 @@ static __inline__ int __nat25_network_hash(unsigned char *networkAddr)
|
|||
|
||||
return x & (NAT25_HASH_SIZE - 1);
|
||||
}
|
||||
else if(networkAddr[0] == NAT25_IPX)
|
||||
else if (networkAddr[0] == NAT25_IPX)
|
||||
{
|
||||
unsigned long x;
|
||||
|
||||
|
@ -347,7 +347,7 @@ static __inline__ int __nat25_network_hash(unsigned char *networkAddr)
|
|||
|
||||
return x & (NAT25_HASH_SIZE - 1);
|
||||
}
|
||||
else if(networkAddr[0] == NAT25_APPLE)
|
||||
else if (networkAddr[0] == NAT25_APPLE)
|
||||
{
|
||||
unsigned long x;
|
||||
|
||||
|
@ -355,7 +355,7 @@ static __inline__ int __nat25_network_hash(unsigned char *networkAddr)
|
|||
|
||||
return x & (NAT25_HASH_SIZE - 1);
|
||||
}
|
||||
else if(networkAddr[0] == NAT25_PPPOE)
|
||||
else if (networkAddr[0] == NAT25_PPPOE)
|
||||
{
|
||||
unsigned long x;
|
||||
|
||||
|
@ -364,7 +364,7 @@ static __inline__ int __nat25_network_hash(unsigned char *networkAddr)
|
|||
return x & (NAT25_HASH_SIZE - 1);
|
||||
}
|
||||
#ifdef CL_IPV6_PASS
|
||||
else if(networkAddr[0] == NAT25_IPV6)
|
||||
else if (networkAddr[0] == NAT25_IPV6)
|
||||
{
|
||||
unsigned long x;
|
||||
|
||||
|
@ -397,7 +397,7 @@ static __inline__ void __network_hash_link(_adapter *priv,
|
|||
//_enter_critical_bh(&priv->br_ext_lock, &irqL);
|
||||
|
||||
ent->next_hash = priv->nethash[hash];
|
||||
if(ent->next_hash != NULL)
|
||||
if (ent->next_hash != NULL)
|
||||
ent->next_hash->pprev_hash = &ent->next_hash;
|
||||
priv->nethash[hash] = ent;
|
||||
ent->pprev_hash = &priv->nethash[hash];
|
||||
|
@ -413,7 +413,7 @@ static __inline__ void __network_hash_unlink(struct nat25_network_db_entry *ent)
|
|||
//_enter_critical_bh(&priv->br_ext_lock, &irqL);
|
||||
|
||||
*(ent->pprev_hash) = ent->next_hash;
|
||||
if(ent->next_hash != NULL)
|
||||
if (ent->next_hash != NULL)
|
||||
ent->next_hash->pprev_hash = ent->pprev_hash;
|
||||
ent->next_hash = NULL;
|
||||
ent->pprev_hash = NULL;
|
||||
|
@ -432,9 +432,9 @@ static int __nat25_db_network_lookup_and_replace(_adapter *priv,
|
|||
db = priv->nethash[__nat25_network_hash(networkAddr)];
|
||||
while (db != NULL)
|
||||
{
|
||||
if(!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN))
|
||||
if (!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN))
|
||||
{
|
||||
if(!__nat25_has_expired(priv, db))
|
||||
if (!__nat25_has_expired(priv, db))
|
||||
{
|
||||
// replace the destination mac address
|
||||
memcpy(skb->data, db->macAddr, ETH_ALEN);
|
||||
|
@ -511,7 +511,7 @@ static void __nat25_db_network_insert(_adapter *priv,
|
|||
db = priv->nethash[hash];
|
||||
while (db != NULL)
|
||||
{
|
||||
if(!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN))
|
||||
if (!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN))
|
||||
{
|
||||
memcpy(db->macAddr, macAddr, ETH_ALEN);
|
||||
db->ageing_timer = jiffies;
|
||||
|
@ -523,7 +523,7 @@ static void __nat25_db_network_insert(_adapter *priv,
|
|||
}
|
||||
|
||||
db = (struct nat25_network_db_entry *) rtw_malloc(sizeof(*db));
|
||||
if(db == NULL) {
|
||||
if (db == NULL) {
|
||||
_exit_critical_bh(&priv->br_ext_lock, &irqL);
|
||||
return;
|
||||
}
|
||||
|
@ -550,10 +550,10 @@ static void __nat25_db_print(_adapter *priv)
|
|||
struct nat25_network_db_entry *db;
|
||||
|
||||
counter++;
|
||||
if((counter % 16) != 0)
|
||||
if ((counter % 16) != 0)
|
||||
return;
|
||||
|
||||
for(i=0, j=0; i<NAT25_HASH_SIZE; i++)
|
||||
for (i=0, j=0; i<NAT25_HASH_SIZE; i++)
|
||||
{
|
||||
db = priv->nethash[i];
|
||||
|
||||
|
@ -634,7 +634,7 @@ void nat25_db_cleanup(_adapter *priv)
|
|||
_irqL irqL;
|
||||
_enter_critical_bh(&priv->br_ext_lock, &irqL);
|
||||
|
||||
for(i=0; i<NAT25_HASH_SIZE; i++)
|
||||
for (i=0; i<NAT25_HASH_SIZE; i++)
|
||||
{
|
||||
struct nat25_network_db_entry *f;
|
||||
f = priv->nethash[i];
|
||||
|
@ -642,7 +642,7 @@ void nat25_db_cleanup(_adapter *priv)
|
|||
struct nat25_network_db_entry *g;
|
||||
|
||||
g = f->next_hash;
|
||||
if(priv->scdb_entry == f)
|
||||
if (priv->scdb_entry == f)
|
||||
{
|
||||
memset(priv->scdb_mac, 0, ETH_ALEN);
|
||||
memset(priv->scdb_ip, 0, 4);
|
||||
|
@ -665,7 +665,7 @@ void nat25_db_expire(_adapter *priv)
|
|||
_irqL irqL;
|
||||
_enter_critical_bh(&priv->br_ext_lock, &irqL);
|
||||
|
||||
//if(!priv->ethBrExtInfo.nat25_disable)
|
||||
//if (!priv->ethBrExtInfo.nat25_disable)
|
||||
{
|
||||
for (i=0; i<NAT25_HASH_SIZE; i++)
|
||||
{
|
||||
|
@ -677,9 +677,9 @@ void nat25_db_expire(_adapter *priv)
|
|||
struct nat25_network_db_entry *g;
|
||||
g = f->next_hash;
|
||||
|
||||
if(__nat25_has_expired(priv, f))
|
||||
if (__nat25_has_expired(priv, f))
|
||||
{
|
||||
if(atomic_dec_and_test(&f->use_count))
|
||||
if (atomic_dec_and_test(&f->use_count))
|
||||
{
|
||||
#ifdef BR_EXT_DEBUG
|
||||
#ifdef CL_IPV6_PASS
|
||||
|
@ -732,7 +732,7 @@ void nat25_db_expire(_adapter *priv)
|
|||
f->networkAddr[10]);
|
||||
#endif
|
||||
#endif
|
||||
if(priv->scdb_entry == f)
|
||||
if (priv->scdb_entry == f)
|
||||
{
|
||||
memset(priv->scdb_mac, 0, ETH_ALEN);
|
||||
memset(priv->scdb_ip, 0, 4);
|
||||
|
@ -785,10 +785,10 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
unsigned short protocol;
|
||||
unsigned char networkAddr[MAX_NETWORK_ADDR_LEN];
|
||||
|
||||
if(skb == NULL)
|
||||
if (skb == NULL)
|
||||
return -1;
|
||||
|
||||
if((method <= NAT25_MIN) || (method >= NAT25_MAX))
|
||||
if ((method <= NAT25_MIN) || (method >= NAT25_MAX))
|
||||
return -1;
|
||||
|
||||
protocol = *((unsigned short *)(skb->data + 2 * ETH_ALEN));
|
||||
|
@ -796,17 +796,17 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
/*---------------------------------------------------*/
|
||||
/* Handle IP frame */
|
||||
/*---------------------------------------------------*/
|
||||
if(protocol == __constant_htons(ETH_P_IP))
|
||||
if (protocol == __constant_htons(ETH_P_IP))
|
||||
{
|
||||
struct iphdr* iph = (struct iphdr *)(skb->data + ETH_HLEN);
|
||||
|
||||
if(((unsigned char*)(iph) + (iph->ihl<<2)) >= (skb->data + ETH_HLEN + skb->len))
|
||||
if (((unsigned char*)(iph) + (iph->ihl<<2)) >= (skb->data + ETH_HLEN + skb->len))
|
||||
{
|
||||
DEBUG_WARN("NAT25: malformed IP packet !\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch(method)
|
||||
switch (method)
|
||||
{
|
||||
case NAT25_CHECK:
|
||||
return -1;
|
||||
|
@ -868,19 +868,19 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
/*---------------------------------------------------*/
|
||||
/* Handle ARP frame */
|
||||
/*---------------------------------------------------*/
|
||||
else if(protocol == __constant_htons(ETH_P_ARP))
|
||||
else if (protocol == __constant_htons(ETH_P_ARP))
|
||||
{
|
||||
struct arphdr *arp = (struct arphdr *)(skb->data + ETH_HLEN);
|
||||
unsigned char *arp_ptr = (unsigned char *)(arp + 1);
|
||||
unsigned int *sender, *target;
|
||||
|
||||
if(arp->ar_pro != __constant_htons(ETH_P_IP))
|
||||
if (arp->ar_pro != __constant_htons(ETH_P_IP))
|
||||
{
|
||||
DEBUG_WARN("NAT25: arp protocol unknown (%4x)!\n", htons(arp->ar_pro));
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch(method)
|
||||
switch (method)
|
||||
{
|
||||
case NAT25_CHECK:
|
||||
return 0; // skb_copy for all ARP frame
|
||||
|
@ -932,7 +932,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
/*---------------------------------------------------*/
|
||||
/* Handle IPX and Apple Talk frame */
|
||||
/*---------------------------------------------------*/
|
||||
else if((protocol == __constant_htons(ETH_P_IPX)) ||
|
||||
else if ((protocol == __constant_htons(ETH_P_IPX)) ||
|
||||
(protocol <= __constant_htons(ETH_FRAME_LEN)))
|
||||
{
|
||||
unsigned char ipx_header[2] = {0xFF, 0xFF};
|
||||
|
@ -941,14 +941,14 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
struct ddpehdr *ddp = NULL;
|
||||
unsigned char *framePtr = skb->data + ETH_HLEN;
|
||||
|
||||
if(protocol == __constant_htons(ETH_P_IPX))
|
||||
if (protocol == __constant_htons(ETH_P_IPX))
|
||||
{
|
||||
DEBUG_INFO("NAT25: Protocol=IPX (Ethernet II)\n");
|
||||
ipx = (struct ipxhdr *)framePtr;
|
||||
}
|
||||
else if(protocol <= __constant_htons(ETH_FRAME_LEN))
|
||||
else if (protocol <= __constant_htons(ETH_FRAME_LEN))
|
||||
{
|
||||
if(!memcmp(ipx_header, framePtr, 2))
|
||||
if (!memcmp(ipx_header, framePtr, 2))
|
||||
{
|
||||
DEBUG_INFO("NAT25: Protocol=IPX (Ethernet 802.3)\n");
|
||||
ipx = (struct ipxhdr *)framePtr;
|
||||
|
@ -958,7 +958,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
unsigned char ipx_8022_type = 0xE0;
|
||||
unsigned char snap_8022_type = 0xAA;
|
||||
|
||||
if(*framePtr == snap_8022_type)
|
||||
if (*framePtr == snap_8022_type)
|
||||
{
|
||||
unsigned char ipx_snap_id[5] = {0x0, 0x0, 0x0, 0x81, 0x37}; // IPX SNAP ID
|
||||
unsigned char aarp_snap_id[5] = {0x00, 0x00, 0x00, 0x80, 0xF3}; // Apple Talk AARP SNAP ID
|
||||
|
@ -966,20 +966,20 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
|
||||
framePtr += 3; // eliminate the 802.2 header
|
||||
|
||||
if(!memcmp(ipx_snap_id, framePtr, 5))
|
||||
if (!memcmp(ipx_snap_id, framePtr, 5))
|
||||
{
|
||||
framePtr += 5; // eliminate the SNAP header
|
||||
|
||||
DEBUG_INFO("NAT25: Protocol=IPX (Ethernet SNAP)\n");
|
||||
ipx = (struct ipxhdr *)framePtr;
|
||||
}
|
||||
else if(!memcmp(aarp_snap_id, framePtr, 5))
|
||||
else if (!memcmp(aarp_snap_id, framePtr, 5))
|
||||
{
|
||||
framePtr += 5; // eliminate the SNAP header
|
||||
|
||||
ea = (struct elapaarp *)framePtr;
|
||||
}
|
||||
else if(!memcmp(ddp_snap_id, framePtr, 5))
|
||||
else if (!memcmp(ddp_snap_id, framePtr, 5))
|
||||
{
|
||||
framePtr += 5; // eliminate the SNAP header
|
||||
|
||||
|
@ -992,11 +992,11 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
else if(*framePtr == ipx_8022_type)
|
||||
else if (*framePtr == ipx_8022_type)
|
||||
{
|
||||
framePtr += 3; // eliminate the 802.2 header
|
||||
|
||||
if(!memcmp(ipx_header, framePtr, 2))
|
||||
if (!memcmp(ipx_header, framePtr, 2))
|
||||
{
|
||||
DEBUG_INFO("NAT25: Protocol=IPX (Ethernet 802.2)\n");
|
||||
ipx = (struct ipxhdr *)framePtr;
|
||||
|
@ -1012,12 +1012,12 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
return -1;
|
||||
|
||||
/* IPX */
|
||||
if(ipx != NULL)
|
||||
if (ipx != NULL)
|
||||
{
|
||||
switch(method)
|
||||
switch (method)
|
||||
{
|
||||
case NAT25_CHECK:
|
||||
if(!memcmp(skb->data+ETH_ALEN, ipx->ipx_source.node, ETH_ALEN))
|
||||
if (!memcmp(skb->data+ETH_ALEN, ipx->ipx_source.node, ETH_ALEN))
|
||||
{
|
||||
DEBUG_INFO("NAT25: Check IPX skb_copy\n");
|
||||
return 0;
|
||||
|
@ -1044,7 +1044,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
ipx->ipx_source.node[5],
|
||||
ipx->ipx_source.sock);
|
||||
|
||||
if(!memcmp(skb->data+ETH_ALEN, ipx->ipx_source.node, ETH_ALEN))
|
||||
if (!memcmp(skb->data+ETH_ALEN, ipx->ipx_source.node, ETH_ALEN))
|
||||
{
|
||||
DEBUG_INFO("NAT25: Use IPX Net, and Socket as network addr\n");
|
||||
|
||||
|
@ -1066,7 +1066,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
|
||||
case NAT25_LOOKUP:
|
||||
{
|
||||
if(!memcmp(GET_MY_HWADDR(priv), ipx->ipx_dest.node, ETH_ALEN))
|
||||
if (!memcmp(GET_MY_HWADDR(priv), ipx->ipx_dest.node, ETH_ALEN))
|
||||
{
|
||||
DEBUG_INFO("NAT25: Lookup IPX, Modify Destination IPX Node addr\n");
|
||||
|
||||
|
@ -1092,16 +1092,16 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
}
|
||||
|
||||
/* AARP */
|
||||
else if(ea != NULL)
|
||||
else if (ea != NULL)
|
||||
{
|
||||
/* Sanity check fields. */
|
||||
if(ea->hw_len != ETH_ALEN || ea->pa_len != AARP_PA_ALEN)
|
||||
if (ea->hw_len != ETH_ALEN || ea->pa_len != AARP_PA_ALEN)
|
||||
{
|
||||
DEBUG_WARN("NAT25: Appletalk AARP Sanity check fail!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch(method)
|
||||
switch (method)
|
||||
{
|
||||
case NAT25_CHECK:
|
||||
return 0;
|
||||
|
@ -1148,9 +1148,9 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
}
|
||||
|
||||
/* DDP */
|
||||
else if(ddp != NULL)
|
||||
else if (ddp != NULL)
|
||||
{
|
||||
switch(method)
|
||||
switch (method)
|
||||
{
|
||||
case NAT25_CHECK:
|
||||
return -1;
|
||||
|
@ -1196,13 +1196,13 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
/*---------------------------------------------------*/
|
||||
/* Handle PPPoE frame */
|
||||
/*---------------------------------------------------*/
|
||||
else if((protocol == __constant_htons(ETH_P_PPP_DISC)) ||
|
||||
else if ((protocol == __constant_htons(ETH_P_PPP_DISC)) ||
|
||||
(protocol == __constant_htons(ETH_P_PPP_SES)))
|
||||
{
|
||||
struct pppoe_hdr *ph = (struct pppoe_hdr *)(skb->data + ETH_HLEN);
|
||||
unsigned short *pMagic;
|
||||
|
||||
switch(method)
|
||||
switch (method)
|
||||
{
|
||||
case NAT25_CHECK:
|
||||
if (ph->sid == 0)
|
||||
|
@ -1210,9 +1210,9 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
return 1;
|
||||
|
||||
case NAT25_INSERT:
|
||||
if(ph->sid == 0) // Discovery phase according to tag
|
||||
if (ph->sid == 0) // Discovery phase according to tag
|
||||
{
|
||||
if(ph->code == PADI_CODE || ph->code == PADR_CODE)
|
||||
if (ph->code == PADI_CODE || ph->code == PADR_CODE)
|
||||
{
|
||||
if (priv->ethBrExtInfo.addPPPoETag) {
|
||||
struct pppoe_tag *tag, *pOldTag;
|
||||
|
@ -1247,7 +1247,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
memcpy(tag->tag_data+MAGIC_CODE_LEN, skb->data+ETH_ALEN, ETH_ALEN);
|
||||
|
||||
//Add relay tag
|
||||
if(__nat25_add_pppoe_tag(skb, tag) < 0)
|
||||
if (__nat25_add_pppoe_tag(skb, tag) < 0)
|
||||
return -1;
|
||||
|
||||
DEBUG_INFO("NAT25: Insert PPPoE, forward %s packet\n",
|
||||
|
@ -1287,7 +1287,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
return 0;
|
||||
|
||||
case NAT25_LOOKUP:
|
||||
if(ph->code == PADO_CODE || ph->code == PADS_CODE)
|
||||
if (ph->code == PADO_CODE || ph->code == PADS_CODE)
|
||||
{
|
||||
if (priv->ethBrExtInfo.addPPPoETag) {
|
||||
struct pppoe_tag *tag;
|
||||
|
@ -1295,7 +1295,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
unsigned short tagType, tagLen;
|
||||
int offset=0;
|
||||
|
||||
if((ptr = __nat25_find_pppoe_tag(ph, ntohs(PTT_RELAY_SID))) == 0) {
|
||||
if ((ptr = __nat25_find_pppoe_tag(ph, ntohs(PTT_RELAY_SID))) == 0) {
|
||||
DEBUG_ERR("Fail to find PTT_RELAY_SID in FADO!\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -1304,7 +1304,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
tagType = (unsigned short)((ptr[0] << 8) + ptr[1]);
|
||||
tagLen = (unsigned short)((ptr[2] << 8) + ptr[3]);
|
||||
|
||||
if((tagType != ntohs(PTT_RELAY_SID)) || (tagLen < (MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN))) {
|
||||
if ((tagType != ntohs(PTT_RELAY_SID)) || (tagLen < (MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN))) {
|
||||
DEBUG_ERR("Invalid PTT_RELAY_SID tag length [%d]!\n", tagLen);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1342,7 +1342,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
}
|
||||
}
|
||||
else {
|
||||
if(ph->sid != 0)
|
||||
if (ph->sid != 0)
|
||||
{
|
||||
DEBUG_INFO("NAT25: Lookup PPPoE, lookup session packet from %s\n", skb->dev->name);
|
||||
__nat25_generate_pppoe_network_addr(networkAddr, skb->data+ETH_ALEN, &(ph->sid));
|
||||
|
@ -1365,9 +1365,9 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
/*---------------------------------------------------*/
|
||||
/* Handle EAP frame */
|
||||
/*---------------------------------------------------*/
|
||||
else if(protocol == __constant_htons(0x888e))
|
||||
else if (protocol == __constant_htons(0x888e))
|
||||
{
|
||||
switch(method)
|
||||
switch (method)
|
||||
{
|
||||
case NAT25_CHECK:
|
||||
return -1;
|
||||
|
@ -1386,10 +1386,10 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
/*---------------------------------------------------*/
|
||||
/* Handle C-Media proprietary frame */
|
||||
/*---------------------------------------------------*/
|
||||
else if((protocol == __constant_htons(0xe2ae)) ||
|
||||
else if ((protocol == __constant_htons(0xe2ae)) ||
|
||||
(protocol == __constant_htons(0xe2af)))
|
||||
{
|
||||
switch(method)
|
||||
switch (method)
|
||||
{
|
||||
case NAT25_CHECK:
|
||||
return -1;
|
||||
|
@ -1409,7 +1409,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
/* Handle IPV6 frame */
|
||||
/*---------------------------------------------------*/
|
||||
#ifdef CL_IPV6_PASS
|
||||
else if(protocol == __constant_htons(ETH_P_IPV6))
|
||||
else if (protocol == __constant_htons(ETH_P_IPV6))
|
||||
{
|
||||
struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + ETH_HLEN);
|
||||
|
||||
|
@ -1419,7 +1419,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
return -1;
|
||||
}
|
||||
|
||||
switch(method)
|
||||
switch (method)
|
||||
{
|
||||
case NAT25_CHECK:
|
||||
if (skb->data[0] & 1)
|
||||
|
@ -1487,7 +1487,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
int nat25_handle_frame(_adapter *priv, struct sk_buff *skb)
|
||||
{
|
||||
#ifdef BR_EXT_DEBUG
|
||||
if((!priv->ethBrExtInfo.nat25_disable) && (!(skb->data[0] & 1)))
|
||||
if ((!priv->ethBrExtInfo.nat25_disable) && (!(skb->data[0] & 1)))
|
||||
{
|
||||
panic_printk("NAT25: Input Frame: DA=%02x%02x%02x%02x%02x%02x SA=%02x%02x%02x%02x%02x%02x\n",
|
||||
skb->data[0],
|
||||
|
@ -1505,7 +1505,7 @@ int nat25_handle_frame(_adapter *priv, struct sk_buff *skb)
|
|||
}
|
||||
#endif
|
||||
|
||||
if(!(skb->data[0] & 1))
|
||||
if (!(skb->data[0] & 1))
|
||||
{
|
||||
int is_vlan_tag=0, i, retval=0;
|
||||
unsigned short vlan_hdr=0;
|
||||
|
@ -1558,7 +1558,7 @@ int nat25_handle_frame(_adapter *priv, struct sk_buff *skb)
|
|||
*((unsigned short *)(skb->data+ETH_ALEN*2+2)) = vlan_hdr;
|
||||
}
|
||||
|
||||
if(retval == -1) {
|
||||
if (retval == -1) {
|
||||
//DEBUG_ERR("NAT25: Lookup fail!\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -1581,11 +1581,11 @@ void mac_clone(_adapter *priv, unsigned char *addr)
|
|||
|
||||
int mac_clone_handle_frame(_adapter *priv, struct sk_buff *skb)
|
||||
{
|
||||
if(priv->ethBrExtInfo.macclone_enable && !priv->macclone_completed)
|
||||
if (priv->ethBrExtInfo.macclone_enable && !priv->macclone_completed)
|
||||
{
|
||||
if(!(skb->data[ETH_ALEN] & 1)) //// check any other particular MAC add
|
||||
if (!(skb->data[ETH_ALEN] & 1)) //// check any other particular MAC add
|
||||
{
|
||||
if(memcmp(skb->data+ETH_ALEN, GET_MY_HWADDR(priv), ETH_ALEN) &&
|
||||
if (memcmp(skb->data+ETH_ALEN, GET_MY_HWADDR(priv), ETH_ALEN) &&
|
||||
((priv->dev->br_port) &&
|
||||
memcmp(skb->data+ETH_ALEN, priv->br_mac, ETH_ALEN)))
|
||||
{
|
||||
|
@ -1625,30 +1625,30 @@ struct dhcpMessage {
|
|||
|
||||
void dhcp_flag_bcast(_adapter *priv, struct sk_buff *skb)
|
||||
{
|
||||
if(skb == NULL)
|
||||
if (skb == NULL)
|
||||
return;
|
||||
|
||||
if(!priv->ethBrExtInfo.dhcp_bcst_disable)
|
||||
if (!priv->ethBrExtInfo.dhcp_bcst_disable)
|
||||
{
|
||||
unsigned short protocol = *((unsigned short *)(skb->data + 2 * ETH_ALEN));
|
||||
|
||||
if(protocol == __constant_htons(ETH_P_IP)) // IP
|
||||
if (protocol == __constant_htons(ETH_P_IP)) // IP
|
||||
{
|
||||
struct iphdr* iph = (struct iphdr *)(skb->data + ETH_HLEN);
|
||||
|
||||
if(iph->protocol == IPPROTO_UDP) // UDP
|
||||
if (iph->protocol == IPPROTO_UDP) // UDP
|
||||
{
|
||||
struct udphdr *udph = (struct udphdr *)((SIZE_PTR)iph + (iph->ihl << 2));
|
||||
|
||||
if((udph->source == __constant_htons(CLIENT_PORT))
|
||||
if ((udph->source == __constant_htons(CLIENT_PORT))
|
||||
&& (udph->dest == __constant_htons(SERVER_PORT))) // DHCP request
|
||||
{
|
||||
struct dhcpMessage *dhcph =
|
||||
(struct dhcpMessage *)((SIZE_PTR)udph + sizeof(struct udphdr));
|
||||
|
||||
if(dhcph->cookie == __constant_htonl(DHCP_MAGIC)) // match magic word
|
||||
if (dhcph->cookie == __constant_htonl(DHCP_MAGIC)) // match magic word
|
||||
{
|
||||
if(!(dhcph->flags & htons(BROADCAST_FLAG))) // if not broadcast
|
||||
if (!(dhcph->flags & htons(BROADCAST_FLAG))) // if not broadcast
|
||||
{
|
||||
register int sum = 0;
|
||||
|
||||
|
@ -1658,7 +1658,7 @@ void dhcp_flag_bcast(_adapter *priv, struct sk_buff *skb)
|
|||
// recalculate checksum
|
||||
sum = ~(udph->check) & 0xffff;
|
||||
sum += dhcph->flags;
|
||||
while(sum >> 16)
|
||||
while (sum >> 16)
|
||||
sum = (sum & 0xffff) + (sum >> 16);
|
||||
udph->check = ~sum;
|
||||
}
|
||||
|
@ -1684,7 +1684,7 @@ void *scdb_findEntry(_adapter *priv, unsigned char *macAddr,
|
|||
db = priv->nethash[hash];
|
||||
while (db != NULL)
|
||||
{
|
||||
if(!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN)) {
|
||||
if (!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN)) {
|
||||
//_exit_critical_bh(&priv->br_ext_lock, &irqL);
|
||||
return (void *)db;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue