Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Netpol test suite randomly fails when run in Kind and with tunnel type set to Geneve #897

Closed
abhiraut opened this issue Jul 2, 2020 · 14 comments · Fixed by #2625
Closed
Labels
area/exp/netpol Issues or PRs related to the netpol proposal. kind/bug Categorizes issue or PR as related to a bug. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test.

Comments

@abhiraut
Copy link
Contributor

abhiraut commented Jul 2, 2020

Describe the bug
Netpol test suite which tests network policy feature fails if run in Kind cluster with tunnel type set to Geneve. When tunnel type is set to VXLAN, the same set of tests pass.

To Reproduce
Run Netpol suite in Kind cluster created with tunnel type set to Geneve.

Expected
Tests should pass and not depend on tunnel type.

@abhiraut abhiraut added kind/bug Categorizes issue or PR as related to a bug. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. area/exp/netpol Issues or PRs related to the netpol proposal. labels Jul 2, 2020
antoninbas added a commit to antoninbas/antrea that referenced this issue Jul 2, 2020
Set default tunnel type to Geneve for Antrea instead of VXLAN.
When running NetworkPolicy tests in Kind, we "force" the tunnel type to
VXLAN as we observe some failures with Geneve (see antrea-io#897).

We also change the Github CI jobs so that CNP tests are run in their own
job. This is to address the issue above, and is also a partial
implementation of antrea-io#893.
antoninbas added a commit to antoninbas/antrea that referenced this issue Jul 2, 2020
When running NetworkPolicy tests in Kind, we "force" the tunnel type to
VXLAN as we observe some failures with Geneve (see antrea-io#897).

We also change the Github CI jobs so that CNP tests are run in their own
job. This is to address the issue above, and is also a partial
implementation of antrea-io#893.
antoninbas added a commit to antoninbas/antrea that referenced this issue Jul 2, 2020
When running NetworkPolicy tests in Kind, we "force" the tunnel type to
VXLAN as we observe some failures with Geneve (see antrea-io#897).

We also change the Github CI jobs so that CNP tests are run in their own
job. This is to address the issue above, and is also a partial
implementation of antrea-io#893.
antoninbas added a commit to antoninbas/antrea that referenced this issue Jul 2, 2020
When running NetworkPolicy tests in Kind, we "force" the tunnel type to
VXLAN as we observe some failures with Geneve (see antrea-io#897).

We also change the Github CI jobs so that CNP tests are run in their own
job. This is to address the issue above, and is also a partial
implementation of antrea-io#893.
antoninbas added a commit to antoninbas/antrea that referenced this issue Jul 2, 2020
When running NetworkPolicy tests in Kind, we "force" the tunnel type to
VXLAN as we observe some failures with Geneve (see antrea-io#897).

We also change the Github CI jobs so that CNP tests are run in their own
job. This is to address the issue above, and is also a partial
implementation of antrea-io#893.
antoninbas added a commit to antoninbas/antrea that referenced this issue Jul 3, 2020
When running NetworkPolicy tests in Kind, we "force" the tunnel type to
VXLAN as we observe some failures with Geneve (see antrea-io#897).

We also change the Github CI jobs so that CNP tests are run in their own
job. This is to address the issue above, and is also a partial
implementation of antrea-io#893.
antoninbas added a commit to antoninbas/antrea that referenced this issue Jul 3, 2020
When running NetworkPolicy tests in Kind, we "force" the tunnel type to
VXLAN as we observe some failures with Geneve (see antrea-io#897).

We also change the Github CI jobs so that CNP tests are run in their own
job. This is to address the issue above, and is also a partial
implementation of antrea-io#893.
antoninbas added a commit to antoninbas/antrea that referenced this issue Jul 3, 2020
When running NetworkPolicy tests in Kind, we "force" the tunnel type to
VXLAN as we observe some failures with Geneve (see antrea-io#897).

We also change the Github CI jobs so that CNP tests are run in their own
job. This is to address the issue above, and is also a partial
implementation of antrea-io#893.
antoninbas added a commit to antoninbas/antrea that referenced this issue Jul 3, 2020
When running NetworkPolicy tests in Kind, we "force" the tunnel type to
VXLAN as we observe some failures with Geneve (see antrea-io#897).

We also change the Github CI jobs so that CNP tests are run in their own
job. This is to address the issue above, and is also a partial
implementation of antrea-io#893.
antoninbas added a commit to antoninbas/antrea that referenced this issue Jul 3, 2020
When running NetworkPolicy tests in Kind, we "force" the tunnel type to
VXLAN as we observe some failures with Geneve (see antrea-io#897).

We also change the Github CI jobs so that CNP tests are run in their own
job. This is to address the issue above, and is also a partial
implementation of antrea-io#893.
antoninbas added a commit that referenced this issue Jul 3, 2020
When running NetworkPolicy tests in Kind, we "force" the tunnel type to
VXLAN as we observe some failures with Geneve (see #897).

We also change the Github CI jobs so that CNP tests are run in their own
job. This is to address the issue above, and is also a partial
implementation of #893.
srikartati added a commit to srikartati/antrea that referenced this issue Jul 14, 2020
Instead of running whole suite for every alpha feature, it was discussed
to run the suite by enabling all alpha features. This PR handles alpha
features on Antrea Agent.
As there is ongoing geneve tunnel issue, Issue antrea-io#897 with ClusterNetworkPolicy
alpha feature on controller, I did not club alpha features on agent and
controller. Similarly, Traceflow feature e2e test could be modified,
when both agent and controller alpha features are clubbed together.

This PR is useful to turn on e2e tests for flow exporter feature PR antrea-io#825.
Modified e2e documentation to run alpha feature specific tests locally.

Issue antrea-io#893
srikartati added a commit to srikartati/antrea that referenced this issue Jul 14, 2020
Instead of running whole suite for every alpha feature, it was discussed
to run the suite by enabling all alpha features. This PR handles alpha
features on Antrea Agent.
As there is ongoing geneve tunnel issue, Issue antrea-io#897 with ClusterNetworkPolicy
alpha feature on controller, I did not club alpha features on agent and
controller. Similarly, Traceflow feature e2e test could be modified,
when both agent and controller alpha features are clubbed together.

This PR is useful to turn on e2e tests for flow exporter feature PR antrea-io#825.
Modified e2e documentation to run alpha feature specific tests locally.

Issue antrea-io#893
@srikartati
Copy link
Member

Changing networkPolicyDelay to 20s helps in passing the test for geneve tunnel.
https://github.com/vmware-tanzu/antrea/blob/master/hack/netpol/pkg/main/main.go#L27

I ran network policy realization benchmark test with geneve and vxlan tunnel to see difference in realization times:
go test -v github.com/vmware-tanzu/antrea/test/e2e -provider=kind -run=xxx -bench=BenchmarkRealizeNetworkPolicy

With vxlan tunnel:

BenchmarkRealizeNetworkPolicy/RealizeNetworkPolicy5000
    BenchmarkRealizeNetworkPolicy/RealizeNetworkPolicy5000: fixtures.go:67: Creating K8s clientset
  ......
BenchmarkRealizeNetworkPolicy/RealizeNetworkPolicy5000-16         	       3	 376273734 ns/op

With geneve tunnel:

BenchmarkRealizeNetworkPolicy/RealizeNetworkPolicy5000
    BenchmarkRealizeNetworkPolicy/RealizeNetworkPolicy5000: fixtures.go:67: Creating K8s clientset
.....
BenchmarkRealizeNetworkPolicy/RealizeNetworkPolicy5000-16         	       3	1319885281 ns/op

There is 10x difference in realization times for Geneve when compared to VXLAN.
Not entirely sure why this is happening. Will there any communication over the tunnel? I see that there are watchers at agent getting network policies, addressGroups and appliedGroups.

As a fix, we could check with wait/poll if network policy is realized on at least one of the agents/required agent using antctl rather than sleeping for constant time. Please suggest if you could think of an alternative.

@antoninbas
Copy link
Contributor

It's more like a 4x difference, but I agree it could explain the issue under certain circumstances. Before thinking about a fix, we need to find an explanation for this if we can:

  • check if for some reason this is caused by executing the ovs-ofctl dump-flows command.
  • add more logs in the agent if needed to try and isolate the issue. I would suggest looking at AddFlowsInBundle and seeing if for some reason it takes longer to execute with Geneve.

The communication channels you mention do not involve the inter-Node tunnels, everything should happen over the host network directly, which is why this is a bit confusing...

@srikartati
Copy link
Member

Yes its not 10x.. don't know why I said that (I was looking at other numbers in parallel).
Thanks for the pointers. Let me try in that direction.
Yes, I thought so too as the involved pods have node IP as their IP.

@srikartati
Copy link
Member

srikartati commented Aug 7, 2020

Checked logs when running netpol tests with timestamps. I see that rules being realized quickly on agent and syncing happens in milliseconds. In addition, checked prometheus metrics (antrea_agent_ovs_flow_ops_latency) at agent corresponding to AddFlowsInBundle. Add operations are finishing in milliseconds.

Following is the failed case. Note the difference in time zones:
Test log:

INFO[0040] running step Port 80 -- 3 of test case EgressAndIngressIntegration 
DEBU[0040] creating policy and sleeping for 2s          
DEBU[0040] current time: 2020-08-06 20:44:58.639887 -0700 PDT m=+40.372703240 
INFO[0040] creating/updating network policy allow-all in ns x 
DEBU[0040] unable to update network policy allow-all in ns x, let's try creating it instead (error: networkpolicies.networking.k8s.io "allow-all" not found) 
WARN[0047] FAILED CONNECTION FOR WHITELISTED PODS y/a -> x/a !!!!  
WARN[0047] FAILED CONNECTION FOR WHITELISTED PODS z/b -> x/a !!!!  
WARN[0047] FAILED CONNECTION FOR WHITELISTED PODS y/c -> x/a !!!!  
WARN[0047] FAILED CONNECTION FOR WHITELISTED PODS y/b -> x/a !!!!

Agent log:

I0807 03:44:58.748639       1 networkpolicy_controller.go:334] Finished syncing rule "9c52b283c343d3d8". (14.5984ms)
I0807 03:44:58.750836       1 networkpolicy_controller.go:334] Finished syncing rule "badd3d0faa48f4b4". (19.1643ms)

Complete agent log:
Bad.log

BenchmarkRealizeNetworkPolicy/RealizeNetworkPolicy5000 is a false positive. After running multiple times, observed that the nanosecond/operation metrics has quite a bit of range for both vxlan and geneve tunnels. In addition, I do not see any rules being realized on the agent. Ignoring this for now.

From above time logs when running failed netpol tests, I feel there may be more to this issue and the cause does not seem to be network policy not being realized on agent. Confirmed from code that time elapsed syncing rule/reconciling at agent involves the time installing of flows for the rule.

@srikartati
Copy link
Member

srikartati commented Aug 10, 2020

Investigated this further. Issue seems to be dataplane flow cache. Even though the rule is installed, cached flow in dataplane is processing the old rule/action, which is causing random failures with geneve tunnel.

I observed that communication is failing for remote pods for whom the rules are changed from previous testcase. If the rule doesn't change, then communication is fine.
By disabling megaflow cache or reducing max-idle time to 1s (networkpolicy delay is 2s), netpol tests are passing fine. Default max-idle time is 10s, which explains why 5s did not work and 20s worked.
I have not tried revalidator time configuration setting. I believe this can also help in invalidating dataplane flows.

With my limited OVS debugging skills, I tried a bit but could not figure out the exact reason why it is happening only for geneve tunnel and not vxlan tunnel :)
May be there is existing bug with geneve tunnel and userspace datapath with respect to invalidation? This also explains why the issue is only for remote pods and not local pods.
Considering the time constraint to release, can we change the max-idle time setting on OVS and fix this bug? Or do we want to know the exact reason? @antoninbas @abhiraut

@antoninbas
Copy link
Contributor

Thanks for looking into this. Let me see if I can reproduce outside of Antrea with a standalone OVS switch, since you are probably busy with the Flow Export stuff. If I can, we can let the OVS team know.

@srikartati
Copy link
Member

Thanks for looking into this. Let me see if I can reproduce outside of Antrea with a standalone OVS switch, since you are probably busy with the Flow Export stuff. If I can, we can let the OVS team know.

Sounds good. Thanks.

@abhiraut
Copy link
Contributor Author

Investigated this further. Issue seems to be dataplane flow cache. Even though the rule is installed, cached flow in dataplane is processing the old rule/action, which is causing random failures with geneve tunnel.

I observed that communication is failing for remote pods for whom the rules are changed from previous testcase. If the rule doesn't change, then communication is fine.
By disabling megaflow cache or reducing max-idle time to 1s (networkpolicy delay is 2s), netpol tests are passing fine. Default max-idle time is 10s, which explains why 5s did not work and 20s worked.
I have not tried revalidator time configuration setting. I believe this can also help in invalidating dataplane flows.

With my limited OVS debugging skills, I tried a bit but could not figure out the exact reason why it is happening only for geneve tunnel and not vxlan tunnel :)
May be there is existing bug with geneve tunnel and userspace datapath with respect to invalidation? This also explains why the issue is only for remote pods and not local pods.
Considering the time constraint to release, can we change the max-idle time setting on OVS and fix this bug? Or do we want to know the exact reason? @antoninbas @abhiraut

probably let ovs team take a look? we anyway have set the netpol tests to run in vxlan mode for now. maybe add a note about it in some sort of known issues doc ? but if it needs a workaround for testing other alpha features (as suggested by @srikartati ) then maybe we can alter the param for testing before ovs team fixes it.

@antoninbas
Copy link
Contributor

Good news. I think I was able to reproduce the issue outside of Antrea, with a vanilla OVS deployment. I will summarize the steps and reach out to the OVS team.

@antoninbas antoninbas added this to the Antrea v0.10.0 release milestone Aug 13, 2020
GraysonWu pushed a commit to GraysonWu/antrea that referenced this issue Sep 22, 2020
When running NetworkPolicy tests in Kind, we "force" the tunnel type to
VXLAN as we observe some failures with Geneve (see antrea-io#897).

We also change the Github CI jobs so that CNP tests are run in their own
job. This is to address the issue above, and is also a partial
implementation of antrea-io#893.
@antoninbas
Copy link
Contributor

It seems a patch was submitted upstream: https://www.mail-archive.com/ovs-dev@openvswitch.org/msg49689.html. We can pick it up in Antrea after it's merged.

YiHungWei added a commit to YiHungWei/ovs that referenced this issue Dec 15, 2020
On userspace datapath, geneve option flag FLOW_TNL_F_UDPIF should only
be set when the geneve option is available.  However, currently, we always
set FLOW_TNL_F_UDPIF in the metadata flag, and that may result in megaflow
revalidation issue when the geneve option length is zero due to the datapath
flow key mis-match.  That is the original flow key always has FLOW_TNL_F_UDPIF
set, while the regenerated flow key during revalidation process  only has
FLOW_TNL_F_UDPIF set if geneve option length is zero.  For reference, check
tun_metadata_to_geneve_nlattr() to see how the flow key of geneve
tunnel metadatafor are generated from netlink attributes.

The following are the reproducible steps reported by Antonin.
After step 6, OvS reports a warning about failing to update the datapath
flow.

2020-12-15T01:56:21.324Z|00007|dpif(revalidator4)|WARN|netdev@ovs-netdev:
failed to put[modify] (No such file or directory)
ufid:d252fe62-5b2a-44e6-846a-190328190e09 skb_priority(0/0),
tunnel(tun_id=0x0,src=192.168.77.1,dst=192.168.77.2,ttl=64/0,tp_src=57391/0,
tp_dst=6081/0,flags(-df-csum+key)),skb_mark(0/0),ct_state(0x21/0x21),
ct_zone(0xfff0/0),ct_mark(0/0),ct_label(0/0),ct_tuple4(src=10.10.0.1/0.0.0.0,
dst=10.10.0.2/0.0.0.0,proto=1/0,tp_src=8/0,tp_dst=0/0),recirc_id(0xa),
dp_hash(0/0),in_port(5),packet_type(ns=0,id=0),
eth(src=1e:9c:f0:fb:18:9c/00:00:00:00:00:00,dst=ee:9f:60:8a:c0:a5/00:00:00:00:00:00),
eth_type(0x0800),ipv4(src=10.10.0.1/0.0.0.0,dst=10.10.0.2,proto=1/0,tos=0/0,
ttl=64/0,frag=no),icmp(type=8/0,code=0/0), actions:drop

Setup:
2 Nodes on the same subnet (192.168.77.101/24 - 192.168.77.102/24)

Step 1 – Creating bridges (run on each Node):

iface="enp0s8"

hwaddr=$(ip link show $iface | grep link/ether | awk '{print $2}')
inet=$(ip addr show $iface | grep "inet " | awk '{ print $2 }')

ovs-vsctl add-br br-phy \
          -- set Bridge br-phy datapath_type=netdev \
          -- br-set-external-id br-phy bridge-id br-phy \
          -- set bridge br-phy fail-mode=standalone \
          other_config:hwaddr="$hwaddr"
ovs-vsctl --timeout 10 add-port br-phy "$iface"
ip addr add "$inet" dev br-phy
ip link set br-phy up
ip addr flush dev enp0s8 2>/dev/null
ip link set enp0s8 up
iptables -F

ovs-vsctl add-br br-int \
          -- set Bridge br-int datapath_type=netdev \
          -- set bridge br-phy fail-mode=standalone

Step 2 – Creating netns to for overlay endpoints:

On first Node (192.168.77.101):
ip netns add ns0
ip link add veth0 type veth peer name veth1
ip link set veth0 netns ns0
ovs-vsctl add-port br-int veth1
ip link set dev veth1 up
ip netns exec ns0 ip addr add 10.10.0.1/24 dev veth0
ip netns exec ns0 ip link set dev veth0 up

On second Node (192.168.77.102):
ip netns add ns0
ip link add veth0 type veth peer name veth1
ip link set veth0 netns ns0
ovs-vsctl add-port br-int veth1
ip link set dev veth1 up
ip netns exec ns0 ip addr add 10.10.0.2/24 dev veth0
ip netns exec ns0 ip link set dev veth0 up

Step 3 – Create tunnel (run on each Node):

ovs-vsctl add-port br-int tun0 -- set interface tun0 type=geneve \
ofport_request=100 options:remote_ip=flow options:key=flow

Step 4 – Create the following flows:

On first Node (192.168.77.101):
root@ovs-test-node-1:/home/vagrant# ovs-ofctl dump-flows br-int --no-stats
priority=100,ip actions=resubmit(,10)
priority=0 actions=NORMAL
priority=50 actions=resubmit(,40)
table=10, priority=100,ip actions=ct(table=20,zone=65520)
table=20, priority=200,ct_state=-new+trk,ip actions=resubmit(,30)
table=20, priority=100,ip,nw_dst=10.10.0.2 actions=resubmit(,30)
table=20, priority=0,ip actions=drop
table=30, priority=100,ip actions=ct(commit,table=40,zone=65520)
table=40, priority=100,in_port=veth1 actions=load:0xc0a84d66->NXM_NX_TUN_IPV4_DST[],output:tun0
table=40, priority=100,in_port=tun0 actions=output:veth1
table=40, priority=0 actions=drop

On second Node (192.168.77.102):
root@ovs-test-node-2:/home/vagrant# ovs-ofctl dump-flows br-int --no-stats
priority=100,ip actions=resubmit(,10)
priority=0 actions=NORMAL
priority=50 actions=resubmit(,40)
table=10, priority=100,ip actions=ct(table=20,zone=65520)
table=20, priority=200,ct_state=-new+trk,ip actions=resubmit(,30)
table=20, priority=100,ip,nw_dst=10.10.0.2 actions=resubmit(,30)
table=20, priority=0,ip actions=drop
table=30, priority=100,ip actions=ct(commit,table=40,zone=65520)
table=40, priority=100,in_port=veth1 actions=load:0xc0a84d65->NXM_NX_TUN_IPV4_DST[],output:tun0
table=40, priority=100,in_port=tun0 actions=output:veth1
table=40, priority=0 actions=drop

Step 5 – Check that ping works:
From the first Node: ip netns exec ns0 ping 10.10.0.2

Step 6 – The actual issue:
From the first Node: ip netns exec ns0 ping -c 3 10.10.0.2
From the second Node: ovs-ofctl del-flows br-int 'table=20,ip,nw_dst=10.10.0.2'
From the first Node: ip netns exec ns0 ping -c 3 10.10.0.2

Execute these instructions in order, as soon as the previous one
completes.  If you follow these steps, you should see the ping in
the last step succeed.  This is not expected because of the deleted
flow. It also does not happen with VXLAN.

Reported-by: Antonin Bas <abas@vmware.com>
Reported-at: antrea-io/antrea#897
Fixes: 6b241d6 ("netdev-vport: Factor-out tunnel Push-pop code into separate module.")
Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
ovsrobot pushed a commit to ovsrobot/ovs that referenced this issue Dec 15, 2020
On userspace datapath, geneve option flag FLOW_TNL_F_UDPIF should only
be set when the geneve option is available.  However, currently, we always
set FLOW_TNL_F_UDPIF in the metadata flag, and that may result in megaflow
revalidation issue when the geneve option length is zero due to the datapath
flow key mis-match.  That is the original flow key always has FLOW_TNL_F_UDPIF
set, while the regenerated flow key during revalidation process  only has
FLOW_TNL_F_UDPIF set if geneve option length is zero.  For reference, check
tun_metadata_to_geneve_nlattr() to see how the flow key of geneve
tunnel metadatafor are generated from netlink attributes.

The following are the reproducible steps reported by Antonin.
After step 6, OvS reports a warning about failing to update the datapath
flow.

2020-12-15T01:56:21.324Z|00007|dpif(revalidator4)|WARN|netdev@ovs-netdev:
failed to put[modify] (No such file or directory)
ufid:d252fe62-5b2a-44e6-846a-190328190e09 skb_priority(0/0),
tunnel(tun_id=0x0,src=192.168.77.1,dst=192.168.77.2,ttl=64/0,tp_src=57391/0,
tp_dst=6081/0,flags(-df-csum+key)),skb_mark(0/0),ct_state(0x21/0x21),
ct_zone(0xfff0/0),ct_mark(0/0),ct_label(0/0),ct_tuple4(src=10.10.0.1/0.0.0.0,
dst=10.10.0.2/0.0.0.0,proto=1/0,tp_src=8/0,tp_dst=0/0),recirc_id(0xa),
dp_hash(0/0),in_port(5),packet_type(ns=0,id=0),
eth(src=1e:9c:f0:fb:18:9c/00:00:00:00:00:00,dst=ee:9f:60:8a:c0:a5/00:00:00:00:00:00),
eth_type(0x0800),ipv4(src=10.10.0.1/0.0.0.0,dst=10.10.0.2,proto=1/0,tos=0/0,
ttl=64/0,frag=no),icmp(type=8/0,code=0/0), actions:drop

Setup:
2 Nodes on the same subnet (192.168.77.101/24 - 192.168.77.102/24)

Step 1 – Creating bridges (run on each Node):

iface="enp0s8"

hwaddr=$(ip link show $iface | grep link/ether | awk '{print $2}')
inet=$(ip addr show $iface | grep "inet " | awk '{ print $2 }')

ovs-vsctl add-br br-phy \
          -- set Bridge br-phy datapath_type=netdev \
          -- br-set-external-id br-phy bridge-id br-phy \
          -- set bridge br-phy fail-mode=standalone \
          other_config:hwaddr="$hwaddr"
ovs-vsctl --timeout 10 add-port br-phy "$iface"
ip addr add "$inet" dev br-phy
ip link set br-phy up
ip addr flush dev enp0s8 2>/dev/null
ip link set enp0s8 up
iptables -F

ovs-vsctl add-br br-int \
          -- set Bridge br-int datapath_type=netdev \
          -- set bridge br-phy fail-mode=standalone

Step 2 – Creating netns to for overlay endpoints:

On first Node (192.168.77.101):
ip netns add ns0
ip link add veth0 type veth peer name veth1
ip link set veth0 netns ns0
ovs-vsctl add-port br-int veth1
ip link set dev veth1 up
ip netns exec ns0 ip addr add 10.10.0.1/24 dev veth0
ip netns exec ns0 ip link set dev veth0 up

On second Node (192.168.77.102):
ip netns add ns0
ip link add veth0 type veth peer name veth1
ip link set veth0 netns ns0
ovs-vsctl add-port br-int veth1
ip link set dev veth1 up
ip netns exec ns0 ip addr add 10.10.0.2/24 dev veth0
ip netns exec ns0 ip link set dev veth0 up

Step 3 – Create tunnel (run on each Node):

ovs-vsctl add-port br-int tun0 -- set interface tun0 type=geneve \
ofport_request=100 options:remote_ip=flow options:key=flow

Step 4 – Create the following flows:

On first Node (192.168.77.101):
root@ovs-test-node-1:/home/vagrant# ovs-ofctl dump-flows br-int --no-stats
priority=100,ip actions=resubmit(,10)
priority=0 actions=NORMAL
priority=50 actions=resubmit(,40)
table=10, priority=100,ip actions=ct(table=20,zone=65520)
table=20, priority=200,ct_state=-new+trk,ip actions=resubmit(,30)
table=20, priority=100,ip,nw_dst=10.10.0.2 actions=resubmit(,30)
table=20, priority=0,ip actions=drop
table=30, priority=100,ip actions=ct(commit,table=40,zone=65520)
table=40, priority=100,in_port=veth1 actions=load:0xc0a84d66->NXM_NX_TUN_IPV4_DST[],output:tun0
table=40, priority=100,in_port=tun0 actions=output:veth1
table=40, priority=0 actions=drop

On second Node (192.168.77.102):
root@ovs-test-node-2:/home/vagrant# ovs-ofctl dump-flows br-int --no-stats
priority=100,ip actions=resubmit(,10)
priority=0 actions=NORMAL
priority=50 actions=resubmit(,40)
table=10, priority=100,ip actions=ct(table=20,zone=65520)
table=20, priority=200,ct_state=-new+trk,ip actions=resubmit(,30)
table=20, priority=100,ip,nw_dst=10.10.0.2 actions=resubmit(,30)
table=20, priority=0,ip actions=drop
table=30, priority=100,ip actions=ct(commit,table=40,zone=65520)
table=40, priority=100,in_port=veth1 actions=load:0xc0a84d65->NXM_NX_TUN_IPV4_DST[],output:tun0
table=40, priority=100,in_port=tun0 actions=output:veth1
table=40, priority=0 actions=drop

Step 5 – Check that ping works:
From the first Node: ip netns exec ns0 ping 10.10.0.2

Step 6 – The actual issue:
From the first Node: ip netns exec ns0 ping -c 3 10.10.0.2
From the second Node: ovs-ofctl del-flows br-int 'table=20,ip,nw_dst=10.10.0.2'
From the first Node: ip netns exec ns0 ping -c 3 10.10.0.2

Execute these instructions in order, as soon as the previous one
completes.  If you follow these steps, you should see the ping in
the last step succeed.  This is not expected because of the deleted
flow. It also does not happen with VXLAN.

Reported-by: Antonin Bas <abas@vmware.com>
Reported-at: antrea-io/antrea#897
Fixes: 6b241d6 ("netdev-vport: Factor-out tunnel Push-pop code into separate module.")
Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
@antoninbas
Copy link
Contributor

There is a new upstream patch for OVS which I believe replaces the one mentioned in #897 (comment): https://mail.openvswitch.org/pipermail/ovs-dev/2020-December/378711.html. The patch has not been merged yet.

@antoninbas antoninbas removed this from the Antrea v1.0 release milestone Apr 6, 2021
ovsrobot pushed a commit to ovsrobot/ovs that referenced this issue Jun 2, 2021
This optimization caused FLOW_TNL_F_UDPIF flag not to be used in
hash calculation for geneve tunnel when revalidating flows which
resulted in different cache hash values and incorrect behaviour.

Added test to prevent regression.

Reported-at: antrea-io/antrea#897
Signed-off-by: Toms Atteka <cpp.code.lv@gmail.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
ovsrobot pushed a commit to ovsrobot/ovs that referenced this issue Jun 3, 2021
This optimization caused FLOW_TNL_F_UDPIF flag not to be used in
hash calculation for geneve tunnel when revalidating flows which
resulted in different cache hash values and incorrect behaviour.

Added test to prevent regression.

Reported-at: antrea-io/antrea#897
Signed-off-by: Toms Atteka <cpp.code.lv@gmail.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
ovsrobot pushed a commit to ovsrobot/ovs that referenced this issue Jun 9, 2021
This optimization caused FLOW_TNL_F_UDPIF flag not to be used in
hash calculation for geneve tunnel when revalidating flows which
resulted in different cache hash values and incorrect behaviour.

Added test to prevent regression.

CC: Jesse Gross <jesse@nicira.com>
Fixes: 6728d57 ("dpif-netdev: Translate Geneve options per-flow, not per-packet.")
Reported-at: antrea-io/antrea#897
Signed-off-by: Toms Atteka <cpp.code.lv@gmail.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
ansisatteka pushed a commit to openvswitch/ovs that referenced this issue Jun 15, 2021
This optimization caused FLOW_TNL_F_UDPIF flag not to be used in
hash calculation for geneve tunnel when revalidating flows which
resulted in different cache hash values and incorrect behaviour.

Added test to prevent regression.

CC: Jesse Gross <jesse@nicira.com>
Fixes: 6728d57 ("dpif-netdev: Translate Geneve options per-flow, not per-packet.")
Reported-at: antrea-io/antrea#897
Signed-off-by: Toms Atteka <cpp.code.lv@gmail.com>
Acked-by: Ansis Atteka <aatteka@ovn.org>
@antoninbas
Copy link
Contributor

The patch has been merged into the master branch of OVS: openvswitch/ovs@cca4014.

We should consider applying it to our OVS build.

@antoninbas antoninbas added this to the Antrea v1.2 release milestone Jun 22, 2021
igsilya pushed a commit to igsilya/ovs that referenced this issue Jun 30, 2021
This optimization caused FLOW_TNL_F_UDPIF flag not to be used in
hash calculation for geneve tunnel when revalidating flows which
resulted in different cache hash values and incorrect behaviour.

Added test to prevent regression.

CC: Jesse Gross <jesse@nicira.com>
Fixes: 6728d57 ("dpif-netdev: Translate Geneve options per-flow, not per-packet.")
Reported-at: antrea-io/antrea#897
Signed-off-by: Toms Atteka <cpp.code.lv@gmail.com>
Acked-by: Ansis Atteka <aatteka@ovn.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
igsilya pushed a commit to igsilya/ovs that referenced this issue Jun 30, 2021
This optimization caused FLOW_TNL_F_UDPIF flag not to be used in
hash calculation for geneve tunnel when revalidating flows which
resulted in different cache hash values and incorrect behaviour.

Added test to prevent regression.

CC: Jesse Gross <jesse@nicira.com>
Fixes: 6728d57 ("dpif-netdev: Translate Geneve options per-flow, not per-packet.")
Reported-at: antrea-io/antrea#897
Signed-off-by: Toms Atteka <cpp.code.lv@gmail.com>
Acked-by: Ansis Atteka <aatteka@ovn.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
igsilya pushed a commit to igsilya/ovs that referenced this issue Jun 30, 2021
This optimization caused FLOW_TNL_F_UDPIF flag not to be used in
hash calculation for geneve tunnel when revalidating flows which
resulted in different cache hash values and incorrect behaviour.

Added test to prevent regression.

CC: Jesse Gross <jesse@nicira.com>
Fixes: 6728d57 ("dpif-netdev: Translate Geneve options per-flow, not per-packet.")
Reported-at: antrea-io/antrea#897
Signed-off-by: Toms Atteka <cpp.code.lv@gmail.com>
Acked-by: Ansis Atteka <aatteka@ovn.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
antoninbas added a commit to antoninbas/antrea that referenced this issue Jul 30, 2021
One interesting fix is to Geneve tunnel support in the userspace
datapath. See antrea-io#897.

Signed-off-by: Antonin Bas <abas@vmware.com>
antoninbas added a commit that referenced this issue Aug 2, 2021
One interesting fix is to Geneve tunnel support in the userspace
datapath. See #897.

Signed-off-by: Antonin Bas <abas@vmware.com>
antoninbas added a commit to antoninbas/antrea that referenced this issue Aug 23, 2021
A patch was merged in upstream OVS and we picked up this patch when we
upgraded to OVS 2.15.1.

Fixes antrea-io#897

Signed-off-by: Antonin Bas <abas@vmware.com>
antoninbas added a commit that referenced this issue Aug 23, 2021
A patch was merged in upstream OVS and we picked up this patch when we
upgraded to OVS 2.15.1.

Fixes #897

Signed-off-by: Antonin Bas <abas@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/exp/netpol Issues or PRs related to the netpol proposal. kind/bug Categorizes issue or PR as related to a bug. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants