Skip to content

Commit

Permalink
add all networks rules
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek9686 committed Dec 15, 2024
1 parent 98e3132 commit 0216c59
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions logic/peers.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,24 @@ func GetPeerUpdateForHost(network string, host *models.Host, allNodes []models.N
HostNetworkInfo: models.HostInfoMap{},
EndpointDetection: servercfg.IsEndpointDetectionEnabled(),
}
defer func() {
if !hostPeerUpdate.FwUpdate.AllowAll {
aclRule := models.AclRule{
ID: "allowed-network-rules",
AllowedProtocol: models.ALL,
Direction: models.TrafficDirectionBi,
Allowed: true,
}
for _, allowedNet := range hostPeerUpdate.FwUpdate.AllowedNetworks {
if allowedNet.IP.To4() != nil {
aclRule.IPList = append(aclRule.IPList, allowedNet)
} else {
aclRule.IP6List = append(aclRule.IP6List, allowedNet)
}
}
hostPeerUpdate.FwUpdate.AclRules["allowed-network-rules"] = aclRule
}
}()

slog.Debug("peer update for host", "hostId", host.ID.String())
peerIndexMap := make(map[string]int)
Expand Down

0 comments on commit 0216c59

Please sign in to comment.