manager

package
v0.0.0-...-4dbdb5d Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package manager is responsible for detecting the current network manager service, and writing and rolling back appropriate configurations for each network manager service.

Package manager is responsible for detecting the current network manager service, and writing and rolling back appropriate configurations for each network manager service.

Package manager is responsible for detecting the current network manager service, and writing and rolling back appropriate configurations for each network manager service.

Package manager is responsible for detecting the current network manager service, and writing and rolling back appropriate configurations for each network manager service.

Package manager is responsible for detecting the current network manager service, and writing and rolling back appropriate configurations for each network manager service.

Package manager is responsible for detecting the current network manager service, and writing and rolling back appropriate configurations for each network manager service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FallbackToDefault

func FallbackToDefault(ctx context.Context) error

FallbackToDefault will attempt to rescue broken networking by rolling back all guest-agent modifications to the network configuration.

func GetInterfaceByMAC

func GetInterfaceByMAC(mac string) (net.Interface, error)

GetInterfaceByMAC gets the interface given the mac string.

func SetupInterfaces

func SetupInterfaces(ctx context.Context, config *cfg.Sections, mds *metadata.Descriptor) error

SetupInterfaces sets up all secondary network interfaces on the system, and primary network interface if enabled in the configuration using the native network manager service detected to be managing the primary network interface.

Types

type IPConfig

type IPConfig struct {
	// InterfaceConfig contains the interface's config.
	InterfaceConfig

	// IPVersion is either ipv4 or ipv6.
	IPVersion ipVersion

	// Address is the IP address.
	Address string

	// Gateway is the gateway address (for ipv4 it will be md's gateway entry and for
	// ipv6 it will be populated with GatewayIpv6).
	Gateway string
}

IPConfig wraps the interface's configuration as well as the IP configuration.

type InterfaceConfig

type InterfaceConfig struct {
	// Iface is the interface name.
	Iface string

	// ParentInterface is the name of the vlan's parent interface.
	ParentInterface string

	// MTU is the vlan's MTU value.
	MTU int

	// MacAddress is the vlan's Mac Address.
	MacAddress string

	// Vlan is the vlan's id.
	Vlan int
}

InterfaceConfig wraps the vlan's link and interface's configuration.

type Interfaces

type Interfaces struct {
	// EthernetInterfaces are the regular ethernet interfaces descriptors offered by metadata.
	EthernetInterfaces []metadata.NetworkInterfaces

	// VlanInterfaces are the vLAN interfaces descriptors offered by metadata.
	VlanInterfaces map[int]VlanInterface
}

Interfaces wraps both ethernet and vlan interfaces.

type Service

type Service interface {
	// Configure gives the opportunity for the Service implementation to adjust its configuration
	// based on the Guest Agent configuration.
	Configure(ctx context.Context, config *cfg.Sections)

	// IsManaging checks whether this network manager service is managing the provided interface.
	IsManaging(ctx context.Context, iface string) (bool, error)

	// Name is the name of the network manager service.
	Name() string

	// SetupEthernetInterface writes the appropriate configurations for the network manager service for all
	// non-primary network interfaces.
	SetupEthernetInterface(ctx context.Context, config *cfg.Sections, nics *Interfaces) error

	// SetupVlanInterface writes the apppropriate vLAN interfaces configuration for the network manager service
	// for all configured interfaces.
	SetupVlanInterface(ctx context.Context, config *cfg.Sections, nics *Interfaces) error

	// Rollback rolls back the changes created in Setup.
	Rollback(ctx context.Context, nics *Interfaces) error

	// RollbackNics rolls back only changes to regular nics (vlan nics are not handled).
	RollbackNics(ctx context.Context, nics *Interfaces) error
}

Service is an interface for setting up network configurations using different network managing services, such as systemd-networkd and wicked.

type VlanInterface

type VlanInterface struct {
	metadata.VlanInterface
	// ParentInterfaceID is the interface name on the host. All network managers should refer
	// this interface name instead of one present in [metadata.VlanInterface] which is just an
	// index to interface in [EthernetInterfaces]
	ParentInterfaceID string
}

VlanInterface are metadata.VlanInterface offered by MDS with derived Parent Interface name added to it for convenience.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL