Neighbour Discovery (RFC4861)
[ICMPv6 Handling]

Collaboration diagram for Neighbour Discovery (RFC4861):


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.

Function Documentation

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.

Parameters:
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
Returns:

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.

Parameters:
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().

Here is the call graph for this function:

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.

Parameters:
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().

Here is the call graph for this function:

void fip_nd6_generateRA ( unsigned char  indexToMyUnicast,
fip_bool_t  multicast 
)

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.

Parameters:
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().

Here is the call graph for this function:

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.

Parameters:
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
Returns:

References fip_nd6_neighbourCache_makeRoom(), and TIMER_EXPIRED.

Referenced by fip_ip_send(), fip_nd6_processLLAO(), and fip_nd6_processNS().

Here is the call graph for this function:

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.

Parameters:
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  ) 

void fip_nd6_periodicUnicast ( fip_ifnum_t  ifnum,
unsigned char  indexToUnicast 
)

fip_return_t fip_nd6_process ( void   ) 

Process the current active buffer if it contains a ICMP-ND message.

Returns:
Return values:
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.

Todo:
AR.2: Complete exception handling.

Todo:
AR.2: Complete exception handling.

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().

Here is the call graph for this function:

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.

Parameters:
offset Offset to the LLAO from the ICMPv6 Header
Returns:
a fip_llptraddr_t that contains the LL Address

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().

Here is the call graph for this function:

static void fip_nd6_processNA ( const fip_nd6_optionStruct_t optionStruct  )  [static]

static void fip_nd6_processNS ( const fip_nd6_optionStruct_t optionStruct  )  [static]

static void fip_nd6_processRA ( const fip_nd6_optionStruct_t optionStruct  )  [static]

static void fip_nd6_processRS ( const fip_nd6_optionStruct_t optionStruct  )  [static]


Generated on Wed Dec 8 13:00:37 2010 for FIP by  doxygen 1.5.7.1