Skip to content

Commit

Permalink
Merge pull request #1528 from gravitl/bugfix_v0.15.1_server_readconfig
Browse files Browse the repository at this point in the history
adding server check
  • Loading branch information
afeiszli authored Sep 7, 2022
2 parents 1400195 + 0e5fc51 commit 7467770
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions netclient/wireguard/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,20 +293,21 @@ func ApplyConf(node *models.Node, ifacename string, confPath string) error {

var nodeCfg config.ClientConfig
nodeCfg.Network = node.Network
nodeCfg.ReadConfig()
if nodeCfg.NetworkSettings.AddressRange != "" {
ip, cidr, err := net.ParseCIDR(nodeCfg.NetworkSettings.AddressRange)
if err == nil {
local.SetCIDRRoute(node.Interface, ip.String(), cidr)
if !(node.IsServer == "yes") {
nodeCfg.ReadConfig()
if nodeCfg.NetworkSettings.AddressRange != "" {
ip, cidr, err := net.ParseCIDR(nodeCfg.NetworkSettings.AddressRange)
if err == nil {
local.SetCIDRRoute(node.Interface, ip.String(), cidr)
}
}
}
if nodeCfg.NetworkSettings.AddressRange6 != "" {
ip, cidr, err := net.ParseCIDR(nodeCfg.NetworkSettings.AddressRange6)
if err == nil {
local.SetCIDRRoute(node.Interface, ip.String(), cidr)
if nodeCfg.NetworkSettings.AddressRange6 != "" {
ip, cidr, err := net.ParseCIDR(nodeCfg.NetworkSettings.AddressRange6)
if err == nil {
local.SetCIDRRoute(node.Interface, ip.String(), cidr)
}
}
}

return err
}

Expand Down

0 comments on commit 7467770

Please sign in to comment.