From 78e807403c54252244102860bc04e17109c25edf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dawans?= Date: Wed, 31 Jul 2013 22:39:00 +0200 Subject: [PATCH] Inserts missing IPv6 Hop-By-Hop RPL Option at first hop --- core/net/rpl/rpl-ext-header.c | 12 ++++++++++++ core/net/rpl/rpl.h | 1 + core/net/uip6.c | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/core/net/rpl/rpl-ext-header.c b/core/net/rpl/rpl-ext-header.c index b00b89d71..e2293c8ec 100644 --- a/core/net/rpl/rpl-ext-header.c +++ b/core/net/rpl/rpl-ext-header.c @@ -343,4 +343,16 @@ rpl_invert_header(void) } } /*---------------------------------------------------------------------------*/ +void +rpl_insert_header(void) +{ + uint8_t uip_ext_opt_offset; + if(default_instance != NULL) { + uip_ext_opt_offset = 2; + if(UIP_EXT_HDR_OPT_BUF->type == UIP_EXT_HDR_OPT_RPL) { + rpl_update_header_empty(); + } + } +} +/*---------------------------------------------------------------------------*/ #endif /* UIP_CONF_IPV6 */ diff --git a/core/net/rpl/rpl.h b/core/net/rpl/rpl.h index 689e2063b..dd3ccd9eb 100644 --- a/core/net/rpl/rpl.h +++ b/core/net/rpl/rpl.h @@ -240,6 +240,7 @@ rpl_instance_t *rpl_get_instance(uint8_t instance_id); void rpl_update_header_empty(void); int rpl_update_header_final(uip_ipaddr_t *addr); int rpl_verify_header(int); +void rpl_insert_header(void); void rpl_remove_header(void); uint8_t rpl_invert_header(void); uip_ipaddr_t *rpl_get_parent_ipaddr(rpl_parent_t *nbr); diff --git a/core/net/uip6.c b/core/net/uip6.c index 75cd2fb32..813c4d9b1 100644 --- a/core/net/uip6.c +++ b/core/net/uip6.c @@ -1557,6 +1557,10 @@ uip_process(uint8_t flag) uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPTCPH_LEN]; +#if UIP_CONF_IPV6_RPL + rpl_insert_header(); +#endif /* UIP_CONF_IPV6_RPL */ + #if UIP_UDP_CHECKSUMS /* Calculate UDP checksum. */ UIP_UDP_BUF->udpchksum = ~(uip_udpchksum());