Browse Source

Merge pull request #2044 from gravitl/GRA-1194/extclient_egress

Gra 1194: add egress ranges of the peer GW to ingress info
dcarns 2 years ago
parent
commit
3c2ec68fe6
2 changed files with 6 additions and 1 deletions
  1. 4 0
      logic/peers.go
  2. 2 1
      models/mqtt.go

+ 4 - 0
logic/peers.go

@@ -405,6 +405,10 @@ func GetPeerUpdateForHost(host *models.Host) (models.HostPeerUpdate, error) {
 						}
 					}
 				}
+				if node.IsIngressGateway && peer.IsEgressGateway {
+					hostPeerUpdate.IngressInfo.EgressRanges = append(hostPeerUpdate.IngressInfo.EgressRanges,
+						peer.EgressGatewayRanges...)
+				}
 				nodePeerMap[peerHost.PublicKey.String()] = models.PeerRouteInfo{
 					PeerAddr: net.IPNet{
 						IP:   net.ParseIP(peer.PrimaryAddress()),

+ 2 - 1
models/mqtt.go

@@ -31,7 +31,8 @@ type HostPeerUpdate struct {
 
 // IngressInfo - struct for ingress info
 type IngressInfo struct {
-	ExtPeers map[string]ExtClientInfo `json:"ext_peers" yaml:"ext_peers"`
+	ExtPeers     map[string]ExtClientInfo `json:"ext_peers" yaml:"ext_peers"`
+	EgressRanges []string                 `json:"egress_ranges" yaml:"egress_ranges"`
 }
 
 // EgressInfo - struct for egress info