TCPIP_IPV6_UniqueLocalUnicastAddressAdd Function
C
IPV6_ULA_RESULT TCPIP_IPV6_UniqueLocalUnicastAddressAdd(
TCPIP_NET_HANDLE netH,
uint16_t subnetID,
IPV6_ULA_FLAGS genFlags,
IP_MULTI_ADDRESS* ntpAddress
);
Description
This function starts the process of adding a ULA address to the specified interface. The segments of the generated address are as follows:
FC00::/7 - ULA prefix
L - 1 bit set to 1, locally assigned
Global ID - 40 bit random generated identifier
subnet ID - 16 bit subnet identifier
Interface ID - 64 bit interface identifier generated as a EUI64 from the specified interface MAC
The randomness of the "Global ID" prefix of the generated IPv6 address is obtained by using an NTP server. The supplied NTP server will be contacted to obtain an NTP time stamp. This time stamp together with the EUI64 identifier obtained from the interface MAC are passed through a 160 bits hash algorithm (SHA1) and the least significant 40 bits are used as the GlobalID of the interface.
Preconditions
The IPv6 stack is initialized and the interface is up and configured.
Parameters
Parameters | Description |
---|---|
netH | The interface to add the address to. |
subnetIP | The subnet ID to be used. |
genFlags | Address generation flags:- IPV6_ULA_FLAG_NTPV4 - if set, the NTP server will be contacted over an IPv4 connection. Otherwise, a default IPv6 connection will be attempted.- IPV6_ULA_FLAG_GENERATE_ONLY - if set, the address will not be added to the list of the addresses for the specified interface. - IPV6_ULA_FLAG_SKIP_DAD - if set, the DAD processing will be skipped. |
ntpAddress | The NTP server address - it is an IPv4/IPv6 address as selected by the IPV6_ULA_FLAG_NTPV4 flag (the IP address could be obtained with an DNS call into the stack). Not currently used. |
Returns
IPV6_ULA_RES_BUSY - address generation module is busy.
IPV6_ULA_RES_IF_ERR - IPv6 interface is not up.
IPV6_ULA_RES_OK - if the call succeeded and the generation process was started.
Remarks
ULA generation needs to be enabled in the stack at build time.
Only one address generation at a time is supported for now. Before attempting a new address generation the previous operation has to be completed, otherwise the call will fail.
This function requires that the NTP client is enabled in the stack. If not, the call will fail.
The caller will be notified by the outcome of the operation by the stack using the standard IPv6 notification handler (registered by TCPIP_IPV6_HandlerRegister() call).
The ntpAddress parameter is not currently used. The NTP timestamp will be obtained using the default NTP server address.