Routing API: added ext_header_hbh_update

This commit is contained in:
Simon Duquennoy 2017-12-10 06:21:37 -08:00
parent 54655335c6
commit 25e07b7d23
6 changed files with 23 additions and 6 deletions

View File

@ -875,13 +875,10 @@ ext_hdr_options_process(void)
* Using this fix, the header is ignored, and the next header (if
* present) is processed.
*/
#if UIP_CONF_IPV6_RPL
LOG_DBG("Processing RPL option\n");
if(!rpl_ext_header_hbh_update(uip_ext_opt_offset)) {
if(!NETSTACK_ROUTING.ext_header_hbh_update(uip_ext_opt_offset)) {
LOG_ERR("RPL Option Error: Dropping Packet\n");
return 1;
}
#endif /* UIP_CONF_IPV6_RPL */
uip_ext_opt_offset += (UIP_EXT_HDR_OPT_BUF->len) + 2;
return 0;
default:

View File

@ -81,6 +81,12 @@ ext_header_update(void)
}
/*---------------------------------------------------------------------------*/
static int
ext_header_hbh_update(int uip_ext_opt_offset)
{
return 1;
}
/*---------------------------------------------------------------------------*/
static int
ext_header_srh_get_next_hop(uip_ipaddr_t *ipaddr)
{
return 0;
@ -95,6 +101,7 @@ const struct routing_driver nullrouting_driver = {
local_repair,
ext_header_remove,
ext_header_update,
ext_header_hbh_update,
ext_header_srh_get_next_hop,
};
/*---------------------------------------------------------------------------*/

View File

@ -87,6 +87,16 @@ struct routing_driver {
* \return 1 in case of success, 0 otherwise
*/
int (* ext_header_update)(void);
/**
* Process and update the routing protocol hob-by-hop
* extention headers of the current uIP packet.
*
* \param uip_ext_opt_offset The offset within the uIP packet where
* extension headers start
* \return 1 in case the packet is valid and to be processed further,
* 0 in case the packet must be dropped.
*/
int (* ext_header_hbh_update)(int uip_ext_opt_offset);
/**
* Look for next hop from SRH of current uIP packet.
*

View File

@ -380,6 +380,7 @@ const struct routing_driver rpl_classic_driver = {
local_repair,
rpl_ext_header_remove,
rpl_ext_header_update,
rpl_ext_header_hbh_update,
rpl_ext_header_srh_get_next_hop,
};
/*---------------------------------------------------------------------------*/

View File

@ -60,7 +60,8 @@ int rpl_ext_header_srh_get_next_hop(uip_ipaddr_t *ipaddr);
int rpl_ext_header_srh_update(void);
/**
* Process and update the RPL extension headers of the current uIP packet.
* Process and update the RPL hop-by-hop extension headers of
* the current uIP packet.
*
* \param uip_ext_opt_offset The offset within the uIP packet where
* extension headers start
@ -70,7 +71,7 @@ int rpl_ext_header_srh_update(void);
int rpl_ext_header_hbh_update(int uip_ext_opt_offset);
/**
* Adds/updates RPL extension headers to current uIP packet.
* Adds/updates all RPL extension headers to current uIP packet.
*
* \return 1 in case of success, 0 otherwise
*/

View File

@ -202,6 +202,7 @@ const struct routing_driver rpl_lite_driver = {
rpl_local_repair,
rpl_ext_header_remove,
rpl_ext_header_update,
rpl_ext_header_hbh_update,
rpl_ext_header_srh_get_next_hop,
};
/*---------------------------------------------------------------------------*/