From 69d5f518c3a2af6634cfbcb33f31a891a0a8fd4b Mon Sep 17 00:00:00 2001 From: Wei Tie Date: Thu, 4 Jan 2018 12:36:32 -0800 Subject: [PATCH] Set goto hostDNAT table priority lower than ARP Rules having the same priority will be processed based on the sequence in flow table, since we always want ARP request goto controller, this commit lower the priority of goto hostDNAT table so that ARP request will always be handled correctly. Signed-off-by: Wei Tie --- ofnet_route_test.go | 4 ++-- vrouter.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ofnet_route_test.go b/ofnet_route_test.go index 7554cf93..cd418aa8 100755 --- a/ofnet_route_test.go +++ b/ofnet_route_test.go @@ -73,7 +73,7 @@ func TestOfnetVrouteAddDelete(t *testing.T) { log.Infof("Flowlist: %v", flowList) // verify ingress host NAT flows - hpInMatch := fmt.Sprintf("priority=100,in_port=%d actions=goto_table:%d", testHostPort+i, HOST_DNAT_TBL_ID) + hpInMatch := fmt.Sprintf("priority=99,in_port=%d actions=goto_table:%d", testHostPort+i, HOST_DNAT_TBL_ID) verifyHostNAT(t, flowList, 0, hpInMatch, true) hpDnatMatch := fmt.Sprintf("priority=100,ip,in_port=%d,nw_dst=172.20.20.%d actions=set_field:02:02:02:%02x:%02x:%02x->eth_dst,set_field:10.10.%d.%d->ip_dst,write_metadata:0x100000000/0xff00000000,goto_table:%d", testHostPort+i, NUM_AGENT+2, i+1, i+1, i+1, i+1, i+1, SRV_PROXY_SNAT_TBL_ID) verifyHostNAT(t, flowList, HOST_DNAT_TBL_ID, hpDnatMatch, true) @@ -148,7 +148,7 @@ func TestOfnetVrouteAddDelete(t *testing.T) { t.Errorf("Error getting flow entries. Err: %v", err) } // verify ingress host NAT flows - hpInMatch := fmt.Sprintf("priority=100,in_port=%d actions=goto_table:%d", testHostPort+i, HOST_DNAT_TBL_ID) + hpInMatch := fmt.Sprintf("priority=99,in_port=%d actions=goto_table:%d", testHostPort+i, HOST_DNAT_TBL_ID) verifyHostNAT(t, flowList, 0, hpInMatch, false) hpDnatMatch := fmt.Sprintf("priority=100,ip,in_port=%d,nw_dst=172.20.20.%d actions=set_field:02:02:02:%02x:%02x:%02x->eth_dst,set_field:10.10.%d.%d->ip_dst,write_metadata:0x100000000/0xff00000000,goto_table:%d", testHostPort+i, NUM_AGENT+2, i+1, i+1, i+1, i+1, i+1, SRV_PROXY_SNAT_TBL_ID) verifyHostNAT(t, flowList, HOST_DNAT_TBL_ID, hpDnatMatch, false) diff --git a/vrouter.go b/vrouter.go index b1529e21..37274f8e 100755 --- a/vrouter.go +++ b/vrouter.go @@ -507,7 +507,8 @@ func (self *Vrouter) AddHostPort(hp HostPortInfo) error { // Set up DNAT for ingress traffic inNATFlow, _ := self.inputTable.NewFlow(ofctrl.FlowMatch{ InputPort: self.hostNATInfo.PortNo, - Priority: FLOW_MATCH_PRIORITY, + // Put at lower priority than ARP rule + Priority: FLOW_MATCH_PRIORITY - 1, }) inNATFlow.Next(self.hostDNATTable)