MCPcopy
hub / github.com/moby/moby / validateAddress

Function validateAddress

daemon/network.go:522–539  ·  view source on GitHub ↗
(addr netip.Addr, subnet netip.Prefix, subnetFamily int)

Source from the content-addressed store, hash-verified

520}
521
522func validateAddress(addr netip.Addr, subnet netip.Prefix, subnetFamily int) error {
523 if !addr.IsValid() {
524 return nil
525 }
526 family := 4
527 if addr.Is6() {
528 family = 6
529 }
530
531 if family != subnetFamily {
532 return fmt.Errorf("parent subnet is an IPv%d block", subnetFamily)
533 }
534 if !subnet.Contains(addr) {
535 return fmt.Errorf("parent subnet %s doesn't contain this address", subnet)
536 }
537
538 return nil
539}
540
541func getIpamConfig(data []networktypes.IPAMConfig) ([]*libnetwork.IpamConf, []*libnetwork.IpamConf, error) {
542 ipamV4Cfg := []*libnetwork.IpamConf{}

Callers 1

validateIpamConfigFunction · 0.85

Calls 4

Is6Method · 0.80
ErrorfMethod · 0.80
IsValidMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…