From b441901321fe9c32fbcd10617c01a34242125647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20De=20Fauw?= Date: Tue, 17 Jun 2014 11:38:07 +0200 Subject: [PATCH 1/2] IPv6 host adds prefixes successfully but return always NULL In Neighbor Discovery Protocol, when IPv6 host adds a prefix (coming from PIO) but it is always failing whatever if is successfully add in prefix table. The reason comes from the fact that the function uip_ds6_prefix_add in host version always return NULL. This is opposite of the specification of the router version. --- core/net/ipv6/uip-ds6.c | 1 + 1 file changed, 1 insertion(+) diff --git a/core/net/ipv6/uip-ds6.c b/core/net/ipv6/uip-ds6.c index 4a191caf9..11b821a6a 100644 --- a/core/net/ipv6/uip-ds6.c +++ b/core/net/ipv6/uip-ds6.c @@ -275,6 +275,7 @@ uip_ds6_prefix_add(uip_ipaddr_t *ipaddr, uint8_t ipaddrlen, PRINTF("Adding prefix "); PRINT6ADDR(&locprefix->ipaddr); PRINTF("length %u, vlifetime%lu\n", ipaddrlen, interval); + return locprefix; } return NULL; } From 22caf4b2e1f403373408717e0ff006111dd0e14e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20De=20Fauw?= Date: Tue, 17 Jun 2014 11:41:43 +0200 Subject: [PATCH 2/2] Prefix Information Option never send in RA messages The problem came from the fact that there two opposite macro (UIP_CONF_ROUTER) that could not activate the code responsible to send the PIO option in NDP. --- core/net/ipv6/uip-nd6.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/net/ipv6/uip-nd6.c b/core/net/ipv6/uip-nd6.c index f2e601fed..36dcaf6d5 100644 --- a/core/net/ipv6/uip-nd6.c +++ b/core/net/ipv6/uip-nd6.c @@ -121,6 +121,8 @@ static uint8_t *nd6_opt_llao; /** Pointer to llao option in uip_buf */ #if !UIP_CONF_ROUTER // TBD see if we move it to ra_input static uip_nd6_opt_prefix_info *nd6_opt_prefix_info; /** Pointer to prefix information option in uip_buf */ static uip_ipaddr_t ipaddr; +#endif +#if (!UIP_CONF_ROUTER || UIP_ND6_SEND_RA) static uip_ds6_prefix_t *prefix; /** Pointer to a prefix list entry */ #endif static uip_ds6_nbr_t *nbr; /** Pointer to a nbr cache entry*/ @@ -682,7 +684,6 @@ uip_nd6_ra_output(uip_ipaddr_t * dest) nd6_opt_offset = UIP_ND6_RA_LEN; -#if !UIP_CONF_ROUTER /* Prefix list */ for(prefix = uip_ds6_prefix_list; prefix < uip_ds6_prefix_list + UIP_DS6_PREFIX_NB; prefix++) { @@ -699,7 +700,6 @@ uip_nd6_ra_output(uip_ipaddr_t * dest) uip_len += UIP_ND6_OPT_PREFIX_INFO_LEN; } } -#endif /* !UIP_CONF_ROUTER */ /* Source link-layer option */ create_llao((uint8_t *)UIP_ND6_OPT_HDR_BUF, UIP_ND6_OPT_SLLAO);