Use UIP_LLH_LEN in multicast engines and add more traces
This commit is contained in:
parent
1549a55e42
commit
ed239372c1
@ -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 */
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user