Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions libnetwork/pasta/pasta_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const (
// mapGuestAddrIpv4 static ip used as forwarder address inside the netns to reach the host,
// given this is a "link local" ip it should be very unlikely that it causes conflicts
mapGuestAddrIpv4 = "169.254.1.2"

mapHostLoopbackOpt = "--map-host-loopback"
)

type SetupOptions struct {
Expand Down Expand Up @@ -276,5 +278,18 @@ func createPastaArgs(opts *SetupOptions) ([]string, []string, []string, error) {
mapGuestAddrIPs = append(mapGuestAddrIPs, mapGuestAddrIpv4)
}

// outbound counterpart: without this the /etc/hosts entry podman writes for
// host.containers.internal is unreachable from bridge containers
hasMapHostLoopback := false
for _, opt := range cmdArgs {
if opt == mapHostLoopbackOpt {
hasMapHostLoopback = true
break
}
}
if !hasMapHostLoopback {
cmdArgs = append(cmdArgs, mapHostLoopbackOpt, mapGuestAddrIpv4)
}

return cmdArgs, dnsForwardIPs, mapGuestAddrIPs, nil
}
Loading