From 1752b53f742c01489c4c6fd3d244e2f2c243a8ea Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Mon, 4 May 2009 11:24:04 +0000 Subject: [PATCH] Refresh routes when a packet is received. Set a conservatively low route timeout (10 seconds). --- core/net/uip-over-mesh.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/net/uip-over-mesh.c b/core/net/uip-over-mesh.c index c47f0b7f9..9ad8d73e3 100644 --- a/core/net/uip-over-mesh.c +++ b/core/net/uip-over-mesh.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: uip-over-mesh.c,v 1.12 2009/04/29 11:40:33 adamdunkels Exp $ + * $Id: uip-over-mesh.c,v 1.13 2009/05/04 11:24:04 adamdunkels Exp $ */ /** @@ -80,6 +80,11 @@ static uip_ipaddr_t netaddr, netmask; static void recv_data(struct unicast_conn *c, rimeaddr_t *from) { + struct route_entry *e; + + e = route_lookup(from); + route_refresh(e); + uip_len = packetbuf_copyto(&uip_buf[UIP_LLH_LEN]); /* uip_len = hc_inflate(&uip_buf[UIP_LLH_LEN], uip_len);*/ @@ -185,8 +190,8 @@ uip_over_mesh_init(u16_t channels) trickle_open(&gateway_announce_conn, CLOCK_SECOND * 4, channels + 3, &trickle_call); - /* tcpip_set_forwarding(1);*/ - + /* Set lifetime to 10 seconds for non-refreshed routes. */ + route_set_lifetime(10); } /*---------------------------------------------------------------------------*/ u8_t