Contiki-Inga 3.x
Data Structures | Macros
Neighbor discovery (RFC 4861)

Data Structures

struct  uip_nd6_ns
 A neighbor solicitation constant part. More...
 
struct  uip_nd6_na
 A neighbor advertisement constant part. More...
 
struct  uip_nd6_rs
 A router solicitation constant part. More...
 
struct  uip_nd6_ra
 A router advertisement constant part. More...
 
struct  uip_nd6_redirect
 A redirect message constant part. More...
 
struct  uip_nd6_opt_hdr
 ND option header. More...
 
struct  uip_nd6_opt_prefix_info
 ND option prefix information. More...
 
struct  uip_nd6_opt_mtu
 ND option MTU. More...
 

Macros

#define UIP_ND6_DEF_MAXDADNS   UIP_ND6_SEND_NA
 Do not try DAD when using EUI-64 as allowed by draft-ietf-6lowpan-nd-15 section 8.2.
 

General

#define UIP_ND6_HOP_LIMIT   255
 HOP LIMIT to be used when sending ND messages (255)
 
#define UIP_ND6_INFINITE_LIFETIME   0xFFFFFFFF
 INFINITE lifetime.
 

RFC 4861 Host constant

#define UIP_ND6_MAX_RTR_SOLICITATION_DELAY   1
 
#define UIP_ND6_RTR_SOLICITATION_INTERVAL   4
 
#define UIP_ND6_MAX_RTR_SOLICITATIONS   3
 

RFC 4861 Router constants

#define UIP_ND6_SEND_RA   1 /* enable/disable RA sending */
 
#define UIP_ND6_SEND_NA   1 /* enable/disable NA sending */
 
#define UIP_ND6_MAX_RA_INTERVAL   600
 
#define UIP_ND6_MIN_RA_INTERVAL   (UIP_ND6_MAX_RA_INTERVAL / 3)
 
#define UIP_ND6_M_FLAG   0
 
#define UIP_ND6_O_FLAG   0
 
#define UIP_ND6_ROUTER_LIFETIME   3 * UIP_ND6_MAX_RA_INTERVAL
 
#define UIP_ND6_MAX_INITIAL_RA_INTERVAL   16 /*seconds*/
 
#define UIP_ND6_MAX_INITIAL_RAS   3 /*transmissions*/
 
#define UIP_ND6_MIN_DELAY_BETWEEN_RAS   3 /*seconds*/
 
#define UIP_ND6_MAX_RA_DELAY_TIME_MS   500 /*milli seconds*/
 

RFC 4861 Node constant

#define UIP_ND6_MAX_MULTICAST_SOLICIT   3
 
#define UIP_ND6_MAX_UNICAST_SOLICIT   3
 
#define UIP_ND6_REACHABLE_TIME   30000
 
#define UIP_ND6_RETRANS_TIMER   1000
 
#define UIP_ND6_DELAY_FIRST_PROBE_TIME   5
 
#define UIP_ND6_MIN_RANDOM_FACTOR(x)   (x / 2)
 
#define UIP_ND6_MAX_RANDOM_FACTOR(x)   ((x) + (x) / 2)
 

ND6 option types

#define UIP_ND6_OPT_SLLAO   1
 Source Link-Layer Address Option.
 
#define UIP_ND6_OPT_TLLAO   2
 Target Link-Layer Address Option.
 
#define UIP_ND6_OPT_PREFIX_INFO   3
 
#define UIP_ND6_OPT_REDIRECTED_HDR   4
 
#define UIP_ND6_OPT_MTU   5
 
#define UIP_ND6_OPT_TYPE_OFFSET   0
 
#define UIP_ND6_OPT_LEN_OFFSET   1
 
#define UIP_ND6_OPT_DATA_OFFSET   2
 

ND6 message length (excluding options)

#define UIP_ND6_NA_LEN   20
 
#define UIP_ND6_NS_LEN   20
 
#define UIP_ND6_RA_LEN   12
 
#define UIP_ND6_RS_LEN   4
 

ND6 option length in bytes

#define UIP_ND6_OPT_HDR_LEN   2
 
#define UIP_ND6_OPT_PREFIX_INFO_LEN   32
 
#define UIP_ND6_OPT_MTU_LEN   8
 
