Routing API: added ext_header_srh_update

This commit is contained in:
Simon Duquennoy 2017-12-10 06:35:50 -08:00
parent 25e07b7d23
commit fdbd89d018
5 changed files with 16 additions and 3 deletions

View File

@ -1352,8 +1352,7 @@ uip_process(uint8_t flag)
LOG_DBG("Processing Routing header\n");
if(UIP_ROUTING_BUF->seg_left > 0) {
#if UIP_CONF_IPV6_RPL && RPL_WITH_NON_STORING
if(rpl_ext_header_srh_update()) {
if(NETSTACK_ROUTING.ext_header_srh_update()) {
/* With routing header, the detination address is us and will
* be swapped later to the next hop. Because of this, the MTU
@ -1381,7 +1380,6 @@ uip_process(uint8_t flag)
goto send; /* Proceed to forwarding */
}
#endif /* UIP_CONF_IPV6_RPL && RPL_WITH_NON_STORING */
uip_icmp6_error_output(ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, UIP_IPH_LEN + uip_ext_len + 2);
UIP_STAT(++uip_stat.ip.drop);
LOG_ERR("unrecognized routing type");

View File

@ -87,6 +87,12 @@ ext_header_hbh_update(int uip_ext_opt_offset)
}
/*---------------------------------------------------------------------------*/
static int
ext_header_srh_update(void)
{
return 0; /* Means SRH not found */
}
/*---------------------------------------------------------------------------*/
static int
ext_header_srh_get_next_hop(uip_ipaddr_t *ipaddr)
{
return 0;
@ -102,6 +108,7 @@ const struct routing_driver nullrouting_driver = {
ext_header_remove,
ext_header_update,
ext_header_hbh_update,
ext_header_srh_update,
ext_header_srh_get_next_hop,
};
/*---------------------------------------------------------------------------*/

View File

@ -97,6 +97,12 @@ struct routing_driver {
* 0 in case the packet must be dropped.
*/
int (* ext_header_hbh_update)(int uip_ext_opt_offset);
/**
* Process and update SRH in-place,
* i.e. internal address swapping as per RFC6554
* \return 1 if SRH found, 0 otherwise
*/
int (* ext_header_srh_update)(void);
/**
* Look for next hop from SRH of current uIP packet.
*

View File

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

View File

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