Skip to content

Commit

Permalink
Output VXLAN multicast flow in sorted order
Browse files Browse the repository at this point in the history
(Which makes it consistent with the local multicast flow, and fixes
a test flake.)
  • Loading branch information
danwinship committed Mar 2, 2017
1 parent c5725d7 commit 876affc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/sdn/plugin/subnets.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package plugin
import (
"fmt"
"net"
"sort"
"strconv"
"strings"

log "github.com/golang/glog"

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

// Build the list of all nodes for multicast forwarding
tun_dsts := ""
tun_dsts := make([]string, 0, len(subnets))
for _, subnet := range subnets {
if subnet.HostIP != plugin.localIP {
tun_dsts += fmt.Sprintf(",set_field:%s->tun_dst,output:1", subnet.HostIP)
tun_dsts = append(tun_dsts, fmt.Sprintf(",set_field:%s->tun_dst,output:1", subnet.HostIP))
}
}
otx.AddFlow("table=111, priority=100, actions=move:NXM_NX_REG0[]->NXM_NX_TUN_ID[0..31]%s,goto_table:120", tun_dsts)
sort.Strings(sort.StringSlice(tun_dsts))
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, ""))

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

0 comments on commit 876affc

Please sign in to comment.