From 7ec3d191a2210e424692f2776848a75a69915700 Mon Sep 17 00:00:00 2001 From: bg- Date: Tue, 8 May 2007 08:28:59 +0000 Subject: [PATCH] * Need to track if we at the moment are doing forwarding or sending. --- core/net/tcpip.c | 8 ++++++-- core/net/tcpip.h | 7 ++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/core/net/tcpip.c b/core/net/tcpip.c index 51f0ce0e6..7bc0e65d7 100644 --- a/core/net/tcpip.c +++ b/core/net/tcpip.c @@ -30,7 +30,7 @@ * * Author: Adam Dunkels * - * $Id: tcpip.c,v 1.5 2007/03/15 19:41:29 adamdunkels Exp $ + * $Id: tcpip.c,v 1.6 2007/05/08 08:28:59 bg- Exp $ */ #include "contiki-conf.h" @@ -66,7 +66,8 @@ enum { PACKET_INPUT }; -static unsigned char forwarding = 0; +static unsigned char forwarding; /* Forwarding enabled. */ +unsigned char tcpip_is_forwarding; /* Forwarding right now? */ PROCESS(tcpip_process, "TCP/IP stack"); @@ -82,7 +83,9 @@ packet_input(void) { if(uip_len > 0) { if(forwarding) { + tcpip_is_forwarding = 1; if(uip_fw_forward() == UIP_FW_LOCAL) { + tcpip_is_forwarding = 0; uip_input(); if(uip_len > 0) { #if UIP_CONF_TCP_SPLIT @@ -92,6 +95,7 @@ packet_input(void) #endif } } + tcpip_is_forwarding = 0; } else { uip_input(); if(uip_len > 0) { diff --git a/core/net/tcpip.h b/core/net/tcpip.h index 5f0ce97e2..d925fd34b 100644 --- a/core/net/tcpip.h +++ b/core/net/tcpip.h @@ -60,7 +60,7 @@ * * Author: Adam Dunkels * - * $Id: tcpip.h,v 1.7 2007/04/01 18:20:55 adamdunkels Exp $ + * $Id: tcpip.h,v 1.8 2007/05/08 08:29:18 bg- Exp $ */ #ifndef __TCPIP_H__ #define __TCPIP_H__ @@ -299,6 +299,11 @@ CCIF void tcpip_input(void); void tcpip_output(void); void tcpip_set_forwarding(unsigned char f); +/* + * Are we at the moment forwarding the contents of uip_buf[]? + */ +extern unsigned char tcpip_is_forwarding; + /** @} */ PROCESS_NAME(tcpip_process);