mirror of
https://github.com/gravitl/netmaker.git
synced 2024-09-20 07:16:06 +08:00
NET-1565:fix extClient ip conflict issue (#3082)
* fix extClient ip conflict issue * Update users.go --------- Co-authored-by: Abhishek K <abhishek@netmaker.io>
This commit is contained in:
parent
19d7bb1ea2
commit
bbca20e463
|
@ -42,19 +42,35 @@ func SetAllocatedIpMap() error {
|
|||
pMap := map[string]net.IP{}
|
||||
netName := v.NetID
|
||||
|
||||
//nodes
|
||||
nodes, err := GetNetworkNodes(netName)
|
||||
if err != nil {
|
||||
slog.Error("could not load node for network", netName, "error", err.Error())
|
||||
continue
|
||||
} else {
|
||||
for _, n := range nodes {
|
||||
|
||||
if n.Address.IP != nil {
|
||||
pMap[n.Address.IP.String()] = n.Address.IP
|
||||
}
|
||||
if n.Address6.IP != nil {
|
||||
pMap[n.Address6.IP.String()] = n.Address6.IP
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for _, n := range nodes {
|
||||
|
||||
if n.Address.IP != nil {
|
||||
pMap[n.Address.IP.String()] = n.Address.IP
|
||||
}
|
||||
if n.Address6.IP != nil {
|
||||
pMap[n.Address6.IP.String()] = n.Address6.IP
|
||||
//extClients
|
||||
extClients, err := GetNetworkExtClients(netName)
|
||||
if err != nil {
|
||||
slog.Error("could not load extClient for network", netName, "error", err.Error())
|
||||
} else {
|
||||
for _, extClient := range extClients {
|
||||
if extClient.Address != "" {
|
||||
pMap[extClient.Address] = net.ParseIP(extClient.Address)
|
||||
}
|
||||
if extClient.Address6 != "" {
|
||||
pMap[extClient.Address6] = net.ParseIP(extClient.Address6)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -849,7 +849,6 @@ func getUserRemoteAccessGwsV1(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
userGwNodes := proLogic.GetUserRAGNodes(*user)
|
||||
logger.Log(0, fmt.Sprintf("1. User Gw Nodes: %+v", userGwNodes))
|
||||
for _, extClient := range allextClients {
|
||||
node, ok := userGwNodes[extClient.IngressGatewayID]
|
||||
if !ok {
|
||||
|
@ -885,7 +884,6 @@ func getUserRemoteAccessGwsV1(w http.ResponseWriter, r *http.Request) {
|
|||
delete(userGwNodes, node.ID.String())
|
||||
}
|
||||
}
|
||||
logger.Log(0, fmt.Sprintf("2. User Gw Nodes: %+v", userGwNodes))
|
||||
// add remaining gw nodes to resp
|
||||
for gwID := range userGwNodes {
|
||||
node, err := logic.GetNodeByID(gwID)
|
||||
|
|
Loading…
Reference in a new issue