beceem: remove ARP spoofing
authorStephen Hemminger <stephen.hemminger@vyatta.com>
Mon, 1 Nov 2010 13:53:58 +0000 (09:53 -0400)
committerStephen Hemminger <stephen.hemminger@vyatta.com>
Mon, 1 Nov 2010 13:53:58 +0000 (09:53 -0400)
Linux support NOARP flag, so the whole Arp spoofing routines
are not needed.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
drivers/staging/bcm/Arp.c [deleted file]
drivers/staging/bcm/Bcmnet.c
drivers/staging/bcm/Makefile
drivers/staging/bcm/Transmit.c

diff --git a/drivers/staging/bcm/Arp.c b/drivers/staging/bcm/Arp.c
deleted file mode 100644 (file)
index 7cb25b3..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-
-/*
- * File Name: Arp.c
- * Abstract: This file contains the routines for handling ARP PACKETS
- */
-#include "headers.h"
-#define        ARP_PKT_SIZE    60
-
-/* =========================================================================
- * Function    - reply_to_arp_request()
- *
- * Description - When this host tries to broadcast ARP request packet through
- *                              the virtual interface (veth0), reply directly to upper layer.
- *                              This function allocates a new skb for ARP reply packet,
- *                              fills in the fields of the packet and then sends it to
- *                              upper layer.
- *
- * Parameters  - skb:  Pointer to sk_buff structure of the ARP request pkt.
- *
- * Returns     - None
- * =========================================================================*/
-
-VOID
-reply_to_arp_request(struct sk_buff *skb)
-{
-       PMINI_ADAPTER           Adapter;
-       struct ArpHeader        *pArpHdr = NULL;
-       struct ethhdr           *pethhdr = NULL;
-       UCHAR                           uiIPHdr[4];
-       /* Check for valid skb */
-       if(skb == NULL)
-       {
-               BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Invalid skb: Cannot reply to ARP request\n");
-               return;
-       }
-
-
-       Adapter = GET_BCM_ADAPTER(skb->dev);
-       /* Print the ARP Request Packet */
-       BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, ARP_RESP, DBG_LVL_ALL, "ARP Packet Dump :");
-       BCM_DEBUG_PRINT_BUFFER(Adapter,DBG_TYPE_TX, ARP_RESP, DBG_LVL_ALL, (PUCHAR)(skb->data), skb->len);
-
-       /*
-        * Extract the Ethernet Header and Arp Payload including Header
-     */
-       pethhdr = (struct ethhdr *)skb->data;
-       pArpHdr  = (struct ArpHeader *)(skb->data+ETH_HLEN);
-
-       if(Adapter->bETHCSEnabled)
-       {
-               if(memcmp(pethhdr->h_source, Adapter->dev->dev_addr, ETH_ALEN))
-               {
-                       dev_kfree_skb(skb);
-                       return;
-               }
-       }
-
-       // Set the Ethernet Header First.
-       memcpy(pethhdr->h_dest, pethhdr->h_source, ETH_ALEN);
-       if(!memcmp(pethhdr->h_source, Adapter->dev->dev_addr, ETH_ALEN))
-       {
-               pethhdr->h_source[5]++;
-       }
-
-       /* Set the reply to ARP Reply */
-       pArpHdr->arp.ar_op = ntohs(ARPOP_REPLY);
-
-       /* Set the HW Address properly */
-       memcpy(pArpHdr->ar_sha, pethhdr->h_source, ETH_ALEN);
-       memcpy(pArpHdr->ar_tha, pethhdr->h_dest, ETH_ALEN);
-
-       // Swapping the IP Adddress
-       memcpy(uiIPHdr,pArpHdr->ar_sip,4);
-       memcpy(pArpHdr->ar_sip,pArpHdr->ar_tip,4);
-       memcpy(pArpHdr->ar_tip,uiIPHdr,4);
-
-       /* Print the ARP Reply Packet */
-
-       BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, ARP_RESP, DBG_LVL_ALL, "ARP REPLY PACKET: ");
-
-       /* Send the Packet to upper layer */
-       BCM_DEBUG_PRINT_BUFFER(Adapter,DBG_TYPE_TX, ARP_RESP, DBG_LVL_ALL, (PUCHAR)(skb->data), skb->len);
-
-       skb->protocol = eth_type_trans(skb,skb->dev);
-       skb->pkt_type = PACKET_HOST;
-
-//     skb->mac.raw=skb->data+LEADER_SIZE;
-       skb_set_mac_header (skb, LEADER_SIZE);
-       netif_rx(skb);
-       BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, ARP_RESP, DBG_LVL_ALL, "<=============\n");
-       return;
-}
-
-
index 1f35cd3c287205666cc49e9c090366279cbdcc9a..908711d0447d1bd3760a8a2a2dfb748e44c17552 100644 (file)
@@ -124,6 +124,9 @@ int register_networkdev(PMINI_ADAPTER Adapter)
        net->ethtool_ops = &bcm_ethtool_ops;
        net->mtu          = MTU_SIZE; /* 1400 Bytes */
        net->tx_queue_len = TX_QLEN;
