Merge branch 'develop' into contrib/uipbuf

This commit is contained in:
George Oikonomou 2017-12-11 21:48:20 +00:00 committed by GitHub
commit 7be2524e1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 17 deletions

View File

@ -229,7 +229,7 @@ icmp_input()
uip_process(UIP_UDP_SEND_CONN);
memcpy(&mcast_buf, uip_buf, uip_len);
memcpy(&mcast_buf, &uip_buf[UIP_LLH_LEN], uip_len);
mcast_len = uip_len;
/* pass the packet to our uip_process to check if it is allowed to
* accept this packet or not */
@ -239,7 +239,7 @@ icmp_input()
uip_process(UIP_DATA);
memcpy(uip_buf, &mcast_buf, mcast_len);
memcpy(&uip_buf[UIP_LLH_LEN], &mcast_buf, mcast_len);
uip_len = mcast_len;
/* Return the IP of the original Multicast sender */
uip_ipaddr_copy(&UIP_IP_BUF->srcipaddr, &src_ip);
@ -257,7 +257,7 @@ icmp_input()
static void
mcast_fwd(void *p)
{
memcpy(uip_buf, &mcast_buf, mcast_len);
memcpy(&uip_buf[UIP_LLH_LEN], &mcast_buf, mcast_len);
uip_len = mcast_len;
UIP_IP_BUF->ttl--;
tcpip_output(NULL);
@ -291,7 +291,7 @@ in()
parent_lladdr = uip_ds6_nbr_lladdr_from_ipaddr(parent_ipaddr);
if(parent_lladdr == NULL) {
PRINTF("ESMRF: NO Parent exist \n");
PRINTF("ESMRF: No Parent found\n");
UIP_MCAST6_STATS_ADD(mcast_dropped);
return UIP_MCAST6_DROP;
}
@ -309,6 +309,7 @@ in()
if(UIP_IP_BUF->ttl <= 1) {
UIP_MCAST6_STATS_ADD(mcast_dropped);
PRINTF("ESMRF: TTL too low\n");
return UIP_MCAST6_DROP;
}
@ -350,12 +351,14 @@ in()
fwd_delay = fwd_delay * (1 + ((random_rand() >> 11) % fwd_spread));
}
memcpy(&mcast_buf, uip_buf, uip_len);
memcpy(&mcast_buf, &uip_buf[UIP_LLH_LEN], uip_len);
mcast_len = uip_len;
ctimer_set(&mcast_periodic, fwd_delay, mcast_fwd, NULL);
}
PRINTF("ESMRF: %u bytes: fwd in %u [%u]\n",
uip_len, fwd_delay, fwd_spread);
} else {
PRINTF("ESMRF: Group unknown, dropping\n");
}
/* Done with this packet unless we are a member of the mcast group */

View File

@ -1321,7 +1321,7 @@ static void
out()
{
if(uip_len + HBHO_TOTAL_LEN > UIP_BUFSIZE) {
if(uip_len + HBHO_TOTAL_LEN > UIP_BUFSIZE - UIP_LLH_LEN) {
PRINTF("ROLL TM: Multicast Out can not add HBHO. Packet too long\n");
goto drop;
}

View File

@ -82,7 +82,7 @@ static uint8_t fwd_spread;
static void
mcast_fwd(void *p)
{
memcpy(uip_buf, &mcast_buf, mcast_len);
memcpy(&uip_buf[UIP_LLH_LEN], &mcast_buf, mcast_len);
uip_len = mcast_len;
UIP_IP_BUF->ttl--;
tcpip_output(NULL);
@ -106,6 +106,7 @@ in()
*/
d = rpl_get_any_dag();
if(!d) {
PRINTF("SMRF: No DODAG\n");
UIP_MCAST6_STATS_ADD(mcast_dropped);
return UIP_MCAST6_DROP;
}
@ -115,6 +116,7 @@ in()
parent_lladdr = uip_ds6_nbr_lladdr_from_ipaddr(parent_ipaddr);
if(parent_lladdr == NULL) {
PRINTF("SMRF: No Parent found\n");
UIP_MCAST6_STATS_ADD(mcast_dropped);
return UIP_MCAST6_DROP;
}
@ -132,6 +134,7 @@ in()
if(UIP_IP_BUF->ttl <= 1) {
UIP_MCAST6_STATS_ADD(mcast_dropped);
PRINTF("SMRF: TTL too low\n");
return UIP_MCAST6_DROP;
}
@ -173,12 +176,14 @@ in()
fwd_delay = fwd_delay * (1 + ((random_rand() >> 11) % fwd_spread));
}
memcpy(&mcast_buf, uip_buf, uip_len);
memcpy(&mcast_buf, &uip_buf[UIP_LLH_LEN], uip_len);
mcast_len = uip_len;
ctimer_set(&mcast_periodic, fwd_delay, mcast_fwd, NULL);
}
PRINTF("SMRF: %u bytes: fwd in %u [%u]\n",
uip_len, fwd_delay, fwd_spread);
} else {
PRINTF("SMRF: Group unknown, dropping\n");
}
/* Done with this packet unless we are a member of the mcast group */

View File

@ -98,6 +98,10 @@
#define LOG_MODULE "IPv6"
#define LOG_LEVEL LOG_LEVEL_IPV6
#if UIP_STATISTICS == 1
struct uip_stats uip_stat;
#endif /* UIP_STATISTICS == 1 */
/*---------------------------------------------------------------------------*/
/**
* \name Layer 2 variables

View File

@ -199,13 +199,6 @@
#define RPL_ROUTE_FROM_MULTICAST_DAO 2
#define RPL_ROUTE_FROM_DIO 3
/* Multicast Route Lifetime as a multiple of the lifetime unit */
#ifdef RPL_CONF_MCAST_LIFETIME
#define RPL_MCAST_LIFETIME RPL_CONF_MCAST_LIFETIME
#else
#define RPL_MCAST_LIFETIME 3
#endif
/* DIS related */
#define RPL_DIS_SEND 1

View File

@ -283,7 +283,7 @@ handle_dao_timer(void *ptr)
if(uip_ds6_if.maddr_list[i].isused
&& uip_is_addr_mcast_global(&uip_ds6_if.maddr_list[i].ipaddr)) {
dao_output_target(instance->current_dag->preferred_parent,
&uip_ds6_if.maddr_list[i].ipaddr, RPL_MCAST_LIFETIME);
&uip_ds6_if.maddr_list[i].ipaddr, instance->default_lifetime);
}
}
@ -293,7 +293,7 @@ handle_dao_timer(void *ptr)
/* Don't send if it's also our own address, done that already */
if(uip_ds6_maddr_lookup(&mcast_route->group) == NULL) {
dao_output_target(instance->current_dag->preferred_parent,
&mcast_route->group, RPL_MCAST_LIFETIME);
&mcast_route->group, instance->default_lifetime);
}
mcast_route = list_item_next(mcast_route);
}