<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 22, 2017 at 5:45 AM, Joe Stringer <span dir="ltr">&lt;<a href="mailto:joe@ovn.org" target="_blank">joe@ovn.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5">On 21 June 2017 at 04:19, Numan Siddique &lt;<a href="mailto:nusiddiq@redhat.com">nusiddiq@redhat.com</a>&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt; On Tue, Jun 20, 2017 at 3:11 AM, Joe Stringer &lt;<a href="mailto:joe@ovn.org">joe@ovn.org</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; On 19 June 2017 at 00:37, Numan Siddique &lt;<a href="mailto:nusiddiq@redhat.com">nusiddiq@redhat.com</a>&gt; wrote:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On Fri, Jun 16, 2017 at 11:22 PM, Joe Stringer &lt;<a href="mailto:joe@ovn.org">joe@ovn.org</a>&gt; wrote:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; On 15 June 2017 at 22:20, Numan Siddique &lt;<a href="mailto:nusiddiq@redhat.com">nusiddiq@redhat.com</a>&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; On Thu, Jun 15, 2017 at 5:06 PM, Aswin S &lt;<a href="mailto:aswinsuryan@gmail.com">aswinsuryan@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt; &gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; Adding some more info here, Thanks Numan! for pointing to this.<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; The issue I am facing looks similar to the one described in [1] and<br>
&gt;&gt; &gt;&gt; &gt;&gt; [2].<br>
&gt;&gt; &gt;&gt; &gt;&gt; But it seems the issue is not yet fixed.  Is there a plan to fix<br>
&gt;&gt; &gt;&gt; &gt;&gt; this<br>
&gt;&gt; &gt;&gt; &gt;&gt; soon?<br>
&gt;&gt; &gt;&gt; &gt;&gt; In Opendaylight security groups is implemented using ovs-conntrack.<br>
&gt;&gt; &gt;&gt; &gt;&gt; So<br>
&gt;&gt; &gt;&gt; &gt;&gt; the<br>
&gt;&gt; &gt;&gt; &gt;&gt; flow based router  ping  responder and floating IP translations hits<br>
&gt;&gt; &gt;&gt; &gt;&gt; this<br>
&gt;&gt; &gt;&gt; &gt;&gt; issue.<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; [1]<a href="https://mail.openvswitch.org/pipermail/ovs-dev/2017-March/329542.html" rel="noreferrer" target="_blank">https://mail.openvswitch.<wbr>org/pipermail/ovs-dev/2017-<wbr>March/329542.html</a><br>
&gt;&gt; &gt;&gt; &gt;&gt; [2]<a href="https://patchwork.ozlabs.org/patch/739796/" rel="noreferrer" target="_blank">https://patchwork.ozlabs.<wbr>org/patch/739796/</a><br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; The same issuse is also seen in OVN as pointed by Aswin.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Joe - If you remember, we had a chat about this same issue during the<br>
&gt;&gt; &gt;&gt; &gt; Openstack Boston summit.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Hi Numan, yeah I recall we had this discussion. I didn&#39;t have much<br>
&gt;&gt; &gt;&gt; clarity on where we&#39;re at with this.  Looking at patchwork, I provided<br>
&gt;&gt; &gt;&gt; some feedback on the RFC. The most straightforward approach seems to<br>
&gt;&gt; &gt;&gt; be adding a nf_ct_set(skb, NULL, 0); call for each of the 5tuple &quot;set&quot;<br>
&gt;&gt; &gt;&gt; actions in the datapath.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Thanks. I will try it out and let you know how it went.<br>
&gt;&gt; &gt; I remember, I was suppose to provide more clarity after our discussion.<br>
&gt;&gt; &gt; My<br>
&gt;&gt; &gt; apologies. It slipped out of my head.<br>
&gt;&gt;<br>
&gt;&gt; No worries, let me know how you go.<br>
&gt;<br>
&gt;<br>
&gt; I tried this and it didn&#39;t work. In fact the function set_ipv4 (in<br>
&gt; datapath/actions.c) is not even called.<br>
&gt;<br>
&gt; Below is the flow which responds to ICMP request packet<br>
&gt;<br>
&gt; cookie=0x64913aa, duration=566.801s, table=17, n_packets=3, n_bytes=294,<br>
&gt; idle_age=144,<br>
&gt; priority=90,icmp,metadata=0x3,<wbr>nw_dst=192.168.0.1,icmp_type=<wbr>8,icmp_code=0<br>
&gt; actions=push:NXM_OF_IP_SRC[],<wbr>push:NXM_OF_IP_DST[],pop:NXM_<wbr>OF_IP_SRC[],pop:NXM_OF_IP_DST[<wbr>],load:0xff-&gt;NXM_NX_IP_TTL[],<wbr>load:0-&gt;NXM_OF_ICMP_TYPE[],<wbr>load:0x1-&gt;NXM_NX_REG10[0],<wbr>resubmit(,18)<br>
&gt;<br>
&gt; Thanks<br>
&gt; Numan<br>
<br>
</div></div>Hi Numan,<br>
<br>
How are you going about making these changes and testing them? Could<br>
you double-check that the correct module was loaded when you ran the<br>
test? Given that the IP src and dst are being modified from the flow<br>
you described above, I think that the set_ipv4 function should be<br>
called for such flows.<br>
<br>
Some sanity checks:<br>
# modinfo openvswitch<br>
# find /lib/modules -name openvswitch.ko* | xargs ls -l<br>
<br>
Might want to double-check that your depmod.d settings are set<br>
correctly so it loads the new module instead of the one that comes<br>
with your kernel.<br>
# man depmod.d<br>
<br>
Of course, the above doesn&#39;t necessarily apply if you&#39;re making<br>
changes directly in your kernel tree and loading the module from there<br>
(for example, using insmod, or make modules_install into the original<br>
module path).<br>
<br></blockquote><div><br></div><div>Hi Joe,</div><div><br></div><div>I verified that the loaded openvswitch module loaded is indeed modified by me.  I also put some printks in functions like &quot;ovs_packet_cmd_execute&quot; to verify.</div><div><br></div><div>I created my testing scenario as per the commands here [1]. There are 2 logical ports with IPs 192.168.0.2 and 192.168.0.3 associated to 2 namespaces ns1 and ns2. The logical switch is also connected to a logical router.</div><div><br></div><div>I pinged from 192.168.0.2 to 192.168.0.3 continuously and monitored the kernel flows with the command -</div><div><br></div><div>$watch -n1 -d &quot;sudo ovs-dpctl dump-flows system@ovs-system&quot;</div><div><div>recirc_id(0),in_port(3),eth(src=00:00:00:00:00:00/01:00:00:00:00:00,dst=50:54:00:00:00:01),eth_type(0x0800),ipv4(dst=<a href="http://192.168.0.2/255.255.255.254,frag=no">192.168.0.2/255.255.255.254,frag=no</a>), packets:28, bytes:2744, used:0.323s, actions:2</div><div>recirc_id(0),in_port(2),eth(src=00:00:00:00:00:00/01:00:00:00:00:00,dst=50:54:00:00:00:02),eth_type(0x0800),ipv4(dst=<a href="http://192.168.0.2/255.255.255.254,frag=no">192.168.0.2/255.255.255.254,frag=no</a>), packets:28, bytes:2744, used:0.323s, actions:3</div></div><div><br></div><div><br></div><div>I pinged from 192.168.0.2 to 192.168.0.1 (without any ACLs, so the ping would be successful), I observed that the action is always userspace and I could see that the function &quot;odp_execute_masked_set_action&quot; in lib/odp-execute.c is called in vswitchd.</div><div><br></div><div>$watch -n1 -d &quot;sudo ovs-dpctl dump-flows system@ovs-system&quot;<br></div><div><div>recirc_id(0),in_port(2),eth(src=50:54:00:00:00:01,dst=00:00:00:00:ff:01),eth_type(0x0806),arp(sip=192.168.0.2,tip=192.168.0.1,op=1/0xff,sha=50:54:00:00:00:01,tha=00:00:00:00:00:00), packets:0, bytes:0, used:never, actions:userspace(pid=4294958020,slow_path(action))</div><div>recirc_id(0),in_port(2),eth(src=50:54:00:00:00:01,dst=00:00:00:00:ff:01),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=1,ttl=64,frag=no),icmp(type=8,code=0), packets:9, bytes:882, used:0.937s, actions:userspace(pid=4294958021,slow_path(action))</div></div><div><br></div><div>In this case, the ICMP reply is framed by the OVS flow  and there is &quot;clone&quot; action involved for the packet to go to and from the logical switch to logical router pipeline.</div><div><br></div><div>To avoid clone action, I added some code in ovn-northd to respond the ICMP reply if the ip4.dst = 192.168.0.1 which translated to the below OF flow</div><div><br></div><div>table=19, n_packets=619, n_bytes=60662, idle_age=1, priority=90,icmp,metadata=0x1,nw_dst=192.168.0.1,icmp_type=8,icmp_code=0 actions=move:NXM_OF_IP_SRC[]-&gt;NXM_OF_IP_DST[],mod_nw_src:192.168.0.1,push:NXM_OF_ETH_SRC[],push:NXM_OF_ETH_DST[],pop:NXM_OF_ETH_SRC[],pop:NXM_OF_ETH_DST[],load:0xff-&gt;NXM_NX_IP_TTL[],load:0-&gt;NXM_OF_ICMP_TYPE[],load:0x1-&gt;NXM_NX_REG10[0],resubmit(,20)<br></div><div><br></div><div>And in both the cases I see that there is an upcall for each packet and odp_execute_masked_set_action is called.</div><div><br></div><div>Thanks</div><div>Numan</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div>I </div><div><br></div><div>[1] - <a href="https://gist.github.com/russellb/4ab0a9641f12f8ac66fdd6822ee7789e">https://gist.github.com/russellb/4ab0a9641f12f8ac66fdd6822ee7789e</a></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Cheers,<br>
Joe<br>
</blockquote></div><br></div></div>