Data Structures | |
struct | fip_nd6_rs_t |
Router Solicitation Message Type. More... | |
struct | fip_nd6_ra_t |
Router Advertisement Message Type. More... | |
struct | fip_nd6_ns_t |
Neighbour Solicitation Message Type. More... | |
struct | fip_nd6_na_t |
Neighbour Advertisement Message Type. More... | |
struct | fip_nd6_llao_t |
Source/Target Link-Layer Option. More... | |
struct | fip_nd6_pio_t |
Prefix Information Option. More... | |
struct | fip_nd6_rho_t |
Redirected Header Option. More... | |
struct | fip_nd6_mtuo_t |
MTU Option. More... | |
struct | fip_nd6_if_t |
Structure holding all the configuration for a specific interface. More... | |
struct | fip_nd6_aro_t |
Address Registration Option. More... | |
struct | fip_nd6_6co_t |
6LoWPAN Context Option More... | |
struct | fip_nd6_abro_t |
Authoritative Border Router Option. More... | |
Files | |
file | fip_nd6.c |
Neighbour Discovery for IPv6 (RFC4861). | |
file | fip_nd6.h |
Neighbour Discovery for IPv6 (RFC4861). | |
file | fip_nd6_generate.c |
Neighbour Discovery for IPv6 (RFC4861), Generate functions. | |
file | fip_nd6_process.c |
Neighbour Discovery for IPv6 (RFC4861). | |
Defines | |
#define | FIP_ND6_NA_ROUTERFLAG (0x80) |
Neighbour Advertisement Header: Is Router Flag. | |
#define | FIP_ND6_NA_SOLICITEDFLAG (0x40) |
Neighbour Advertisement Header: Is Solicited Flag. | |
#define | FIP_ND6_NA_OVERRIDEFLAG (0x20) |
Neighbour Advertisement Header: Override Flag. | |
#define | FIP_ND6_RA_MFLAG (0x80) |
Router Advertisement Header: Managed Address Configuration Flag. | |
#define | FIP_ND6_RA_OFLAG (0x40) |
Router Advertisement Header: Other Configuration Flag. | |
#define | FIP_ND6_OPTION_SLLAO (1) |
ND Option Type: SLLAO. | |
#define | FIP_ND6_OPTION_TLLAO (2) |
ND Option Type: TLLAO. | |
#define | FIP_ND6_OPTION_PIO (3) |
ND Option Type: PIO. | |
#define | FIP_ND6_OPTION_RHO (4) |
ND Option Type: RHO. | |
#define | FIP_ND6_OPTION_MTUO (5) |
ND Option Type: MTUO. | |
#define | FIP_ND6_OPTION_ARO (31) |
ND Option Type: ARO. | |
#define | FIP_ND6_OPTION_6CO (32) |
ND Option Type: 6CO. | |
#define | FIP_ND6_OPTION_ABRO (33) |
ND Option Type: ABRO. | |
#define | FIP_ND6_OPTION_PIO_LFLAG (0x80) |
ND Prefix Information Option: On-Link Flag. | |
#define | FIP_ND6_OPTION_PIO_AFLAG (0x40) |
ND Prefix Information Option: Autoconf Flag. | |
#define | FIP_ARO_SUCCESS (0) |
Address Registration Option Status Field: Success. | |
#define | FIP_ARO_DUPLICATE (1) |
Address Registration Option Status Field: Duplicate Address. | |
#define | FIP_ARO_NCFULL (2) |
Address Registration Option Status Field: Neighbor Cache Full. | |
#define | FIP_6CO_CFLAG (1<<4) |
6LoWPAN Context Option: Valid for Compression Field | |
Functions | |
void | fip_nd6_periodicIf (fip_ifnum_t ifnum) |
Performs periodic maintenance of any ND6 structures on the interface. | |
void | fip_nd6_periodicUnicast (fip_ifnum_t ifnum, unsigned char indexToUnicast) |
Performs periodic maintenance of unicast IPv6 addresses assigned to the interface, as required by RFC4861 etc. | |
void | fip_nd6_neighbourCache_updateLL (fip_ifnum_t ifnum, fip_nd6_index_t index, fip_llptraddr_t lladdr) |
Update the Link-Layer address of a neighbour cache entry. | |
void | fip_nd6_neighbourCache_add (fip_ifnum_t ifnum, const unsigned char *const ipaddr, fip_llptraddr_t llptraddr, fip_bool_t isRouter) |
Add a neighbour to the neighbour cache, does not check for duplicate entries. | |
void | fip_nd6_generateNS (const fip_ip6addr_t *const targetAddress, unsigned char indexToMyUnicast, const fip_ip6addr_t *const destAddress, const uint8_t *optionData, const unsigned char optionLen, fip_bool_t addLLAO) |
Generate a neighbour solicitation. | |
void | fip_nd6_generateNA (fip_bool_t solicited, unsigned char indexToMyUnicast, const uint8_t *optionData, const unsigned char optionLen, fip_bool_t addLLAO) |
Generate a neighbour advertisement. | |
void | fip_nd6_generateRS (unsigned char indexToMyUnicast) |
Generate a router solicitation which is generated in current active packet buffer, which needs enough room! Size depends on LL address length, but should not be longer than 80 bytes normally. | |
void | fip_nd6_generateRA (unsigned char indexToMyUnicast, fip_bool_t multicast) |
Generate a router advertisement, buffer should already be set up with destination IP address in it. | |
static unsigned char | fip_nd6_addLLAO (uint8_t type, unsigned char llaoOffset, fip_llptraddr_t lladdr) |
Add either the TLLAO or SLLAO to a ND Message. | |
static void | fip_nd6_processRS (const fip_nd6_optionStruct_t *optionStruct) |
Process an incoming Router Solicitation. | |
static void | fip_nd6_processRA (const fip_nd6_optionStruct_t *optionStruct) |
Process an incoming Router Advertisement. | |
static void | fip_nd6_processNS (const fip_nd6_optionStruct_t *optionStruct) |
Process an incoming Neighbour Solicitation. | |
static void | fip_nd6_processNA (const fip_nd6_optionStruct_t *optionStruct) |
Process an incoming Neighbour Advertisement. | |
fip_llptraddr_t | fip_nd6_processLLAO (unsigned char offset) |
Process the LLAO in a ND message, and update the Neighbour Cache if this represents a new neighbour. | |
fip_return_t | fip_nd6_process (void) |
Process the current active buffer if it contains a ICMP-ND message. |
static unsigned char fip_nd6_addLLAO | ( | uint8_t | type, | |
unsigned char | llaoOffset, | |||
fip_llptraddr_t | lladdr | |||
) | [static] |
Add either the TLLAO or SLLAO to a ND Message.
type | Set to FIP_ND6_OPTION_SLLAO or FIP_ND6_OPTION_TLLAO | |
llaoOffset | Offset from start of fip_packet_getPtrToICMP6Buf() to where option goes | |
lladdr | The Link-Layer Address |
References fip_packet_getBufPtr, fip_padUpTo8Byte, fip_nd6_llao_t::length, fip_nd6_llao_t::linkLayerAddress, and fip_nd6_llao_t::type.
Referenced by fip_nd6_generateNA(), fip_nd6_generateNS(), fip_nd6_generateRA(), and fip_nd6_generateRS().
void fip_nd6_generateNA | ( | fip_bool_t | solicited, | |
unsigned char | indexToMyUnicast, | |||
const uint8_t * | optionData, | |||
const unsigned char | optionLen, | |||
fip_bool_t | addLLAO | |||
) |
Generate a neighbour advertisement.
Is generated in current active packet buffer, which needs enough room! Size depends on LL address length, but should not be longer than 80 bytes ever. Sets up everything in IPv6 header except source & destination addresses. Destination and source addresses must be setup before calling this function.
solicited | Is this a solicited NA or not | |
indexToMyUnicast | Index to the unicast address we are advertising | |
optionData | Additional option data to add to the NA | |
optionLen | Length of additional options to add specified in optionData | |
addLLAO | Should we add a LLAO? |
References fip_nd6_na_t::checksum, fip_nd6_na_t::code, fip_icmp6_finalize(), fip_ip6addr_cpy, fip_memcpy_ucharLen, fip_nd6_addLLAO(), FIP_ND6_NA_OVERRIDEFLAG, FIP_ND6_NA_ROUTERFLAG, FIP_ND6_NA_SOLICITEDFLAG, FIP_ND6_OPTION_TLLAO, fip_packet_getBufPtr, fip_packet_getFromIP6Hdr_isDestMulticast, fip_packet_setBufSize, fip_packet_setToIP6Hdr_hopLimit, fip_packet_setToIP6Hdr_nextHeader, fip_nd6_na_t::flags_reserved, fip_nd6_na_t::reserved1, fip_nd6_na_t::reserved2, fip_nd6_na_t::reserved3, fip_nd6_na_t::targetAddress, and fip_nd6_na_t::type.
Referenced by fip_nd6_periodicUnicast(), and fip_nd6_processNS().
void fip_nd6_generateNS | ( | const fip_ip6addr_t *const | targetAddress, | |
unsigned char | indexToMyUnicast, | |||
const fip_ip6addr_t *const | destAddress, | |||
const uint8_t * | optionData, | |||
const unsigned char | optionLen, | |||
fip_bool_t | addLLAO | |||
) |
Generate a neighbour solicitation.
Is generated in current active packet buffer, which needs enough room! Size depends on LL address length, but should not be longer than 80 bytes ever. Sets up everything in IPv6 header including source & dest addresses.
targetAddress | Target IPv6 Address we are solicitating | |
indexToMyUnicast | Index to the source IPv6 Address we are using | |
destAddress | Destination to transmit NS to | |
optionData | Additional option data to add to the NA | |
optionLen | Length of additional options to add specified in optionData | |
addLLAO | Should we add a LLAO? |
References fip_ip6addr_t::addr, ADDR_OPTIMISTIC, ADDR_PREFERRED, fip_nd6_ns_t::checksum, fip_nd6_ns_t::code, fip_icmp6_finalize(), fip_ip6addr_cpy, fip_isSrcUnspecified(), fip_memcpy_ucharLen, fip_nd6_addLLAO(), FIP_ND6_OPTION_SLLAO, fip_packet_copyToIP6Hdr_destAddr(), fip_packet_copyToIP6Hdr_srcAddr(), fip_packet_getBufPtr, fip_packet_getFromIP6Hdr_destPtr, fip_packet_resetAddrFlags, fip_packet_setAddrFlags, fip_packet_setBufSize, fip_packet_setToIP6Hdr_destAddr, fip_packet_setToIP6Hdr_hopLimit, fip_packet_setToIP6Hdr_nextHeader, fip_packet_setToIP6Hdr_srcAddrUnspecified(), fip_nd6_ns_t::reserved, fip_nd6_ns_t::targetAddress, and fip_nd6_ns_t::type.
Referenced by fip_nd6_periodicIf(), and fip_nd6_periodicUnicast().
void fip_nd6_generateRA | ( | unsigned char | indexToMyUnicast, | |
fip_bool_t | multicast | |||
) |
Generate a router advertisement, buffer should already be set up with destination IP address in it.
indexToMyUnicast | Index to the address we should send from | |
multicast |
References ADDR_PREFERRED, fip_nd6_ra_t::checksum, fip_nd6_ra_t::code, fip_nd6_ra_t::curHopLimit, fip_icmp6_finalize(), fip_ip6addr_cpy, fip_nd6_6lowpan_addRAOptions(), fip_nd6_addLLAO(), FIP_ND6_OPTION_PIO, FIP_ND6_OPTION_PIO_AFLAG, FIP_ND6_OPTION_SLLAO, fip_packet_activeDrop(), fip_packet_copyToIP6Hdr_srcAddr(), fip_packet_getBufPtr, fip_packet_getIfNum, fip_packet_setBufSize, fip_packet_setToIP6Hdr_destAddrAllNodes(), fip_packet_setToIP6Hdr_hopLimit, fip_packet_setToIP6Hdr_nextHeader, fip_nd6_pio_t::flags_reserved, fip_nd6_ra_t::flagsReserved, fip_nd6_pio_t::length, fip_nd6_pio_t::preferredLifetime, PREFIX_UNUSED, fip_nd6_pio_t::prefixAddress, fip_nd6_pio_t::prefixLength, fip_nd6_ra_t::reachableTime, fip_nd6_pio_t::reserved2, fip_nd6_ra_t::retransTime, fip_nd6_ra_t::routerLifetime, fip_nd6_pio_t::type, fip_nd6_ra_t::type, and fip_nd6_pio_t::validLifetime.
Referenced by fip_nd6_periodicIf(), and fip_nd6_processRS().
void fip_nd6_generateRS | ( | unsigned char | indexToMyUnicast | ) |
Generate a router solicitation which is generated in current active packet buffer, which needs enough room! Size depends on LL address length, but should not be longer than 80 bytes normally.
indexToMyUnicast | Which address do we send from? |
References ADDR_PREFERRED, fip_nd6_rs_t::checksum, fip_nd6_rs_t::code, fip_icmp6_finalize(), fip_isSrcUnspecified(), fip_nd6_addLLAO(), FIP_ND6_OPTION_SLLAO, fip_packet_activeDrop(), fip_packet_copyToIP6Hdr_srcAddr(), fip_packet_getBufPtr, fip_packet_getIfNum, fip_packet_setBufSize, fip_packet_setToIP6Hdr_destAddrAllRouters(), fip_packet_setToIP6Hdr_hopLimit, fip_packet_setToIP6Hdr_nextHeader, fip_packet_setToIP6Hdr_srcAddrUnspecified(), fip_nd6_rs_t::reserved, and fip_nd6_rs_t::type.
Referenced by fip_nd6_periodicIf().
void fip_nd6_neighbourCache_add | ( | fip_ifnum_t | ifnum, | |
const unsigned char *const | ipaddr, | |||
fip_llptraddr_t | llptraddr, | |||
fip_bool_t | isRouter | |||
) |
Add a neighbour to the neighbour cache, does not check for duplicate entries.
ifnum | Interface number to add on | |
ipaddr | IP Address of the neighbour | |
llptraddr | Link-Layer Address of the Neighbour, if the 'len' field is zero then the entry is considered incomplete | |
isRouter | Sets the isRouter flag |
References fip_nd6_neighbourCache_makeRoom(), and TIMER_EXPIRED.
Referenced by fip_ip_send(), fip_nd6_processLLAO(), and fip_nd6_processNS().
void fip_nd6_neighbourCache_updateLL | ( | fip_ifnum_t | ifnum, | |
fip_nd6_index_t | index, | |||
fip_llptraddr_t | lladdr | |||
) |
Update the Link-Layer address of a neighbour cache entry.
If the lladdr is different from the one currently stored, the state is set to STALE.
ifnum | Interface number to update on | |
index | The entry to update. | |
lladdr | The updated Link-Layer address. |
Referenced by fip_nd6_processLLAO(), fip_nd6_processNA(), and fip_nd6_processNS().
void fip_nd6_periodicIf | ( | fip_ifnum_t | ifnum | ) |
Performs periodic maintenance of any ND6 structures on the interface.
ifnum | Interface number to perform periodic processing on |
References fip_nd6_if_t::defaultNsAddr, fip_hostInterface_getMiliSeconds32(), fip_nd6_generateNS(), fip_nd6_generateRA(), fip_nd6_generateRS(), fip_nd6_neighbourCache_getState, fip_packet_activeNew(), fip_timer_getExpireTime32miliS(), fip_timer_isExpired32, fip_nd6_if_t::NextRtrAdvTime32ms, fip_nd6_if_t::NextRtrSolicitationTime32mS, fip_nd6_if_t::retransTime, fip_nd6_if_t::RtrAdvInterval32mS, fip_nd6_if_t::RtrSoliciationMaxTime32mS, fip_nd6_if_t::RtrSolicitationInterval32mS, fip_nd6_if_t::RtrSolicitationsToSend, RV_OK, and fip_nd6_if_t::using6LPND.
Referenced by fip_if6_periodic().
void fip_nd6_periodicUnicast | ( | fip_ifnum_t | ifnum, | |
unsigned char | indexToUnicast | |||
) |
Performs periodic maintenance of unicast IPv6 addresses assigned to the interface, as required by RFC4861 etc.
ifnum | Interface number periodic maintenance is occurring on | |
indexToUnicast | Index to the unicast IPv6 address to perform maintenance on |
References fip_ip6addr_t::addr, fip_myip6addr_t::addr, ADDR_DELETE, ADDR_DEPRECATED, ADDR_DUPLICATE, ADDR_NEW, ADDR_PREFERRED, ADDR_TENATIVE, ADDR_UNUSED, fip_myip6addr_t::dupAddrDetectLeft, fip_nd6_if_t::DupAddrDetectTransmits, fip_hostInterface_getMiliSeconds32(), fip_nd6_generateNA(), fip_nd6_generateNS(), fip_packet_activeNew(), fip_packet_copyToIP6Hdr_srcAddr(), fip_packet_setToIP6Hdr_destAddrAllNodes(), fip_timer_getExpireTime32miliS(), fip_timer_isExpired32, fip_myip6addr_t::hasSolicitedMulticast, fip_myip6addr_t::retransExpire32mS, fip_nd6_if_t::retransTime, RV_OK, fip_myip6addr_t::state, TIMER_EXPIRED, TRACE, TRACE_ADDIP6ADDR, and fip_nd6_if_t::using6LPND.
Referenced by fip_if6_periodic().
fip_return_t fip_nd6_process | ( | void | ) |
Process the current active buffer if it contains a ICMP-ND message.
RV_OK | If message was processed | |
RV_UNHANDLED | If active buffer did not contain a recognised ND message. | |
RV_UNKNOWN_ERROR | If an error was encountered processing the message. |
References fip_nd6_processNA(), fip_nd6_processNS(), fip_nd6_processRA(), fip_nd6_processRS(), fip_packet_activeDrop(), fip_packet_getBufSize, fip_packet_getFromICMP6Hdr_Type, fip_nd6_option_t::length, MAX_ICMPV6_OPTIONS, fip_nd6_optionStruct_t::numOpts, fip_nd6_option_t::offset, fip_nd6_optionStruct_t::options, RV_OK, RV_UNHANDLED, RV_UNKNOWN_ERROR, TRACE, TRACE_ADDVAR, and fip_nd6_option_t::type.
Referenced by fip_icmp6_process().
fip_llptraddr_t fip_nd6_processLLAO | ( | unsigned char | offset | ) |
Process the LLAO in a ND message, and update the Neighbour Cache if this represents a new neighbour.
offset | Offset to the LLAO from the ICMPv6 Header |
References fip_if6_shortenLLAOLength(), fip_nd6_neighbourCache_add(), fip_nd6_neighbourCache_lookupByIp(), fip_nd6_neighbourCache_updateLL(), fip_packet_getBufPtr, fip_packet_getFromIP6Hdr_srcPtr, fip_packet_getIfNum, fip_ds6_searchStatus_t::index, and fip_ds6_searchStatus_t::itemFound.
Referenced by fip_nd6_processNS(), fip_nd6_processRA(), and fip_nd6_processRS().
static void fip_nd6_processNA | ( | const fip_nd6_optionStruct_t * | optionStruct | ) | [static] |
Process an incoming Neighbour Advertisement.
optionStruct | Pointer to the preprocessed options |
References ADDR_DUPLICATE, ADDR_PREFERRED, fip_nd6_na_t::code, fip_if6_shortenLLAOLength(), fip_nd6_6lowpan_processNA(), FIP_ND6_NA_OVERRIDEFLAG, FIP_ND6_NA_ROUTERFLAG, FIP_ND6_NA_SOLICITEDFLAG, fip_nd6_neighbourCache_getState, fip_nd6_neighbourCache_lookupByIp(), fip_nd6_neighbourCache_updateLL(), FIP_ND6_OPTION_TLLAO, fip_packet_activeDrop(), fip_packet_getBufPtr, fip_packet_getFromIP6Hdr_isDestMulticast, fip_packet_getIfNum, fip_timer_getExpireTime32miliS(), fip_nd6_na_t::flags_reserved, fip_ds6_searchStatus_t::index, fip_ds6_searchStatus_t::itemFound, fip_nd6_option_t::length, fip_nd6_optionStruct_t::numOpts, fip_nd6_option_t::offset, fip_nd6_optionStruct_t::options, fip_nd6_na_t::targetAddress, TRACE, and fip_nd6_option_t::type.
Referenced by fip_nd6_process().
static void fip_nd6_processNS | ( | const fip_nd6_optionStruct_t * | optionStruct | ) | [static] |
Process an incoming Neighbour Solicitation.
optionStruct | Pointer to the preprocessed options |
References ADDR_DUPLICATE, ADDR_PREFERRED, fip_nd6_ns_t::code, fip_isSrcUnspecified(), fip_nd6_generateNA(), fip_nd6_neighbourCache_add(), fip_nd6_neighbourCache_lookupByIp(), fip_nd6_neighbourCache_updateLL(), FIP_ND6_OPTION_SLLAO, fip_nd6_processLLAO(), fip_packet_activeDrop(), fip_packet_activeNew(), fip_packet_activeResponsePacket(), fip_packet_copyToIP6Hdr_srcAddr(), fip_packet_getAddrFlags, fip_packet_getAttr, fip_packet_getBufPtr, fip_packet_getIfNum, fip_packet_setLLDestAddr, fip_packet_setToIP6Hdr_destAddrAllNodes(), fip_ds6_searchStatus_t::index, fip_ds6_searchStatus_t::itemFound, fip_nd6_optionStruct_t::numOpts, fip_nd6_option_t::offset, fip_nd6_optionStruct_t::options, RV_OK, fip_nd6_ns_t::targetAddress, and fip_nd6_option_t::type.
Referenced by fip_nd6_process().
static void fip_nd6_processRA | ( | const fip_nd6_optionStruct_t * | optionStruct | ) | [static] |
Process an incoming Router Advertisement.
optionStruct | Pointer to the preprocessed options |
: need time comparison macro
: make access macros to get remaining lifetime
References abroAddress, abroVersionNumber, fip_ip6addr_t::addr, fip_nd6_abro_t::address, fip_nd6_ra_t::code, fip_nd6_6co_t::context, fip_nd6_6co_t::contextIDFlags, fip_nd6_6co_t::contextLength, FIP_6CO_CFLAG, fip_hostInterface_getSeconds32(), fip_if6_addPrefix(), fip_ip6addr_cpy, fip_nd6_6lowpan_LBRTableNewEntry(), fip_nd6_neighbourCache_lookupByIp(), FIP_ND6_OPTION_6CO, FIP_ND6_OPTION_ABRO, FIP_ND6_OPTION_PIO, FIP_ND6_OPTION_PIO_AFLAG, FIP_ND6_OPTION_PIO_LFLAG, FIP_ND6_OPTION_SLLAO, fip_nd6_processLLAO(), fip_packet_activeDrop(), fip_packet_getBufPtr, fip_packet_getFromIP6Hdr_srcPtr, fip_packet_getIfNum, fip_nd6_pio_t::flags_reserved, fip_ds6_searchStatus_t::index, fip_ds6_searchStatus_t::itemFound, fip_nd6_optionStruct_t::numOpts, fip_nd6_option_t::offset, fip_nd6_optionStruct_t::options, fip_nd6_pio_t::preferredLifetime, fip_nd6_pio_t::prefixAddress, fip_nd6_pio_t::prefixLength, fip_nd6_ra_t::reachableTime, fip_nd6_ra_t::retransTime, fip_nd6_ra_t::routerLifetime, fip_nd6_option_t::type, fip_nd6_pio_t::validLifetime, fip_nd6_abro_t::versionNumber, and fip_nd6_6co_t::vlifetime.
Referenced by fip_nd6_process().
static void fip_nd6_processRS | ( | const fip_nd6_optionStruct_t * | optionStruct | ) | [static] |
Process an incoming Router Solicitation.
optionStruct | Pointer to the preprocessed options |
References fip_nd6_rs_t::code, fip_isSrcUnspecified(), fip_nd6_generateRA(), FIP_ND6_OPTION_SLLAO, fip_nd6_processLLAO(), fip_packet_activeDrop(), fip_packet_activeResponsePacket(), fip_packet_getBufPtr, fip_packet_getIfNum, fip_packet_setLLDestAddr, fip_nd6_optionStruct_t::numOpts, fip_nd6_option_t::offset, fip_nd6_optionStruct_t::options, RV_OK, and fip_nd6_option_t::type.
Referenced by fip_nd6_process().