diff --git a/apps/tinydtls b/apps/tinydtls index 6c4757caea..a6fa96c9f6 160000 --- a/apps/tinydtls +++ b/apps/tinydtls @@ -1 +1 @@ -Subproject commit 6c4757caea14bedc4e398ea1a774040f2c351bc4 +Subproject commit a6fa96c9f6cf242660574f32794709ef39367770 diff --git a/examples/6lbr/6lbr/nvm-config.c b/examples/6lbr/6lbr/nvm-config.c index 6e2adc4a97..4167abbf99 100644 --- a/examples/6lbr/6lbr/nvm-config.c +++ b/examples/6lbr/6lbr/nvm-config.c @@ -49,6 +49,8 @@ #include "nvm-itf.h" #include "log-6lbr.h" +nvm_data_t *nvms_data; +uint16_t rpl_instances, rpl_current_instance; nvm_data_t nvm_data; /*---------------------------------------------------------------------------*/ diff --git a/examples/6lbr/6lbr/nvm-config.h b/examples/6lbr/6lbr/nvm-config.h index f6c676dfd3..9f6859b883 100644 --- a/examples/6lbr/6lbr/nvm-config.h +++ b/examples/6lbr/6lbr/nvm-config.h @@ -39,7 +39,9 @@ #include "nvm-data.h" +extern nvm_data_t *nvms_data; extern nvm_data_t nvm_data; +extern uint16_t rpl_instances, rpl_current_instance; void load_nvm_config(void); void store_nvm_config(void); diff --git a/examples/6lbr/6lbr/rio.c b/examples/6lbr/6lbr/rio.c index 43b2a43968..2dc6cd091f 100644 --- a/examples/6lbr/6lbr/rio.c +++ b/examples/6lbr/6lbr/rio.c @@ -59,18 +59,22 @@ uip_ds6_route_info_add(uip_ipaddr_t * ipaddr, uint8_t ipaddrlen, if(uip_ds6_list_loop ((uip_ds6_element_t *) uip_ds6_route_info_list, UIP_DS6_ROUTE_INFO_NB, sizeof(uip_ds6_route_info_t), ipaddr, ipaddrlen, - (uip_ds6_element_t **) & locrtinfo) == FREESPACE) { - locrtinfo->isused = 1; - uip_ipaddr_copy(&locrtinfo->ipaddr, ipaddr); - locrtinfo->length = ipaddrlen; - locrtinfo->flags = flags; - locrtinfo->lifetime = rlifetime; - LOG6LBR_6ADDR(DEBUG, &locrtinfo->ipaddr, "Adding route information: length=%u, flags=%x, route lifetime=%lu, dest=", - ipaddrlen, flags, rlifetime); - return locrtinfo; - } else { - LOG6LBR_ERROR("No more space in route information list\n"); - } + (uip_ds6_element_t **) & locrtinfo) != FOUND) + if(uip_ds6_list_loop + ((uip_ds6_element_t *) uip_ds6_route_info_list, UIP_DS6_ROUTE_INFO_NB, + sizeof(uip_ds6_route_info_t), ipaddr, ipaddrlen, + (uip_ds6_element_t **) & locrtinfo) == FREESPACE) { + locrtinfo->isused = 1; + uip_ipaddr_copy(&locrtinfo->ipaddr, ipaddr); + locrtinfo->length = ipaddrlen; + locrtinfo->flags = flags; + locrtinfo->lifetime = rlifetime; + LOG6LBR_6ADDR(DEBUG, &locrtinfo->ipaddr, "Adding route information: length=%u, flags=%x, route lifetime=%lu, dest=", + ipaddrlen, flags, rlifetime); + return locrtinfo; + } else { + LOG6LBR_ERROR("No more space in route information list\n"); + } return NULL; } diff --git a/examples/6lbr/Makefile b/examples/6lbr/Makefile index 6f112af5d8..5ff7904730 100644 --- a/examples/6lbr/Makefile +++ b/examples/6lbr/Makefile @@ -11,6 +11,8 @@ CETIC_6LBR_LEARN_RPL_MAC=1 CONTIKI_WITH_IPV6 = 1 +RPL_CONF_MAX_INSTANCES=10 + 6LBR?=. CONTIKI = $(6LBR)/../.. @@ -40,6 +42,7 @@ CFLAGS +=-DCETIC_6LBR_ROUTER=$(CETIC_6LBR_ROUTER) CFLAGS +=-DCETIC_6LBR_6LR=$(CETIC_6LBR_6LR) CFLAGS +=-DCETIC_6LBR_ONE_ITF=$(CETIC_6LBR_ONE_ITF) CFLAGS +=-DCETIC_6LBR_LEARN_RPL_MAC=$(CETIC_6LBR_LEARN_RPL_MAC) +CFLAGS +=-DRPL_CONF_MAX_INSTANCES=$(RPL_CONF_MAX_INSTANCES) CONTIKI_WITH_RPL ?= 1 WITH_IP64?=1 diff --git a/examples/6lbr/angstrom/control b/examples/6lbr/angstrom/control index 6284f9791f..4a0023c722 100644 --- a/examples/6lbr/angstrom/control +++ b/examples/6lbr/angstrom/control @@ -1,5 +1,5 @@ Package: cetic-6lbr -Version: 1.3.2 +Version: 1.4.0 Architecture: armv7a Maintainer: CETIC <6lbr@cetic.be> Section: network diff --git a/examples/6lbr/apps/6lbr-webserver/Makefile.6lbr-webserver b/examples/6lbr/apps/6lbr-webserver/Makefile.6lbr-webserver index 3cd69884b8..2dee7608ad 100644 --- a/examples/6lbr/apps/6lbr-webserver/Makefile.6lbr-webserver +++ b/examples/6lbr/apps/6lbr-webserver/Makefile.6lbr-webserver @@ -1,6 +1,7 @@ CFLAGS += -DWEBSERVER=1 6lbr-webserver_src = httpd.c httpd-cgi.c httpd-urlconv.c webserver.c webserver-utils.c \ webserver-main.c webserver-network.c \ + webserver-instances.c \ webserver-config.c webserver-statistics.c webserver-admin.c webserver-log.c ifeq ($(CONTIKI_WITH_RPL),1) diff --git a/examples/6lbr/apps/6lbr-webserver/httpd-cgi.c b/examples/6lbr/apps/6lbr-webserver/httpd-cgi.c index 153775f005..98ad8d31ea 100644 --- a/examples/6lbr/apps/6lbr-webserver/httpd-cgi.c +++ b/examples/6lbr/apps/6lbr-webserver/httpd-cgi.c @@ -36,16 +36,59 @@ #include #include +#include #include "contiki-net.h" #include "httpd-cgi.h" #include "nvm-config.h" +static httpd_group_t *instances = NULL; static httpd_group_t *groups = NULL; static httpd_cgi_call_t *calls = NULL; static httpd_cgi_command_t *commands = NULL; /*---------------------------------------------------------------------------*/ void +httpd_instances_add(void *dgroup, uint16_t nb) +{ + httpd_group_t *group; + if(nb > 0){ + group = (httpd_group_t *)malloc(2 + nb * sizeof(httpd_group_t)); + + group[0].title = (char*)malloc(2*sizeof(char)); + sprintf(group[0].title, "%c", '-'); + group[0].next = &group[1]; + group[1].title = (char*)malloc(2*sizeof(char)); + sprintf(group[1].title, "%c", '+'); + } + else { + group = (httpd_group_t *)malloc(sizeof(httpd_group_t)); + + group[0].title = (char*)malloc(2*sizeof(char)); + sprintf(group[0].title, "%c", '+'); + group[0].next = NULL; + } + + if(nb > 0){ + group[1].next = &group[2]; + int i; + char * instance; + for(i=0;iquery) { - LOG6LBR_6ADDR(DEBUG, &uip_conn->ripaddr, "Request for '%s?%s' from ", s->filename, s->query); + LOG6LBR_6ADDR(INFO, &uip_conn->ripaddr, "Request for '%s?%s' from ", s->filename, s->query); } else { - LOG6LBR_6ADDR(DEBUG, &uip_conn->ripaddr, "Request for '%s' from ", s->filename); + LOG6LBR_6ADDR(INFO, &uip_conn->ripaddr, "Request for '%s' from ", s->filename); } s->state = STATE_OUTPUT; diff --git a/examples/6lbr/apps/6lbr-webserver/webserver-config.c b/examples/6lbr/apps/6lbr-webserver/webserver-config.c index 984b0639f9..4d26a5d412 100644 --- a/examples/6lbr/apps/6lbr-webserver/webserver-config.c +++ b/examples/6lbr/apps/6lbr-webserver/webserver-config.c @@ -511,6 +511,13 @@ update_config(const char *name, uint8_t *reboot_needed) } } if(do_update) { + int i,find=0; + for(i=0;i + */ + +#define LOG6LBR_MODULE "WEB" + +#include + +#include "contiki.h" +#include "httpd.h" +#include "httpd-cgi.h" +#include "webserver-utils.h" + +#include "cetic-6lbr.h" +#include "node-info.h" +#include "log-6lbr.h" + +#include "nvm-config.h" + +#if CETIC_NODE_CONFIG +#include "node-config.h" +#endif + +nvm_data_t default_nvm_data; + +#define INPUT_FLAG(name, nvm_name, flag, text, on_text, off_text) \ + if ((default_nvm_data.global_flags & CETIC_GLOBAL_DISABLE_CONFIG) == 0) { \ + add(text " :
" \ + " "on_text"
", \ + (default_nvm_data.nvm_name & (flag)) != 0 ? "checked" : ""); \ + add(" "off_text"
", \ + (default_nvm_data.nvm_name & (flag)) == 0 ? "checked" : ""); \ + } else { \ + add(text " : %s
", (default_nvm_data.nvm_name & (flag)) != 0 ? on_text : off_text ); \ + } + +#define INPUT_FLAG_CB(name, nvm_name, flag, text) \ + if ((default_nvm_data.global_flags & CETIC_GLOBAL_DISABLE_CONFIG) == 0) { \ + add(text " :
" \ + " on ", \ + (default_nvm_data.nvm_name & (flag)) != 0 ? "checked" : ""); \ + add(" off
", \ + (default_nvm_data.nvm_name & (flag)) == 0 ? "checked" : ""); \ + } else { \ + add(text " : %s
", (default_nvm_data.nvm_name & (flag)) != 0 ? "on" : "off" ); \ + } + +#define INPUT_IPADDR(name, nvm_name, text) \ + if ((default_nvm_data.global_flags & CETIC_GLOBAL_DISABLE_CONFIG) == 0) { \ + add(text " :
"); \ + } else { \ + add(text " : "); \ + ipaddr_add_u8(default_nvm_data.nvm_name); \ + add("
"); \ + } + +#define INPUT_IP4ADDR(name, nvm_name, text) \ + if ((default_nvm_data.global_flags & CETIC_GLOBAL_DISABLE_CONFIG) == 0) { \ + add(text " :
"); \ + } else { \ + add(text " : "); \ + ip4addr_add_u8(default_nvm_data.nvm_name); \ + add("
"); \ + } + +#define INPUT_CONTEXT(name, nvm_name, text) \ + if ((default_nvm_data.global_flags & CETIC_GLOBAL_DISABLE_CONFIG) == 0) { \ + add(text " :
"); \ + } else { \ + add(text " : "); \ + ipaddr_add_u8(default_nvm_data.nvm_name); \ + add("
"); \ + } + +#define INPUT_INT(name, nvm_name, text) \ + if ((default_nvm_data.global_flags & CETIC_GLOBAL_DISABLE_CONFIG) == 0) { \ + add(text " :
", default_nvm_data.nvm_name); \ + } else { \ + add(text " : %d
", default_nvm_data.nvm_name); \ + } + +#define INPUT_HEX(name, nvm_name, text) \ + if ((default_nvm_data.global_flags & CETIC_GLOBAL_DISABLE_CONFIG) == 0) { \ + add(text " :
", default_nvm_data.nvm_name); \ + } else { \ + add(text " : %x
", default_nvm_data.nvm_name); \ + } + +#define INPUT_KEY(name, nvm_name, size, text) \ + if ((default_nvm_data.global_flags & CETIC_GLOBAL_DISABLE_CONFIG) == 0) { \ + add(text " :
"); \ + } else { \ + add(text " : ****
"); \ + } + +#define INPUT_STRING(name, nvm_name, size, text) \ + if ((default_nvm_data.global_flags & CETIC_GLOBAL_DISABLE_CONFIG) == 0) { \ + add(text " :
", size, default_nvm_data.nvm_name); \ + } else { \ + add(text " : \"%s\"
", default_nvm_data.nvm_name); \ + } + +#define SELECT_OPTION(nvm_name, value, name) add("", value, default_nvm_data.nvm_name == value ? "selected" : "", name) + +static +PT_THREAD(generate_instances(struct httpd_state *s)) +{ + if(strcmp(s->query,"+") == 0) { + + check_nvm(&default_nvm_data, 1); + PSOCK_BEGIN(&s->sout); + + add("
"); + add("

