Skip to content

Commit

Permalink
Merge pull request #1519 from Luap99/slirp4netns-signal
Browse files Browse the repository at this point in the history
libnetwork/slirp4netns: add Pdeathsig option
  • Loading branch information
openshift-merge-robot authored Jun 22, 2023
2 parents 586a3be + a7293e6 commit 6eebb37
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions libnetwork/slirp4netns/slirp4netns.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ type SetupOptions struct {
ContainerID string
// Netns path to the netns
Netns string
// ContainerPID is the pid of container process
ContainerPID int
// Ports the should be forwarded
Ports []types.PortMapping
// ExtraOptions for slirp4netns that were set on the cli
Expand All @@ -84,6 +82,9 @@ type SetupOptions struct {
// RootlessPortSyncPipe pipe used to exit the rootlessport process.
// Same as Slirp4netnsExitPipeR, except this is only used when ports are given.
RootlessPortExitPipeR *os.File
// Pdeathsig is the signal which is send to slirp4netns process if the calling thread
// exits. The caller is responsible for locking the thread with runtime.LockOSThread().
Pdeathsig syscall.Signal
}

// SetupResult return type from Setup()
Expand Down Expand Up @@ -309,7 +310,8 @@ func Setup(opts *SetupOptions) (*SetupResult, error) {
cmd := exec.Command(path, cmdArgs...)
logrus.Debugf("slirp4netns command: %s", strings.Join(cmd.Args, " "))
cmd.SysProcAttr = &syscall.SysProcAttr{
Setpgid: true,
Setpgid: true,
Pdeathsig: opts.Pdeathsig,
}

// workaround for https://github.com/rootless-containers/slirp4netns/pull/153
Expand Down

0 comments on commit 6eebb37

Please sign in to comment.