Documentation ¶
Index ¶
- Constants
- func RegisterItems(log *base.LogObject, registry *reconciler.DefaultRegistry, ...) error
- type AccessPort
- type Bridge
- type BridgeConfigurator
- func (c *BridgeConfigurator) Create(ctx context.Context, item dg.Item) error
- func (c *BridgeConfigurator) Delete(ctx context.Context, item dg.Item) error
- func (c *BridgeConfigurator) Modify(ctx context.Context, oldItem, newItem dg.Item) (err error)
- func (c *BridgeConfigurator) NeedsRecreate(oldItem, newItem dg.Item) (recreate bool)
- type BridgePort
- type BridgePortConfigurator
- func (c *BridgePortConfigurator) Create(ctx context.Context, item dg.Item) error
- func (c *BridgePortConfigurator) Delete(ctx context.Context, item dg.Item) (err error)
- func (c *BridgePortConfigurator) Modify(ctx context.Context, oldItem, newItem dg.Item) (err error)
- func (c *BridgePortConfigurator) NeedsRecreate(oldItem, newItem dg.Item) (recreate bool)
- type BridgePortVariant
- type ContainerApp
- type DummyIf
- type DummyIfConfigurator
- func (c *DummyIfConfigurator) Create(ctx context.Context, item dg.Item) error
- func (c *DummyIfConfigurator) Delete(ctx context.Context, item dg.Item) error
- func (c *DummyIfConfigurator) Modify(ctx context.Context, oldItem, newItem dg.Item) (err error)
- func (c *DummyIfConfigurator) NeedsRecreate(oldItem, newItem dg.Item) (recreate bool)
- type IPRule
- type IPRuleConfigurator
- func (c *IPRuleConfigurator) Create(ctx context.Context, item dg.Item) error
- func (c *IPRuleConfigurator) Delete(ctx context.Context, item dg.Item) error
- func (c *IPRuleConfigurator) Modify(_ context.Context, _, _ dg.Item) (err error)
- func (c *IPRuleConfigurator) NeedsRecreate(oldItem, newItem dg.Item) (recreate bool)
- type IPSet
- type IPSetConfigurator
- func (c *IPSetConfigurator) Create(ctx context.Context, item dg.Item) error
- func (c *IPSetConfigurator) Delete(ctx context.Context, item dg.Item) error
- func (c *IPSetConfigurator) Modify(ctx context.Context, oldItem, newItem dg.Item) (err error)
- func (c *IPSetConfigurator) NeedsRecreate(oldItem, newItem dg.Item) (recreate bool)
- type Route
- type RouteConfigurator
- func (c *RouteConfigurator) Create(ctx context.Context, item dg.Item) error
- func (c *RouteConfigurator) Delete(ctx context.Context, item dg.Item) error
- func (c *RouteConfigurator) Modify(ctx context.Context, oldItem, newItem dg.Item) (err error)
- func (c *RouteConfigurator) NeedsRecreate(oldItem, newItem dg.Item) (recreate bool)
- type Sysctl
- type SysctlConfigurator
- func (c *SysctlConfigurator) Create(ctx context.Context, item dg.Item) error
- func (c *SysctlConfigurator) Delete(ctx context.Context, item dg.Item) error
- func (c *SysctlConfigurator) Modify(ctx context.Context, oldItem, newItem dg.Item) error
- func (c *SysctlConfigurator) NeedsRecreate(oldItem, newItem dg.Item) (recreate bool)
- type TrunkPort
- type VIF
- type VIFConfigurator
- func (c *VIFConfigurator) Create(ctx context.Context, item dg.Item) error
- func (c *VIFConfigurator) Delete(ctx context.Context, item dg.Item) error
- func (c *VIFConfigurator) Modify(ctx context.Context, oldItem, newItem dg.Item) (err error)
- func (c *VIFConfigurator) NeedsRecreate(oldItem, newItem dg.Item) (recreate bool)
- type VIFReference
- type VIFVariant
- type VLANBridge
- type VLANBridgeConfigurator
- func (c *VLANBridgeConfigurator) Create(ctx context.Context, item dg.Item) error
- func (c *VLANBridgeConfigurator) Delete(ctx context.Context, item dg.Item) error
- func (c *VLANBridgeConfigurator) Modify(ctx context.Context, oldItem, newItem dg.Item) (err error)
- func (c *VLANBridgeConfigurator) NeedsRecreate(oldItem, newItem dg.Item) (recreate bool)
- type VLANConfig
- type VLANPort
- type VLANPortConfigurator
- func (c *VLANPortConfigurator) Create(ctx context.Context, item dg.Item) error
- func (c *VLANPortConfigurator) Delete(ctx context.Context, item dg.Item) error
- func (c *VLANPortConfigurator) Modify(ctx context.Context, oldItem, newItem dg.Item) (err error)
- func (c *VLANPortConfigurator) NeedsRecreate(oldItem, newItem dg.Item) (recreate bool)
- type Veth
Constants ¶
const ( // VIFTypename : typename for VIF. VIFTypename = "VIF" // IPRuleTypename : typename for Linux IP rules. IPRuleTypename = "IPRule" // BridgeTypename : typename for Linux bridges. BridgeTypename = "Bridge" // BridgePortTypename : typename for network interface added into a Linux bridge. BridgePortTypename = "BridgePort" // DummyIfTypename : typename for Linux dummy interface. DummyIfTypename = "DummyInterface" // VLANBridgeTypename : typename for (Linux bridge) enabled for VLANs. VLANBridgeTypename = "VLANBridge" // VLANPortTypename : typename for bridged port with configured VLAN(s). VLANPortTypename = "VLANPort" // SysctlTypename : typename for kernel config applied via sysctl. SysctlTypename = "Sysctl" )
Variables ¶
This section is empty.
Functions ¶
func RegisterItems ¶
func RegisterItems(log *base.LogObject, registry *reconciler.DefaultRegistry, monitor netmonitor.NetworkMonitor) error
RegisterItems : register all configurators implemented by this package.
Types ¶
type AccessPort ¶
type AccessPort struct {
VID uint16
}
AccessPort : port carries untagged traffic from a single VLAN.
type Bridge ¶
type Bridge struct { // IfName : name of the bridge interface inside the network stack. IfName string // CreatedByNIM : true if this bridge was created by NIM to extend the bridge domain // of an uplink interface. Such bridge is then directly used for L2 network instances. CreatedByNIM bool // MACAddress : MAC address allocated for (or already assigned by NIM to) the bridge. MACAddress net.HardwareAddr // IPAddresses : a set of IP addresses allocated for the bridge itself (L3 NI), // or already assigned by the DHCP client (NIM-created bridge, L2 NI). IPAddresses []*net.IPNet }
Bridge : Linux bridge.
func (Bridge) Dependencies ¶
func (b Bridge) Dependencies() (deps []dg.Dependency)
Dependencies returns reservations of IPs that bridge should have assigned.
func (Bridge) GetAssignedIPs ¶
GetAssignedIPs returns IP addresses assigned to the bridge interface. The function is needed for the definition of dependencies for dnsmasq and HTTP server.
type BridgeConfigurator ¶
BridgeConfigurator implements Configurator interface (libs/reconciler) for Linux bridge.
func (*BridgeConfigurator) NeedsRecreate ¶
func (c *BridgeConfigurator) NeedsRecreate(oldItem, newItem dg.Item) (recreate bool)
NeedsRecreate always returns true - Modify is not implemented.
type BridgePort ¶
type BridgePort struct { // BridgeIfName : interface name of the bridge. BridgeIfName string // Variant : port should be one of the supported variants. Variant BridgePortVariant }
BridgePort : network interface added into a Linux bridge.
func (BridgePort) Dependencies ¶
func (p BridgePort) Dependencies() (deps []dg.Dependency)
Dependencies returns the bridge and the port as the dependencies.
func (BridgePort) Equal ¶
func (p BridgePort) Equal(other dg.Item) bool
Equal compares two BridgePort instances.
func (BridgePort) Name ¶
func (p BridgePort) Name() string
Name returns the interface name of the bridged port
type BridgePortConfigurator ¶
type BridgePortConfigurator struct { Log *base.LogObject NetworkMonitor netmonitor.NetworkMonitor }
BridgePortConfigurator implements Configurator interface (libs/reconciler) for Linux bridge port.
func (*BridgePortConfigurator) NeedsRecreate ¶
func (c *BridgePortConfigurator) NeedsRecreate(oldItem, newItem dg.Item) (recreate bool)
NeedsRecreate returns true - Modify is not implemented.
type BridgePortVariant ¶
type BridgePortVariant struct { // UplinkIfName : bridged uplink interface. UplinkIfName string // VIFIfName : bridged VIF. VIFIfName string }
BridgePortVariant is like union, only one option should have non-zero value.
type ContainerApp ¶
type ContainerApp struct { ID uuid.UUID // NetNsName : name of a file under /var/run/netns/ dir, referencing network // namespace of the (container) app. NetNsName string }
ContainerApp : container application separated from the host only using Linux namespaces.
type DummyIf ¶
type DummyIf struct { // IfName : name of the DummyIf interface inside the network stack. IfName string // ARPOff : enable to suppress ARP on the dummy interface. ARPOff bool }
DummyIf : Linux dummy interface.
func (DummyIf) Dependencies ¶
func (d DummyIf) Dependencies() (deps []dg.Dependency)
Dependencies returns no dependencies.
type DummyIfConfigurator ¶
DummyIfConfigurator implements Configurator interface (libs/reconciler) for Linux dummy interface.
func (*DummyIfConfigurator) NeedsRecreate ¶
func (c *DummyIfConfigurator) NeedsRecreate(oldItem, newItem dg.Item) (recreate bool)
NeedsRecreate always returns true - Modify is not implemented.
type IPRule ¶
IPRule : Linux IP rule.
func (IPRule) Dependencies ¶
func (r IPRule) Dependencies() (deps []dg.Dependency)
Dependencies returns no dependencies (table does not have to exist).
func (IPRule) Label ¶
Label is more human-readable than name. Label resembles the output of "ip rule list".
type IPRuleConfigurator ¶
IPRuleConfigurator implements Configurator interface (libs/reconciler) for Linux IP rule.
func (*IPRuleConfigurator) NeedsRecreate ¶
func (c *IPRuleConfigurator) NeedsRecreate(oldItem, newItem dg.Item) (recreate bool)
NeedsRecreate returns true - Modify is not implemented.
type IPSet ¶
type IPSet struct { // SetName : name of the IPSet. // See "SETNAME" in https://ipset.netfilter.org/ipset.man.html. SetName string // TypeName : type of the IPSet. // See "TYPENAME" in https://ipset.netfilter.org/ipset.man.html. // See "SET TYPES" on that website for the summary of available types. TypeName string // AddrFamily should be either AF_INET or AF_INET6. AddrFamily int // Entries : set of entries added to the IPSet. // Entry syntax depends on the type, for example "192.168.1.1,udp:53" // would be valid for typename "hash:ip,port". Entries []string }
IPSet : Linux ipset (https://ipset.netfilter.org/index.html).
func (IPSet) Dependencies ¶
func (s IPSet) Dependencies() (deps []dg.Dependency)
Dependencies returns no dependencies.
type IPSetConfigurator ¶
IPSetConfigurator implements Configurator interface (libs/reconciler) for Linux ipset (from netfilter).
func (*IPSetConfigurator) Modify ¶
Modify is not implemented. Note that zedrouter does not need to ever modify Entries - they are either static or dynamically managed by dnsmasq, i.e. outside zedrouter.
func (*IPSetConfigurator) NeedsRecreate ¶
func (c *IPSetConfigurator) NeedsRecreate(oldItem, newItem dg.Item) (recreate bool)
NeedsRecreate always returns true - Modify is not implemented.
type Route ¶
type Route struct { // Non-zero Route.LinkIndex should match OutputIf. // If Route.LinkIndex is zero, RouteConfigurator will find the output interface // index. netlink.Route // OutputIf : output interface for the routed traffic. // Leave undefined if the destination is unreachable. OutputIf genericitems.NetworkIf // GwViaLinkRoute is set to true if gateway is not included in the output interface // subnet and therefore depends on a link route (RT_SCOPE_LINK) for reachability. GwViaLinkRoute bool // ForApp is defined if route is configured inside app network namespace. ForApp ContainerApp }
Route : Network route.
func (Route) Dependencies ¶
func (r Route) Dependencies() (deps []dg.Dependency)
Dependencies of a network route are:
- the "via" interface must exist and be UP
- the "via" interface must have an IP address assigned from the subnet of the route gateway.
- if route has src IP, this IP must be assigned to the "via" interface
type RouteConfigurator ¶
type RouteConfigurator struct { Log *base.LogObject NetworkMonitor netmonitor.NetworkMonitor }
RouteConfigurator implements Configurator interface (libs/reconciler) for network routes.
func (*RouteConfigurator) NeedsRecreate ¶
func (c *RouteConfigurator) NeedsRecreate(oldItem, newItem dg.Item) (recreate bool)
NeedsRecreate returns true - Modify is not implemented.
type Sysctl ¶
type Sysctl struct { // ForApp : if defined, apply these kernel parameters for a (container) app // (and not for the host). ForApp ContainerApp // NetIf : network interface for which parameters are applied. NetIf genericitems.NetworkIf // EnableDAD : enable duplicate address detection (IPv6). EnableDAD bool // EnableARPNotify : generate gratuitous arp requests when device is brought up // or hardware address changes EnableARPNotify bool }
Sysctl : item representing kernel parameters set for a network interface using sysctl.
func (Sysctl) Dependencies ¶
func (s Sysctl) Dependencies() (deps []dg.Dependency)
Dependencies returns the target interface as the only dependency.
type SysctlConfigurator ¶
SysctlConfigurator implements Configurator for sysctl settings.
func (*SysctlConfigurator) NeedsRecreate ¶
func (c *SysctlConfigurator) NeedsRecreate(oldItem, newItem dg.Item) (recreate bool)
NeedsRecreate returns false - Modify is able to apply any change.
type VIF ¶
type VIF struct { // HostIfName : name of the interface inside the network stack on the host side. HostIfName string // NetAdapterName is the logical name for this interface received from the controller // in NetworkAdapter.Name. // Unique in the scope of the application. NetAdapterName string // Variant : VIF should be one of the supported variants. Variant VIFVariant }
VIF : virtual interface connecting an application to a network instance. It can be either an external item created by the hypervisor, or an internal item configured by zedrouter.
func (VIF) Dependencies ¶
func (v VIF) Dependencies() (deps []dg.Dependency)
Dependencies returns no dependencies.
func (VIF) GetAssignedIPs ¶
GetAssignedIPs returns IP addresses assigned (by zedrouter) to the VIF interface.
type VIFConfigurator ¶
VIFConfigurator implements Configurator interface for Veth VIF.
func (*VIFConfigurator) NeedsRecreate ¶
func (c *VIFConfigurator) NeedsRecreate(oldItem, newItem dg.Item) (recreate bool)
NeedsRecreate returns true when anything other that Veth IPs change.
type VIFReference ¶
VIFReference : VIF used as the output interface for route.
type VIFVariant ¶
type VIFVariant struct { // Enable if VIF is created by an external process (e.g. hypervisor). External bool // Veth configured by zedrouter between the host and the app (container). Veth Veth }
VIFVariant is like union, only one option should have non-zero value.
type VLANBridge ¶
type VLANBridge struct { // BridgeIfName : interface name of the bridge. BridgeIfName string // EnableVLANFiltering : drop packet if it belongs to a VLAN which is not enabled // on the input bridge port (using VLANPort config item). EnableVLANFiltering bool }
VLANBridge : VLAN configuration for a Linux bridge.
func (VLANBridge) Dependencies ¶
func (v VLANBridge) Dependencies() (deps []dg.Dependency)
Dependencies returns the bridge as the only dependency.
func (VLANBridge) Equal ¶
func (v VLANBridge) Equal(other dg.Item) bool
Equal compares two VLANBridge instances.
func (VLANBridge) Name ¶
func (v VLANBridge) Name() string
Name returns the interface name of the bridge.
type VLANBridgeConfigurator ¶
type VLANBridgeConfigurator struct { Log *base.LogObject NetworkMonitor netmonitor.NetworkMonitor }
VLANBridgeConfigurator implements Configurator interface (libs/reconciler) for VLAN configuration applied to a Linux bridge.
func (*VLANBridgeConfigurator) NeedsRecreate ¶
func (c *VLANBridgeConfigurator) NeedsRecreate(oldItem, newItem dg.Item) (recreate bool)
NeedsRecreate returns true - Modify is not implemented.
type VLANConfig ¶
type VLANConfig struct { AccessPort *AccessPort TrunkPort *TrunkPort }
VLANConfig : VLAN configuration to apply on the bridge port. Port is either configured as a trunk or as an access port (use this struct as union).
type VLANPort ¶
type VLANPort struct { // BridgeIfName : interface name of the bridge. BridgeIfName string // PortIfName : interface name of the bridge port. PortIfName string // VLANConfig : VLAN configuration to apply on the bridged interface. VLANConfig VLANConfig }
VLANPort : VLAN configuration for a Linux bridge port.
func (VLANPort) Dependencies ¶
func (v VLANPort) Dependencies() (deps []dg.Dependency)
Dependencies returns the (VLAN-enabled) bridge and the port as the dependencies.
type VLANPortConfigurator ¶
type VLANPortConfigurator struct { Log *base.LogObject NetworkMonitor netmonitor.NetworkMonitor }
VLANPortConfigurator implements Configurator interface (libs/reconciler) for VLAN configuration applied to a Linux bridge port.
func (*VLANPortConfigurator) NeedsRecreate ¶
func (c *VLANPortConfigurator) NeedsRecreate(oldItem, newItem dg.Item) (recreate bool)
NeedsRecreate returns true - Modify is not implemented.
type Veth ¶
type Veth struct { ForApp ContainerApp // AppIfName : name of the interface inside the network stack on the app side. AppIfName string // AppIfMAC : MAC address assigned to the Veth interface on the app side. AppIfMAC net.HardwareAddr // AppIPs : IP addresses assigned to Veth on the app side. AppIPs []*net.IPNet }
Veth : virtual ethernet pair created between the host and the (container) app network namespace.