WSN Network

"); +#if !CETIC_6LBR_ONE_ITF + add("

802.15.4 configuration

"); + INPUT_INT("channel", channel, "Channel"); +#if !CONTIKI_TARGET_NATIVE + INPUT_HEX("panid", pan_id, "PAN ID"); +#endif + SEND_STRING(&s->sout, buf); + reset_buf(); + + add("

802.15.4 Security

"); + add("Link-layer security :
"); + SEND_STRING(&s->sout, buf); + reset_buf(); + add("Link-layer security level :
"); + SEND_STRING(&s->sout, buf); + reset_buf(); + INPUT_KEY("psk", noncoresec_key, 16, "Pre-shared key"); + INPUT_FLAG_CB("sec_dis_ar", noncoresec_flags, CETIC_6LBR_NONCORESEC_DISABLE_ANTIREPLAY, "Disable anti-replay"); + INPUT_FLAG_CB("sec_ar_wa", noncoresec_flags, CETIC_6LBR_NONCORESEC_ANTIREPLAY_WORKAROUND, "Enable anti-replay workaround"); + SEND_STRING(&s->sout, buf); + reset_buf(); +#if CETIC_6LBR_MAC_WRAPPER + add("

MAC

"); + add("MAC Layer :
"); + SEND_STRING(&s->sout, buf); + reset_buf(); +#endif +#endif + + add("

IP configuration

"); +#if CETIC_6LBR_SMARTBRIDGE || CETIC_6LBR_TRANSPARENTBRIDGE + INPUT_FLAG_CB("wait_ra", mode, CETIC_MODE_WAIT_RA_MASK, "Network autoconfiguration"); + INPUT_IPADDR("wsn_pre", wsn_net_prefix, "Prefix"); + INPUT_INT("wsn_pre_len", wsn_net_prefix_len, "Prefix length"); + INPUT_IPADDR("eth_dft", eth_dft_router, "Default router"); + SEND_STRING(&s->sout, buf); + reset_buf(); +#elif CETIC_6LBR_ROUTER + INPUT_IPADDR("wsn_pre", wsn_net_prefix, "Prefix"); + INPUT_INT("wsn_pre_len", wsn_net_prefix_len, "Prefix length"); +#endif + INPUT_CONTEXT("wsn_context_0", wsn_6lowpan_context_0, "6LoPWAN context 0"); + INPUT_FLAG_CB("wsn_auto", mode, CETIC_MODE_WSN_AUTOCONF, "Address autoconfiguration"); + INPUT_IPADDR("wsn_addr", wsn_ip_addr, "Manual address"); + SEND_STRING(&s->sout, buf); + reset_buf(); + add("

Extra configuration

"); +#if CETIC_6LBR_SMARTBRIDGE + INPUT_FLAG_CB("smart_multi", mode, CETIC_MODE_SMART_MULTI_BR, "Multi-BR support"); +#endif + INPUT_IPADDR("dns", dns_server, "DNS server"); +#if CETIC_NODE_CONFIG + INPUT_FLAG_CB("nc_filter", global_flags, CETIC_GLOBAL_FILTER_NODES, "Filter nodes"); +#endif + SEND_STRING(&s->sout, buf); + reset_buf(); + + add("

Eth Network

"); +#if CETIC_6LBR_ROUTER + add("

IP configuration

"); + INPUT_IPADDR("eth_pre", eth_net_prefix, "Prefix"); + INPUT_INT("eth_pre_len", eth_net_prefix_len, "Prefix length"); + SEND_STRING(&s->sout, buf); + reset_buf(); + + INPUT_FLAG_CB("eth_auto", mode, CETIC_MODE_ETH_AUTOCONF, "Address autoconfiguration" ); + INPUT_IPADDR("eth_addr", eth_ip_addr, "Manual address"); + SEND_STRING(&s->sout, buf); + reset_buf(); + INPUT_IPADDR("eth_dft", eth_dft_router, "Peer router"); + SEND_STRING(&s->sout, buf); + reset_buf(); +#endif +#if CETIC_6LBR_IP64 + add("

IP64

"); + INPUT_FLAG_CB("ip64", global_flags, CETIC_GLOBAL_IP64, "IP64" ); + INPUT_FLAG_CB("ip64_dhcp", eth_ip64_flags, CETIC_6LBR_IP64_DHCP, "DHCP" ); + INPUT_IP4ADDR("ip64_addr", eth_ip64_addr, "Address"); + SEND_STRING(&s->sout, buf); + reset_buf(); + INPUT_IP4ADDR("ip64_netmask", eth_ip64_netmask, "Netmask"); + INPUT_IP4ADDR("ip64_gateway", eth_ip64_gateway, "Gateway"); + INPUT_FLAG_CB("ip64_6052", eth_ip64_flags, CETIC_6LBR_IP64_RFC6052_PREFIX, "RFC 6052 prefix" ); + INPUT_FLAG_CB("ip64_port_map", eth_ip64_flags, CETIC_6LBR_IP64_SPECIAL_PORTS, "Static port mapping" ); + SEND_STRING(&s->sout, buf); + reset_buf(); +#endif +#if RESOLV_CONF_SUPPORTS_MDNS + add("

MDNS

"); + INPUT_FLAG_CB("mdns", global_flags, CETIC_GLOBAL_MDNS, "MDNS publishing" ); + INPUT_STRING("hostname", dns_host_name, NVM_DATA_DNS_HOST_NAME_SIZE, "Hostname"); +#if RESOLV_CONF_SUPPORTS_DNS_SD + INPUT_FLAG_CB("dns_sd", dns_flags, CETIC_6LBR_DNS_DNS_SD, "DNS-SD publishing" ); +#endif + SEND_STRING(&s->sout, buf); + reset_buf(); +#endif +#if CETIC_6LBR_ROUTER + add("

RA Daemon

"); + INPUT_FLAG("ra_daemon", mode, CETIC_MODE_ROUTER_RA_DAEMON, "RA Daemon", "active", "inactive"); + INPUT_INT("ra_lifetime", ra_router_lifetime, "Router lifetime"); + SEND_STRING(&s->sout, buf); + reset_buf(); + add("

RA

"); + INPUT_INT( "ra_max_interval", ra_max_interval, "Max interval"); + INPUT_INT( "ra_min_interval", ra_min_interval, "Min interval"); + INPUT_INT( "ra_min_delay", ra_min_delay, "Min delay"); + SEND_STRING(&s->sout, buf); + reset_buf(); + add("

RA Prefix

"); + INPUT_FLAG_CB( "ra_pio", ra_prefix_flags, CETIC_6LBR_MODE_SEND_PIO, "Send Prefix Information"); + INPUT_FLAG_CB( "ra_prefix_o", ra_prefix_flags, UIP_ND6_RA_FLAG_ONLINK, "Prefix on-link"); + INPUT_FLAG_CB( "ra_prefix_a", ra_prefix_flags, UIP_ND6_RA_FLAG_AUTONOMOUS, "Allow autoconfiguration"); + SEND_STRING(&s->sout, buf); + reset_buf(); + INPUT_INT( "ra_prefix_vtime", ra_prefix_vtime, "Prefix valid time"); + INPUT_INT( "ra_prefix_ptime", ra_prefix_ptime, "Prefix preferred time"); + add("
"); + SEND_STRING(&s->sout, buf); + reset_buf(); + add("

