net

package
v1.9.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2017 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SIOCETHTOOL     = 0x8946     // linux/sockios.h
	ETHTOOL_GTXCSUM = 0x00000016 // linux/ethtool.h
	ETHTOOL_STXCSUM = 0x00000017 // linux/ethtool.h
	IFNAMSIZ        = 16         // linux/if.h
)
View Source
const (
	VethName = "ethwe" // name inside container namespace

)

Variables

View Source
var ErrBridgeNoIP = fmt.Errorf("Bridge has no IP address")
View Source
var ErrLinkNotFound = errors.New("Link not found")
View Source
var WeaveUtilCmd = "weaveutil"

Functions

func AddAddresses added in v1.6.0

func AddAddresses(link netlink.Link, cidrs []*net.IPNet) (newAddrs []*net.IPNet, err error)

func AddRoute added in v1.6.0

func AddRoute(link netlink.Link, scope netlink.Scope, dst *net.IPNet, gw net.IP) error

func AttachContainer added in v1.6.0

func AttachContainer(netNSPath, id, ifName, bridgeName string, mtu int, withMulticastRoute bool, cidrs []*net.IPNet, keepTXOn bool, hairpinMode bool) error

NB: This function can be used only by a process that terminates immediately

after calling the function as it changes netns via WithNetNSLinkUnsafe.

func CheckAddressOverlap added in v1.1.0

func CheckAddressOverlap(addr net.IP, ignoreIfaceNames map[string]struct{}) error

For a specific address, we only care if it is actually *inside* an existing route, because weave-local traffic never hits IP routing.

func CheckNetworkFree added in v1.0.0

func CheckNetworkFree(subnet *net.IPNet, ignoreIfaceNames map[string]struct{}) error

A network is considered free if it does not overlap any existing routes on this host. This is the same approach taken by Docker.

func ConfigureARPCache added in v1.6.0

func ConfigureARPCache(name string) error

Configure the ARP cache parameters for the given interface. This makes containers react more quickly to a change in the MAC address associated with an IP address.

func ConnectedToBridgeVethPeerIds added in v1.8.0

func ConnectedToBridgeVethPeerIds(bridgeName string) ([]int, error)

ConnectedToBridgeVethPeerIds returns peer indexes of veth links connected to the given bridge. The peer index is used to query from a container netns whether the container is connected to the bridge.

func CreateAndAttachVeth added in v1.6.0

func CreateAndAttachVeth(name, peerName, bridgeName string, mtu int, keepTXOn bool, init func(peer netlink.Link) error) (*netlink.Veth, error)

create and attach a veth to the Weave bridge

func DetachContainer added in v1.6.0

func DetachContainer(netNSPath, id, ifName string, cidrs []*net.IPNet) error

NB: This function can be used only by a process that terminates immediately

after calling the function as it changes netns via WithNetNSLinkUnsafe.

func DetectHairpin added in v1.8.2

func DetectHairpin(portIfName string, log *logrus.Logger) error

func EnsureInterface

func EnsureInterface(ifaceName string) (*net.Interface, error)

Wait for an interface to come up.

func EnsureInterfaceAndMcastRoute added in v1.1.0

func EnsureInterfaceAndMcastRoute(ifaceName string) (*net.Interface, error)

Wait for an interface to come up and have a route added to the multicast subnet. This matches the behaviour in 'weave attach', which is the only context in which we expect this to be called. If you change one, change the other to match.

func EthtoolTXOff added in v1.6.0

func EthtoolTXOff(name string) error

Disable TX checksum offload on specified interface

func ExposeNAT added in v1.8.1

func ExposeNAT(ipnet net.IPNet) error