summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-01-22 05:07:15 -0500
committerGitHub <noreply@github.com>2021-01-22 05:07:15 -0500
commitf02aba659447ea9198851231d7f11a8bfdfe69ba (patch)
tree0d22b1af8408cba9499da16e565cb7e48a845330 /pkg
parent6fd83de31dab0c60932972c6b26f68fa0bd1871f (diff)
parentef654941d1b7d3bd8f5af51418aa54e0d6f2d48c (diff)
downloadpodman-f02aba659447ea9198851231d7f11a8bfdfe69ba.tar.gz
podman-f02aba659447ea9198851231d7f11a8bfdfe69ba.tar.bz2
podman-f02aba659447ea9198851231d7f11a8bfdfe69ba.zip
Merge pull request #9052 from giuseppe/set-source-to-slirp4netns-ip
rootlessport: set source IP to slirp4netns device
Diffstat (limited to 'pkg')
-rw-r--r--pkg/rootlessport/rootlessport_linux.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/pkg/rootlessport/rootlessport_linux.go b/pkg/rootlessport/rootlessport_linux.go
index c686d80fc..80e1309a5 100644
--- a/pkg/rootlessport/rootlessport_linux.go
+++ b/pkg/rootlessport/rootlessport_linux.go
@@ -48,6 +48,7 @@ type Config struct {
ExitFD int
ReadyFD int
TmpDir string
+ ChildIP string
}
func init() {
@@ -227,7 +228,7 @@ outer:
// let parent expose ports
logrus.Infof("exposing ports %v", cfg.Mappings)
- if err := exposePorts(driver, cfg.Mappings); err != nil {
+ if err := exposePorts(driver, cfg.Mappings, cfg.ChildIP); err != nil {
return err
}
@@ -248,7 +249,7 @@ outer:
return nil
}
-func exposePorts(pm rkport.Manager, portMappings []ocicni.PortMapping) error {
+func exposePorts(pm rkport.Manager, portMappings []ocicni.PortMapping, childIP string) error {
ctx := context.TODO()
for _, i := range portMappings {
hostIP := i.HostIP
@@ -260,6 +261,7 @@ func exposePorts(pm rkport.Manager, portMappings []ocicni.PortMapping) error {
ParentIP: hostIP,
ParentPort: int(i.HostPort),
ChildPort: int(i.ContainerPort),
+ ChildIP: childIP,
}
if err := rkportutil.ValidatePortSpec(spec, nil); err != nil {
return err