From 5d7a8701ae0c13c26685272cda85654b528f3522 Mon Sep 17 00:00:00 2001 From: toweber <> Date: Thu, 19 Dec 2024 15:09:11 +0100 Subject: [PATCH] Add mgmt subnet range to no_proxy var --- clab/config.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/clab/config.go b/clab/config.go index 331cfd0a0..799d252c4 100644 --- a/clab/config.go +++ b/clab/config.go @@ -227,14 +227,14 @@ func (c *CLab) createNodeCfg(nodeName string, nodeDef *types.NodeDefinition, idx noProxyLower, existsLower := nodeCfg.Env["no_proxy"] noProxyUpper, existsUpper := nodeCfg.Env["NO_PROXY"] noProxy := "" - if existsLower { + if existsLower { noProxy = noProxyLower - for _, defaultValue := range noProxyDefaults { + for _, defaultValue := range noProxyDefaults { if !strings.Contains(noProxy, defaultValue) { noProxy=noProxy + "," + defaultValue } } - } else if existsUpper { + } else if existsUpper { noProxy = noProxyUpper for _, defaultValue := range noProxyDefaults { if !strings.Contains(noProxy, defaultValue) { @@ -247,9 +247,9 @@ func (c *CLab) createNodeCfg(nodeName string, nodeDef *types.NodeDefinition, idx // add all clab nodes to the no_proxy variable, if they have a static IP assigned, add this as well var noProxyList []string - for key := range c.Config.Topology.Nodes { - noProxyList = append(noProxyList, key) - ipv4address := c.Config.Topology.Nodes[key].GetMgmtIPv4() + for key := range c.Config.Topology.Nodes { + noProxyList = append(noProxyList, key) + ipv4address := c.Config.Topology.Nodes[key].GetMgmtIPv4() if ipv4address != "" { noProxyList = append(noProxyList, ipv4address) } @@ -257,7 +257,11 @@ func (c *CLab) createNodeCfg(nodeName string, nodeDef *types.NodeDefinition, idx if ipv6address != "" { noProxyList = append(noProxyList, ipv6address) } - } + } + + // add mgmt subnet range for the sake of completeness - some OS support it, others don't + noProxyList = append(noProxyList, c.Config.Mgmt.IPv4Subnet) + noProxyList = append(noProxyList, c.Config.Mgmt.IPv6Subnet) // sort for better readability sort.Strings(noProxyList)