vintage_net v0.6.0 VintageNet.Route.Calculator View Source

This module computes the desired routing table contents

It's used by the RouteManager to update the Linux routing tables when interfaces come online or change state. See the RouteManager docs for a discussion of how routes are configured.

The functions in this module have no side effects so that it's easier to test that routing scenarios result in correct Linux routing table configurations.

Link to this section Summary

Functions

Compute a Linux routing table configuration

Initialize state carried between calculations

Link to this section Types

Link to this type

default_route()

View Source
default_route() ::
  {:default_route, VintageNet.ifname(), :inet.ip_address(), metric(),
   table_index()}
Link to this type

entries()

View Source
entries() :: [entry()]
Link to this type

interface_infos()

View Source
interface_infos() :: %{
  required(VintageNet.ifname()) => VintageNet.Route.InterfaceInfo.t()
}
Link to this type

local_route()

View Source
local_route() ::
  {:local_route, VintageNet.ifname(), :inet.ip_address(), metric(),
   table_index()}
Link to this type

metric()

View Source
metric() :: 0..32767
Link to this type

table_index()

View Source
table_index() :: 0..255 | :main | :local | :default
Link to this type

table_indices()

View Source
table_indices() :: %{required(VintageNet.ifname()) => table_index()}

Link to this section Functions

Compute a Linux routing table configuration

The entries are ordered so that List.myers_difference/2 can be used to minimize the routing table changes.

Initialize state carried between calculations