RA Route Information

"); + INPUT_FLAG_CB( "ra_rio_en", ra_rio_flags, CETIC_6LBR_MODE_SEND_RIO, "Include RIO"); + INPUT_INT( "ra_rio_lifetime", ra_rio_lifetime, "Route lifetime"); + add("
"); + SEND_STRING(&s->sout, buf); + reset_buf(); +#endif + +#if UIP_CONF_IPV6_RPL && (CETIC_6LBR_ROUTER || CETIC_6LBR_SMARTBRIDGE) + add("

RPL Configuration

"); + INPUT_INT( "rpl_instance_id", rpl_instance_id, "Instance ID"); + INPUT_FLAG_CB( "dodag_manual", rpl_config, CETIC_6LBR_MODE_MANUAL_DODAG, "Manual DODAG ID"); + INPUT_IPADDR("dodag_id", rpl_dodag_id, "DODAG ID"); + SEND_STRING(&s->sout, buf); + reset_buf(); + INPUT_FLAG_CB( "dodag_global", rpl_config, CETIC_6LBR_MODE_GLOBAL_DODAG, "Global DODAG ID"); + INPUT_INT( "rpl_preference", rpl_preference, "Preference"); + INPUT_INT( "rpl_dio_intdoubl", rpl_dio_intdoubl, "DIO interval doubling"); + INPUT_INT( "rpl_dio_intmin", rpl_dio_intmin, "DIO min interval"); + SEND_STRING(&s->sout, buf); + reset_buf(); + INPUT_INT( "rpl_dio_redundancy", rpl_dio_redundancy, "DIO redundancy"); + INPUT_INT( "rpl_min_hoprankinc", rpl_min_hoprankinc, "Min rank increment"); + INPUT_INT( "rpl_max_rankinc", rpl_max_rankinc, "Max rank increase"); + INPUT_INT( "rpl_default_lifetime", rpl_default_lifetime, "Route lifetime"); + INPUT_INT( "rpl_lifetime_unit", rpl_lifetime_unit, "Route lifetime unit"); + SEND_STRING(&s->sout, buf); + reset_buf(); +#endif + +#if CETIC_6LBR_ROUTER + add("

Packet filtering

"); + INPUT_FLAG("rewrite", mode, CETIC_MODE_REWRITE_ADDR_MASK, "Address rewrite", "enabled", "disabled"); +#endif + if ((default_nvm_data.global_flags & CETIC_GLOBAL_DISABLE_CONFIG) == 0) { + add("
"); + } + SEND_STRING(&s->sout, buf); + reset_buf(); + + PSOCK_END(&s->sout); + } + else if (strcmp(s->query,"-") == 0){ + PSOCK_BEGIN(&s->sout); + add("
"); + add("

Deleting the RPL instance number :

"); + add("

