mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-08-14 09:28:59 +00:00
added support for dropping packets if hop limit is reached
This commit is contained in:
parent
1214b1fa40
commit
48a9bff889
@ -41,7 +41,7 @@
|
|||||||
*
|
*
|
||||||
* This file is part of the uIP TCP/IP stack.
|
* This file is part of the uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: uip6.c,v 1.13 2010/02/15 19:23:54 adamdunkels Exp $
|
* $Id: uip6.c,v 1.14 2010/03/09 15:50:15 joxe Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -1099,9 +1099,16 @@ uip_process(u8_t flag)
|
|||||||
PRINT6ADDR(&UIP_IP_BUF->destipaddr);
|
PRINT6ADDR(&UIP_IP_BUF->destipaddr);
|
||||||
PRINTF("\n");
|
PRINTF("\n");
|
||||||
|
|
||||||
|
if(UIP_IP_BUF->ttl <= 1) {
|
||||||
|
PRINTF("Dropping packet: hop limit reached\n");
|
||||||
|
UIP_STAT(++uip_stat.ip.drop);
|
||||||
|
uip_icmp6_error_output(ICMP6_TIME_EXCEEDED,
|
||||||
|
ICMP6_TIME_EXCEED_TRANSIT, 0);
|
||||||
|
} else {
|
||||||
/* Decrement the TTL (time-to-live) value in the IP header */
|
/* Decrement the TTL (time-to-live) value in the IP header */
|
||||||
UIP_IP_BUF->ttl = UIP_IP_BUF->ttl - 1;
|
UIP_IP_BUF->ttl = UIP_IP_BUF->ttl - 1;
|
||||||
UIP_STAT(++uip_stat.ip.forwarded);
|
UIP_STAT(++uip_stat.ip.forwarded);
|
||||||
|
}
|
||||||
goto send;
|
goto send;
|
||||||
} else if(!uip_is_addr_linklocal_allnodes_mcast(&UIP_IP_BUF->destipaddr) &&
|
} else if(!uip_is_addr_linklocal_allnodes_mcast(&UIP_IP_BUF->destipaddr) &&
|
||||||
!uip_is_addr_linklocal_allrouters_mcast(&UIP_IP_BUF->destipaddr)) {
|
!uip_is_addr_linklocal_allrouters_mcast(&UIP_IP_BUF->destipaddr)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user