[ovs-dev] [PATCH] Allow processing of RARP packets.

Mehak Mahajan mmahajan at nicira.com
Fri Oct 19 20:39:59 UTC 2012


With this commit, the datapath will process the ARP header for
RARP packets, both request and reply.

Signed-off-by: Mehak Mahajan <mmahajan at nicira.com>
---
 datapath/flow.c |    6 ++++--
 lib/flow.c      |    4 +++-
 lib/packets.c   |    2 +-
 lib/packets.h   |    3 ++-
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/datapath/flow.c b/datapath/flow.c
index d07337c..76aa7f4 100644
--- a/datapath/flow.c
+++ b/datapath/flow.c
@@ -730,8 +730,10 @@ int ovs_flow_extract(struct sk_buff *skb, u16 in_port, struct sw_flow_key *key,
 			if (ntohs(arp->ar_op) <= 0xff)
 				key->ip.proto = ntohs(arp->ar_op);
 
-			if (key->ip.proto == ARPOP_REQUEST
-					|| key->ip.proto == ARPOP_REPLY) {
+            if (key->ip.proto == ARPOP_REQUEST
+                || key->ip.proto == ARPOP_REPLY
+                || key->ip.proto == ARPOP_RREQUEST
+                || key->ip.proto == ARPOP_RREPLY) {
 				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);
diff --git a/lib/flow.c b/lib/flow.c
index 76d2340..be9efaf 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -435,7 +435,9 @@ flow_extract(struct ofpbuf *packet, uint32_t skb_priority,
             }
 
             if ((flow->nw_proto == ARP_OP_REQUEST)
-                || (flow->nw_proto == ARP_OP_REPLY)) {
+                || (flow->nw_proto == ARP_OP_REPLY)
+                || (flow->nw_proto == ARP_OP_RREQUEST)
+                || (flow->nw_proto == ARP_OP_RREPLY)) {
                 flow->nw_src = arp->ar_spa;
                 flow->nw_dst = arp->ar_tpa;
                 memcpy(flow->arp_sha, arp->ar_sha, ETH_ADDR_LEN);
diff --git a/lib/packets.c b/lib/packets.c
index 16f4fe6..cbfcda4 100644
--- a/lib/packets.c
+++ b/lib/packets.c
@@ -159,7 +159,7 @@ compose_rarp(struct ofpbuf *b, const uint8_t eth_src[ETH_ADDR_LEN])
     arp->ar_pro = htons(ARP_PRO_IP);
     arp->ar_hln = sizeof arp->ar_sha;
     arp->ar_pln = sizeof arp->ar_spa;
-    arp->ar_op = htons(ARP_OP_RARP);
+    arp->ar_op = htons(ARP_OP_RREQUEST);
     memcpy(arp->ar_sha, eth_src, ETH_ADDR_LEN);
     arp->ar_spa = htonl(0);
     memcpy(arp->ar_tha, eth_src, ETH_ADDR_LEN);
diff --git a/lib/packets.h b/lib/packets.h
index 24b51da..0f3bc1c 100644
--- a/lib/packets.h
+++ b/lib/packets.h
@@ -412,7 +412,8 @@ BUILD_ASSERT_DECL(TCP_HEADER_LEN == sizeof(struct tcp_header));
 #define ARP_PRO_IP 0x0800
 #define ARP_OP_REQUEST 1
 #define ARP_OP_REPLY 2
-#define ARP_OP_RARP 3
+#define ARP_OP_RREQUEST 3
+#define ARP_OP_RREPLY 4
 
 #define ARP_ETH_HEADER_LEN 28
 struct arp_eth_header {
-- 
1.7.2.5




More information about the dev mailing list