namespace_linux.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699
  1. package osl
  2. import (
  3. "context"
  4. "errors"
  5. "fmt"
  6. "net"
  7. "os"
  8. "path/filepath"
  9. "runtime"
  10. "strconv"
  11. "strings"
  12. "sync"
  13. "syscall"
  14. "time"
  15. "github.com/containerd/containerd/log"
  16. "github.com/docker/docker/internal/unshare"
  17. "github.com/docker/docker/libnetwork/ns"
  18. "github.com/docker/docker/libnetwork/osl/kernel"
  19. "github.com/docker/docker/libnetwork/types"
  20. "github.com/vishvananda/netlink"
  21. "github.com/vishvananda/netns"
  22. "golang.org/x/sys/unix"
  23. )
  24. const defaultPrefix = "/var/run/docker"
  25. func init() {
  26. // Lock main() to the initial thread to exclude the goroutines spawned
  27. // by func (*networkNamespace) InvokeFunc() or func setIPv6() below from
  28. // being scheduled onto that thread. Changes to the network namespace of
  29. // the initial thread alter /proc/self/ns/net, which would break any
  30. // code which (incorrectly) assumes that that file is the network
  31. // namespace for the thread it is currently executing on.
  32. runtime.LockOSThread()
  33. }
  34. var (
  35. once sync.Once
  36. garbagePathMap = make(map[string]bool)
  37. gpmLock sync.Mutex
  38. gpmWg sync.WaitGroup
  39. gpmCleanupPeriod = 60 * time.Second
  40. gpmChan = make(chan chan struct{})
  41. netnsBasePath = filepath.Join(defaultPrefix, "netns")
  42. )
  43. // SetBasePath sets the base url prefix for the ns path
  44. func SetBasePath(path string) {
  45. netnsBasePath = filepath.Join(path, "netns")
  46. }
  47. func basePath() string {
  48. return netnsBasePath
  49. }
  50. func createBasePath() {
  51. err := os.MkdirAll(basePath(), 0o755)
  52. if err != nil {
  53. panic("Could not create net namespace path directory")
  54. }
  55. // Start the garbage collection go routine
  56. go removeUnusedPaths()
  57. }
  58. func removeUnusedPaths() {
  59. gpmLock.Lock()
  60. period := gpmCleanupPeriod
  61. gpmLock.Unlock()
  62. ticker := time.NewTicker(period)
  63. for {
  64. var (
  65. gc chan struct{}
  66. gcOk bool
  67. )
  68. select {
  69. case <-ticker.C:
  70. case gc, gcOk = <-gpmChan:
  71. }
  72. gpmLock.Lock()
  73. pathList := make([]string, 0, len(garbagePathMap))
  74. for path := range garbagePathMap {
  75. pathList = append(pathList, path)
  76. }
  77. garbagePathMap = make(map[string]bool)
  78. gpmWg.Add(1)
  79. gpmLock.Unlock()
  80. for _, path := range pathList {
  81. os.Remove(path)
  82. }
  83. gpmWg.Done()
  84. if gcOk {
  85. close(gc)
  86. }
  87. }
  88. }
  89. func addToGarbagePaths(path string) {
  90. gpmLock.Lock()
  91. garbagePathMap[path] = true
  92. gpmLock.Unlock()
  93. }
  94. func removeFromGarbagePaths(path string) {
  95. gpmLock.Lock()
  96. delete(garbagePathMap, path)
  97. gpmLock.Unlock()
  98. }
  99. // GC triggers garbage collection of namespace path right away
  100. // and waits for it.
  101. func GC() {
  102. gpmLock.Lock()
  103. if len(garbagePathMap) == 0 {
  104. // No need for GC if map is empty
  105. gpmLock.Unlock()
  106. return
  107. }
  108. gpmLock.Unlock()
  109. // if content exists in the garbage paths
  110. // we can trigger GC to run, providing a
  111. // channel to be notified on completion
  112. waitGC := make(chan struct{})
  113. gpmChan <- waitGC
  114. // wait for GC completion
  115. <-waitGC
  116. }
  117. // GenerateKey generates a sandbox key based on the passed
  118. // container id.
  119. func GenerateKey(containerID string) string {
  120. maxLen := 12
  121. // Read sandbox key from host for overlay
  122. if strings.HasPrefix(containerID, "-") {
  123. var (
  124. index int
  125. indexStr string
  126. tmpkey string
  127. )
  128. dir, err := os.ReadDir(basePath())
  129. if err != nil {
  130. return ""
  131. }
  132. for _, v := range dir {
  133. id := v.Name()
  134. if strings.HasSuffix(id, containerID[:maxLen-1]) {
  135. indexStr = strings.TrimSuffix(id, containerID[:maxLen-1])
  136. tmpindex, err := strconv.Atoi(indexStr)
  137. if err != nil {
  138. return ""
  139. }
  140. if tmpindex > index {
  141. index = tmpindex
  142. tmpkey = id
  143. }
  144. }
  145. }
  146. containerID = tmpkey
  147. if containerID == "" {
  148. return ""
  149. }
  150. }
  151. if len(containerID) < maxLen {
  152. maxLen = len(containerID)
  153. }
  154. return basePath() + "/" + containerID[:maxLen]
  155. }
  156. // NewSandbox provides a new sandbox instance created in an os specific way
  157. // provided a key which uniquely identifies the sandbox
  158. func NewSandbox(key string, osCreate, isRestore bool) (Sandbox, error) {
  159. if !isRestore {
  160. err := createNetworkNamespace(key, osCreate)
  161. if err != nil {
  162. return nil, err
  163. }
  164. } else {
  165. once.Do(createBasePath)
  166. }
  167. n := &networkNamespace{path: key, isDefault: !osCreate, nextIfIndex: make(map[string]int)}
  168. sboxNs, err := netns.GetFromPath(n.path)
  169. if err != nil {
  170. return nil, fmt.Errorf("failed get network namespace %q: %v", n.path, err)
  171. }
  172. defer sboxNs.Close()
  173. n.nlHandle, err = netlink.NewHandleAt(sboxNs, syscall.NETLINK_ROUTE)
  174. if err != nil {
  175. return nil, fmt.Errorf("failed to create a netlink handle: %v", err)
  176. }
  177. err = n.nlHandle.SetSocketTimeout(ns.NetlinkSocketsTimeout)
  178. if err != nil {
  179. log.G(context.TODO()).Warnf("Failed to set the timeout on the sandbox netlink handle sockets: %v", err)
  180. }
  181. // In live-restore mode, IPV6 entries are getting cleaned up due to below code
  182. // We should retain IPV6 configurations in live-restore mode when Docker Daemon
  183. // comes back. It should work as it is on other cases
  184. // As starting point, disable IPv6 on all interfaces
  185. if !isRestore && !n.isDefault {
  186. err = setIPv6(n.path, "all", false)
  187. if err != nil {
  188. log.G(context.TODO()).Warnf("Failed to disable IPv6 on all interfaces on network namespace %q: %v", n.path, err)
  189. }
  190. }
  191. if err = n.loopbackUp(); err != nil {
  192. n.nlHandle.Close()
  193. return nil, err
  194. }
  195. return n, nil
  196. }
  197. func mountNetworkNamespace(basePath string, lnPath string) error {
  198. return syscall.Mount(basePath, lnPath, "bind", syscall.MS_BIND, "")
  199. }
  200. // GetSandboxForExternalKey returns sandbox object for the supplied path
  201. func GetSandboxForExternalKey(basePath string, key string) (Sandbox, error) {
  202. if err := createNamespaceFile(key); err != nil {
  203. return nil, err
  204. }
  205. if err := mountNetworkNamespace(basePath, key); err != nil {
  206. return nil, err
  207. }
  208. n := &networkNamespace{path: key, nextIfIndex: make(map[string]int)}
  209. sboxNs, err := netns.GetFromPath(n.path)
  210. if err != nil {
  211. return nil, fmt.Errorf("failed get network namespace %q: %v", n.path, err)
  212. }
  213. defer sboxNs.Close()
  214. n.nlHandle, err = netlink.NewHandleAt(sboxNs, syscall.NETLINK_ROUTE)
  215. if err != nil {
  216. return nil, fmt.Errorf("failed to create a netlink handle: %v", err)
  217. }
  218. err = n.nlHandle.SetSocketTimeout(ns.NetlinkSocketsTimeout)
  219. if err != nil {
  220. log.G(context.TODO()).Warnf("Failed to set the timeout on the sandbox netlink handle sockets: %v", err)
  221. }
  222. // As starting point, disable IPv6 on all interfaces
  223. err = setIPv6(n.path, "all", false)
  224. if err != nil {
  225. log.G(context.TODO()).Warnf("Failed to disable IPv6 on all interfaces on network namespace %q: %v", n.path, err)
  226. }
  227. if err = n.loopbackUp(); err != nil {
  228. n.nlHandle.Close()
  229. return nil, err
  230. }
  231. return n, nil
  232. }
  233. func createNetworkNamespace(path string, osCreate bool) error {
  234. if err := createNamespaceFile(path); err != nil {
  235. return err
  236. }
  237. do := func() error {
  238. return mountNetworkNamespace(fmt.Sprintf("/proc/self/task/%d/ns/net", unix.Gettid()), path)
  239. }
  240. if osCreate {
  241. return unshare.Go(unix.CLONE_NEWNET, do, nil)
  242. }
  243. return do()
  244. }
  245. func unmountNamespaceFile(path string) {
  246. if _, err := os.Stat(path); err == nil {
  247. if err := syscall.Unmount(path, syscall.MNT_DETACH); err != nil && !errors.Is(err, unix.EINVAL) {
  248. log.G(context.TODO()).WithError(err).Error("Error unmounting namespace file")
  249. }
  250. }
  251. }
  252. func createNamespaceFile(path string) (err error) {
  253. var f *os.File
  254. once.Do(createBasePath)
  255. // Remove it from garbage collection list if present
  256. removeFromGarbagePaths(path)
  257. // If the path is there unmount it first
  258. unmountNamespaceFile(path)
  259. // wait for garbage collection to complete if it is in progress
  260. // before trying to create the file.
  261. gpmWg.Wait()
  262. if f, err = os.Create(path); err == nil {
  263. f.Close()
  264. }
  265. return err
  266. }
  267. // networkNamespace represents a network sandbox. It represents a Linux network
  268. // namespace, and moves an interface into it when called on method AddInterface
  269. // or sets the gateway etc. It holds a list of Interfaces, routes etc., and more
  270. // can be added dynamically.
  271. type networkNamespace struct {
  272. path string
  273. iFaces []*nwIface
  274. gw net.IP
  275. gwv6 net.IP
  276. staticRoutes []*types.StaticRoute
  277. neighbors []*neigh
  278. nextIfIndex map[string]int
  279. isDefault bool
  280. nlHandle *netlink.Handle
  281. loV6Enabled bool
  282. sync.Mutex
  283. }
  284. // Interfaces returns the collection of Interface previously added with the AddInterface
  285. // method. Note that this doesn't include network interfaces added in any
  286. // other way (such as the default loopback interface which is automatically
  287. // created on creation of a sandbox).
  288. func (n *networkNamespace) Interfaces() []Interface {
  289. ifaces := make([]Interface, len(n.iFaces))
  290. for i, iface := range n.iFaces {
  291. ifaces[i] = iface
  292. }
  293. return ifaces
  294. }
  295. // InterfaceOptions an interface with methods to set interface options.
  296. func (n *networkNamespace) InterfaceOptions() IfaceOptionSetter {
  297. return n
  298. }
  299. func (n *networkNamespace) loopbackUp() error {
  300. iface, err := n.nlHandle.LinkByName("lo")
  301. if err != nil {
  302. return err
  303. }
  304. return n.nlHandle.LinkSetUp(iface)
  305. }
  306. // GetLoopbackIfaceName returns the name of the loopback interface
  307. func (n *networkNamespace) GetLoopbackIfaceName() string {
  308. return "lo"
  309. }
  310. // AddAliasIP adds the passed IP address to the named interface
  311. func (n *networkNamespace) AddAliasIP(ifName string, ip *net.IPNet) error {
  312. iface, err := n.nlHandle.LinkByName(ifName)
  313. if err != nil {
  314. return err
  315. }
  316. return n.nlHandle.AddrAdd(iface, &netlink.Addr{IPNet: ip})
  317. }
  318. // RemoveAliasIP removes the passed IP address from the named interface
  319. func (n *networkNamespace) RemoveAliasIP(ifName string, ip *net.IPNet) error {
  320. iface, err := n.nlHandle.LinkByName(ifName)
  321. if err != nil {
  322. return err
  323. }
  324. return n.nlHandle.AddrDel(iface, &netlink.Addr{IPNet: ip})
  325. }
  326. // DisableARPForVIP disables ARP replies and requests for VIP addresses
  327. // on a particular interface.
  328. func (n *networkNamespace) DisableARPForVIP(srcName string) (Err error) {
  329. dstName := ""
  330. for _, i := range n.Interfaces() {
  331. if i.SrcName() == srcName {
  332. dstName = i.DstName()
  333. break
  334. }
  335. }
  336. if dstName == "" {
  337. return fmt.Errorf("failed to find interface %s in sandbox", srcName)
  338. }
  339. err := n.InvokeFunc(func() {
  340. path := filepath.Join("/proc/sys/net/ipv4/conf", dstName, "arp_ignore")
  341. if err := os.WriteFile(path, []byte{'1', '\n'}, 0o644); err != nil {
  342. Err = fmt.Errorf("Failed to set %s to 1: %v", path, err)
  343. return
  344. }
  345. path = filepath.Join("/proc/sys/net/ipv4/conf", dstName, "arp_announce")
  346. if err := os.WriteFile(path, []byte{'2', '\n'}, 0o644); err != nil {
  347. Err = fmt.Errorf("Failed to set %s to 2: %v", path, err)
  348. return
  349. }
  350. })
  351. if err != nil {
  352. return err
  353. }
  354. return
  355. }
  356. // InvokeFunc invoke a function in the network namespace.
  357. func (n *networkNamespace) InvokeFunc(f func()) error {
  358. path := n.nsPath()
  359. newNS, err := netns.GetFromPath(path)
  360. if err != nil {
  361. return fmt.Errorf("failed get network namespace %q: %w", path, err)
  362. }
  363. defer newNS.Close()
  364. done := make(chan error, 1)
  365. go func() {
  366. runtime.LockOSThread()
  367. // InvokeFunc() could have been called from a goroutine with
  368. // tampered thread state, e.g. from another InvokeFunc()
  369. // callback. The outer goroutine's thread state cannot be
  370. // trusted.
  371. origNS, err := netns.Get()
  372. if err != nil {
  373. runtime.UnlockOSThread()
  374. done <- fmt.Errorf("failed to get original network namespace: %w", err)
  375. return
  376. }
  377. defer origNS.Close()
  378. if err := netns.Set(newNS); err != nil {
  379. runtime.UnlockOSThread()
  380. done <- err
  381. return
  382. }
  383. defer func() {
  384. close(done)
  385. if err := netns.Set(origNS); err != nil {
  386. log.G(context.TODO()).WithError(err).Warn("failed to restore thread's network namespace")
  387. // Recover from the error by leaving this goroutine locked to
  388. // the thread. The runtime will terminate the thread and replace
  389. // it with a clean one when this goroutine returns.
  390. } else {
  391. runtime.UnlockOSThread()
  392. }
  393. }()
  394. f()
  395. }()
  396. return <-done
  397. }
  398. func (n *networkNamespace) nsPath() string {
  399. n.Lock()
  400. defer n.Unlock()
  401. return n.path
  402. }
  403. // Key returns the path where the network namespace is mounted.
  404. func (n *networkNamespace) Key() string {
  405. return n.path
  406. }
  407. // Destroy destroys the sandbox.
  408. func (n *networkNamespace) Destroy() error {
  409. if n.nlHandle != nil {
  410. n.nlHandle.Close()
  411. }
  412. // Assuming no running process is executing in this network namespace,
  413. // unmounting is sufficient to destroy it.
  414. if err := syscall.Unmount(n.path, syscall.MNT_DETACH); err != nil {
  415. return err
  416. }
  417. // Stash it into the garbage collection list
  418. addToGarbagePaths(n.path)
  419. return nil
  420. }
  421. // Restore restores the network namespace.
  422. func (n *networkNamespace) Restore(ifsopt map[Iface][]IfaceOption, routes []*types.StaticRoute, gw net.IP, gw6 net.IP) error {
  423. // restore interfaces
  424. for name, opts := range ifsopt {
  425. i := &nwIface{
  426. srcName: name.SrcName,
  427. dstName: name.DstPrefix,
  428. ns: n,
  429. }
  430. i.processInterfaceOptions(opts...)
  431. if i.master != "" {
  432. i.dstMaster = n.findDst(i.master, true)
  433. if i.dstMaster == "" {
  434. return fmt.Errorf("could not find an appropriate master %q for %q",
  435. i.master, i.srcName)
  436. }
  437. }
  438. if n.isDefault {
  439. i.dstName = i.srcName
  440. } else {
  441. links, err := n.nlHandle.LinkList()
  442. if err != nil {
  443. return fmt.Errorf("failed to retrieve list of links in network namespace %q during restore", n.path)
  444. }
  445. // due to the docker network connect/disconnect, so the dstName should
  446. // restore from the namespace
  447. for _, link := range links {
  448. addrs, err := n.nlHandle.AddrList(link, netlink.FAMILY_V4)
  449. if err != nil {
  450. return err
  451. }
  452. ifaceName := link.Attrs().Name
  453. if strings.HasPrefix(ifaceName, "vxlan") {
  454. if i.dstName == "vxlan" {
  455. i.dstName = ifaceName
  456. break
  457. }
  458. }
  459. // find the interface name by ip
  460. if i.address != nil {
  461. for _, addr := range addrs {
  462. if addr.IPNet.String() == i.address.String() {
  463. i.dstName = ifaceName
  464. break
  465. }
  466. continue
  467. }
  468. if i.dstName == ifaceName {
  469. break
  470. }
  471. }
  472. // This is to find the interface name of the pair in overlay sandbox
  473. if strings.HasPrefix(ifaceName, "veth") {
  474. if i.master != "" && i.dstName == "veth" {
  475. i.dstName = ifaceName
  476. }
  477. }
  478. }
  479. var index int
  480. indexStr := strings.TrimPrefix(i.dstName, name.DstPrefix)
  481. if indexStr != "" {
  482. index, err = strconv.Atoi(indexStr)
  483. if err != nil {
  484. return err
  485. }
  486. }
  487. index++
  488. n.Lock()
  489. if index > n.nextIfIndex[name.DstPrefix] {
  490. n.nextIfIndex[name.DstPrefix] = index
  491. }
  492. n.iFaces = append(n.iFaces, i)
  493. n.Unlock()
  494. }
  495. }
  496. // restore routes
  497. for _, r := range routes {
  498. n.Lock()
  499. n.staticRoutes = append(n.staticRoutes, r)
  500. n.Unlock()
  501. }
  502. // restore gateway
  503. if len(gw) > 0 {
  504. n.Lock()
  505. n.gw = gw
  506. n.Unlock()
  507. }
  508. if len(gw6) > 0 {
  509. n.Lock()
  510. n.gwv6 = gw6
  511. n.Unlock()
  512. }
  513. return nil
  514. }
  515. // Checks whether IPv6 needs to be enabled/disabled on the loopback interface
  516. func (n *networkNamespace) checkLoV6() {
  517. var (
  518. enable = false
  519. action = "disable"
  520. )
  521. n.Lock()
  522. for _, iface := range n.iFaces {
  523. if iface.AddressIPv6() != nil {
  524. enable = true
  525. action = "enable"
  526. break
  527. }
  528. }
  529. n.Unlock()
  530. if n.loV6Enabled == enable {
  531. return
  532. }
  533. if err := setIPv6(n.path, "lo", enable); err != nil {
  534. log.G(context.TODO()).Warnf("Failed to %s IPv6 on loopback interface on network namespace %q: %v", action, n.path, err)
  535. }
  536. n.loV6Enabled = enable
  537. }
  538. // ApplyOSTweaks applies operating system specific knobs on the sandbox.
  539. func (n *networkNamespace) ApplyOSTweaks(types []SandboxType) {
  540. for _, t := range types {
  541. switch t {
  542. case SandboxTypeLoadBalancer, SandboxTypeIngress:
  543. kernel.ApplyOSTweaks(map[string]*kernel.OSValue{
  544. // disables any special handling on port reuse of existing IPVS connection table entries
  545. // more info: https://github.com/torvalds/linux/blame/v5.15/Documentation/networking/ipvs-sysctl.rst#L32
  546. "net.ipv4.vs.conn_reuse_mode": {Value: "0", CheckFn: nil},
  547. // expires connection from the IPVS connection table when the backend is not available
  548. // more info: https://github.com/torvalds/linux/blame/v5.15/Documentation/networking/ipvs-sysctl.rst#L133
  549. "net.ipv4.vs.expire_nodest_conn": {Value: "1", CheckFn: nil},
  550. // expires persistent connections to destination servers with weights set to 0
  551. // more info: https://github.com/torvalds/linux/blame/v5.15/Documentation/networking/ipvs-sysctl.rst#L151
  552. "net.ipv4.vs.expire_quiescent_template": {Value: "1", CheckFn: nil},
  553. })
  554. }
  555. }
  556. }
  557. func setIPv6(nspath, iface string, enable bool) error {
  558. errCh := make(chan error, 1)
  559. go func() {
  560. defer close(errCh)
  561. namespace, err := netns.GetFromPath(nspath)
  562. if err != nil {
  563. errCh <- fmt.Errorf("failed get network namespace %q: %w", nspath, err)
  564. return
  565. }
  566. defer namespace.Close()
  567. runtime.LockOSThread()
  568. origNS, err := netns.Get()
  569. if err != nil {
  570. runtime.UnlockOSThread()
  571. errCh <- fmt.Errorf("failed to get current network namespace: %w", err)
  572. return
  573. }
  574. defer origNS.Close()
  575. if err = netns.Set(namespace); err != nil {
  576. runtime.UnlockOSThread()
  577. errCh <- fmt.Errorf("setting into container netns %q failed: %w", nspath, err)
  578. return
  579. }
  580. defer func() {
  581. if err := netns.Set(origNS); err != nil {
  582. log.G(context.TODO()).WithError(err).Error("libnetwork: restoring thread network namespace failed")
  583. // The error is only fatal for the current thread. Keep this
  584. // goroutine locked to the thread to make the runtime replace it
  585. // with a clean thread once this goroutine returns.
  586. } else {
  587. runtime.UnlockOSThread()
  588. }
  589. }()
  590. var (
  591. action = "disable"
  592. value = byte('1')
  593. path = fmt.Sprintf("/proc/sys/net/ipv6/conf/%s/disable_ipv6", iface)
  594. )
  595. if enable {
  596. action = "enable"
  597. value = '0'
  598. }
  599. if _, err := os.Stat(path); err != nil {
  600. if os.IsNotExist(err) {
  601. log.G(context.TODO()).WithError(err).Warn("Cannot configure IPv6 forwarding on container interface. Has IPv6 been disabled in this node's kernel?")
  602. return
  603. }
  604. errCh <- err
  605. return
  606. }
  607. if err = os.WriteFile(path, []byte{value, '\n'}, 0o644); err != nil {
  608. errCh <- fmt.Errorf("failed to %s IPv6 forwarding for container's interface %s: %w", action, iface, err)
  609. return
  610. }
  611. }()
  612. return <-errCh
  613. }