Skip to content

Commit

Permalink
Merge pull request #1619 from dfr/freebsd-cni
Browse files Browse the repository at this point in the history
libnetwork/cni: use 'ifconfig -j' on FreeBSD if it is supported
  • Loading branch information
openshift-merge-robot authored Aug 17, 2023
2 parents 49a0071 + 7ce18d9 commit 6135cf6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libnetwork/cni/run_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ import (
// add the default address. Note: this will also add ::1 as a side
// effect.
func setupLoopback(namespacePath string) error {
// The jexec wrapper runs the ifconfig command inside the jail.
// Try to run the command using ifconfig's -j flag (supported in 13.3 and later)
if err := exec.Command("ifconfig", "-j", namespacePath, "lo0", "inet", "127.0.0.1").Run(); err == nil {
return nil
}

// Fall back to using the jexec wrapper to run the ifconfig command
// inside the jail.
return exec.Command("jexec", namespacePath, "ifconfig", "lo0", "inet", "127.0.0.1").Run()
}

0 comments on commit 6135cf6

Please sign in to comment.