Merge pull request #366 from icecrime/hairpin-nat
Resurrect hairpin NAT
This commit is contained in:
commit
21ed4766b1
|
@ -38,6 +38,12 @@ type Network struct {
|
||||||
// container's interfaces if a pair is created, specifically in the case of type veth
|
// container's interfaces if a pair is created, specifically in the case of type veth
|
||||||
// Note: This does not apply to loopback interfaces.
|
// Note: This does not apply to loopback interfaces.
|
||||||
TxQueueLen int `json:"txqueuelen,omitempty"`
|
TxQueueLen int `json:"txqueuelen,omitempty"`
|
||||||
|
|
||||||
|
// HairpinMode specifies if hairpin NAT should be enabled on the virtual interface
|
||||||
|
// bridge port in the case of type veth
|
||||||
|
// Note: This is unsupported on some systems.
|
||||||
|
// Note: This does not apply to loopback interfaces.
|
||||||
|
HairpinMode bool `json:"hairpin_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Struct describing the network specific runtime state that will be maintained by libcontainer for all running containers
|
// Struct describing the network specific runtime state that will be maintained by libcontainer for all running containers
|
||||||
|
|
|
@ -39,6 +39,11 @@ func (v *Veth) Create(n *Network, nspid int, networkState *NetworkState) error {
|
||||||
if err := SetMtu(name1, n.Mtu); err != nil {
|
if err := SetMtu(name1, n.Mtu); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if n.HairpinMode {
|
||||||
|
if err := SetHairpinMode(name1, true); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
if err := InterfaceUp(name1); err != nil {
|
if err := InterfaceUp(name1); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue