(containerPid int)
| 69 | } |
| 70 | |
| 71 | func (c *ContainerNetwork) SetContainerNet(containerPid int) error { |
| 72 | veth, err := c.getNewVeth() |
| 73 | if err != nil { |
| 74 | return err |
| 75 | } |
| 76 | |
| 77 | // bind veth to bridge |
| 78 | if err := veth.Init(containerPid, c.bridge.Name); err != nil { |
| 79 | return err |
| 80 | } |
| 81 | |
| 82 | newIP := &net.IPNet{ |
| 83 | IP: veth.IP, |
| 84 | Mask: c.bridgeIPNet.Mask, |
| 85 | } |
| 86 | |
| 87 | if err := veth.BindContainer(c.bridgeIP.String(), newIP); err != nil { |
| 88 | return err |
| 89 | } |
| 90 | |
| 91 | return nil |
| 92 | } |
| 93 | |
| 94 | func (c *ContainerNetwork) getNewVeth() (*Veth, error) { |
| 95 | c.vethLock.Lock() |
nothing calls this directly
no test coverage detected