VintageNet.IP.IPv4Config (vintage_net v0.13.11)

Copy Markdown View Source

This is a helper module for VintageNet.Technology implementations that use IPv4.

IPv4 configuration is specified under the :ipv4 key in the configuration map. Fields include:

  • :method - :dhcp, :static, or :disabled

The :dhcp method supports the following optional field:

  • :dhcp_request_options - a list of additional DHCP option names (strings) to request from the DHCP server beyond udhcpc's defaults. Each entry is passed through to udhcpc as -O <entry>. Either symbolic names ("wpad", "sipsrv") or numeric option codes ("252") are accepted; what's recognized depends on the busybox version in use. Defaults to []. Values that the DHCP server returns are parsed by VintageNet.DHCP.Options and exposed via the ["interface", ifname, "dhcp_options"] property. Requesting additional options changes the contents of the DHCP request, which some networks use to classify or segment clients (for example, fingerprint-based VLAN assignment), so only opt in to options you actually need.

The :static method uses the following fields:

  • :address - the IP address
  • :prefix_length - the number of bits in the IP address to use for the subnet (e.g., 24)
  • :netmask - either this or prefix_length is used to determine the subnet. If you have a choice, use prefix_length
  • :gateway - the default gateway for this interface (optional)
  • :name_servers - a list of DNS servers (optional)
  • :domain - DNS search domain (optional)

Configuration normalization converts :netmask to :prefix_length.

Summary

Functions

Add IPv4 configuration commands for supporting static and dynamic IP addressing

Normalize the IPv4 parameters in a configuration.

Functions

add_config(raw_config, config, opts)

Add IPv4 configuration commands for supporting static and dynamic IP addressing

normalize(config)

@spec normalize(map()) :: %{ipv4: map()}

Normalize the IPv4 parameters in a configuration.