",rpl_current_instance); + add("
"); + add("
or choice other menu to cancel
"); + SEND_STRING(&s->sout, buf); + reset_buf(); + PSOCK_END(&s->sout); + } +} + +/*---------------------------------------------------------------------------*/ + +#define UPDATE_FLAG(name, nvm_name, flag, reboot) \ +else if(strcmp(param, name) == 0) { \ + if(strcmp(value, "0") == 0) { \ + nvm_data.nvm_name &= ~(flag); \ + *reboot_needed |= (reboot); \ + } else if(strcmp(value, "1") == 0) { \ + nvm_data.nvm_name |= (flag); \ + *reboot_needed |= (reboot); \ + } else { \ + LOG6LBR_WARN("Invalid value for %s : '%s'\n", param, value); \ + do_update = 0; \ + } \ +} +#define UPDATE_INT(name, nvm_name, reboot) \ + else if(strcmp(param, name) == 0) { \ + nvm_data.nvm_name = atoi(value); \ + *reboot_needed |= (reboot); \ + } + +#define UPDATE_HEX(name, nvm_name, reboot) \ + else if(strcmp(param, name) == 0) { \ + nvm_data.nvm_name = strtoul(value, NULL, 16); \ + *reboot_needed |= (reboot); \ + } + +#define UPDATE_IPADDR(name, nvm_name, reboot) \ + else if(strcmp(param, name) == 0) { \ + if(uiplib_ipaddrconv(value, &loc_fipaddr)) { \ + memcpy(&nvm_data.nvm_name, &loc_fipaddr.u8, \ + sizeof(nvm_data.nvm_name)); \ + *reboot_needed |= (reboot); \ + } else { \ + LOG6LBR_WARN("Invalid value for %s : '%s'\n", param, value); \ + do_update = 0; \ + } \ + } + +#define UPDATE_IP4ADDR(name, nvm_name, reboot) \ + else if(strcmp(param, name) == 0) { \ + if(uiplib_ip4addrconv(value, &loc_fip4addr)) { \ + memcpy(&nvm_data.nvm_name, &loc_fip4addr.u8, \ + sizeof(nvm_data.nvm_name)); \ + *reboot_needed |= (reboot); \ + } else { \ + LOG6LBR_WARN("Invalid value for %s : '%s'\n", param, value); \ + do_update = 0; \ + } \ + } + +#define UPDATE_KEY(name, nvm_name, size, reboot) \ + else if(strcmp(param, name) == 0) { \ + uint8_t tmp_key[size]; \ + if(key_conv(value, tmp_key, size)) { \ + memcpy(&nvm_data.nvm_name, tmp_key, \ + sizeof(nvm_data.nvm_name)); \ + *reboot_needed |= (reboot); \ + } else { \ + LOG6LBR_WARN("Invalid value for %s : '%s'\n", param, value); \ + do_update = 0; \ + } \ + } + +#define UPDATE_STRING(name, nvm_name, size, reboot) \ + else if(strcmp(param, name) == 0) { \ + strncpy((char *)nvm_data.nvm_name, value, size); \ + *reboot_needed |= (reboot); \ + } + +static int +update_config(const char *name, uint8_t *reboot_needed) +{ + const char *ptr = name; + char *next; + uint8_t do_update = 1; + uip_ipaddr_t loc_fipaddr; +#if CETIC_6LBR_IP64 + uip_ip4addr_t loc_fip4addr; +#endif + + *reboot_needed = 0; + + while(*ptr) { + const char *param = ptr; + + next = index(ptr, '='); + if(!next) + break; + *next = 0; + ptr = next + 1; + const char *value = ptr; + + next = index(ptr, '&'); + if(next) { + *next = 0; + ptr = next + 1; + } else { + ptr += strlen(ptr); + } + + LOG6LBR_DEBUG("Got param: '%s' = '%s'\n", param, value); + if (0) { + } + UPDATE_FLAG("smart_multi", mode, CETIC_MODE_SMART_MULTI_BR, 1) + UPDATE_FLAG("wait_ra", mode, CETIC_MODE_WAIT_RA_MASK, 1) + UPDATE_INT("channel", channel, 1) + UPDATE_HEX("panid", pan_id, 1) +#if CETIC_6LBR_MAC_WRAPPER + UPDATE_INT("mac", mac_layer, 1) +#endif + UPDATE_INT("llsec", security_layer, 1) + UPDATE_INT("llsec_level", security_level, 1) + UPDATE_KEY("psk", noncoresec_key, 16, 1) + UPDATE_FLAG( "sec_dis_ar", noncoresec_flags, CETIC_6LBR_NONCORESEC_DISABLE_ANTIREPLAY, 1) + UPDATE_FLAG( "sec_ar_wa", noncoresec_flags, CETIC_6LBR_NONCORESEC_ANTIREPLAY_WORKAROUND, 1) + UPDATE_IPADDR("wsn_pre", wsn_net_prefix, 1) + UPDATE_INT("wsn_pre_len", wsn_net_prefix_len, 1) + UPDATE_IPADDR("wsn_context_0", wsn_6lowpan_context_0, 1) + UPDATE_FLAG("wsn_auto", mode, CETIC_MODE_WSN_AUTOCONF, 1) + UPDATE_IPADDR("wsn_addr", wsn_ip_addr, 1) + UPDATE_IPADDR("dns", dns_server, 1) + UPDATE_IPADDR("eth_pre", eth_net_prefix, 1) + UPDATE_INT("eth_pre_len", eth_net_prefix_len, 1) + UPDATE_FLAG("eth_auto", mode, CETIC_MODE_ETH_AUTOCONF, 1) + UPDATE_IPADDR("eth_addr", eth_ip_addr, 1) + UPDATE_IPADDR("eth_dft", eth_dft_router, 1) + UPDATE_FLAG("ra_daemon", mode, CETIC_MODE_ROUTER_RA_DAEMON, 1) + UPDATE_FLAG("rewrite", mode, CETIC_MODE_REWRITE_ADDR_MASK, 1) +#if CETIC_6LBR_IP64 + UPDATE_FLAG("ip64", global_flags, CETIC_GLOBAL_IP64, 1) + UPDATE_FLAG("ip64_dhcp", eth_ip64_flags, CETIC_6LBR_IP64_DHCP, 1) + UPDATE_IP4ADDR("ip64_addr", eth_ip64_addr, 1) + UPDATE_IP4ADDR("ip64_netmask", eth_ip64_netmask, 1) + UPDATE_IP4ADDR("ip64_gateway", eth_ip64_gateway, 1) + UPDATE_FLAG("ip64_port_map", eth_ip64_flags, CETIC_6LBR_IP64_SPECIAL_PORTS, 1) + UPDATE_FLAG("ip64_6052", eth_ip64_flags, CETIC_6LBR_IP64_RFC6052_PREFIX, 1) +#endif +#if RESOLV_CONF_SUPPORTS_MDNS + UPDATE_FLAG("mdns", global_flags, CETIC_GLOBAL_MDNS, 1) + UPDATE_STRING("hostname", dns_host_name, NVM_DATA_DNS_HOST_NAME_SIZE, 1) +#if RESOLV_CONF_SUPPORTS_DNS_SD + UPDATE_FLAG("dns_sd", dns_flags, CETIC_6LBR_DNS_DNS_SD, 1) +#endif +#endif +#if CETIC_NODE_CONFIG + UPDATE_FLAG("nc_filter", global_flags, CETIC_GLOBAL_FILTER_NODES, 1) +#endif + UPDATE_INT( "ra_lifetime", ra_router_lifetime, 1) + UPDATE_INT( "ra_max_interval", ra_max_interval, 1) + UPDATE_INT( "ra_min_interval", ra_min_interval, 1) + UPDATE_INT( "ra_min_delay", ra_min_delay, 1) + + UPDATE_FLAG( "ra_pio", ra_prefix_flags, CETIC_6LBR_MODE_SEND_PIO, 1) + UPDATE_FLAG( "ra_prefix_o", ra_prefix_flags, UIP_ND6_RA_FLAG_ONLINK, 1) + UPDATE_FLAG( "ra_prefix_a", ra_prefix_flags, UIP_ND6_RA_FLAG_AUTONOMOUS, 1) + UPDATE_INT( "ra_prefix_vtime", ra_prefix_vtime, 1) + UPDATE_INT( "ra_prefix_ptime", ra_prefix_ptime, 1) + + UPDATE_FLAG( "ra_rio_en", ra_rio_flags, CETIC_6LBR_MODE_SEND_RIO, 1) + UPDATE_INT( "ra_rio_lifetime", ra_rio_lifetime, 1) + + UPDATE_INT( "rpl_instance_id", rpl_instance_id, 1) + UPDATE_FLAG("dodag_manual", rpl_config, CETIC_6LBR_MODE_MANUAL_DODAG, 1) + UPDATE_FLAG("dodag_global", rpl_config, CETIC_6LBR_MODE_GLOBAL_DODAG, 1) + UPDATE_IPADDR("dodag_id", rpl_dodag_id, 1) + UPDATE_INT( "rpl_preference", rpl_preference, 1) + UPDATE_INT( "rpl_dio_intdoubl", rpl_dio_intdoubl, 1) + UPDATE_INT( "rpl_dio_intmin", rpl_dio_intmin, 1) + UPDATE_INT( "rpl_dio_redundancy", rpl_dio_redundancy, 1) + UPDATE_INT( "rpl_default_lifetime", rpl_default_lifetime, 1) + UPDATE_INT( "rpl_min_hoprankinc", rpl_min_hoprankinc, 1) + UPDATE_INT( "rpl_max_rankinc", rpl_max_rankinc, 1) + UPDATE_INT( "rpl_lifetime_unit", rpl_lifetime_unit, 1) + +#if !LOG6LBR_STATIC + UPDATE_INT( "log_level", log_level, 0) + UPDATE_HEX( "log_services", log_services, 0) +#endif + else { + LOG6LBR_WARN("Unknown parameter '%s'\n", param); + do_update=0; + } + } + if(do_update) { + //store_nvm_config(); +#if !LOG6LBR_STATIC + if(nvm_data.log_level != 0xFF) { + Log6lbr_level = nvm_data.log_level; + Log6lbr_services = nvm_data.log_services; + } +#endif + } + return do_update; +} +static httpd_cgi_call_t * +webserver_instance_new(struct httpd_state *s) +{ + uint8_t reboot_needed = 0; + webserver_result_title = "Configuration"; + + check_nvm(&default_nvm_data, 1); + nvm_data_t tmp_nvm_data = nvm_data; + nvm_data = default_nvm_data; + + if(!s->query || update_config(s->query, &reboot_needed)) { + rpl_instances++; + nvm_data_t * new_nvms_data = (nvm_data_t*)malloc(rpl_instances * sizeof(nvm_data_t)); + memcpy(new_nvms_data, nvms_data, (rpl_instances - 1) * sizeof(nvm_data_t)); + memcpy(&new_nvms_data[rpl_instances-1], &nvm_data, sizeof(nvm_data_t)); + free(nvms_data); + nvms_data = new_nvms_data; + store_nvm_config(); + if(!reboot_needed) { + webserver_result_text = "Configuration updated"; + } else { + cetic_6lbr_restart_type = CETIC_6LBR_RESTART; + webserver_result_text = "Configuration updated, restarting BR..."; + webserver_result_refresh = 15; + process_post(&cetic_6lbr_process, cetic_6lbr_restart_event, NULL); + } + } else { + webserver_result_text = "Configuration invalid"; + } + return &webserver_result_page; +} + +static httpd_cgi_call_t * +webserver_instance_rm(struct httpd_state *s) +{ + + const char *ptr = s->query; + char *next; + + while(*ptr) { + const char *param = ptr; + + next = index(ptr, '='); + if(!next) + break; + *next = 0; + ptr = next + 1; + const char *value = ptr; + + next = index(ptr, '&'); + if(next) { + *next = 0; + ptr = next + 1; + } else { + ptr += strlen(ptr); + } + + LOG6LBR_DEBUG("Got param: '%s' = '%s'\n", param, value); + + int instance_id = atoi(value); + webserver_result_title = "Configuration"; + if(instance_id>0){ + int i=0; + rpl_instances--; + nvm_data_t * new_nvms_data = (nvm_data_t*)malloc(rpl_instances * sizeof(nvm_data_t)); + for(i=0;iquery); + strcat(rt, " deleted"); + webserver_result_text = (char*)malloc(35*sizeof(char)); + strcpy(webserver_result_text, rt); + webserver_result_refresh = 15; + process_post(&cetic_6lbr_process, cetic_6lbr_restart_event, NULL); + return &webserver_result_page; + } + } +} + + +static httpd_cgi_call_t * +webserver_instances_selection(struct httpd_state *s) +{ + int instance_id = atoi(s->query); + if(instance_id>0){ + int i=0; + while(nvms_data[i].rpl_instance_id != instance_id) + i++; + nvm_data = nvms_data[i]; + rpl_current_instance = instance_id; + webserver_result_title = "Instance selection"; + char rt[35] = "Instance number "; + strcat(rt, s->query); + strcat(rt, " selectioned"); + webserver_result_text = (char*)malloc(35*sizeof(char)); + strcpy(webserver_result_text, rt); + webserver_result_refresh = 1; + return &webserver_result_page; + } + webserver_result_title = "Instance selection ERROR"; + char rt[30] = "Unknow instance number :"; + strcat(rt, s->query); + webserver_result_text = (char*)malloc(30*sizeof(char)); + strcpy(webserver_result_text, rt); + webserver_result_refresh = 1; + return &webserver_result_page; +} + + +HTTPD_CGI_CALL_NAME(webserver_instances); +HTTPD_CGI_CALL(webserver_instances, "instances_mgmt", "Instance Management", generate_instances, 0); +HTTPD_CGI_CMD(webserver_instance_new_cmd, "instance_new", webserver_instance_new,0); +HTTPD_CGI_CMD(webserver_instance_rm_cmd, "instance_rm", webserver_instance_rm,0); +HTTPD_CGI_CMD(webserver_instances_select_cmd, "select", webserver_instances_selection,0); diff --git a/examples/6lbr/apps/6lbr-webserver/webserver-network.c b/examples/6lbr/apps/6lbr-webserver/webserver-network.c index 55d928fe76..ba82dc3ded 100644 --- a/examples/6lbr/apps/6lbr-webserver/webserver-network.c +++ b/examples/6lbr/apps/6lbr-webserver/webserver-network.c @@ -87,34 +87,34 @@ PT_THREAD(generate_network(struct httpd_state *s)) if(uip_ds6_if.addr_list[i].isused) { ipaddr_add(&uip_ds6_if.addr_list[i].ipaddr); char flag; - + if(uip_ds6_if.addr_list[i].state == ADDR_TENTATIVE) { - flag = 'T'; + flag = 'T'; } else if(uip_ds6_if.addr_list[i].state == ADDR_PREFERRED) { - flag = 'P'; + flag = 'P'; } else { - flag = '?'; + flag = '?'; } add(" %c", flag); if(uip_ds6_if.addr_list[i].type == ADDR_MANUAL) { - flag = 'M'; + flag = 'M'; } else if(uip_ds6_if.addr_list[i].type == ADDR_DHCP) { - flag = 'D'; + flag = 'D'; } else if(uip_ds6_if.addr_list[i].type == ADDR_AUTOCONF) { - flag = 'A'; + flag = 'A'; } else { - flag = '?'; + flag = '?'; } add(" %c", flag); if(!uip_ds6_if.addr_list[i].isinfinite) { - add(" %u s", stimer_remaining(&uip_ds6_if.addr_list[i].vlifetime)); + add(" %u s", stimer_remaining(&uip_ds6_if.addr_list[i].vlifetime)); } add("\n"); SEND_STRING(&s->sout, buf); reset_buf(); } } - + add("

Prefixes

