Skip to content

Commit

Permalink
Add ability to return already received routes for a VNI
Browse files Browse the repository at this point in the history
Signed-off-by: Guvenc Gulce <[email protected]>
  • Loading branch information
guvenc committed Jul 17, 2023
1 parent 34d4a13 commit b667a7e
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions metalbond.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ func (m *MetalBond) distributeRouteToPeers(action UpdateAction, vni VNI, dest De
// send route to all peers who have subscribed to this VNI - with few exceptions:
for p := range m.subscribers[vni] {
// don't send route back to the peer we got it from
// Except for the LB routes
if p == fromPeer && hop.Type != pb.NextHopType_LOADBALANCER_TARGET {
// Only for NAT routes
if p == fromPeer && hop.Type == pb.NextHopType_NAT {
continue
}

Expand All @@ -297,6 +297,19 @@ func (m *MetalBond) distributeRouteToPeers(action UpdateAction, vni VNI, dest De
return nil
}

func (m *MetalBond) GetRoutesForVni(vni VNI) error {
for dest, hops := range m.routeTable.GetDestinationsByVNI(vni) {
for _, hop := range hops {
err := m.client.AddRoute(vni, dest, hop)
if err != nil {
m.log().Errorf("Client.AddRoute call failed in Refill: %v", err)
return err
}
}
}
return nil
}

func (m *MetalBond) addReceivedRoute(fromPeer *metalBondPeer, vni VNI, dest Destination, hop NextHop) error {
err := m.routeTable.AddNextHop(vni, dest, hop, fromPeer)
if err != nil {
Expand Down

0 comments on commit b667a7e

Please sign in to comment.