From: Mehak Mahajan Date: Wed, 24 Oct 2012 02:00:02 +0000 (-0700) Subject: Allow processing of RARP packets. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3d3ad0c04a7b8db1cabd7ca89aca6961708d076;p=openvswitch Allow processing of RARP packets. With this commit, the datapath will process the ARP header for RARP packets. It also fixes a bug whereby if the ARP opcode is something other than ARP request or reply, the key_len is not adjusted to include ARP info. Signed-off-by: Mehak Mahajan Acked-by: Jesse Gross --- diff --git a/datapath/flow.c b/datapath/flow.c index b6efd35e..c70daeed 100644 --- a/datapath/flow.c +++ b/datapath/flow.c @@ -738,15 +738,11 @@ int ovs_flow_extract(struct sk_buff *skb, u16 in_port, struct sw_flow_key *key, /* We only match on the lower 8 bits of the opcode. */ if (ntohs(arp->ar_op) <= 0xff) key->ip.proto = ntohs(arp->ar_op); - - if (key->ip.proto == ARPOP_REQUEST - || key->ip.proto == ARPOP_REPLY) { - memcpy(&key->ipv4.addr.src, arp->ar_sip, sizeof(key->ipv4.addr.src)); - memcpy(&key->ipv4.addr.dst, arp->ar_tip, sizeof(key->ipv4.addr.dst)); - memcpy(key->ipv4.arp.sha, arp->ar_sha, ETH_ALEN); - memcpy(key->ipv4.arp.tha, arp->ar_tha, ETH_ALEN); - key_len = SW_FLOW_KEY_OFFSET(ipv4.arp); - } + memcpy(&key->ipv4.addr.src, arp->ar_sip, sizeof(key->ipv4.addr.src)); + memcpy(&key->ipv4.addr.dst, arp->ar_tip, sizeof(key->ipv4.addr.dst)); + memcpy(key->ipv4.arp.sha, arp->ar_sha, ETH_ALEN); + memcpy(key->ipv4.arp.tha, arp->ar_tha, ETH_ALEN); + key_len = SW_FLOW_KEY_OFFSET(ipv4.arp); } } else if (key->eth.type == htons(ETH_P_IPV6)) { int nh_len; /* IPv6 Header + Extensions */ diff --git a/lib/flow.c b/lib/flow.c index 0c9aa363..06478da7 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -435,13 +435,10 @@ flow_extract(struct ofpbuf *packet, uint32_t skb_priority, flow->nw_proto = ntohs(arp->ar_op); } - if ((flow->nw_proto == ARP_OP_REQUEST) - || (flow->nw_proto == ARP_OP_REPLY)) { - flow->nw_src = arp->ar_spa; - flow->nw_dst = arp->ar_tpa; - memcpy(flow->arp_sha, arp->ar_sha, ETH_ADDR_LEN); - memcpy(flow->arp_tha, arp->ar_tha, ETH_ADDR_LEN); - } + flow->nw_src = arp->ar_spa; + flow->nw_dst = arp->ar_tpa; + memcpy(flow->arp_sha, arp->ar_sha, ETH_ADDR_LEN); + memcpy(flow->arp_tha, arp->ar_tha, ETH_ADDR_LEN); } } }