Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions network/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions network/veth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down