#define UIP_ND6_OPT_LLAO_LEN   8
 length of a ND6 LLAO option for default L2 type (e.g. More...
 

Neighbor Advertisement flags masks

#define UIP_ND6_NA_FLAG_ROUTER   0x80
 
#define UIP_ND6_NA_FLAG_SOLICITED   0x40
 
#define UIP_ND6_NA_FLAG_OVERRIDE   0x20
 
#define UIP_ND6_RA_FLAG_ONLINK   0x80
 
#define UIP_ND6_RA_FLAG_AUTONOMOUS   0x40
 

ND message structures

typedef struct uip_nd6_ns uip_nd6_ns
 A neighbor solicitation constant part. More...
 
typedef struct uip_nd6_na uip_nd6_na
 A neighbor advertisement constant part. More...
 
typedef struct uip_nd6_rs uip_nd6_rs
 A router solicitation constant part. More...
 
typedef struct uip_nd6_ra uip_nd6_ra
 A router advertisement constant part. More...
 
typedef struct uip_nd6_redirect uip_nd6_redirect
 A redirect message constant part. More...
 

ND Option structures

typedef struct uip_nd6_opt_hdr uip_nd6_opt_hdr
 ND option header.
 
typedef struct
uip_nd6_opt_prefix_info 
uip_nd6_opt_prefix_info
 ND option prefix information.
 
typedef struct uip_nd6_opt_mtu uip_nd6_opt_mtu
 ND option MTU.
 
typedef struct
uip_nd6_opt_redirected_hdr 
uip_nd6_opt_redirected_hdr
 

ND Messages Processing and Generation

void uip_nd6_ns_input (void)
 Process a neighbor solicitation. More...
 
void uip_nd6_ns_output (uip_ipaddr_t *src, uip_ipaddr_t *dest, uip_ipaddr_t *tgt)
 Send a neighbor solicitation, send a Neighbor Advertisement. More...
 
void uip_nd6_na_input (void)
 Process a Neighbor Advertisement. More...
 
void uip_nd6_rs_output (void)
 Send a Router Solicitation. More...
 
void uip_nd6_ra_input (void)
 process a Router Advertisement More...
 

Detailed Description

Author
Julien Abeille jabei.nosp@m.lle@.nosp@m.cisco.nosp@m..com
Mathilde Durvy mdurv.nosp@m.y@ci.nosp@m.sco.c.nosp@m.om

Macro Definition Documentation

#define UIP_ND6_OPT_LLAO_LEN   8

length of a ND6 LLAO option for default L2 type (e.g.

Ethernet)

Definition at line 186 of file uip-nd6.h.

Referenced by uip_nd6_ns_input(), uip_nd6_ns_output(), and uip_nd6_rs_output().

Typedef Documentation

typedef struct uip_nd6_na uip_nd6_na

A neighbor advertisement constant part.

Possible option is: TLLAO

typedef struct uip_nd6_ns uip_nd6_ns

A neighbor solicitation constant part.

Possible option is: SLLAO

typedef struct uip_nd6_ra uip_nd6_ra

A router advertisement constant part.

Possible options are: SLLAO, MTU, Prefix Information

A redirect message constant part.

Possible options are: TLLAO, redirected header

typedef struct uip_nd6_rs uip_nd6_rs

A router solicitation constant part.

Possible option is: SLLAO

Function Documentation

void uip_nd6_na_input ( void  )

Process a Neighbor Advertisement.

we might have to send a pkt that had been buffered while address resolution was performed (if we support buffering, see UIP_CONF_QUEUE_PKT)

As per RFC 4861, on link layer that have addresses, TLLAO options MUST be included when responding to multicast solicitations, SHOULD be included in response to unicast (here we assume it is for now)

NA can be received after sending NS for DAD, Address resolution or NUD. Can be unsolicited as well. It can trigger update of the state of the neighbor in the neighbor cache, router in the router list. If the NS was for DAD, it means DAD failed

Definition at line 396 of file uip-nd6.c.

References NULL, stimer_set(), uip_ds6_defrt_lookup(), uip_ds6_defrt_rm(), uip_ds6_nbr_get_ll(), uip_ds6_nbr_lookup(), UIP_ICMP_BUF, UIP_IP_BUF, uip_is_addr_mcast, uip_len, UIP_ND6_HOP_LIMIT, UIP_ND6_OPT_HDR_BUF, UIP_ND6_OPT_TLLAO, and UIP_STAT.

Referenced by uip_process().

void uip_nd6_ns_input ( void  )

Process a neighbor solicitation.

The NS can be received in 3 cases (procedures):

  • sender is performing DAD (ip src = unspecified, no SLLAO option)
  • sender is performing NUD (ip dst = unicast)
  • sender is performing address resolution (ip dest = solicited node mcast address)

We do:

  • if the tgt belongs to me, reply, otherwise ignore
  • if i was performing DAD for the same address, two cases: – I already sent a NS, hence I win – I did not send a NS yet, hence I lose

If we need to send a NA in response (i.e. the NS was done for NUD, or address resolution, or DAD and there is a conflict), we do it in this function: set src, dst, tgt address in the three cases, then for all cases set the rest, including SLLAO

Definition at line 147 of file uip-nd6.c.

References ICMP6_NA, NULL, uip_create_linklocal_allnodes_mcast, uip_ds6_is_my_addr, uip_ds6_nbr_add(), uip_ds6_nbr_get_ll(), uip_ds6_nbr_lookup(), uip_ds6_select_src(), uip_ext_len, uip_icmp6chksum(), UIP_ICMP_BUF, UIP_IP_BUF, uip_ipaddr_copy, uip_is_addr_mcast, uip_is_addr_solicited_node, uip_is_addr_unspecified, uip_len, UIP_ND6_HOP_LIMIT, UIP_ND6_OPT_HDR_BUF, UIP_ND6_OPT_LLAO_LEN, UIP_ND6_OPT_SLLAO, UIP_ND6_OPT_TLLAO, and UIP_STAT.

Referenced by uip_process().

void uip_nd6_ns_output ( uip_ipaddr_t *  src,
uip_ipaddr_t *  dest,
uip_ipaddr_t *  tgt 
)

Send a neighbor solicitation, send a Neighbor Advertisement.

Parameters
srcpointer to the src of the NS if known
destpointer to ip address to send the NS, for DAD or ADDR Resol, MUST be NULL, for NUD, must be correct unicast dest
tgtpointer to ip address to fill the target address field, must not be NULL
  • RFC 4861, 7.2.2 : "If the source address of the packet prompting the solicitation is the same as one of the addresses assigned to the outgoing interface, that address SHOULD be placed in the IP Source Address of the outgoing solicitation. Otherwise, any one of the addresses assigned to the interface should be used." This is why we have a src ip address as argument. If NULL, we will do src address selection, otherwise we use the argument.
  • we check if it is a NS for Address resolution or NUD, if yes we include a SLLAO option, otherwise no.

Definition at line 330 of file uip-nd6.c.

References ICMP6_NS, NULL, uip_create_solicited_node, uip_create_unspecified, uip_ds6_is_my_addr, uip_ds6_select_src(), uip_ext_len, uip_icmp6chksum(), UIP_ICMP_BUF, UIP_IP_BUF, uip_ipaddr_copy, uip_is_addr_unspecified, uip_len, UIP_ND6_HOP_LIMIT, UIP_ND6_OPT_LLAO_LEN, UIP_ND6_OPT_SLLAO, and UIP_STAT.

Referenced by tcpip_ipv6_output(), and uip_ds6_neighbor_periodic().

void uip_nd6_ra_input ( void  )

process a Router Advertisement

  • Possible actions when receiving a RA: add router to router list, recalculate reachable time, update link hop limit, update retrans timer.
  • If MTU option: update MTU.
  • If SLLAO option: update entry in neighbor cache
  • If prefix option: start autoconf, add prefix to prefix list

Definition at line 768 of file uip-nd6.c.

References NULL, stimer_remaining(), stimer_set(), uip_ds6_compute_reachable_time(), uip_ds6_defrt_add(), uip_ds6_defrt_lookup(), uip_ds6_defrt_rm(), uip_ds6_nbr_add(), uip_ds6_nbr_get_ll(), uip_ds6_nbr_lookup(), uip_ds6_set_addr_iid(), UIP_ICMP_BUF, UIP_IP_BUF, uip_ipaddr_copy, uip_is_addr_link_local, uip_len, uip_lladdr, UIP_ND6_HOP_LIMIT, UIP_ND6_INFINITE_LIFETIME, UIP_ND6_OPT_HDR_BUF, UIP_ND6_OPT_SLLAO, and UIP_STAT.

Referenced by uip_process().

void uip_nd6_rs_output ( void  )

Send a Router Solicitation.

src is chosen through the uip_netif_select_src function. If src is unspecified (i.e. we do not have a preferred address yet), then we do not put a SLLAO option (MUST NOT in RFC 4861). Otherwise we do.

RS message format, possible option is SLLAO, MUST NOT be included if source = unspecified SHOULD be included otherwise

Definition at line 728 of file uip-nd6.c.

References ICMP6_RS, uip_create_linklocal_allrouters_mcast, uip_ds6_select_src(), uip_icmp6chksum(), UIP_ICMP_BUF, UIP_IP_BUF, uip_is_addr_unspecified, uip_len, UIP_ND6_HOP_LIMIT, UIP_ND6_OPT_LLAO_LEN, UIP_ND6_OPT_SLLAO, and UIP_STAT.

Referenced by uip_ds6_send_rs().