vintage_net v0.6.0 VintageNet.RouteManager View Source
This module manages the default route.
Devices with more than one network interface may have more than one way of reaching the Internet. The routing table decides which interface an IP packet should use by looking at the "default route" entries. One interface is chosen.
Since not all interfaces are equal, we'd like Linux to pick the fastest and lowest latency one. for example, one could prefer wired Ethernet over WiFi and prefer WiFi over a cellular connection. This module lets you specify an ordering for interfaces and sets up the routes based on this ordering.
This module also handles networking failures. One failure that
Linux can't figure out on its own is whether an interface can
reach the Internet. Internet reachability is handled elsewhere
like in the ConnectivityChecker
module. This module should be
told reachability status so that it can properly order default
routes so that the best reachable interface is used.
IMPORTANT: This module uses priority-based routing. Make sure the following kernel options are enabled:
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_IP_MULTIPLE_TABLES=y
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Clear out the default gateway for an interface.
Set the connection status on an interface.
Set the order that default gateways should be used
Set the default route for an interface.
Start the route manager.
Stop the route manager.
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Clear out the default gateway for an interface.
set_connection_status(ifname, status)
View Sourceset_connection_status( VintageNet.ifname(), VintageNet.Interface.Classification.connection_status() ) :: :ok
Set the connection status on an interface.
Changing the connection status can re-prioritize routing. The specified interface doesn't need to have a default route.
set_prioritization(priorities)
View Sourceset_prioritization([VintageNet.Interface.Classification.prioritization()]) :: :ok
Set the order that default gateways should be used
The list is ordered from highest priority to lowest
set_route(ifname, ip_subnets, route, status \\ :lan)
View Sourceset_route( VintageNet.ifname(), [{:inet.ip_address(), VintageNet.prefix_length()}], :inet.ip_address(), VintageNet.Interface.Classification.connection_status() ) :: :ok
Set the default route for an interface.
This replaces any existing routes on that interface
Start the route manager.
Stop the route manager.