MCPcopy Create free account
hub / github.com/containerd/nerdctl / parseNetworkSubnets

Function parseNetworkSubnets

pkg/inspecttypes/dockercompat/dockercompat.go:1094–1107  ·  view source on GitHub ↗

parseNetworkSubnets extracts and parses subnet configurations from IPAM config

(ipamConfigs []IPAMConfig)

Source from the content-addressed store, hash-verified

1092
1093// parseNetworkSubnets extracts and parses subnet configurations from IPAM config
1094func parseNetworkSubnets(ipamConfigs []IPAMConfig) []*net.IPNet {
1095 var subnets []*net.IPNet
1096 for _, config := range ipamConfigs {
1097 if config.Subnet != "" {
1098 _, subnet, err := net.ParseCIDR(config.Subnet)
1099 if err != nil {
1100 log.L.WithError(err).Warnf("failed to parse subnet %q", config.Subnet)
1101 continue
1102 }
1103 subnets = append(subnets, subnet)
1104 }
1105 }
1106 return subnets
1107}
1108
1109// isUsableInterface checks if a network interface is usable (not loopback and interface is up)
1110func isUsableInterface(iface *native.NetInterface) bool {

Callers 1

NetworkFromNativeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…