Enable RPL neighbor webserver page
This commit is contained in:
parent
bc8513d4d6
commit
0735b431aa
|
@ -287,7 +287,8 @@ extern void mac_log_802_15_4_rx(const uint8_t* buffer, size_t total_len);
|
||||||
#if UIP_CONF_IPV6_RPL
|
#if UIP_CONF_IPV6_RPL
|
||||||
|
|
||||||
/* Not completely working yet. Works on Ubuntu after $ifconfig usb0 -arp to drop the neighbor solitications */
|
/* 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,
|
/* 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
|
/* For the present the buffer_length calcs in rpl-icmp6.c will need adjustment by the length difference
|
||||||
|
@ -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
|
* 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.
|
* and a 10 meter range to a full-sensitivity RF230 sniffer.
|
||||||
*/
|
*/
|
||||||
#define RF230_MAX_TX_POWER 15
|
//#define RF230_MAX_TX_POWER 15
|
||||||
#define RF230_MIN_RX_POWER 30
|
//#define RF230_MIN_RX_POWER 30
|
||||||
|
|
||||||
#define UIP_CONF_ROUTER 1
|
#define UIP_CONF_ROUTER 1
|
||||||
|
#define RPL_BORDER_ROUTER 1
|
||||||
#define RPL_CONF_STATS 0
|
#define RPL_CONF_STATS 0
|
||||||
#define PROCESS_CONF_NO_PROCESS_NAMES 0
|
#define UIP_CONF_BUFFER_SIZE 1300
|
||||||
#undef UIP_CONF_TCP //TCP needed to serve RPL neighbor web page
|
#define UIP_CONF_DS6_NBR_NBU 12
|
||||||
#define UIP_CONF_TCP 0
|
#define UIP_CONF_DS6_ROUTE_NBU 12
|
||||||
#undef UIP_FALLBACK_INTERFACE
|
#undef UIP_FALLBACK_INTERFACE
|
||||||
#define UIP_FALLBACK_INTERFACE rpl_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_SEND_RA 0
|
||||||
#define UIP_CONF_ND6_REACHABLE_TIME 600000
|
#define UIP_CONF_ND6_REACHABLE_TIME 600000
|
||||||
#define UIP_CONF_ND6_RETRANS_TIMER 10000
|
#define UIP_CONF_ND6_RETRANS_TIMER 10000
|
||||||
|
|
||||||
//#define UIP_CONF_BUFFER_SIZE 1300
|
/* 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_ICMP_DEST_UNREACH 1
|
#define UIP_CONF_ICMP_DEST_UNREACH 1
|
||||||
|
|
||||||
#define UIP_CONF_DHCP_LIGHT
|
#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
|
#define UIP_CONF_UDP_CONNS 12
|
||||||
#undef UIP_CONF_FWCACHE_SIZE
|
#undef UIP_CONF_FWCACHE_SIZE
|
||||||
#define UIP_CONF_FWCACHE_SIZE 30
|
#define UIP_CONF_FWCACHE_SIZE 30
|
||||||
#define UIP_CONF_BROADCAST 1
|
#define UIP_CONF_BROADCAST 1
|
||||||
//#define UIP_ARCH_IPCHKSUM 1
|
//#define UIP_ARCH_IPCHKSUM 1
|
||||||
#define UIP_CONF_PINGADDRCONF 0
|
|
||||||
#define UIP_CONF_LOGGING 0
|
|
||||||
|
|
||||||
#endif /* UIP_CONF_IPV6_RPL */
|
#endif /* UIP_CONF_IPV6_RPL */
|
||||||
#endif /* RF230BB */
|
#endif /* RF230BB */
|
||||||
|
|
|
@ -138,12 +138,9 @@ const struct uip_fallback_interface rpl_interface = {
|
||||||
init, output
|
init, output
|
||||||
};
|
};
|
||||||
|
|
||||||
#define RPL_BORDER_ROUTER 1 //Set to 1 for border router
|
#if RPL_BORDER_ROUTER
|
||||||
#define RPL_HTTPD_SERVER 0 //Set to 1 for border router web page
|
|
||||||
|
|
||||||
#include "net/rpl/rpl.h"
|
#include "net/rpl/rpl.h"
|
||||||
|
|
||||||
#if RPL_BORDER_ROUTER
|
|
||||||
// avr-objdump --section .bss -x ravenusbstick.elf
|
// avr-objdump --section .bss -x ravenusbstick.elf
|
||||||
uint16_t dag_id[] PROGMEM = {0x1111, 0x1100, 0, 0, 0, 0, 0, 0x0011};
|
uint16_t dag_id[] PROGMEM = {0x1111, 0x1100, 0, 0, 0, 0, 0, 0x0011};
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* 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 */
|
/* Only one single web request at time, MSS is 48 to save RAM */
|
||||||
static char buf[64];
|
static char buf[48];
|
||||||
static uint8_t blen;
|
static uint8_t blen;
|
||||||
#define ADD(FORMAT,args...) do { \
|
#define ADD(FORMAT,args...) do { \
|
||||||
blen += snprintf_P(&buf[blen], sizeof(buf) - blen, PSTR(FORMAT),##args); \
|
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 = "<html><head><title>ContikiRPL(Jackdaw)</title></head><body>\n";
|
char TOP1[] PROGMEM = "<html><head><title>ContikiRPL(Jackdaw)";
|
||||||
char BOTTOM[] PROGMEM = "</body></html>\n";
|
char TOP2[] PROGMEM = "</title></head><body>";
|
||||||
|
char BOTTOM[] PROGMEM = "</body></html>";
|
||||||
#if UIP_CONF_IPV6
|
#if UIP_CONF_IPV6
|
||||||
extern uip_ds6_nbr_t uip_ds6_nbr_cache[];
|
extern uip_ds6_nbr_t uip_ds6_nbr_cache[];
|
||||||
extern uip_ds6_route_t uip_ds6_routing_table[];
|
extern uip_ds6_route_t uip_ds6_routing_table[];
|
||||||
|
@ -255,24 +256,25 @@ PT_THREAD(generate_routes(struct httpd_state *s))
|
||||||
static int i;
|
static int i;
|
||||||
PSOCK_BEGIN(&s->sout);
|
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;
|
blen = 0;
|
||||||
ADD("<h2>Neighbors</h2>");
|
ADD("<h2>Neighbors [%u max]</h2>",UIP_DS6_NBR_NB);
|
||||||
#if UIP_CONF_IPV6
|
#if UIP_CONF_IPV6
|
||||||
for(i = 0; i < UIP_DS6_NBR_NB; i++) {
|
for(i = 0; i < UIP_DS6_NBR_NB; i++) {
|
||||||
if(uip_ds6_nbr_cache[i].isused) {
|
if(uip_ds6_nbr_cache[i].isused) {
|
||||||
ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr);
|
ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr);
|
||||||
ADD("<br>\n");
|
ADD("<br>");
|
||||||
if(blen > sizeof(buf) - 45) {
|
// if(blen > sizeof(buf) - 45) {
|
||||||
PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf);
|
PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf);
|
||||||
blen = 0;
|
blen = 0;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ADD("<h2>Routes</h2>");
|
ADD("<h2>Routes [%u max]</h2>",UIP_DS6_ROUTE_NB);
|
||||||
PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf);
|
PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf);
|
||||||
blen = 0;
|
blen = 0;
|
||||||
#if UIP_CONF_IPV6
|
#if UIP_CONF_IPV6
|
||||||
|
@ -280,11 +282,13 @@ PT_THREAD(generate_routes(struct httpd_state *s))
|
||||||
if(uip_ds6_routing_table[i].isused) {
|
if(uip_ds6_routing_table[i].isused) {
|
||||||
ipaddr_add(&uip_ds6_routing_table[i].ipaddr);
|
ipaddr_add(&uip_ds6_routing_table[i].ipaddr);
|
||||||
ADD("/%u (via ", uip_ds6_routing_table[i].length);
|
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);
|
ipaddr_add(&uip_ds6_routing_table[i].nexthop);
|
||||||
if(uip_ds6_routing_table[i].state.lifetime < 600) {
|
if(uip_ds6_routing_table[i].state.lifetime < 600) {
|
||||||
ADD(") %lus<br>\n", uip_ds6_routing_table[i].state.lifetime);
|
ADD(") %lus<br>", uip_ds6_routing_table[i].state.lifetime);
|
||||||
} else {
|
} else {
|
||||||
ADD(")<br>\n");
|
ADD(")<br>");
|
||||||
}
|
}
|
||||||
PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf);
|
PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf);
|
||||||
blen = 0;
|
blen = 0;
|
||||||
|
|
Loading…
Reference in a new issue