Skip to content

Commit

Permalink
Ignore previous serf user events to avoid wrong fdb programming
Browse files Browse the repository at this point in the history
Signed-off-by: Santhosh Manohar <[email protected]>
  • Loading branch information
Santhosh Manohar committed Feb 7, 2017
1 parent e6d4289 commit f26b2e6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions drivers/overlay/ov_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,9 @@ func (n *network) watchMiss(nlSock *nl.NetlinkSocket) {
}

if neigh.IP.To4() == nil {
if neigh.HardwareAddr != nil {
logrus.Debugf("Miss notification, l2 mac %v", neigh.HardwareAddr)
}
continue
}

Expand Down
8 changes: 5 additions & 3 deletions drivers/overlay/ov_serf.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (d *driver) serfJoin(neighIP string) error {
if neighIP == "" {
return fmt.Errorf("no neighbor to join")
}
if _, err := d.serfInstance.Join([]string{neighIP}, false); err != nil {
if _, err := d.serfInstance.Join([]string{neighIP}, true); err != nil {
return fmt.Errorf("Failed to join the cluster at neigh IP %s: %v",
neighIP, err)
}
Expand All @@ -94,8 +94,8 @@ func (d *driver) notifyEvent(event ovNotify) {
}

func (d *driver) processEvent(u serf.UserEvent) {
logrus.Debugf("Received user event name:%s, payload:%s\n", u.Name,
string(u.Payload))
logrus.Debugf("Received user event name:%s, payload:%s LTime:%v \n", u.Name,
string(u.Payload), uint64(u.LTime))

var dummy, action, vtepStr, nid, eid, ipStr, maskStr, macStr string
if _, err := fmt.Sscan(u.Name, &dummy, &vtepStr, &nid, &eid); err != nil {
Expand Down Expand Up @@ -146,6 +146,7 @@ func (d *driver) processQuery(q *serf.Query) {
return
}

logrus.Debugf("Sending peer query resp %v", fmt.Sprintf("%s %s %s", peerMac.String(), net.IP(peerIPMask).String(), vtep.String()))
q.Respond([]byte(fmt.Sprintf("%s %s %s", peerMac.String(), net.IP(peerIPMask).String(), vtep.String())))
}

Expand Down Expand Up @@ -173,6 +174,7 @@ func (d *driver) resolvePeer(nid string, peerIP net.IP) (net.HardwareAddr, net.I
return nil, nil, nil, fmt.Errorf("failed to parse mac: %v", err)
}

logrus.Debugf("Received peer query response, mac %s, vtep %s, mask %s", macStr, vtepStr, maskStr)
return mac, net.IPMask(net.ParseIP(maskStr).To4()), net.ParseIP(vtepStr), nil

case <-time.After(time.Second):
Expand Down
2 changes: 2 additions & 0 deletions osl/neigh_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"net"

"github.com/Sirupsen/logrus"
"github.com/vishvananda/netlink"
)

Expand Down Expand Up @@ -96,6 +97,7 @@ func (n *networkNamespace) AddNeighbor(dstIP net.IP, dstMac net.HardwareAddr, op

nh := n.findNeighbor(dstIP, dstMac)
if nh != nil {
logrus.Debugf("Neighbor entry already present for IP %v, mac %v", dstIP, dstMac)
// If it exists silently return
return nil
}
Expand Down

0 comments on commit f26b2e6

Please sign in to comment.