View Source VintageNet.Route.IPRoute (vintage_net v0.13.6)

This module knows how to invoke the ip command to modify the Linux routing tables

Summary

Functions

Add a source IP address -> routing table rule

Clear one local route generically

Clear one default route out of the main table for any interface

Clear one default route that goes to the specified interface

Clear out one rule

Clear all routes on all interfaces

Clear all rules that select the specified table or tables

Functions

add_default_route(ifname, route, metric, table_index)

@spec add_default_route(
  VintageNet.ifname(),
  :inet.ip_address(),
  VintageNet.Route.metric(),
  VintageNet.Route.table_index()
) :: :ok | {:error, any()}

Add a default route

add_local_route(ifname, ip, subnet_bits, metric, table_index)

Add a local route

add_rule(ip_address, table_index)

@spec add_rule(:inet.ip_address(), VintageNet.Route.table_index()) ::
  :ok | {:error, any()}

Add a source IP address -> routing table rule

clear_a_local_route(ifname)

@spec clear_a_local_route(VintageNet.ifname()) :: :ok | {:error, any()}

Clear one local route generically

clear_a_local_route(ifname, ip, subnet_bits, metric, table_index)

Clear one local route

clear_a_route()

@spec clear_a_route() :: :ok | {:error, any()}

Clear one default route out of the main table for any interface

clear_a_route(ifname, table_index \\ :main)

@spec clear_a_route(VintageNet.ifname(), VintageNet.Route.table_index()) ::
  :ok | {:error, any()}

Clear one default route that goes to the specified interface

clear_a_rule(table_index)

@spec clear_a_rule(VintageNet.Route.table_index()) :: :ok | {:error, any()}

Clear out one rule

clear_all_routes()

@spec clear_all_routes() :: :ok

Clear all routes on all interfaces

clear_all_rules(table_index)

@spec clear_all_rules(VintageNet.Route.table_index() | Enumerable.t()) :: :ok

Clear all rules that select the specified table or tables