Don't try to use the IP addresses from ARP packets when matching.
authorJustin Pettit <jpettit@nicira.com>
Sat, 10 May 2008 07:45:06 +0000 (00:45 -0700)
committerJustin Pettit <jpettit@nicira.com>
Sat, 10 May 2008 07:45:06 +0000 (00:45 -0700)
ChangeLog
datapath/flow.c
lib/flow.c
switch/switch-flow.c

index 30c83830db2645443bc346dcbf8a95da7b5969ef..20201c9c0798d3e7515379b46ba154755c29d963 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+v0.8.1 - 14 May 2008
+--------------------
+    - No longer set nwsrc/nwdst fields in flow structs on ARP packets
+    - Various bug fixes and tweaks
+
 v0.8.0 - 04 May 2008
 --------------------
     - Added support for flow entry priorities
index a6164b5d983bff3d3e61e48d6ab916d8d511ca43..5e1140710b05c6e6c134e8c81a882b9926040aae 100644 (file)
@@ -9,7 +9,6 @@
 #include <linux/etherdevice.h>
 #include <linux/if_ether.h>
 #include <linux/if_vlan.h>
-#include <linux/if_arp.h>
 #include <net/llc_pdu.h>
 #include <linux/ip.h>
 #include <linux/kernel.h>
@@ -84,11 +83,6 @@ void flow_extract_match(struct sw_flow_key* to, const struct ofp_match* from)
                to->tp_src = from->tp_src;
                to->tp_dst = from->tp_dst;
                return;
-       } else if (from->dl_type == htons(ETH_P_ARP)) {
-               to->nw_src = from->nw_src;
-               to->nw_dst = from->nw_dst;
-               to->nw_proto = 0;
-               goto no_th;
        }
 
        to->nw_src = 0;
@@ -195,20 +189,6 @@ uint32_t hash_in6(const struct in6_addr *in)
                        ^ in->s6_addr32[2] ^ in->s6_addr32[3]);
 }
 
-// with inspiration from linux/if_arp.h
-struct arp_eth_hdr {
-       uint16_t  ar_hrd;  /* format of hardware address    */
-       uint16_t  ar_pro;  /* format of protocol address    */
-       uint8_t   ar_hln;  /* length of hardware address    */
-       uint8_t   ar_pln;  /* length of protocol address    */
-       uint16_t  ar_op;   /* ARP opcode (command)          */
-
-       uint8_t   ar_sha[ETH_ALEN]; /* source hardware addr */
-       uint32_t  ar_sip;           /* source protocol addr */
-       uint8_t   ar_tha[ETH_ALEN]; /* dest hardware addr   */
-       uint32_t  ar_tip;           /* dest protocol addr   */
-} __attribute__((packed));
-
 /* Parses the Ethernet frame in 'skb', which was received on 'in_port',
  * and initializes 'key' to match. */
 void flow_extract(struct sk_buff *skb, uint16_t in_port,
@@ -276,22 +256,6 @@ void flow_extract(struct sk_buff *skb, uint16_t in_port,
                key->tp_dst = th->dest;
 
                return;
-       } else if (key->dl_type == htons(ETH_P_ARP)) {
-               /* just barely within 46-byte minimum packet */
-               struct arp_eth_hdr *ah = (struct arp_eth_hdr *)skb_network_header(skb);
-               if (ah->ar_hrd == htons(ARPHRD_ETHER)
-                   && ah->ar_pro == htons(ETH_P_IP)
-                   && ah->ar_hln == ETH_ALEN
-                   && ah->ar_pln == sizeof(key->nw_src))
-               {
-                       /* check if sha/tha match dl_src/dl_dst? */
-                       key->nw_src = ah->ar_sip;
-                       key->nw_dst = ah->ar_tip;
-                       key->nw_proto = 0;
-                       goto no_th;
-               }
-       } else {
-               /* Fall through. */
        }
 
        key->nw_src = 0;
index a3ddfd49e5a197be174d1c122b81225008b5f644..6ec8ffdbe4e0ba38a2aea331ad01595e923c32fa 100644 (file)
@@ -124,17 +124,6 @@ flow_extract(struct buffer *packet, uint16_t in_port, struct flow *flow)
                     }
                 }
             }
-        } else if (flow->dl_type == htons(ETH_TYPE_ARP)) {
-            const struct arp_eth_header *ah = buffer_at(&b, 0, sizeof *ah);
-            if (ah && ah->ar_hrd == htons(ARP_HRD_ETHERNET)
-                && ah->ar_pro == htons(ARP_PRO_IP)
-                && ah->ar_hln == ETH_ADDR_LEN
-                && ah->ar_pln == sizeof flow->nw_src)
-            {
-                /* check if sha/tha match dl_src/dl_dst? */
-                flow->nw_src = ah->ar_spa;
-                flow->nw_dst = ah->ar_tpa;
-            }
         }
     }
 }
index 5a3533515a59936273856882b272593670ebce74..39df8622a406779e91b5d4052b04ef49717318c5 100644 (file)
@@ -100,11 +100,6 @@ void flow_extract_match(struct sw_flow_key* to, const struct ofp_match* from)
         to->flow.tp_src = from->tp_src;
         to->flow.tp_dst = from->tp_dst;
         return;
-    } else if (from->dl_type == htons(ETH_TYPE_ARP)) {
-        to->flow.nw_src = from->nw_src;
-        to->flow.nw_dst = from->nw_dst;
-        to->flow.nw_proto = 0;
-        goto no_th;
     }
 
     to->flow.nw_src = 0;