diff --git a/core/net/mac/contikimac.c b/core/net/mac/contikimac.c index c65a975c9..81640793e 100644 --- a/core/net/mac/contikimac.c +++ b/core/net/mac/contikimac.c @@ -535,6 +535,12 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr, struct rdc_buf_ struct hdr *chdr; #endif /* WITH_CONTIKIMAC_HEADER */ + /* Exit if RDC and radio were explicitly turned off */ + if (!contikimac_is_on && !contikimac_keep_radio_on) { + PRINTF("contikimac: radio is turned off\n"); + return MAC_TX_ERR_FATAL; + } + if(packetbuf_totlen() == 0) { PRINTF("contikimac: send_packet data len 0\n"); return MAC_TX_ERR_FATAL; diff --git a/examples/ipv6/rpl-border-router/border-router.c b/examples/ipv6/rpl-border-router/border-router.c index 418425ff9..33d9f754b 100644 --- a/examples/ipv6/rpl-border-router/border-router.c +++ b/examples/ipv6/rpl-border-router/border-router.c @@ -74,6 +74,13 @@ AUTOSTART_PROCESSES(&border_router_process,&webserver_nogui_process); #else /* Use simple webserver with only one page */ #include "httpd-simple.h" + +#define WEBSERVER_CONF_LOADTIME 0 +#define WEBSERVER_CONF_FILESTATS 0 +#define WEBSERVER_CONF_NEIGHBOR_STATUS 0 +#define WEBSERVER_CONF_ROUTE_LINKS 0 +#define BUF_USES_STACK 1 + PROCESS(webserver_nogui_process, "Web server"); PROCESS_THREAD(webserver_nogui_process, ev, data) { @@ -92,11 +99,19 @@ AUTOSTART_PROCESSES(&border_router_process,&webserver_nogui_process); static const char *TOP = "
"); for(i = 0; i < UIP_DS6_NBR_NB; i++) { if(uip_ds6_nbr_cache[i].isused) { + +#if WEBSERVER_CONF_NEIGHBOR_STATUS +#if BUF_USES_STACK +{char* j=bufptr+25; ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr); + while (bufptr < j) ADD(" "); + switch (uip_ds6_nbr_cache[i].state) { + case NBR_INCOMPLETE: ADD(" INCOMPLETE");break; + case NBR_REACHABLE: ADD(" REACHABLE");break; + case NBR_STALE: ADD(" STALE");break; + case NBR_DELAY: ADD(" DELAY");break; + case NBR_PROBE: ADD(" NBR_PROBE");break; + } +} +#else +{uint8_t j=blen+25; + ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr); + while (blen < j) ADD(" "); + switch (uip_ds6_nbr_cache[i].state) { + case NBR_INCOMPLETE: ADD(" INCOMPLETE");break; + case NBR_REACHABLE: ADD(" REACHABLE");break; + case NBR_STALE: ADD(" STALE");break; + case NBR_DELAY: ADD(" DELAY");break; + case NBR_PROBE: ADD(" NBR_PROBE");break; + } +} +#endif +#else + ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr); +#endif + ADD("\n"); +#if BUF_USES_STACK + if(bufptr > bufend - 45) { + SEND_STRING(&s->sout, buf); + bufptr = buf; bufend = bufptr + sizeof(buf); + } +#else if(blen > sizeof(buf) - 45) { SEND_STRING(&s->sout, buf); blen = 0; } +#endif } } - ADD("Routes
"); SEND_STRING(&s->sout, buf); +#if BUF_USES_STACK + bufptr = buf; bufend = bufptr + sizeof(buf); +#else blen = 0; +#endif for(i = 0; i < UIP_DS6_ROUTE_NB; i++) { if(uip_ds6_routing_table[i].isused) { +#if BUF_USES_STACK +#if WEBSERVER_CONF_ROUTE_LINKS + ADD(""); + ipaddr_add(&uip_ds6_routing_table[i].ipaddr); + ADD(""); +#else + ipaddr_add(&uip_ds6_routing_table[i].ipaddr); +#endif +#else +#if WEBSERVER_CONF_ROUTE_LINKS + ADD(""); + SEND_STRING(&s->sout, buf); //TODO: why tunslip6 needs an output here, wpcapslip does not + blen = 0; + ipaddr_add(&uip_ds6_routing_table[i].ipaddr); + ADD(""); +#else + ipaddr_add(&uip_ds6_routing_table[i].ipaddr); +#endif +#endif ADD("/%u (via ", uip_ds6_routing_table[i].length); ipaddr_add(&uip_ds6_routing_table[i].nexthop); - if(uip_ds6_routing_table[i].state.lifetime < 600) { + if(1 || (uip_ds6_routing_table[i].state.lifetime < 600)) { ADD(") %lus\n", uip_ds6_routing_table[i].state.lifetime); } else { ADD(")\n"); } SEND_STRING(&s->sout, buf); +#if BUF_USES_STACK + bufptr = buf; bufend = bufptr + sizeof(buf); +#else blen = 0; +#endif } } ADD(""); -//if(blen > 0) { - SEND_STRING(&s->sout, buf); -// blen = 0; -//} +#if WEBSERVER_CONF_FILESTATS + static uint16_t numtimes; + ADD("