+       net->flags |= IFF_NOARP;
+       net->flags &= ~(IFF_BROADCAST|IFF_MULTICAST);
+
        netif_carrier_off(net);
 
        SET_NETDEV_DEVTYPE(net, &wimax_type);
index 0050206b0fc1e163684e8ce30089c98acee48e1d..652b7f87737cd0ba46a61826c29d4daf71a870bd 100644 (file)
@@ -6,7 +6,7 @@ obj-$(CONFIG_BCM_WIMAX) +=      bcm_wimax.o
 
 bcm_wimax-y :=  InterfaceDld.o InterfaceIdleMode.o InterfaceInit.o InterfaceRx.o \
                InterfaceIsr.o InterfaceMisc.o InterfaceTx.o \
-               Arp.o CmHost.o IPv6Protocol.o Qos.o Transmit.o\
+               CmHost.o IPv6Protocol.o Qos.o Transmit.o\
                Bcmnet.o DDRInit.o HandleControlPacket.o\
                LeakyBucket.o Misc.o sort.o Bcmchar.o hostmibs.o PHSModule.o\
                led_control.o nvm.o vendorspecificextn.o
index 1f69625f241e270eae4bfdebcf93d51bf2a53a14..4b94d822578cedd469897dbb75eae07dd327cc5d 100644 (file)
@@ -6,7 +6,7 @@
 digraph transmit1 {
 node[shape=box]
 edge[weight=5;color=red]
-bcm_transmit->reply_to_arp_request[label="ARP"]
+
 bcm_transmit->GetPacketQueueIndex[label="IP Packet"]
 GetPacketQueueIndex->IpVersion4[label="IPV4"]
 GetPacketQueueIndex->IpVersion6[label="IPV6"]
@@ -63,17 +63,8 @@ netdev_tx_t bcm_transmit(struct sk_buff *skb, struct net_device *dev)
 
        qindex = GetPacketQueueIndex(Adapter, skb);
 
-       if (INVALID_QUEUE_INDEX==qindex)        {
-               if (ntohs(eth_hdr(skb)->h_proto) != ETH_ARP_FRAME)
-                       goto drop;
-
-               /*
-                 Reply directly to ARP request packet
-                 ARP Spoofing only if NO ETH CS rule matches for it
-               */
-               reply_to_arp_request(skb);
-               return NETDEV_TX_OK;
-       }
+       if (INVALID_QUEUE_INDEX==qindex)
+               goto drop;
 
        if (Adapter->PackInfo[qindex].uiCurrentPacketsOnHost >= SF_MAX_ALLOWED_PACKETS_TO_BACKUP)
                return NETDEV_TX_BUSY;