");
   for(i = 0; i < UIP_DS6_PREFIX_NB; i++) {
     if(uip_ds6_prefix_list[i].isused) {
@@ -122,11 +122,11 @@ PT_THREAD(generate_network(struct httpd_state *s))
       add(" ");
 #if UIP_CONF_ROUTER
       if(uip_ds6_prefix_list[i].advertise) {
-        add("A");
+	add("A");
       }
 #else
       if(uip_ds6_prefix_list[i].isinfinite) {
-        add("I");
+	add("I");
       }
 #endif
       add("\n");
@@ -134,7 +134,7 @@ PT_THREAD(generate_network(struct httpd_state *s))
   }
   SEND_STRING(&s->sout, buf);
   reset_buf();
-
+  
 #if CETIC_6LBR_IP64
   if((nvm_data.global_flags & CETIC_GLOBAL_IP64) != 0) {
     add("

IP64

");
@@ -149,11 +149,11 @@ PT_THREAD(generate_network(struct httpd_state *s))
       ip4addr_add(ip64_get_draddr());
       add("
"); if((nvm_data.eth_ip64_flags & CETIC_6LBR_IP64_DHCP) != 0) { - extern struct ip64_dhcpc_state *ip64_dhcp_state; - add("DHCP Server : "); - ip4addr_add_u8(ip64_dhcp_state->serverid); - add("
"); - add("DHCP lease time : %d s
", uip_ntohs(ip64_dhcp_state->lease_time[0])*65536ul + uip_ntohs(ip64_dhcp_state->lease_time[1])); + extern struct ip64_dhcpc_state *ip64_dhcp_state; + add("DHCP Server : "); + ip4addr_add_u8(ip64_dhcp_state->serverid); + add("
"); + add("DHCP lease time : %d s
", uip_ntohs(ip64_dhcp_state->lease_time[0])*65536ul + uip_ntohs(ip64_dhcp_state->lease_time[1])); } } else { add("Waiting configuration
"); @@ -162,13 +162,13 @@ PT_THREAD(generate_network(struct httpd_state *s)) reset_buf(); } #endif - + add("

Neighbors

");
-
+  
   for(nbr = nbr_table_head(ds6_neighbors);
       nbr != NULL;
       nbr = nbr_table_next(ds6_neighbors, nbr)) {
-
+    
     if ((nvm_data.global_flags & CETIC_GLOBAL_DISABLE_CONFIG) == 0) {
       add("[ipaddr);
@@ -188,7 +188,7 @@ PT_THREAD(generate_network(struct httpd_state *s))
     SEND_STRING(&s->sout, buf);
     reset_buf();
   }
-
+      
   add("

Routes

");
   SEND_STRING(&s->sout, buf);
   reset_buf();
@@ -228,9 +228,9 @@ PT_THREAD(generate_network(struct httpd_state *s))
     SEND_STRING(&s->sout, buf);
     reset_buf();
   }
-
+  
   add("

Default Routers

");
-
+  
   for(dr = uip_ds6_defrt_list_head(); dr != NULL; dr = list_item_next(r)) {
     ipaddr_add(&dr->ipaddr);
     if(!dr->isinfinite) {
@@ -240,21 +240,21 @@ PT_THREAD(generate_network(struct httpd_state *s))
     SEND_STRING(&s->sout, buf);
     reset_buf();
   }
-
+  
 #if UIP_CONF_DS6_ROUTE_INFORMATION
   add("

Route info

");
   for(i = 0; i < UIP_DS6_ROUTE_INFO_NB; i++) {
     if(uip_ds6_route_info_list[i].isused) {
       ipaddr_add(&uip_ds6_route_info_list[i].ipaddr);
       add("/%u (%x) %us\n", uip_ds6_route_info_list[i].length,
-          uip_ds6_route_info_list[i].flags,
-          uip_ds6_route_info_list[i].lifetime);
+	  uip_ds6_route_info_list[i].flags,
+	  uip_ds6_route_info_list[i].lifetime);
     }
   }
   SEND_STRING(&s->sout, buf);
   reset_buf();
 #endif
-
+  
   add("

DNS server

");
   //Note: Currently we assume only one DNS server
   uip_ipaddr_t * dns = uip_nameserver_get(0);
@@ -264,33 +264,33 @@ PT_THREAD(generate_network(struct httpd_state *s))
   }
   SEND_STRING(&s->sout, buf);
   reset_buf();
-
+  
 #if CETIC_6LBR_IP64
   if((nvm_data.global_flags & CETIC_GLOBAL_IP64) != 0) {
     add("

IP64 connections mapping

");
     static struct ip64_addrmap_entry *m;
     for(m = ip64_addrmap_list();
-        m != NULL;
-        m = list_item_next(m)) {
+	m != NULL;
+	m = list_item_next(m)) {
       if(timer_expired(&m->timer)) continue;
       ipaddr_add(&m->ip6addr);
       add("%%%d (%d)", m->ip6port, m->protocol);
       if(m->ip6to4 && m->ip4to6) {
-        add(" <-> ");
+	add(" <-> ");
       } else if(m->ip6to4) {
-        add(" -> ");
+	add(" -> ");
       } else {
-        add(" <- ");
+	add(" <- ");
       }
       ip4addr_add(&m->ip4addr);
       add("%%%d : %d (%x) %us\n", m->ip4port, m->mapped_port,
-          m->flags, (m->timer.interval - (clock_time() - m->timer.start)) / CLOCK_SECOND);
+	  m->flags, (m->timer.interval - (clock_time() - m->timer.start)) / CLOCK_SECOND);
       SEND_STRING(&s->sout, buf);
       reset_buf();
     }
   }
 #endif
-
+  
 #if SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS > 0
   add("

6LoWPAN Prefix contexts

");
   for(i = 0; i < SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS; i++) {
@@ -304,12 +304,12 @@ PT_THREAD(generate_network(struct httpd_state *s))
   SEND_STRING(&s->sout, buf);
   reset_buf();
 #endif
-
+  
 #if CETIC_6LBR_TRANSPARENTBRIDGE
   add("

HW Prefixes cache

");
   for(i = 0; i < prefixCounter; i++) {
     add("%02x:%02x:%02x\n", prefixBuffer[i][0], prefixBuffer[i][1],
-        prefixBuffer[i][2]);
+	prefixBuffer[i][2]);
   }
   SEND_STRING(&s->sout, buf);
   add("

"); @@ -317,6 +317,7 @@ PT_THREAD(generate_network(struct httpd_state *s)) #endif PSOCK_END(&s->sout); } + static void add_network_cases(const uint8_t state) { diff --git a/examples/6lbr/apps/6lbr-webserver/webserver-rpl.c b/examples/6lbr/apps/6lbr-webserver/webserver-rpl.c index 810f06c9b6..22d1a85917 100644 --- a/examples/6lbr/apps/6lbr-webserver/webserver-rpl.c +++ b/examples/6lbr/apps/6lbr-webserver/webserver-rpl.c @@ -65,55 +65,57 @@ PT_THREAD(generate_rpl(struct httpd_state *s)) reset_buf(); for(i = 0; i < RPL_MAX_INSTANCES; ++i) { if(instance_table[i].used) { - add("

Instance %d

", instance_table[i].instance_id); - for(j = 0; j < RPL_MAX_DAG_PER_INSTANCE; ++j) { - if(instance_table[i].dag_table[j].used) { - add("

DODAG %d

", j); - add("DODAG ID : "); - ipaddr_add(&instance_table[i].dag_table[j].dag_id); - SEND_STRING(&s->sout, buf); - reset_buf(); - add("
Version : %d", instance_table[i].dag_table[j].version); - add("
Grounded : %s", - instance_table[i].dag_table[j].grounded ? "Yes" : "No"); - add("
Preference : %d", - instance_table[i].dag_table[j].preference); - add("
Mode of Operation : %u", instance_table[i].mop); - add("
Objective Function Code Point : %u", - instance_table[i].of->ocp); - add("
Joined : %s", - instance_table[i].dag_table[j].joined ? "Yes" : "No"); - add("
Rank : %d", instance_table[i].dag_table[j].rank); - add("
"); - SEND_STRING(&s->sout, buf); - reset_buf(); - add("
Current DIO Interval [%u-%u] : %u", - instance_table[i].dio_intmin, - instance_table[i].dio_intmin + instance_table[i].dio_intdoubl, - instance_table[i].dio_intcurrent); - if(instance_table[i].dio_send) { - add("
Next DIO : %u", (etimer_expiration_time(&instance_table[i].dio_timer.etimer) - clock_time()) / CLOCK_SECOND ); - add("
Next Interval : %u", (etimer_expiration_time(&instance_table[i].dio_timer.etimer) + instance_table[i].dio_next_delay - clock_time()) / CLOCK_SECOND ); - } else { - add("
Next DIO : -"); - add("
Next Interval : %u", (etimer_expiration_time(&instance_table[i].dio_timer.etimer) - clock_time()) / CLOCK_SECOND); - } - if (instance_table[i].dio_redundancy > 0) { - add("
DIO suppression : %s (%u >= %u)", (instance_table[i].dio_counter >= instance_table[i].dio_redundancy ? "Yes" : "No"), instance_table[i].dio_counter, instance_table[i].dio_redundancy); - } else { - add("
DIO suppression : Disabled"); - } - add("
"); + if(instance_table[i].instance_id == rpl_current_instance){ + add("

Instance %d

", instance_table[i].instance_id); + for(j = 0; j < RPL_MAX_DAG_PER_INSTANCE; ++j) { + if(instance_table[i].dag_table[j].used) { + add("

DODAG %d

", j); + add("DODAG ID : "); + ipaddr_add(&instance_table[i].dag_table[j].dag_id); + SEND_STRING(&s->sout, buf); + reset_buf(); + add("
Version : %d", instance_table[i].dag_table[j].version); + add("
Grounded : %s", + instance_table[i].dag_table[j].grounded ? "Yes" : "No"); + add("
Preference : %d", + instance_table[i].dag_table[j].preference); + add("
Mode of Operation : %u", instance_table[i].mop); + add("
Objective Function Code Point : %u", + instance_table[i].of->ocp); + add("
Joined : %s", + instance_table[i].dag_table[j].joined ? "Yes" : "No"); + add("
Rank : %d", instance_table[i].dag_table[j].rank); + add("
"); + SEND_STRING(&s->sout, buf); + reset_buf(); + add("
Current DIO Interval [%u-%u] : %u", + instance_table[i].dio_intmin, + instance_table[i].dio_intmin + instance_table[i].dio_intdoubl, + instance_table[i].dio_intcurrent); + if(instance_table[i].dio_send) { + add("
Next DIO : %u", (etimer_expiration_time(&instance_table[i].dio_timer.etimer) - clock_time()) / CLOCK_SECOND ); + add("
Next Interval : %u", (etimer_expiration_time(&instance_table[i].dio_timer.etimer) + instance_table[i].dio_next_delay - clock_time()) / CLOCK_SECOND ); + } else { + add("
Next DIO : -"); + add("
Next Interval : %u", (etimer_expiration_time(&instance_table[i].dio_timer.etimer) - clock_time()) / CLOCK_SECOND); + } + if (instance_table[i].dio_redundancy > 0) { + add("
DIO suppression : %s (%u >= %u)", (instance_table[i].dio_counter >= instance_table[i].dio_redundancy ? "Yes" : "No"), instance_table[i].dio_counter, instance_table[i].dio_redundancy); + } else { + add("
DIO suppression : Disabled"); + } + add("
"); #if RPL_CONF_STATS - add("DIO intervals : %d
", instance_table[i].dio_totint); - add("Sent DIO : %d
", instance_table[i].dio_totsend); - add("Received DIO : %d
", instance_table[i].dio_totrecv); - add("
"); + add("DIO intervals : %d
", instance_table[i].dio_totint); + add("Sent DIO : %d
", instance_table[i].dio_totsend); + add("Received DIO : %d
", instance_table[i].dio_totrecv); + add("
"); #endif - SEND_STRING(&s->sout, buf); - reset_buf(); - } - } + SEND_STRING(&s->sout, buf); + reset_buf(); + } + } + } } } if ((nvm_data.global_flags & CETIC_GLOBAL_DISABLE_CONFIG) == 0) { diff --git a/examples/6lbr/apps/6lbr-webserver/webserver-sensors.c b/examples/6lbr/apps/6lbr-webserver/webserver-sensors.c index 006503e16e..c5404cacc7 100644 --- a/examples/6lbr/apps/6lbr-webserver/webserver-sensors.c +++ b/examples/6lbr/apps/6lbr-webserver/webserver-sensors.c @@ -94,121 +94,129 @@ PT_THREAD(generate_sensors_info(struct httpd_state *s)) reset_buf(); for(i = 0; i < UIP_DS6_ROUTE_NB; i++) { - if(node_info_table[i].isused) { - add(""); - add("
state.dag; + if(dag->instance->instance_id == rpl_current_instance){ + + if(node_info_table[i].isused) { + add(""); + add("%s (", node_config_get_name(node_config_find_by_ip(&node_info_table[i].ipaddr))); - ipaddr_add(&node_info_table[i].ipaddr); - add(")"); - } else + if ( node_config_loaded ) { + add("\">%s (", node_config_get_name(node_config_find_by_ip(&node_info_table[i].ipaddr))); + ipaddr_add(&node_info_table[i].ipaddr); + add(")"); + } else #endif - { - add("\">"); - ipaddr_add(&node_info_table[i].ipaddr); - add(""); - } - - if(0) { - } else if(node_info_table[i].ipaddr.u8[8] == 0x02 - && node_info_table[i].ipaddr.u8[9] == 0x12 - && (node_info_table[i].ipaddr.u8[10] == 0x74 || - node_info_table[i].ipaddr.u8[10] == 0x75)) { - add("Moteiv Telos"); - } else if(node_info_table[i].ipaddr.u8[8] == 0x02 - && node_info_table[i].ipaddr.u8[9] == 0x1A - && node_info_table[i].ipaddr.u8[10] == 0x4C) { - add("Crossbow Sky"); - } else if(node_info_table[i].ipaddr.u8[8] == 0xC3 - && node_info_table[i].ipaddr.u8[9] == 0x0C - && node_info_table[i].ipaddr.u8[10] == 0x00) { - add("Zolertia Z1"); - } else if(node_info_table[i].ipaddr.u8[8] == 0x02 - && node_info_table[i].ipaddr.u8[9] == 0x80 - && node_info_table[i].ipaddr.u8[10] == 0xE1) { - add("STMicro"); - } else if(node_info_table[i].ipaddr.u8[8] == 0x02 - && node_info_table[i].ipaddr.u8[9] == 0x12 - && node_info_table[i].ipaddr.u8[10] == 0x4B) { - add("TI"); - } else if(node_info_table[i].ipaddr.u8[8] == 0x02 - && node_info_table[i].ipaddr.u8[9] == 0x50 - && node_info_table[i].ipaddr.u8[10] == 0xC2 - && node_info_table[i].ipaddr.u8[11] == 0xA8 - && (node_info_table[i].ipaddr.u8[12] & 0XF0) == 0xC0) { - add("Redwire Econotag I"); - } else if(node_info_table[i].ipaddr.u8[8] == 0x02 - && node_info_table[i].ipaddr.u8[9] == 0x05 - && node_info_table[i].ipaddr.u8[10] == 0x0C - && node_info_table[i].ipaddr.u8[11] == 0x2A - && node_info_table[i].ipaddr.u8[12] == 0x8C) { - add("Redwire Econotag I"); - } else if(node_info_table[i].ipaddr.u8[8] == 0xEE - && node_info_table[i].ipaddr.u8[9] == 0x47 - && node_info_table[i].ipaddr.u8[10] == 0x3C) { - if(node_info_table[i].ipaddr.u8[11] == 0x4D - && node_info_table[i].ipaddr.u8[12] == 0x12) { - add("Redwire M12"); - } else { - add("Redwire Unknown"); - } - } else if((node_info_table[i].ipaddr.u8[8] & 0x02) == 0) { - add("User defined"); - } else { - add("Unknown"); - } - SEND_STRING(&s->sout, buf); - reset_buf(); + { + add("\">"); + ipaddr_add(&node_info_table[i].ipaddr); + add(""); + } + + if(0) { + } else if(node_info_table[i].ipaddr.u8[8] == 0x02 + && node_info_table[i].ipaddr.u8[9] == 0x12 + && (node_info_table[i].ipaddr.u8[10] == 0x74 || + node_info_table[i].ipaddr.u8[10] == 0x75)) { + add("Moteiv Telos"); + } else if(node_info_table[i].ipaddr.u8[8] == 0x02 + && node_info_table[i].ipaddr.u8[9] == 0x1A + && node_info_table[i].ipaddr.u8[10] == 0x4C) { + add("Crossbow Sky"); + } else if(node_info_table[i].ipaddr.u8[8] == 0xC3 + && node_info_table[i].ipaddr.u8[9] == 0x0C + && node_info_table[i].ipaddr.u8[10] == 0x00) { + add("Zolertia Z1"); + } else if(node_info_table[i].ipaddr.u8[8] == 0x02 + && node_info_table[i].ipaddr.u8[9] == 0x80 + && node_info_table[i].ipaddr.u8[10] == 0xE1) { + add("STMicro"); + } else if(node_info_table[i].ipaddr.u8[8] == 0x02 + && node_info_table[i].ipaddr.u8[9] == 0x12 + && node_info_table[i].ipaddr.u8[10] == 0x4B) { + add("TI"); + } else if(node_info_table[i].ipaddr.u8[8] == 0x02 + && node_info_table[i].ipaddr.u8[9] == 0x50 + && node_info_table[i].ipaddr.u8[10] == 0xC2 + && node_info_table[i].ipaddr.u8[11] == 0xA8 + && (node_info_table[i].ipaddr.u8[12] & 0XF0) == 0xC0) { + add("Redwire Econotag I"); + } else if(node_info_table[i].ipaddr.u8[8] == 0x02 + && node_info_table[i].ipaddr.u8[9] == 0x05 + && node_info_table[i].ipaddr.u8[10] == 0x0C + && node_info_table[i].ipaddr.u8[11] == 0x2A + && node_info_table[i].ipaddr.u8[12] == 0x8C) { + add("Redwire Econotag I"); + } else if(node_info_table[i].ipaddr.u8[8] == 0xEE + && node_info_table[i].ipaddr.u8[9] == 0x47 + && node_info_table[i].ipaddr.u8[10] == 0x3C) { + if(node_info_table[i].ipaddr.u8[11] == 0x4D + && node_info_table[i].ipaddr.u8[12] == 0x12) { + add("Redwire M12"); + } else { + add("Redwire Unknown"); + } + } else if((node_info_table[i].ipaddr.u8[8] & 0x02) == 0) { + add("User defined"); + } else { + add("Unknown"); + } + SEND_STRING(&s->sout, buf); + reset_buf(); #if CETIC_6LBR_IP64 && CETIC_NODE_CONFIG - if(ip64_addr_is_ip64(&UIP_IP_BUF->srcipaddr)) { - node_config_t * config = node_config_find_by_ip(&node_info_table[i].ipaddr); - if(config && (nvm_data.eth_ip64_flags & CETIC_6LBR_IP64_SPECIAL_PORTS) != 0) { - add("web", config->http_port); - add("coap", config->coap_port); - } else { - add(""); - } - } else + if(ip64_addr_is_ip64(&UIP_IP_BUF->srcipaddr)) { + node_config_t * config = node_config_find_by_ip(&node_info_table[i].ipaddr); + if(config && (nvm_data.eth_ip64_flags & CETIC_6LBR_IP64_SPECIAL_PORTS) != 0) { + add("web", config->http_port); + add("coap", config->coap_port); + } else { + add(""); + } + } else #endif - { - add("web"); - add("coap"); - } - if(node_info_table[i].messages_received > 0) { - add(""); + { + add("web"); + add("coap"); + } + if(node_info_table[i].messages_received > 0) { + add(""); #if CETIC_NODE_CONFIG_HAS_NAME - if (node_config_loaded) { - add("%s (", node_config_get_name(node_config_find_by_ip(&node_info_table[i].ip_parent))); - ipaddr_add(&node_info_table[i].ip_parent); - add(")"); - } else { - ipaddr_add(&node_info_table[i].ip_parent); - } + if (node_config_loaded) { + add("%s (", node_config_get_name(node_config_find_by_ip(&node_info_table[i].ip_parent))); + ipaddr_add(&node_info_table[i].ip_parent); + add(")"); + } else { + ipaddr_add(&node_info_table[i].ip_parent); + } #else - ipaddr_add(&node_info_table[i].ip_parent); + ipaddr_add(&node_info_table[i].ip_parent); #endif - add(""); - add("%.1f%%", 100.0 * (node_info_table[i].messages_sent - node_info_table[i].up_messages_lost)/node_info_table[i].messages_sent); - add("%.1f%%", 100.0 * (node_info_table[i].messages_sent - node_info_table[i].down_messages_lost)/node_info_table[i].messages_sent); - } else { - add(""); + add(""); + add("%.1f%%", 100.0 * (node_info_table[i].messages_sent - node_info_table[i].up_messages_lost)/node_info_table[i].messages_sent); + add("%.1f%%", 100.0 * (node_info_table[i].messages_sent - node_info_table[i].down_messages_lost)/node_info_table[i].messages_sent); + } else { + add(""); + } + add("%d", + (clock_time() - node_info_table[i].last_seen) / CLOCK_SECOND); + add("%s", node_info_table[i].has_route ? "OK" : "NR"); + add(""); + SEND_STRING(&s->sout, buf); + reset_buf(); + } } - add("%d", - (clock_time() - node_info_table[i].last_seen) / CLOCK_SECOND); - add("%s", node_info_table[i].has_route ? "OK" : "NR"); - add(""); - SEND_STRING(&s->sout, buf); - reset_buf(); } } add("
"); @@ -287,42 +295,50 @@ PT_THREAD(generate_sensors_tree(struct httpd_state *s)) #endif for(i = 0; i < UIP_DS6_ROUTE_NB; i++) { if(node_info_table[i].isused) { - if(! uip_is_addr_unspecified(&node_info_table[i].ip_parent)) { + + uip_ds6_route_t * ds6_r = uip_ds6_route_lookup(&node_info_table[i].ipaddr); + if(ds6_r){ + rpl_dag_t * dag = (rpl_dag_t*)ds6_r->state.dag; + if(dag->instance->instance_id == rpl_current_instance){ + + if(! uip_is_addr_unspecified(&node_info_table[i].ip_parent)) { #if CETIC_NODE_CONFIG_HAS_NAME - node_config_t * node_config = node_config_find_by_ip(&node_info_table[i].ipaddr); - node_config_t * parent_node_config = node_config_find_by_ip(&node_info_table[i].ip_parent); - if ( node_config ) { - if ( parent_node_config ) { - add("%%22%s%%22->%%22%s%%22;", - node_config_get_name(node_config), - node_config_get_name(parent_node_config)); - } else { - add("%%22%s%%22->%%22%04hx%%22;", - node_config_get_name(node_config), - (node_info_table[i].ip_parent.u8[14] << 8) + - node_info_table[i].ip_parent.u8[15]); - } - } else { - if (parent_node_config) { - add("%%22%04hx%%22->%%22%s%%22;", - (node_info_table[i].ipaddr.u8[14] << 8) + - node_info_table[i].ipaddr.u8[15], - node_config_get_name(parent_node_config)); - } else { - add("%%22%04hx%%22->%%22%04hx%%22;", - (node_info_table[i].ipaddr.u8[14] << 8) + - node_info_table[i].ipaddr.u8[15], - (node_info_table[i].ip_parent.u8[14] << 8) + - node_info_table[i].ip_parent.u8[15]); - } - } + node_config_t * node_config = node_config_find_by_ip(&node_info_table[i].ipaddr); + node_config_t * parent_node_config = node_config_find_by_ip(&node_info_table[i].ip_parent); + if ( node_config ) { + if ( parent_node_config ) { + add("%%22%s%%22->%%22%s%%22;", + node_config_get_name(node_config), + node_config_get_name(parent_node_config)); + } else { + add("%%22%s%%22->%%22%04hx%%22;", + node_config_get_name(node_config), + (node_info_table[i].ip_parent.u8[14] << 8) + + node_info_table[i].ip_parent.u8[15]); + } + } else { + if (parent_node_config) { + add("%%22%04hx%%22->%%22%s%%22;", + (node_info_table[i].ipaddr.u8[14] << 8) + + node_info_table[i].ipaddr.u8[15], + node_config_get_name(parent_node_config)); + } else { + add("%%22%04hx%%22->%%22%04hx%%22;", + (node_info_table[i].ipaddr.u8[14] << 8) + + node_info_table[i].ipaddr.u8[15], + (node_info_table[i].ip_parent.u8[14] << 8) + + node_info_table[i].ip_parent.u8[15]); + } + } #else - add("%%22%04hx%%22->%%22%04hx%%22;", - (node_info_table[i].ipaddr.u8[14] << 8) + - node_info_table[i].ipaddr.u8[15], - (node_info_table[i].ip_parent.u8[14] << 8) + - node_info_table[i].ip_parent.u8[15]); + add("%%22%04hx%%22->%%22%04hx%%22;", + (node_info_table[i].ipaddr.u8[14] << 8) + + node_info_table[i].ipaddr.u8[15], + (node_info_table[i].ip_parent.u8[14] << 8) + + node_info_table[i].ip_parent.u8[15]); #endif + } + } } } } @@ -343,24 +359,32 @@ PT_THREAD(generate_sensors_prr(struct httpd_state *s)) add("['Sensor', 'IP', 'PRR Up', 'PRR Down'],"); for(i = 0; i < UIP_DS6_ROUTE_NB; i++) { if(node_info_table[i].isused && node_info_table[i].messages_sent > 0 && node_info_table[i].replies_sent > 0) { - float prr_up = 100.0 * (node_info_table[i].messages_sent - node_info_table[i].up_messages_lost)/node_info_table[i].messages_sent; - float prr_down = 100.0 * (node_info_table[i].replies_sent - node_info_table[i].down_messages_lost)/node_info_table[i].replies_sent; + + uip_ds6_route_t * ds6_r = uip_ds6_route_lookup(&node_info_table[i].ipaddr); + if(ds6_r){ + rpl_dag_t * dag = (rpl_dag_t*)ds6_r->state.dag; + if(dag->instance->instance_id == rpl_current_instance){ + + float prr_up = 100.0 * (node_info_table[i].messages_sent - node_info_table[i].up_messages_lost)/node_info_table[i].messages_sent; + float prr_down = 100.0 * (node_info_table[i].replies_sent - node_info_table[i].down_messages_lost)/node_info_table[i].replies_sent; #if CETIC_NODE_CONFIG_HAS_NAME - if (node_config_loaded) { - node_config_t * node_config = node_config_find_by_ip(&node_info_table[i].ipaddr); - add("[\"%s\",", node_config_get_name(node_config)); - } else + if (node_config_loaded) { + node_config_t * node_config = node_config_find_by_ip(&node_info_table[i].ipaddr); + add("[\"%s\",", node_config_get_name(node_config)); + } else #endif - { - add("[\""); - ipaddr_add(&node_info_table[i].ipaddr); - add("\","); + { + add("[\""); + ipaddr_add(&node_info_table[i].ipaddr); + add("\","); + } + add("\""); + ipaddr_add(&node_info_table[i].ipaddr); + add("\",%.1f,%.1f],", prr_up, prr_down); + SEND_STRING(&s->sout, buf); + reset_buf(); + } } - add("\""); - ipaddr_add(&node_info_table[i].ipaddr); - add("\",%.1f,%.1f],", prr_up, prr_down); - SEND_STRING(&s->sout, buf); - reset_buf(); } } add("]);var options={vAxis:{minValue: 0,maxValue: 100},legend:{position: \"none\"}};"); @@ -382,22 +406,29 @@ PT_THREAD(generate_sensors_parent_switch(struct httpd_state *s)) add("['Sensor', 'IP', 'Parent switch'],"); for(i = 0; i < UIP_DS6_ROUTE_NB; i++) { if(node_info_table[i].isused && node_info_table[i].messages_sent > 0) { + + uip_ds6_route_t * ds6_r = uip_ds6_route_lookup(&node_info_table[i].ipaddr); + if(ds6_r){ + rpl_dag_t * dag = (rpl_dag_t*)ds6_r->state.dag; + if(dag->instance->instance_id == rpl_current_instance){ #if CETIC_NODE_CONFIG_HAS_NAME - if (node_config_loaded) { - node_config_t * node_config = node_config_find_by_ip(&node_info_table[i].ipaddr); - add("[\"%s\",", node_config_get_name(node_config)); - } else + if (node_config_loaded) { + node_config_t * node_config = node_config_find_by_ip(&node_info_table[i].ipaddr); + add("[\"%s\",", node_config_get_name(node_config)); + } else #endif - { - add("[\""); - ipaddr_add(&node_info_table[i].ipaddr); - add("\","); + { + add("[\""); + ipaddr_add(&node_info_table[i].ipaddr); + add("\","); + } + add("\""); + ipaddr_add(&node_info_table[i].ipaddr); + add("\",%d],", node_info_table[i].parent_switch); + SEND_STRING(&s->sout, buf); + reset_buf(); + } } - add("\""); - ipaddr_add(&node_info_table[i].ipaddr); - add("\",%d],", node_info_table[i].parent_switch); - SEND_STRING(&s->sout, buf); - reset_buf(); } } add("]);var options={vAxis:{minValue: 0},legend:{position: \"none\"}};"); @@ -419,22 +450,28 @@ PT_THREAD(generate_sensors_hop_count(struct httpd_state *s)) add("['Sensor', 'IP', 'Hop count'],"); for(i = 0; i < UIP_DS6_ROUTE_NB; i++) { if(node_info_table[i].isused && node_info_table[i].messages_sent > 0) { + uip_ds6_route_t * ds6_r = uip_ds6_route_lookup(&node_info_table[i].ipaddr); + if(ds6_r){ + rpl_dag_t * dag = (rpl_dag_t*)ds6_r->state.dag; + if(dag->instance->instance_id == rpl_current_instance){ #if CETIC_NODE_CONFIG_HAS_NAME - if (node_config_loaded) { - node_config_t * node_config = node_config_find_by_ip(&node_info_table[i].ipaddr); - add("[\"%s\",", node_config_get_name(node_config)); - } else + if (node_config_loaded) { + node_config_t * node_config = node_config_find_by_ip(&node_info_table[i].ipaddr); + add("[\"%s\",", node_config_get_name(node_config)); + } else #endif - { - add("[\""); - ipaddr_add(&node_info_table[i].ipaddr); - add("\","); + { + add("[\""); + ipaddr_add(&node_info_table[i].ipaddr); + add("\","); + } + add("\""); + ipaddr_add(&node_info_table[i].ipaddr); + add("\",%d],", node_info_table[i].hop_count); + SEND_STRING(&s->sout, buf); + reset_buf(); + } } - add("\""); - ipaddr_add(&node_info_table[i].ipaddr); - add("\",%d],", node_info_table[i].hop_count); - SEND_STRING(&s->sout, buf); - reset_buf(); } } add("]);var options={vAxis:{minValue: 0},legend:{position: \"none\"}};"); diff --git a/examples/6lbr/apps/6lbr-webserver/webserver-utils.c b/examples/6lbr/apps/6lbr-webserver/webserver-utils.c index 65f6e4b8ae..dec894eb5e 100644 --- a/examples/6lbr/apps/6lbr-webserver/webserver-utils.c +++ b/examples/6lbr/apps/6lbr-webserver/webserver-utils.c @@ -45,6 +45,8 @@ #include +#include + /*---------------------------------------------------------------------------*/ #define WEBSERVER_CONF_LOADTIME 1 @@ -220,8 +222,33 @@ key_conv(const char *str, uint8_t * key, int size) } /*---------------------------------------------------------------------------*/ static void +add_instances_menu(struct httpd_state *s) +{ + add("
"); + httpd_group_t *f; + for(f = httpd_instance_head(); f != NULL; f = f->next) { + add("
"); + if(s->script != NULL && f == s->script->group) { + add("%s", f->title); + } else { + if (strcmp(f->title, "+") == 0 || strcmp(f->title, "-") == 0) + add("%s", f->title, f->title); + else { + if (rpl_current_instance == atoi(f->title)) + add("%s", f->title); + else + add("%s", f->title, f->title); + } + } + add("
"); + } + add("
"); +} +/*---------------------------------------------------------------------------*/ +static void add_menu(struct httpd_state *s) { + add("
"); httpd_group_t *f; for(f = httpd_group_head(); f != NULL; f = f->next) { add("
"); @@ -232,6 +259,7 @@ add_menu(struct httpd_state *s) } add("
"); } + add("
"); } static void @@ -270,6 +298,9 @@ PT_THREAD(generate_top(struct httpd_state *s)) add(BODY); SEND_STRING(&s->sout, buf); reset_buf(); + add_instances_menu(s); + SEND_STRING(&s->sout, buf); + reset_buf(); add_menu(s); SEND_STRING(&s->sout, buf); reset_buf(); diff --git a/examples/6lbr/apps/6lbr-webserver/webserver.c b/examples/6lbr/apps/6lbr-webserver/webserver.c index 22558dda9b..8d372e02b3 100644 --- a/examples/6lbr/apps/6lbr-webserver/webserver.c +++ b/examples/6lbr/apps/6lbr-webserver/webserver.c @@ -45,6 +45,7 @@ #include "nvm-config.h" #include "log-6lbr.h" +HTTPD_GROUPS(instances_group); HTTPD_GROUP(main_group, "System"); HTTPD_GROUP(sensors_group, "Sensors"); HTTPD_GROUP(status_group, "Status"); @@ -52,6 +53,13 @@ HTTPD_GROUP(config_group, "Configuration"); HTTPD_GROUP(statistics_group, "Statistics"); HTTPD_GROUP(admin_group, "Administration"); +HTTPD_CGI_CALL_NAME(webserver_instances) +HTTPD_CGI_CMD_NAME(webserver_instances_select_cmd) +HTTPD_CGI_CMD_NAME(webserver_instance_rm_cmd) +HTTPD_CGI_CMD_NAME(webserver_instance_new_cmd) +/* +HTTPD_CGI_CALL_NAME(webserver_instances_rm) +*/ HTTPD_CGI_CALL_NAME(webserver_main) HTTPD_CGI_CALL_NAME(webserver_network) HTTPD_CGI_CMD_NAME(webserver_network_route_add_cmd) @@ -100,6 +108,7 @@ void webserver_init(void) { httpd_init(); + httpd_instances_add(&instances_group,rpl_instances); httpd_group_add(&main_group); httpd_group_add(&sensors_group); @@ -108,6 +117,11 @@ webserver_init(void) httpd_group_add(&statistics_group); httpd_group_add(&admin_group); + + httpd_group_add_page(&instances_group, &webserver_instances); + httpd_cgi_command_add(&webserver_instances_select_cmd); + httpd_cgi_command_add(&webserver_instance_rm_cmd); + httpd_cgi_command_add(&webserver_instance_new_cmd); httpd_group_add_page(&main_group, &webserver_main); httpd_group_add_page(&config_group, &webserver_config); #if CETIC_NODE_INFO diff --git a/examples/6lbr/apps/6lbr-webserver/webserver.h b/examples/6lbr/apps/6lbr-webserver/webserver.h index ec8ee8e9c2..6ad7978d5b 100644 --- a/examples/6lbr/apps/6lbr-webserver/webserver.h +++ b/examples/6lbr/apps/6lbr-webserver/webserver.h @@ -39,6 +39,7 @@ #include "httpd-cgi.h" +HTTPD_GROUPS_NAME(instances_group); HTTPD_GROUP_NAME(main_group); HTTPD_GROUP_NAME(sensors_group); HTTPD_GROUP_NAME(status_group); diff --git a/examples/6lbr/cetic-6lbr.c b/examples/6lbr/cetic-6lbr.c index 0776a70c07..ef9c91c76c 100644 --- a/examples/6lbr/cetic-6lbr.c +++ b/examples/6lbr/cetic-6lbr.c @@ -459,7 +459,6 @@ PROCESS_THREAD(cetic_6lbr_process, ev, data) platform_init(); platform_load_config(CONFIG_LEVEL_LOAD); - #if !LOG6LBR_STATIC if(nvm_data.log_level != 0xFF) { Log6lbr_level = nvm_data.log_level; @@ -512,8 +511,17 @@ PROCESS_THREAD(cetic_6lbr_process, ev, data) #endif packet_filter_init(); - - cetic_6lbr_init(); + if(rpl_instances > 0){ + int i; + for(i=0;i 0){ + int i; + for(i=0;i Thu, 12 May 2016 16:32:25 +0200 + cetic-6lbr (1.3.3) unstable; urgency=low - * Initial Release. + * 6LoWPAN/RPL + Multi DODAG bugfixes + Support DAG parameter updates + Do not drop partially received segmented packets + * Slip-Radio + Better Z1 and CC2538 support + Check message format + Add more baud rates + * Network + Fix multicast snooping on bridge interface + Fix bridge hw address + Fix tap interface down issue + * BeagleBone + Add Debian support + Add USB scanning issue workaround - -- 6LBR Team <6lbr@cetic.be> Wed, 25 Mar 2015 13:27:37 +0000 + -- 6lbr-team <6lbr@cetic.be> Fri, 08 May 2015 12:23:54 +0000 diff --git a/examples/6lbr/debian/control b/examples/6lbr/debian/control index bd2d26ce31..214bf9d5e2 100644 --- a/examples/6lbr/debian/control +++ b/examples/6lbr/debian/control @@ -1,5 +1,5 @@ Source: cetic-6lbr -Section: network +Section: net Priority: extra Maintainer: 6LBR Team <6lbr@cetic.be> Build-Depends: debhelper (>= 8.0.0) @@ -8,6 +8,7 @@ Homepage: https://github.com/cetic/6lbr Package: cetic-6lbr Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, ${misc:Depends}, bridge-utils Description: CETIC 6LoWPAN Border Router - CETIC 6LBR is an enhanced version of Contiki's 6LoWPAN Border Router solution. rIit provides network configuration and monitoring and support out of the box redundant and distributed operating modes. + CETIC 6LBR is an enhanced version of Contiki's 6LoWPAN Border Router solution. + It provides network configuration and monitoring, and supports out of the box redundant and distributed operating modes. diff --git a/examples/6lbr/debian/rules b/examples/6lbr/debian/rules index 4456cf852c..1d476de94f 100755 --- a/examples/6lbr/debian/rules +++ b/examples/6lbr/debian/rules @@ -13,9 +13,13 @@ export DH_VERBOSE=1 dh $@ override_dh_auto_build: - make all_native + make TARGET=native all make plugins make tools +# Add extra installation target for plugins +override_dh_auto_install: + dh_auto_install -- plugins-install + override_dh_installinit: dh_installinit --onlyscripts --name 6lbr diff --git a/examples/6lbr/platform/native/native-config.c b/examples/6lbr/platform/native/native-config.c index 4a48150e16..4b9d34ff4e 100644 --- a/examples/6lbr/platform/native/native-config.c +++ b/examples/6lbr/platform/native/native-config.c @@ -57,7 +57,7 @@ static native_config_callback_t network_route_config_cb; #endif /*---------------------------------------------------------------------------*/ static int native_config_global_handler(config_level_t level, void* user, const char* section, const char* name, - const char* value) { + const char* value) { if(!name) { //ignore end of section return 1; diff --git a/examples/6lbr/platform/native/native-nvm.c b/examples/6lbr/platform/native/native-nvm.c index 1e37d9729c..17b53e0a3c 100644 --- a/examples/6lbr/platform/native/native-nvm.c +++ b/examples/6lbr/platform/native/native-nvm.c @@ -41,6 +41,10 @@ #include #include #include +#include +#include +#include + #include "log-6lbr.h" #include "nvm-itf.h" @@ -53,31 +57,46 @@ char const *nvm_file = NULL; void nvm_data_read(void) -{ - LOG6LBR_DEBUG("Opening nvm file '%s'\n", nvm_file); +{ + LOG6LBR_INFO("Opening nvm file '%s'\n", nvm_file); memset(nvm_mem, 0xff, NVM_SIZE); int s = open(nvm_file, O_RDONLY); if(s > 0) { - if(read(s, nvm_mem, NVM_SIZE) < 0) { - LOG6LBR_ERROR("Failed to read NVM"); + struct stat buf_stat; + fstat(s,&buf_stat); + rpl_instances = 0; + rpl_instances = buf_stat.st_size / NVM_SIZE; + nvms_data = (nvm_data_t*)malloc(rpl_instances * sizeof(nvm_data_t)); + int i; + for(i=0;i 0) { - if(write(s, nvm_mem, NVM_SIZE) != NVM_SIZE) { - LOG6LBR_ERROR("Failed to write to NVM"); + int i; + for(i=0;i