diff --git a/platform/avr-ravenusb/contiki-conf.h b/platform/avr-ravenusb/contiki-conf.h index d0d0a759c..6b8730e32 100644 --- a/platform/avr-ravenusb/contiki-conf.h +++ b/platform/avr-ravenusb/contiki-conf.h @@ -287,9 +287,10 @@ extern void mac_log_802_15_4_rx(const uint8_t* buffer, size_t total_len); #if UIP_CONF_IPV6_RPL /* Not completely working yet. Works on Ubuntu after $ifconfig usb0 -arp to drop the neighbor solitications */ -/* Haven't figured out how to drop the NS on Windows */ +/* Dropping the NS on other OSs is more complicated, see http://www.sics.se/~adam/wiki/index.php/Jackdaw_RNDIS_RPL_border_router */ + /* RPL requires the uip stack. Change #CONTIKI_NO_NET=1 to UIP_CONF_IPV6=1 in the examples makefile, -or include the needed source files in /plaftorm/avr-ravenusb/Makefile.avr-ravenusb */ + or include the needed source files in /plaftorm/avr-ravenusb/Makefile.avr-ravenusb */ /* For the present the buffer_length calcs in rpl-icmp6.c will need adjustment by the length difference between 6lowpan (0) and ethernet (14) link-layer headers: // buffer_length = uip_len - uip_l2_l3_icmp_hdr_len; @@ -306,48 +307,58 @@ or include the needed source files in /plaftorm/avr-ravenusb/Makefile.avr-ravenu * These numbers applied to both Raven and Jackdaw give a maximum communication distance of about 15 cm * and a 10 meter range to a full-sensitivity RF230 sniffer. */ -#define RF230_MAX_TX_POWER 15 -#define RF230_MIN_RX_POWER 30 +//#define RF230_MAX_TX_POWER 15 +//#define RF230_MIN_RX_POWER 30 -#define UIP_CONF_ROUTER 1 -#define RPL_CONF_STATS 0 -#define PROCESS_CONF_NO_PROCESS_NAMES 0 -#undef UIP_CONF_TCP //TCP needed to serve RPL neighbor web page -#define UIP_CONF_TCP 0 +#define UIP_CONF_ROUTER 1 +#define RPL_BORDER_ROUTER 1 +#define RPL_CONF_STATS 0 +#define UIP_CONF_BUFFER_SIZE 1300 +#define UIP_CONF_DS6_NBR_NBU 12 +#define UIP_CONF_DS6_ROUTE_NBU 12 #undef UIP_FALLBACK_INTERFACE #define UIP_FALLBACK_INTERFACE rpl_interface -//#undef UIP_CONF_MAX_CONNECTIONS -//#define UIP_CONF_MAX_CONNECTIONS 1 -//#undef UIP_CONF_MAX_LISTENPORTS -//#define UIP_CONF_MAX_LISTENPORTS 10 -//#define UIP_CONF_TCP_MSS 512 -#undef UIP_CONF_TCP_SPLIT //daktest -#define UIP_CONF_TCP_SPLIT 0 -#undef UIP_CONF_STATISTICS -#define UIP_CONF_STATISTICS 0 - -#define UIP_CONF_DS6_NBR_NBU 5 -#define UIP_CONF_DS6_ROUTE_NBU 5 - #define UIP_CONF_ND6_SEND_RA 0 -#define UIP_CONF_ND6_REACHABLE_TIME 600000 -#define UIP_CONF_ND6_RETRANS_TIMER 10000 +#define UIP_CONF_ND6_REACHABLE_TIME 600000 +#define UIP_CONF_ND6_RETRANS_TIMER 10000 + +/* Save all the RAM we can */ +#define PROCESS_CONF_NO_PROCESS_NAMES 0 +#undef UIP_CONF_TCP_SPLIT +#define UIP_CONF_TCP_SPLIT 0 +#undef UIP_CONF_STATISTICS +#define UIP_CONF_STATISTICS 0 +#define UIP_CONF_PINGADDRCONF 0 +#define UIP_CONF_LOGGING 0 +#undef UIP_CONF_MAX_CONNECTIONS +#define UIP_CONF_MAX_CONNECTIONS 1 +#undef UIP_CONF_MAX_LISTENPORTS +#define UIP_CONF_MAX_LISTENPORTS 3 + +/* Optional, TCP needed to serve the RPL neighbor web page currently hard coded at bbbb::11 */ +/* The RPL neighbors can also be viewed using the jack menu */ +/* A small MSS is adequate for the internal jackdaw webserver and RAM is very limited*/ +#define RPL_HTTPD_SERVER 1 +#if RPL_HTTPD_SERVER +#undef UIP_CONF_TCP +#define UIP_CONF_TCP 1 +#define UIP_CONF_TCP_MSS 48 +#define UIP_CONF_RECEIVE_WINDOW 48 +#undef UIP_CONF_DS6_NBR_NBU +#define UIP_CONF_DS6_NBR_NBU 5 +#undef UIP_CONF_DS6_ROUTE_NBU +#define UIP_CONF_DS6_ROUTE_NBU 5 +#endif -//#define UIP_CONF_BUFFER_SIZE 1300 #define UIP_CONF_ICMP_DEST_UNREACH 1 #define UIP_CONF_DHCP_LIGHT -//#define UIP_CONF_LLH_LEN 0 -//#define UIP_CONF_RECEIVE_WINDOW 48 -//#define UIP_CONF_TCP_MSS 48 #define UIP_CONF_UDP_CONNS 12 #undef UIP_CONF_FWCACHE_SIZE #define UIP_CONF_FWCACHE_SIZE 30 #define UIP_CONF_BROADCAST 1 //#define UIP_ARCH_IPCHKSUM 1 -#define UIP_CONF_PINGADDRCONF 0 -#define UIP_CONF_LOGGING 0 #endif /* UIP_CONF_IPV6_RPL */ #endif /* RF230BB */ diff --git a/platform/avr-ravenusb/contiki-raven-main.c b/platform/avr-ravenusb/contiki-raven-main.c index 0e6889f26..c406df2e0 100644 --- a/platform/avr-ravenusb/contiki-raven-main.c +++ b/platform/avr-ravenusb/contiki-raven-main.c @@ -138,12 +138,9 @@ const struct uip_fallback_interface rpl_interface = { init, output }; -#define RPL_BORDER_ROUTER 1 //Set to 1 for border router -#define RPL_HTTPD_SERVER 0 //Set to 1 for border router web page - +#if RPL_BORDER_ROUTER #include "net/rpl/rpl.h" -#if RPL_BORDER_ROUTER // avr-objdump --section .bss -x ravenusbstick.elf uint16_t dag_id[] PROGMEM = {0x1111, 0x1100, 0, 0, 0, 0, 0, 0x0011}; diff --git a/platform/avr-ravenusb/httpd-simple-avr.c b/platform/avr-ravenusb/httpd-simple-avr.c index fb2e2242e..c17f64576 100644 --- a/platform/avr-ravenusb/httpd-simple-avr.c +++ b/platform/avr-ravenusb/httpd-simple-avr.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: httpd-simple-avr.c,v 1.4 2010/11/12 20:49:03 dak664 Exp $ + * $Id: httpd-simple-avr.c,v 1.5 2010/11/29 21:21:36 dak664 Exp $ */ /** @@ -212,8 +212,8 @@ httpd_init(void) } /*---------------------------------------------------------------------------*/ -/* Only one single web request at time */ -static char buf[64]; +/* Only one single web request at time, MSS is 48 to save RAM */ +static char buf[48]; static uint8_t blen; #define ADD(FORMAT,args...) do { \ blen += snprintf_P(&buf[blen], sizeof(buf) - blen, PSTR(FORMAT),##args); \ @@ -242,8 +242,9 @@ ipaddr_add(const uip_ipaddr_t *addr) } } /*---------------------------------------------------------------------------*/ -char TOP[] PROGMEM = "ContikiRPL(Jackdaw)\n"; -char BOTTOM[] PROGMEM = "\n"; +char TOP1[] PROGMEM = "ContikiRPL(Jackdaw)"; +char TOP2[] PROGMEM = ""; +char BOTTOM[] PROGMEM = ""; #if UIP_CONF_IPV6 extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; extern uip_ds6_route_t uip_ds6_routing_table[]; @@ -255,24 +256,25 @@ PT_THREAD(generate_routes(struct httpd_state *s)) static int i; PSOCK_BEGIN(&s->sout); - PSOCK_GENERATOR_SEND(&s->sout, generate_string_P, TOP); + PSOCK_GENERATOR_SEND(&s->sout, generate_string_P, TOP1); + PSOCK_GENERATOR_SEND(&s->sout, generate_string_P, TOP2); blen = 0; - ADD("

