Index: net/containernetworking-plugins/Makefile =================================================================== --- net/containernetworking-plugins/Makefile +++ net/containernetworking-plugins/Makefile @@ -1,7 +1,7 @@ PORTNAME= containernetworking-plugins DISTVERSIONPREFIX= freebsd-v DISTVERSION= 0.5 -PORTREVISION= 14 +PORTREVISION= 15 CATEGORIES= net MAINTAINER= dfr@FreeBSD.org Index: net/containernetworking-plugins/files/patch-plugins_freebsd_meta_portmap_portmap.go =================================================================== --- /dev/null +++ net/containernetworking-plugins/files/patch-plugins_freebsd_meta_portmap_portmap.go @@ -0,0 +1,34 @@ +--- plugins/freebsd/meta/portmap/portmap.go.orig 2025-06-14 16:53:13 UTC ++++ plugins/freebsd/meta/portmap/portmap.go +@@ -82,11 +82,28 @@ func forwardPorts(config *PortMapConf, containerNet ne + // rdr inet proto tcp from any to ! 10.89.0.77 port 8080 -> 10.89.0.77 port 80 + containerIP := containerNet.IP.String() + var af string +- if containerNet.IP.To4() != nil { +- af = "inet" ++ ++ // Determine address family based on host IP, not container IP ++ if pmap.HostIP != "" { ++ // Parse the host IP to determine if it's IPv4 or IPv6 ++ hostIPParsed := net.ParseIP(pmap.HostIP) ++ if hostIPParsed == nil { ++ return nil, fmt.Errorf("invalid host IP: %s", pmap.HostIP) ++ } ++ if hostIPParsed.To4() != nil { ++ af = "inet" ++ } else { ++ af = "inet6" ++ } + } else { +- af = "inet6" ++ // If no specific host IP, use container's address family ++ if containerNet.IP.To4() != nil { ++ af = "inet" ++ } else { ++ af = "inet6" ++ } + } ++ + hostIP := pmap.HostIP + if hostIP == "" { + hostIP = "self"