[ovs-dev] [PATCH] ofproto-dpif-xlate: Check mac address after execute action

laixiangwu laixiangwu at cmss.chinamobile.com
Thu Jun 24 10:07:20 UTC 2021


After the packet completes the table lookup in the slow path, if the set mac operation
is performed, I think we should compare whether the source and destination mac address
are the same after the set mac operation, and they should not be the same.

Signed-off-by: laixiangwu <laixiangwu at cmss.chinamobile.com>

---
 ofproto/ofproto-dpif-xlate.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index a6f4ea3..544f47e 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -7169,6 +7169,12 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t ofpacts_len,
             break;
         }
     }
+	/* After SET_ETH action is executed, the source and destination mac address of same flow 
+	   should be different. */
+    if (eth_addr_to_uint64(flow->dl_src) == eth_addr_to_uint64(flow->dl_dst)) {
+        VLOG_ERR("The source and destination mac address of same flow should be different.");
+        ctx->error = XLATE_FORWARDING_DISABLED;
+    }
 }
 
 void
-- 
1.8.3.1





More information about the dev mailing list