mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2025-05-09 06:43:06 +00:00
rtl8188eu: Change C90 comments to /* */ form
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
9b5b5c4e12
commit
54abf571c4
21 changed files with 4526 additions and 4764 deletions
|
@ -56,7 +56,7 @@
|
|||
|
||||
#define MAGIC_CODE 0x8186
|
||||
#define MAGIC_CODE_LEN 2
|
||||
#define WAIT_TIME_PPPOE 5 // waiting time for pppoe server in sec
|
||||
#define WAIT_TIME_PPPOE 5 /* waiting time for pppoe server in sec */
|
||||
|
||||
/*-----------------------------------------------------------------
|
||||
How database records network address:
|
||||
|
@ -70,7 +70,7 @@
|
|||
-----------------------------------------------------------------*/
|
||||
|
||||
|
||||
//Find a tag in pppoe frame and return the pointer
|
||||
/* Find a tag in pppoe frame and return the pointer */
|
||||
static __inline__ unsigned char *__nat25_find_pppoe_tag(struct pppoe_hdr *ph, unsigned short type)
|
||||
{
|
||||
unsigned char *cur_ptr, *start_ptr;
|
||||
|
@ -78,7 +78,7 @@ static __inline__ unsigned char *__nat25_find_pppoe_tag(struct pppoe_hdr *ph, un
|
|||
|
||||
start_ptr = cur_ptr = (unsigned char *)ph->tag;
|
||||
while((cur_ptr - start_ptr) < ntohs(ph->length)) {
|
||||
// prevent un-alignment access
|
||||
/* 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)
|
||||
|
@ -101,7 +101,7 @@ static __inline__ int __nat25_add_pppoe_tag(struct sk_buff *skb, struct pppoe_ta
|
|||
}
|
||||
|
||||
skb_put(skb, data_len);
|
||||
// have a room for new tag
|
||||
/* have a room for new tag */
|
||||
memmove(((unsigned char *)ph->tag + data_len), (unsigned char *)ph->tag, ntohs(ph->length));
|
||||
ph->length = htons(ntohs(ph->length) + data_len);
|
||||
memcpy((unsigned char *)ph->tag, tag, data_len);
|
||||
|
@ -301,8 +301,8 @@ 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;
|
||||
|
||||
//dst_mac[0] = 0xff;
|
||||
//dst_mac[1] = 0xff;
|
||||
/* dst_mac[0] = 0xff; */
|
||||
/* dst_mac[1] = 0xff; */
|
||||
/*modified by qinjunjie,ipv6 multicast address ix 0x33-33-xx-xx-xx-xx*/
|
||||
dst_mac[0] = 0x33;
|
||||
dst_mac[1] = 0x33;
|
||||
|
@ -379,9 +379,9 @@ static __inline__ int __nat25_network_hash(unsigned char *networkAddr)
|
|||
static __inline__ void __network_hash_link(struct adapter *priv,
|
||||
struct nat25_network_db_entry *ent, int hash)
|
||||
{
|
||||
// Caller must _enter_critical_bh already!
|
||||
//_irqL irqL;
|
||||
//_enter_critical_bh(&priv->br_ext_lock, &irqL);
|
||||
/* Caller must _enter_critical_bh already! */
|
||||
/* _irqL irqL; */
|
||||
/* _enter_critical_bh(&priv->br_ext_lock, &irqL); */
|
||||
|
||||
ent->next_hash = priv->nethash[hash];
|
||||
if(ent->next_hash != NULL)
|
||||
|
@ -389,15 +389,15 @@ static __inline__ void __network_hash_link(struct adapter *priv,
|
|||
priv->nethash[hash] = ent;
|
||||
ent->pprev_hash = &priv->nethash[hash];
|
||||
|
||||
//_exit_critical_bh(&priv->br_ext_lock, &irqL);
|
||||
/* _exit_critical_bh(&priv->br_ext_lock, &irqL); */
|
||||
}
|
||||
|
||||
|
||||
static __inline__ void __network_hash_unlink(struct nat25_network_db_entry *ent)
|
||||
{
|
||||
// Caller must _enter_critical_bh already!
|
||||
//_irqL irqL;
|
||||
//_enter_critical_bh(&priv->br_ext_lock, &irqL);
|
||||
/* Caller must _enter_critical_bh already! */
|
||||
/* _irqL irqL; */
|
||||
/* _enter_critical_bh(&priv->br_ext_lock, &irqL); */
|
||||
|
||||
*(ent->pprev_hash) = ent->next_hash;
|
||||
if(ent->next_hash != NULL)
|
||||
|
@ -405,7 +405,7 @@ static __inline__ void __network_hash_unlink(struct nat25_network_db_entry *ent)
|
|||
ent->next_hash = NULL;
|
||||
ent->pprev_hash = NULL;
|
||||
|
||||
//_exit_critical_bh(&priv->br_ext_lock, &irqL);
|
||||
/* _exit_critical_bh(&priv->br_ext_lock, &irqL); */
|
||||
}
|
||||
|
||||
|
||||
|
@ -423,7 +423,7 @@ static int __nat25_db_network_lookup_and_replace(struct adapter *priv,
|
|||
{
|
||||
if(!__nat25_has_expired(priv, db))
|
||||
{
|
||||
// replace the destination mac address
|
||||
/* replace the destination mac address */
|
||||
memcpy(skb->data, db->macAddr, ETH_ALEN);
|
||||
atomic_inc(&db->use_count);
|
||||
|
||||
|
@ -571,7 +571,7 @@ void nat25_db_expire(struct 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++)
|
||||
{
|
||||
|
@ -668,13 +668,13 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
|
|||
case NAT25_INSERT:
|
||||
{
|
||||
tmp = be32_to_cpu(iph->saddr);
|
||||
//some muticast with source IP is all zero, maybe other case is illegal
|
||||
//in class A, B, C, host address is all zero or all one is illegal
|
||||
/* some muticast with source IP is all zero, maybe other case is illegal */
|
||||
/* in class A, B, C, host address is all zero or all one is illegal */
|
||||
if (iph->saddr == 0)
|
||||
return 0;
|
||||
DEBUG_INFO("NAT25: Insert IP, SA=%08x, DA=%08x\n", iph->saddr, iph->daddr);
|
||||
__nat25_generate_ipv4_network_addr(networkAddr, &tmp);
|
||||
//record source IP address and , source mac address into db
|
||||
/* record source IP address and , source mac address into db */
|
||||
__nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr);
|
||||
|
||||
__nat25_db_print(priv);
|
||||
|
@ -697,11 +697,11 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
|
|||
|
||||
if (!__nat25_db_network_lookup_and_replace(priv, skb, networkAddr)) {
|
||||
if (*((unsigned char *)&iph->daddr + 3) == 0xff) {
|
||||
// L2 is unicast but L3 is broadcast, make L2 bacome broadcast
|
||||
/* L2 is unicast but L3 is broadcast, make L2 bacome broadcast */
|
||||
DEBUG_INFO("NAT25: Set DA as boardcast\n");
|
||||
memset(skb->data, 0xff, ETH_ALEN);
|
||||
} else {
|
||||
// forward unknow IP packet to upper TCP/IP
|
||||
/* forward unknow IP packet to upper TCP/IP */
|
||||
DEBUG_INFO("NAT25: Replace DA with BR's MAC\n");
|
||||
if ( (*(u32 *)priv->br_mac) == 0 && (*(u16 *)(priv->br_mac+4)) == 0 ) {
|
||||
printk("Re-init netdev_br_init() due to br_mac==0!\n");
|
||||
|
@ -737,14 +737,14 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
|
|||
switch(method)
|
||||
{
|
||||
case NAT25_CHECK:
|
||||
return 0; // skb_copy for all ARP frame
|
||||
return 0; /* skb_copy for all ARP frame */
|
||||
|
||||
case NAT25_INSERT:
|
||||
{
|
||||
DEBUG_INFO("NAT25: Insert ARP, MAC=%02x%02x%02x%02x%02x%02x\n", arp_ptr[0],
|
||||
arp_ptr[1], arp_ptr[2], arp_ptr[3], arp_ptr[4], arp_ptr[5]);
|
||||
|
||||
// change to ARP sender mac address to wlan STA address
|
||||
/* change to ARP sender mac address to wlan STA address */
|
||||
memcpy(arp_ptr, GET_MY_HWADDR(priv), ETH_ALEN);
|
||||
|
||||
arp_ptr += arp->ar_hln;
|
||||
|
@ -771,7 +771,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
|
|||
|
||||
__nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
|
||||
|
||||
// change to ARP target mac address to Lookup result
|
||||
/* change to ARP target mac address to Lookup result */
|
||||
arp_ptr = (unsigned char *)(arp + 1);
|
||||
arp_ptr += (arp->ar_hln + arp->ar_pln);
|
||||
memcpy(arp_ptr, skb->data, ETH_ALEN);
|
||||
|
@ -814,28 +814,28 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
|
|||
|
||||
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
|
||||
unsigned char ddp_snap_id[5] = {0x08, 0x00, 0x07, 0x80, 0x9B}; // Apple Talk DDP SNAP ID
|
||||
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 */
|
||||
unsigned char ddp_snap_id[5] = {0x08, 0x00, 0x07, 0x80, 0x9B}; /* Apple Talk DDP SNAP ID */
|
||||
|
||||
framePtr += 3; // eliminate the 802.2 header
|
||||
framePtr += 3; /* eliminate the 802.2 header */
|
||||
|
||||
if(!memcmp(ipx_snap_id, framePtr, 5))
|
||||
{
|
||||
framePtr += 5; // eliminate the SNAP header
|
||||
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))
|
||||
{
|
||||
framePtr += 5; // eliminate the SNAP header
|
||||
framePtr += 5; /* eliminate the SNAP header */
|
||||
|
||||
ea = (struct elapaarp *)framePtr;
|
||||
}
|
||||
else if(!memcmp(ddp_snap_id, framePtr, 5))
|
||||
{
|
||||
framePtr += 5; // eliminate the SNAP header
|
||||
framePtr += 5; /* eliminate the SNAP header */
|
||||
|
||||
ddp = (struct ddpehdr *)framePtr;
|
||||
}
|
||||
|
@ -848,7 +848,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
|
|||
}
|
||||
else if(*framePtr == ipx_8022_type)
|
||||
{
|
||||
framePtr += 3; // eliminate the 802.2 header
|
||||
framePtr += 3; /* eliminate the 802.2 header */
|
||||
|
||||
if(!memcmp(ipx_header, framePtr, 2))
|
||||
{
|
||||
|
@ -904,7 +904,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
|
|||
|
||||
__nat25_generate_ipx_network_addr_with_socket(networkAddr, &ipx->ipx_source.net, &ipx->ipx_source.sock);
|
||||
|
||||
// change IPX source node addr to wlan STA address
|
||||
/* change IPX source node addr to wlan STA address */
|
||||
memcpy(ipx->ipx_source.node, GET_MY_HWADDR(priv), ETH_ALEN);
|
||||
}
|
||||
else
|
||||
|
@ -928,7 +928,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
|
|||
|
||||
__nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
|
||||
|
||||
// replace IPX destination node addr with Lookup destination MAC addr
|
||||
/* replace IPX destination node addr with Lookup destination MAC addr */
|
||||
memcpy(ipx->ipx_dest.node, skb->data, ETH_ALEN);
|
||||
}
|
||||
else
|
||||
|
@ -962,7 +962,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
|
|||
|
||||
case NAT25_INSERT:
|
||||
{
|
||||
// change to AARP source mac address to wlan STA address
|
||||
/* change to AARP source mac address to wlan STA address */
|
||||
memcpy(ea->hw_src, GET_MY_HWADDR(priv), ETH_ALEN);
|
||||
|
||||
DEBUG_INFO("NAT25: Insert AARP, Source=%d,%d Destination=%d,%d\n",
|
||||
|
@ -991,7 +991,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
|
|||
|
||||
__nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
|
||||
|
||||
// change to AARP destination mac address to Lookup result
|
||||
/* change to AARP destination mac address to Lookup result */
|
||||
memcpy(ea->hw_dst, skb->data, ETH_ALEN);
|
||||
}
|
||||
return 0;
|
||||
|
@ -1064,7 +1064,7 @@ int nat25_db_handle(struct 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)
|
||||
{
|
||||
|
@ -1075,7 +1075,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
|
|||
|
||||
tag = (struct pppoe_tag *)tag_buf;
|
||||
pOldTag = (struct pppoe_tag *)__nat25_find_pppoe_tag(ph, ntohs(PTT_RELAY_SID));
|
||||
if (pOldTag) { // if SID existed, copy old value and delete it
|
||||
if (pOldTag) { /* if SID existed, copy old value and delete it */
|
||||
old_tag_len = ntohs(pOldTag->tag_len);
|
||||
if (old_tag_len+TAG_HDR_LEN+MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN > sizeof(tag_buf)) {
|
||||
DEBUG_ERR("SID tag length too long!\n");
|
||||
|
@ -1095,19 +1095,19 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
|
|||
tag->tag_type = PTT_RELAY_SID;
|
||||
tag->tag_len = htons(MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN+old_tag_len);
|
||||
|
||||
// insert the magic_code+client mac in relay tag
|
||||
/* insert the magic_code+client mac in relay tag */
|
||||
pMagic = (__be16 *)tag->tag_data;
|
||||
*pMagic = htons(MAGIC_CODE);
|
||||
memcpy(tag->tag_data+MAGIC_CODE_LEN, skb->data+ETH_ALEN, ETH_ALEN);
|
||||
|
||||
//Add relay tag
|
||||
/* Add relay tag */
|
||||
if(__nat25_add_pppoe_tag(skb, tag) < 0)
|
||||
return -1;
|
||||
|
||||
DEBUG_INFO("NAT25: Insert PPPoE, forward %s packet\n",
|
||||
(ph->code == PADI_CODE ? "PADI" : "PADR"));
|
||||
}
|
||||
else { // not add relay tag
|
||||
else { /* not add relay tag */
|
||||
if (priv->pppoe_connection_in_progress &&
|
||||
memcmp(skb->data+ETH_ALEN, priv->pppoe_addr, ETH_ALEN)) {
|
||||
DEBUG_ERR("Discard PPPoE packet due to another PPPoE connection is in progress!\n");
|
||||
|
@ -1123,7 +1123,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
|
|||
else
|
||||
return -1;
|
||||
}
|
||||
else // session phase
|
||||
else /* session phase */
|
||||
{
|
||||
DEBUG_INFO("NAT25: Insert PPPoE, insert session packet to %s\n", skb->dev->name);
|
||||
|
||||
|
@ -1186,7 +1186,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
|
|||
DEBUG_INFO("NAT25: Lookup PPPoE, forward %s Packet from %s\n",
|
||||
(ph->code == PADO_CODE ? "PADO" : "PADS"), skb->dev->name);
|
||||
}
|
||||
else { // not add relay tag
|
||||
else { /* not add relay tag */
|
||||
if (!priv->pppoe_connection_in_progress) {
|
||||
DEBUG_ERR("Discard PPPoE packet due to no connection in progresss!\n");
|
||||
return -1;
|
||||
|
@ -1332,7 +1332,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
#endif // CL_IPV6_PASS
|
||||
#endif /* CL_IPV6_PASS */
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -1380,7 +1380,7 @@ int nat25_handle_frame(struct adapter *priv, struct sk_buff *skb)
|
|||
!memcmp(priv->br_ip, skb->data+ETH_HLEN+16, 4)) ||
|
||||
((*((__be16 *)(skb->data+ETH_ALEN*2)) == __constant_htons(ETH_P_ARP)) &&
|
||||
!memcmp(priv->br_ip, skb->data+ETH_HLEN+24, 4))) {
|
||||
// for traffic to upper TCP/IP
|
||||
/* for traffic to upper TCP/IP */
|
||||
retval = nat25_db_handle(priv, skb, NAT25_LOOKUP);
|
||||
}
|
||||
}
|
||||
|
@ -1394,7 +1394,7 @@ int nat25_handle_frame(struct adapter *priv, struct sk_buff *skb)
|
|||
}
|
||||
|
||||
if(retval == -1) {
|
||||
//DEBUG_ERR("NAT25: Lookup fail!\n");
|
||||
/* DEBUG_ERR("NAT25: Lookup fail!\n"); */
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -1435,30 +1435,30 @@ void dhcp_flag_bcast(struct adapter *priv, struct sk_buff *skb)
|
|||
{
|
||||
__be16 protocol = *((__be16 *)(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))
|
||||
&& (udph->dest == __constant_htons(SERVER_PORT))) // DHCP request
|
||||
&& (udph->dest == __constant_htons(SERVER_PORT))) /* DHCP request */
|
||||
{
|
||||
struct dhcpMessage *dhcph =
|
||||
(struct dhcpMessage *)((SIZE_PTR)udph + sizeof(struct udphdr));
|
||||
|
||||
if(dhcph->cookie == DHCP_MAGIC) // match magic word
|
||||
if(dhcph->cookie == DHCP_MAGIC) /* match magic word */
|
||||
{
|
||||
if(!(dhcph->flags & BROADCAST_FLAG)) // if not broadcast
|
||||
if(!(dhcph->flags & BROADCAST_FLAG)) /* if not broadcast */
|
||||
{
|
||||
register int sum = 0;
|
||||
|
||||
DEBUG_INFO("DHCP: change flag of DHCP request to broadcast.\n");
|
||||
// or BROADCAST flag
|
||||
/* or BROADCAST flag */
|
||||
dhcph->flags |= BROADCAST_FLAG;
|
||||
// recalculate checksum
|
||||
/* recalculate checksum */
|
||||
sum = ~(udph->check) & 0xffff;
|
||||
sum += dhcph->flags;
|
||||
while(sum >> 16)
|
||||
|
@ -1479,8 +1479,8 @@ void *scdb_findEntry(struct adapter *priv, unsigned char *macAddr,
|
|||
unsigned char networkAddr[MAX_NETWORK_ADDR_LEN];
|
||||
struct nat25_network_db_entry *db;
|
||||
int hash;
|
||||
//_irqL irqL;
|
||||
//_enter_critical_bh(&priv->br_ext_lock, &irqL);
|
||||
/* _irqL irqL; */
|
||||
/* _enter_critical_bh(&priv->br_ext_lock, &irqL); */
|
||||
|
||||
__nat25_generate_ipv4_network_addr(networkAddr, (unsigned int *)ipAddr);
|
||||
hash = __nat25_network_hash(networkAddr);
|
||||
|
@ -1488,15 +1488,15 @@ void *scdb_findEntry(struct adapter *priv, unsigned char *macAddr,
|
|||
while (db != NULL)
|
||||
{
|
||||
if(!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN)) {
|
||||
//_exit_critical_bh(&priv->br_ext_lock, &irqL);
|
||||
/* _exit_critical_bh(&priv->br_ext_lock, &irqL); */
|
||||
return (void *)db;
|
||||
}
|
||||
|
||||
db = db->next_hash;
|
||||
}
|
||||
|
||||
//_exit_critical_bh(&priv->br_ext_lock, &irqL);
|
||||
/* _exit_critical_bh(&priv->br_ext_lock, &irqL); */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif // CONFIG_BR_EXT
|
||||
#endif /* CONFIG_BR_EXT */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue