diff --git a/vxlanBridge.go b/vxlanBridge.go index 889f7d58..21a33ec9 100755 --- a/vxlanBridge.go +++ b/vxlanBridge.go @@ -130,6 +130,24 @@ func (self *Vxlan) SwitchConnected(sw *ofctrl.OFSwitch) { self.initFgraph() log.Infof("Switch connected(vxlan)") + + // If vlanDb is populated and switch is connected, this implies + // we reconnected to a switch again. In this case, we have to + // update the current vlan entry to use a new switch object + if len(self.vlanDb) != 0 { + for vlanId, vlan := range self.vlanDb { + log.Debugf(" Updating vlan %s switch object", vlanId) + var err error + vlan.localFlood, err = self.ofSwitch.NewFlood() + if err != nil { + log.Fatalf("Unable to assign new switch to vlan %v local flood", vlanId) + } + vlan.allFlood, err = self.ofSwitch.NewFlood() + if err != nil { + log.Fatalf("Unable to assign new switch to vlan %v all flood", vlanId) + } + } + } } // Handle switch disconnected notification