View Source VintageNet.PredictableInterfaceName (vintage_net v0.12.0)

Handles predictable interface names by subscribing to the property table and renaming matching interface names based on the configuration in application environment.

Link to this section Summary

Types

hw_path to a user supplied ifname mapping

Functions

Return whether an ifname is a built-in one

Returns a specification to start this module under a supervisor.

Called before interface configuration.

Link to this section Types

@type hw_path_config() :: %{hw_path: Path.t(), ifname: VintageNet.ifname()}

hw_path to a user supplied ifname mapping

Link to this section Functions

@spec built_in?(VintageNet.ifname()) :: boolean()

Return whether an ifname is a built-in one

Built-in names start with eth, wlan, etc. and cannot be used as interfaces names when using the predictable networking feature.

Examples:

iex> PredictableInterfaceName.built_in?("wlan0")
true

iex> PredictableInterfaceName.built_in?("eth50")
true

iex> PredictableInterfaceName.built_in?("lan")
false

Returns a specification to start this module under a supervisor.

See Supervisor.

@spec precheck(VintageNet.ifname()) :: :ok | {:error, :not_predictable_interface_name}

Called before interface configuration.

First checks if vintage_net is configured to use predictable interface names, if so checks the given ifname for "common" naming schemes.

Instead of a boolean this function returns :ok on success, and {:error, not_predictable_interface_name} on failure. This is done to allow usage in with chains.

@spec start_link([hw_path_config()]) :: GenServer.on_start()