From 323610d21f161cc54a0d3a53fdf37c644af8620a Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Fri, 13 Jul 2012 16:43:18 +0900 Subject: [PATCH] nxm: fix nxm to OFPMatch conversion This fixes a bug that the conversion ignores dl_dst. Soheil Hassas Yeganeh reported a problem about simple_isolation: The problem is that the isolation service tries to install flow-entries for a specific src and dst (in SimpleIsolation._modflow_and_send_packet), but instead the nx match code installs flow-entries only with src addresses and ignores the dst. So, when I boot multiple vms, only one of them is reachable. For instance, assume that you have two VM's A and B. When a packet comes from the gw to A, it installs "gw->A: A's port", but the acutal installed rule is "gw: A's port". This works for A, but, when you boot B, it tries to install "gw->B: B's port", but the acutal rule to be installed is "gw: B's port". So, it always connect the gateway to only one VM at a time. Reported-by: Soheil Hassas Yeganeh Signed-off-by: FUJITA Tomonori Reviewed-by: Soheil Hassas Yeganeh --- ryu/ofproto/nx_match.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ryu/ofproto/nx_match.py b/ryu/ofproto/nx_match.py index c9f2834e..3fe55665 100644 --- a/ryu/ofproto/nx_match.py +++ b/ryu/ofproto/nx_match.py @@ -297,6 +297,10 @@ class ClsRule(object): if self.wc.dl_dst_mask: return ofproto_v1_0.NXFF_NXM + # Masking DL_SRC is only supported by NXM + if self.wc.dl_src_mask: + return ofproto_v1_0.NXFF_NXM + # ECN is only supported by NXM if not self.wc.wildcards & FWW_NW_ECN: return ofproto_v1_0.NXFF_NXM @@ -313,7 +317,7 @@ class ClsRule(object): if self.flow.dl_src != mac.DONTCARE: wildcards &= ~ofproto.OFPFW_DL_SRC - if self.wc.dl_dst_mask: + if self.flow.dl_dst != mac.DONTCARE: wildcards &= ~ofproto.OFPFW_DL_DST if not self.wc.wildcards & FWW_DL_TYPE: