[ovs-dev] [packet_in 12/13] ofproto-dpif: Implement PACKET_IN in userspace.

Ethan Jackson ethan at nicira.com
Tue Jan 3 18:50:16 UTC 2012


I decided to add a patch which masks out the CFI bit in eth_push_vlan().
It will be included when I resend the series.

Here is an incremental.

---
 ofproto/ofproto-dpif.c |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index d9aa889..bff09b8 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -4278,18 +4278,22 @@ execute_controller_action(struct action_xlate_ctx *ctx, int len)
         if (ctx->flow.vlan_tci & htons(VLAN_CFI)) {
             eth_push_vlan(packet, ctx->flow.vlan_tci);
         }
-    }
 
-    if (ctx->flow.dl_type == htons(ETH_TYPE_IP) && packet->l4) {
-        packet_set_ipv4(packet, ctx->flow.nw_src, ctx->flow.nw_dst,
-                        ctx->flow.nw_tos, ctx->flow.nw_ttl);
-    }
+        if (packet->l4) {
+            if (ctx->flow.dl_type == htons(ETH_TYPE_IP)) {
+                packet_set_ipv4(packet, ctx->flow.nw_src, ctx->flow.nw_dst,
+                                ctx->flow.nw_tos, ctx->flow.nw_ttl);
+            }
 
-    if (packet->l7) {
-        if (ctx->flow.nw_proto == IPPROTO_TCP) {
-            packet_set_tcp_port(packet, ctx->flow.tp_src, ctx->flow.tp_dst);
-        } else if (ctx->flow.nw_proto == IPPROTO_UDP) {
-            packet_set_udp_port(packet, ctx->flow.tp_src, ctx->flow.tp_dst);
+            if (packet->l7) {
+                if (ctx->flow.nw_proto == IPPROTO_TCP) {
+                    packet_set_tcp_port(packet, ctx->flow.tp_src,
+                                        ctx->flow.tp_dst);
+                } else if (ctx->flow.nw_proto == IPPROTO_UDP) {
+                    packet_set_udp_port(packet, ctx->flow.tp_src,
+                                        ctx->flow.tp_dst);
+                }
+            }
         }
     }
 
-- 
1.7.7.1




More information about the dev mailing list