Skip to content

Commit c080e5b

Browse files
authored
Merge pull request #104 from tiewei/arp-priority
Set goto hostDNAT table priority lower than ARP
2 parents 1d2c7cb + 69d5f51 commit c080e5b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

ofnet_route_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func TestOfnetVrouteAddDelete(t *testing.T) {
7373

7474
log.Infof("Flowlist: %v", flowList)
7575
// verify ingress host NAT flows
76-
hpInMatch := fmt.Sprintf("priority=100,in_port=%d actions=goto_table:%d", testHostPort+i, HOST_DNAT_TBL_ID)
76+
hpInMatch := fmt.Sprintf("priority=99,in_port=%d actions=goto_table:%d", testHostPort+i, HOST_DNAT_TBL_ID)
7777
verifyHostNAT(t, flowList, 0, hpInMatch, true)
7878
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)
7979
verifyHostNAT(t, flowList, HOST_DNAT_TBL_ID, hpDnatMatch, true)
@@ -148,7 +148,7 @@ func TestOfnetVrouteAddDelete(t *testing.T) {
148148
t.Errorf("Error getting flow entries. Err: %v", err)
149149
}
150150
// verify ingress host NAT flows
151-
hpInMatch := fmt.Sprintf("priority=100,in_port=%d actions=goto_table:%d", testHostPort+i, HOST_DNAT_TBL_ID)
151+
hpInMatch := fmt.Sprintf("priority=99,in_port=%d actions=goto_table:%d", testHostPort+i, HOST_DNAT_TBL_ID)
152152
verifyHostNAT(t, flowList, 0, hpInMatch, false)
153153
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)
154154
verifyHostNAT(t, flowList, HOST_DNAT_TBL_ID, hpDnatMatch, false)

vrouter.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,8 @@ func (self *Vrouter) AddHostPort(hp HostPortInfo) error {
507507
// Set up DNAT for ingress traffic
508508
inNATFlow, _ := self.inputTable.NewFlow(ofctrl.FlowMatch{
509509
InputPort: self.hostNATInfo.PortNo,
510-
Priority: FLOW_MATCH_PRIORITY,
510+
// Put at lower priority than ARP rule
511+
Priority: FLOW_MATCH_PRIORITY - 1,
511512
})
512513
inNATFlow.Next(self.hostDNATTable)
513514

0 commit comments

Comments
 (0)