Skip to content

Commit c557d6d

Browse files
committed
Output VXLAN multicast flow in sorted order
(Which makes it consistent with the local multicast flow, and fixes a test flake.)
1 parent d4b3563 commit c557d6d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pkg/sdn/plugin/subnets.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ package plugin
33
import (
44
"fmt"
55
"net"
6+
"sort"
67
"strconv"
8+
"strings"
79

810
log "github.com/golang/glog"
911

@@ -266,13 +268,14 @@ func (plugin *OsdnNode) updateVXLANMulticastRules(subnets hostSubnetMap) {
266268
otx := plugin.ovs.NewTransaction()
267269

268270
// Build the list of all nodes for multicast forwarding
269-
tun_dsts := ""
271+
tun_dsts := make([]string, 0, len(subnets))
270272
for _, subnet := range subnets {
271273
if subnet.HostIP != plugin.localIP {
272-
tun_dsts += fmt.Sprintf(",set_field:%s->tun_dst,output:1", subnet.HostIP)
274+
tun_dsts = append(tun_dsts, fmt.Sprintf(",set_field:%s->tun_dst,output:1", subnet.HostIP))
273275
}
274276
}
275-
otx.AddFlow("table=111, priority=100, actions=move:NXM_NX_REG0[]->NXM_NX_TUN_ID[0..31]%s,goto_table:120", tun_dsts)
277+
sort.Strings(sort.StringSlice(tun_dsts))
278+
otx.AddFlow("table=111, priority=100, actions=move:NXM_NX_REG0[]->NXM_NX_TUN_ID[0..31]%s,goto_table:120", strings.Join(tun_dsts, ""))
276279

277280
if err := otx.EndTransaction(); err != nil {
278281
log.Errorf("Error updating OVS VXLAN multicast flows: %v", err)

0 commit comments

Comments
 (0)