Skip to content

Commit

Permalink
Merge pull request #104 from tiewei/arp-priority
Browse files Browse the repository at this point in the history
Set goto hostDNAT table priority lower than ARP
  • Loading branch information
tiewei authored Jan 4, 2018
2 parents 1d2c7cb + 69d5f51 commit c080e5b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ofnet_route_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion vrouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit c080e5b

Please sign in to comment.