]> git.proxmox.com Git - ovs.git/commitdiff
netdev-dummy: Implement ARP responder.
authorBen Pfaff <blp@nicira.com>
Sun, 10 May 2015 07:01:59 +0000 (00:01 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 16 Jun 2015 15:21:16 +0000 (08:21 -0700)
This is the only missing piece to make native tunneling work with dummy
devices for testing purposes.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
lib/netdev-dummy.c

index 4d1ef8acabe072dc7e564893eea96decebb98db6..ff6568996f7144d3c21b1d07840226b98784dd4b 100644 (file)
@@ -932,6 +932,23 @@ netdev_dummy_send(struct netdev *netdev, int qid OVS_UNUSED,
 
         dummy_packet_conn_send(&dev->conn, buffer, size);
 
+        /* Reply to ARP requests for 'dev''s assigned IP address. */
+        if (dev->address.s_addr) {
+            struct dp_packet packet;
+            struct flow flow;
+
+            dp_packet_use_const(&packet, buffer, size);
+            flow_extract(&packet, &flow);
+            if (flow.dl_type == htons(ETH_TYPE_ARP)
+                && flow.nw_proto == ARP_OP_REQUEST
+                && flow.nw_dst == dev->address.s_addr) {
+                struct dp_packet *reply = dp_packet_new(0);
+                compose_arp(reply, ARP_OP_REPLY, dev->hwaddr, flow.dl_src,
+                            false, flow.nw_dst, flow.nw_src);
+                netdev_dummy_queue_packet(dev, reply);
+            }
+        }
+
         if (dev->tx_pcap) {
             struct dp_packet packet;