Routing API: added ext_header_update

This commit is contained in:
Simon Duquennoy 2017-12-10 06:11:01 -08:00
parent 4cdf2d4819
commit 54655335c6
6 changed files with 40 additions and 26 deletions

View File

@ -665,14 +665,13 @@ tcpip_ipv6_output(void)
goto exit;
}
#if UIP_CONF_IPV6_RPL
if(!rpl_ext_header_update()) {
if(!NETSTACK_ROUTING.ext_header_update()) {
/* Packet can not be forwarded */
LOG_ERR("output: RPL header update error\n");
LOG_ERR("output: routing protocol extension header update error\n");
uip_clear_buf();
return;
}
#endif /* UIP_CONF_IPV6_RPL */
if(uip_is_addr_mcast(&UIP_IP_BUF->destipaddr)) {
linkaddr = NULL;

View File

@ -75,6 +75,12 @@ ext_header_remove(void)
}
/*---------------------------------------------------------------------------*/
static int
ext_header_update(void)
{
return 1;
}
/*---------------------------------------------------------------------------*/
static int
ext_header_srh_get_next_hop(uip_ipaddr_t *ipaddr)
{
return 0;
@ -88,6 +94,7 @@ const struct routing_driver nullrouting_driver = {
global_repair,
local_repair,
ext_header_remove,
ext_header_update,
ext_header_srh_get_next_hop,
};
/*---------------------------------------------------------------------------*/

View File

@ -81,6 +81,12 @@ struct routing_driver {
* Removes all extension headers that pertain to the routing protocol.
*/
void (* ext_header_remove)(void);
/**
* Adds/updates routing protocol extension headers to current uIP packet.
*
* \return 1 in case of success, 0 otherwise
*/
int (* ext_header_update)(void);
/**
* Look for next hop from SRH of current uIP packet.
*

View File

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

View File

@ -44,30 +44,30 @@
/********** Public functions **********/
/**
* Look for next hop from SRH of current uIP packet.
*
* \param ipaddr A pointer to the address where to store the next hop.
* \return 1 if a next hop was found, 0 otherwise
*/
int rpl_ext_header_srh_get_next_hop(uip_ipaddr_t *ipaddr);
/**
* Look for next hop from SRH of current uIP packet.
*
* \param ipaddr A pointer to the address where to store the next hop.
* \return 1 if a next hop was found, 0 otherwise
*/
int rpl_ext_header_srh_get_next_hop(uip_ipaddr_t *ipaddr);
/**
* Process and update SRH in-place,
* i.e. internal address swapping as per RFC6554
* \return 1 if SRH found, 0 otherwise
*/
int rpl_ext_header_srh_update(void);
/**
* Process and update SRH in-place,
* i.e. internal address swapping as per RFC6554
* \return 1 if SRH found, 0 otherwise
*/
int rpl_ext_header_srh_update(void);
/**
* Process and update the RPL extension 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 rpl_ext_header_hbh_update(int uip_ext_opt_offset);
/**
* Process and update the RPL extension 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 rpl_ext_header_hbh_update(int uip_ext_opt_offset);
/**
* Adds/updates RPL extension headers to current uIP packet.

View File

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