-
Notifications
You must be signed in to change notification settings - Fork 321
AddressInfo
AddressInfo — Click element; specifies address information
AddressInfo(NAME ADDRESS [ADDRESS...], ...)
Ports: None
Lets you use mnemonic names for IPv4 and IPv6 addresses, IPv4 and IPv6 address prefixes, and Ethernet addresses. Each argument has the form `NAME ADDRESS [ADDRESS...]', which associates the given ADDRESSes with NAME. For example, if a configuration contains this AddressInfo element,
AddressInfo(mauer 10.0.0.1, mazu 10.0.0.10);
then other configuration strings can use mauer
and mazu
as mnemonics
for the IP addresses 10.0.0.1 and 10.0.0.10, respectively.
The mnemonic names introduced by AddressInfo elements are local with respect to compound elements. That is, names created inside a compound element apply only within that compound element and its subelements. For example:
AddressInfo(mauer 10.0.0.1);
compound :: {
AddressInfo(mazu 10.0.0.10);
... -> IPEncap(6, mauer, mazu) -> ... // OK
};
... -> IPEncap(6, mauer, mazu) -> ... // error: `mazu' undefined
Any name can be simultaneously associated with an IP address, an IP network address, and an Ethernet address. The kind of address that is returned is generally determined from context. For example:
AddressInfo(mauer 10.0.0.1 00-50-BA-85-84-A9);
... -> IPEncap(6, mauer, ...) // as IP address
-> EtherEncap(0x0800, mauer, ...) -> ... // as Ethernet address
... -> ARPResponder(mauer) -> ... // as IP address and Ethernet address!
An optional suffix makes the context unambiguous. NAME
is an ambiguous
reference to some address, but NAME:ip
is always an IPv4 address,
NAME:ipnet
is always an IPv4 network address (IPv4 address prefix),
NAME:ip6
is always an IPv6 address, NAME:ip6net
is always an IPv6
network address, and NAME:eth
is always an Ethernet address.
Names with both address and prefix definitions are preferentially parsed as addresses. For example:
AddressInfo(boojum 10.0.0.1/24); // defines address and prefix
a1 :: ARPResponder(boojum 00-01-02-03-04-05);
// a1 will have the same configuration as:
a2 :: ARPResponder(10.0.0.1/32 00-01-02-03-04-05);
To prefer the network prefix, use NAME:ipnet
.
If NAME:ipnet
is a valid IPv4 network address, then NAME:bcast
is a
valid IPv4 address equaling the broadcast address for that network. This is
obtained by setting all the host bits in the address prefix to 1.
NAME:gw
usually equals the default gateway address for network
NAME
. If NAME
is a device, then NAME:gw
can sometimes be
looked up explicitly; otherwise, NAME:gw
is calculated from
NAME:ipnet
by setting the lowest-order bit in the network address.
If you do not define an address for a given NAME, AddressInfo will use the default, if any. Defaults are as follows:
- * — For Ethernet addresses, Click checks for an Ethernet device named NAME, and uses its address. (At userlevel, this works only on BSD and Linux.)
- * — For IPv4 addresses, Click checks for a network device named NAME, and uses its primary IPv4 address.
- * —
For
NAME:gw
, Click checks for a network device named NAME, and uses its default gateway.
These defaults are not available on all platforms.
Generated by click-elem2man from ../include/click/standard/addressinfo.hh:7
on 2017/10/17.