Neighbors

"); + ADD("

Neighbors [%u max]

",UIP_DS6_NBR_NB); #if UIP_CONF_IPV6 for(i = 0; i < UIP_DS6_NBR_NB; i++) { if(uip_ds6_nbr_cache[i].isused) { ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr); - ADD("
\n"); - if(blen > sizeof(buf) - 45) { + ADD("
"); +// if(blen > sizeof(buf) - 45) { PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf); blen = 0; - } +// } } } #endif - ADD("

Routes

"); + ADD("

Routes [%u max]

",UIP_DS6_ROUTE_NB); PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf); blen = 0; #if UIP_CONF_IPV6 @@ -280,11 +282,13 @@ PT_THREAD(generate_routes(struct httpd_state *s)) if(uip_ds6_routing_table[i].isused) { ipaddr_add(&uip_ds6_routing_table[i].ipaddr); ADD("/%u (via ", uip_ds6_routing_table[i].length); + PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf); + blen=0; ipaddr_add(&uip_ds6_routing_table[i].nexthop); if(uip_ds6_routing_table[i].state.lifetime < 600) { - ADD(") %lus
\n", uip_ds6_routing_table[i].state.lifetime); + ADD(") %lus
", uip_ds6_routing_table[i].state.lifetime); } else { - ADD(")
\n"); + ADD(")
"); } PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf); blen = 0;