Merge pull request #366 from icecrime/hairpin-nat

Resurrect hairpin NAT
This commit is contained in:
Mrunal Patel 2015-02-10 15:35:43 -08:00
commit 21ed4766b1
2 changed files with 11 additions and 0 deletions

View File

@ -38,6 +38,12 @@ type Network struct {
// container's interfaces if a pair is created, specifically in the case of type veth
// Note: This does not apply to loopback interfaces.
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

View File

@ -39,6 +39,11 @@ func (v *Veth) Create(n *Network, nspid int, networkState *NetworkState) error {
if err := SetMtu(name1, n.Mtu); err != nil {
return err
}
if n.HairpinMode {
if err := SetHairpinMode(name1, true); err != nil {
return err
}
}
if err := InterfaceUp(name1); err != nil {
return err
}