Merge branch 'contiki' into osd

This commit is contained in:
Harald Pichler 2014-12-07 15:24:00 +01:00
commit a02be51f08
274 changed files with 1159 additions and 1285 deletions

View file

@ -14,10 +14,6 @@ ifeq ($(TARGET),)
endif endif
endif endif
ifeq ($(UIP_CONF_IPV6),1)
CFLAGS += -DUIP_CONF_IPV6=1
endif
ifeq ($(DEFINES),) ifeq ($(DEFINES),)
-include Makefile.$(TARGET).defines -include Makefile.$(TARGET).defines
ifneq ($(DEFINES),) ifneq ($(DEFINES),)
@ -67,6 +63,43 @@ CFLAGS += -DCONTIKI=1 -DCONTIKI_TARGET_$(TARGET_UPPERCASE)=1
MODULES += core/sys core/dev core/lib MODULES += core/sys core/dev core/lib
# Include IPv6, IPv4, and/or Rime
HAS_STACK = 0
ifeq ($(CONTIKI_WITH_IPV4),1)
HAS_STACK = 1
CFLAGS += -DNETSTACK_CONF_WITH_IPV4=1
MODULES += core/net/ipv4 core/net/ip
endif
ifeq ($(CONTIKI_WITH_RIME),1)
HAS_STACK = 1
CFLAGS += -DNETSTACK_CONF_WITH_RIME=1
MODULES += core/net/rime
endif
# Make IPv6 the default stack
ifeq ($(HAS_STACK),0)
ifneq ($(CONTIKI_WITH_IPV6),0)
CONTIKI_WITH_IPV6 = 1
endif
endif
ifeq ($(CONTIKI_WITH_IPV6),1)
CFLAGS += -DNETSTACK_CONF_WITH_IPV6=1
ifneq ($(CONTIKI_WITH_RPL),0)
CONTIKI_WITH_RPL = 1
endif
MODULES += core/net/ipv6 core/net/ip
endif
ifeq ($(CONTIKI_WITH_RPL),1)
CFLAGS += -DUIP_CONF_IPV6_RPL=1
MODULES += core/net/rpl
else
CFLAGS += -DUIP_CONF_IPV6_RPL=0
endif
CONTIKI_SOURCEFILES += $(CONTIKIFILES) CONTIKI_SOURCEFILES += $(CONTIKIFILES)
CONTIKIDIRS += ${addprefix $(CONTIKI)/core/,dev lib net net/llsec net/mac net/rime \ CONTIKIDIRS += ${addprefix $(CONTIKI)/core/,dev lib net net/llsec net/mac net/rime \

View file

@ -67,7 +67,7 @@
/* direct access into the buffer */ /* direct access into the buffer */
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN]) #define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
#define UIP_UDP_BUF ((struct uip_udp_hdr *)&uip_buf[uip_l2_l3_hdr_len]) #define UIP_UDP_BUF ((struct uip_udp_hdr *)&uip_buf[uip_l2_l3_hdr_len])
#else #else
#define UIP_UDP_BUF ((struct uip_udp_hdr *)&uip_buf[UIP_LLH_LEN + UIP_IPH_LEN]) #define UIP_UDP_BUF ((struct uip_udp_hdr *)&uip_buf[UIP_LLH_LEN + UIP_IPH_LEN])

View file

@ -51,7 +51,7 @@ struct powertrace_sniff_stats {
uint32_t num_input, num_output; uint32_t num_input, num_output;
uint32_t input_txtime, input_rxtime; uint32_t input_txtime, input_rxtime;
uint32_t output_txtime, output_rxtime; uint32_t output_txtime, output_rxtime;
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
uint16_t proto; /* includes proto + possibly flags */ uint16_t proto; /* includes proto + possibly flags */
#endif #endif
uint16_t channel; uint16_t channel;
@ -135,7 +135,7 @@ powertrace_print(char *str)
for(s = list_head(stats_list); s != NULL; s = list_item_next(s)) { for(s = list_head(stats_list); s != NULL; s = list_item_next(s)) {
#if ! UIP_CONF_IPV6 #if ! NETSTACK_CONF_WITH_IPV6
printf("%s %lu SP %d.%d %lu %u %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu (channel %d radio %d.%02d%% / %d.%02d%%)\n", printf("%s %lu SP %d.%d %lu %u %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu (channel %d radio %d.%02d%% / %d.%02d%%)\n",
str, clock_time(), linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1], seqno, str, clock_time(), linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1], seqno,
s->channel, s->channel,
@ -249,7 +249,7 @@ add_packet_stats(int input_or_output)
put it on the list. */ put it on the list. */
for(s = list_head(stats_list); s != NULL; s = list_item_next(s)) { for(s = list_head(stats_list); s != NULL; s = list_item_next(s)) {
if(s->channel == packetbuf_attr(PACKETBUF_ATTR_CHANNEL) if(s->channel == packetbuf_attr(PACKETBUF_ATTR_CHANNEL)
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
&& s->proto == packetbuf_attr(PACKETBUF_ATTR_NETWORK_ID) && s->proto == packetbuf_attr(PACKETBUF_ATTR_NETWORK_ID)
#endif #endif
) { ) {
@ -262,7 +262,7 @@ add_packet_stats(int input_or_output)
if(s != NULL) { if(s != NULL) {
memset(s, 0, sizeof(struct powertrace_sniff_stats)); memset(s, 0, sizeof(struct powertrace_sniff_stats));
s->channel = packetbuf_attr(PACKETBUF_ATTR_CHANNEL); s->channel = packetbuf_attr(PACKETBUF_ATTR_CHANNEL);
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
s->proto = packetbuf_attr(PACKETBUF_ATTR_NETWORK_ID); s->proto = packetbuf_attr(PACKETBUF_ATTR_NETWORK_ID);
#endif #endif
list_add(stats_list, s); list_add(stats_list, s);
@ -283,7 +283,7 @@ output_sniffer(int mac_status)
add_packet_stats(OUTPUT); add_packet_stats(OUTPUT);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if ! UIP_CONF_IPV6 #if ! NETSTACK_CONF_WITH_IPV6
static void static void
sniffprint(char *prefix, int seqno) sniffprint(char *prefix, int seqno)
{ {

View file

@ -379,3 +379,5 @@ PROCESS_THREAD(servreg_hack_process, ev, data)
PROCESS_END(); PROCESS_END();
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @} */

View file

@ -1,19 +1,35 @@
shell_src = shell.c shell-reboot.c \ shell_src = shell.c shell-reboot.c shell-vars.c shell-ps.c \
shell-vars.c shell-ps.c shell-rime.c shell-sendtest.c \
shell-blink.c shell-text.c shell-time.c \ shell-blink.c shell-text.c shell-time.c \
shell-file.c shell-netfile.c shell-run.c \ shell-file.c shell-run.c \
shell-rime-ping.c shell-rime-sniff.c shell-rime-netcmd.c \ shell-coffee.c \
shell-rime-debug.c shell-rime-debug-runicast.c shell-coffee.c \
shell-wget.c shell-httpd.c shell-irc.c \
shell-power.c \ shell-power.c \
shell-tcpsend.c shell-udpsend.c shell-ping.c shell-netstat.c \
shell-rime-sendcmd.c shell-download.c shell-rime-neighbors.c \
shell-rime-unicast.c \
shell-base64.c \ shell-base64.c \
shell-netperf.c shell-memdebug.c \ shell-memdebug.c \
shell-powertrace.c shell-collect-view.c shell-crc.c shell-powertrace.c shell-crc.c
shell_dsc = shell-dsc.c shell_dsc = shell-dsc.c
ifeq ($(CONTIKI_WITH_RIME),1)
shell_src += shell-rime.c shell-sendtest.c shell-netfile.c \
shell-rime-ping.c shell-rime-sniff.c shell-rime-netcmd.c \
shell-rime-debug.c shell-rime-debug-runicast.c \
shell-rime-sendcmd.c shell-download.c shell-rime-neighbors.c \
shell-rime-unicast.c shell-netperf.c \
shell-collect-view.c
APPS += collect-view
include $(CONTIKI)/apps/collect-view/Makefile.collect-view
endif
ifeq ($(CONTIKI_WITH_IPV4),1)
SHELL_WITH_IP = 1
endif
ifeq ($(CONTIKI_WITH_IPV6),1)
SHELL_WITH_IP = 1
endif
ifeq ($(SHELL_WITH_IP),1)
shell_src += shell-wget.c shell-httpd.c shell-irc.c \
shell-tcpsend.c shell-udpsend.c shell-ping.c shell-netstat.c
APPS += webserver APPS += webserver
include $(CONTIKI)/apps/webserver/Makefile.webserver include $(CONTIKI)/apps/webserver/Makefile.webserver
ifndef PLATFORM_BUILD ifndef PLATFORM_BUILD
@ -38,13 +54,11 @@ ifndef PLATFORM_BUILD
override telnet_src = telnet.c override telnet_src = telnet.c
endif endif
endif
APPS += powertrace APPS += powertrace
include $(CONTIKI)/apps/powertrace/Makefile.powertrace include $(CONTIKI)/apps/powertrace/Makefile.powertrace
APPS += collect-view
include $(CONTIKI)/apps/collect-view/Makefile.collect-view
ifeq ($(TARGET),sky) ifeq ($(TARGET),sky)
shell_src += shell-sky.c shell-exec.c shell_src += shell-sky.c shell-exec.c
endif endif

View file

@ -62,7 +62,7 @@ static unsigned char running;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void static void
send_ping(uip_ipaddr_t *dest_addr) send_ping(uip_ipaddr_t *dest_addr)
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
{ {
static uint16_t count; static uint16_t count;
UIP_IP_BUF->vtc = 0x60; UIP_IP_BUF->vtc = 0x60;
@ -92,7 +92,7 @@ send_ping(uip_ipaddr_t *dest_addr)
tcpip_ipv6_output(); tcpip_ipv6_output();
} }
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
{ {
static uint16_t ipid = 0; static uint16_t ipid = 0;
static uint16_t seqno = 0; static uint16_t seqno = 0;
@ -128,7 +128,7 @@ send_ping(uip_ipaddr_t *dest_addr)
tcpip_output(); tcpip_output();
} }
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_ping_process, ev, data) PROCESS_THREAD(shell_ping_process, ev, data)
{ {

View file

@ -64,7 +64,7 @@ webserver_log_file(uip_ipaddr_t *requester, char *file)
{ {
/* Print out IP address of requesting host. */ /* Print out IP address of requesting host. */
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
#if WEBSERVER_CONF_ADDRESSES #if WEBSERVER_CONF_ADDRESSES
char buf[48]; char buf[48];
uint8_t j; uint8_t j;
@ -78,7 +78,7 @@ webserver_log_file(uip_ipaddr_t *requester, char *file)
char buf[20]; char buf[20];
sprintf(buf, "%d.%d.%d.%d: ", requester->u8[0], requester->u8[1], sprintf(buf, "%d.%d.%d.%d: ", requester->u8[0], requester->u8[1],
requester->u8[2], requester->u8[3]); requester->u8[2], requester->u8[3]);
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
//log_message(buf, file); //log_message(buf, file);
printf("%s%s\n", buf, file); printf("%s%s\n", buf, file);
} }

View file

@ -157,7 +157,7 @@ make_tcp_stats(void *arg)
struct httpd_state *s = (struct httpd_state *)arg; struct httpd_state *s = (struct httpd_state *)arg;
conn = &uip_conns[s->u.count]; conn = &uip_conns[s->u.count];
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
char buf[48]; char buf[48];
httpd_sprint_ip6(conn->ripaddr, buf); httpd_sprint_ip6(conn->ripaddr, buf);
return snprintf((char *)uip_appdata, uip_mss(), return snprintf((char *)uip_appdata, uip_mss(),
@ -184,7 +184,7 @@ make_tcp_stats(void *arg)
conn->timer, conn->timer,
(uip_outstanding(conn))? '*':' ', (uip_outstanding(conn))? '*':' ',
(uip_stopped(conn))? '!':' '); (uip_stopped(conn))? '!':' ');
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static static
@ -226,7 +226,7 @@ PT_THREAD(processes(struct httpd_state *s, char *ptr))
} }
PSOCK_END(&s->sout); PSOCK_END(&s->sout);
} }
#if WEBSERVER_CONF_STATUSPAGE && UIP_CONF_IPV6 #if WEBSERVER_CONF_STATUSPAGE && NETSTACK_CONF_WITH_IPV6
/* These cgi's are invoked by the status.shtml page in /apps/webserver/httpd-fs. /* These cgi's are invoked by the status.shtml page in /apps/webserver/httpd-fs.
* To keep the webserver build small that 160 byte page is not present in the * To keep the webserver build small that 160 byte page is not present in the
* default httpd-fsdata.c file. Run the PERL script /../../tools/makefsdata from the * default httpd-fsdata.c file. Run the PERL script /../../tools/makefsdata from the
@ -357,7 +357,7 @@ httpd_cgi_add(struct httpd_cgi_call *c)
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if WEBSERVER_CONF_STATUSPAGE && UIP_CONF_IPV6 #if WEBSERVER_CONF_STATUSPAGE && NETSTACK_CONF_WITH_IPV6
static const char adrs_name[] HTTPD_STRING_ATTR = "addresses"; static const char adrs_name[] HTTPD_STRING_ATTR = "addresses";
static const char nbrs_name[] HTTPD_STRING_ATTR = "neighbors"; static const char nbrs_name[] HTTPD_STRING_ATTR = "neighbors";
static const char rtes_name[] HTTPD_STRING_ATTR = "routes"; static const char rtes_name[] HTTPD_STRING_ATTR = "routes";
@ -365,7 +365,7 @@ static const char rtes_name[] HTTPD_STRING_ATTR = "routes";
HTTPD_CGI_CALL(file, file_name, file_stats); HTTPD_CGI_CALL(file, file_name, file_stats);
HTTPD_CGI_CALL(tcp, tcp_name, tcp_stats); HTTPD_CGI_CALL(tcp, tcp_name, tcp_stats);
HTTPD_CGI_CALL(proc, proc_name, processes); HTTPD_CGI_CALL(proc, proc_name, processes);
#if WEBSERVER_CONF_STATUSPAGE && UIP_CONF_IPV6 #if WEBSERVER_CONF_STATUSPAGE && NETSTACK_CONF_WITH_IPV6
HTTPD_CGI_CALL(adrs, adrs_name, addresses); HTTPD_CGI_CALL(adrs, adrs_name, addresses);
HTTPD_CGI_CALL(nbrs, nbrs_name, neighbors); HTTPD_CGI_CALL(nbrs, nbrs_name, neighbors);
HTTPD_CGI_CALL(rtes, rtes_name, routes); HTTPD_CGI_CALL(rtes, rtes_name, routes);
@ -377,7 +377,7 @@ httpd_cgi_init(void)
httpd_cgi_add(&file); httpd_cgi_add(&file);
httpd_cgi_add(&tcp); httpd_cgi_add(&tcp);
httpd_cgi_add(&proc); httpd_cgi_add(&proc);
#if WEBSERVER_CONF_STATUSPAGE && UIP_CONF_IPV6 #if WEBSERVER_CONF_STATUSPAGE && NETSTACK_CONF_WITH_IPV6
httpd_cgi_add(&adrs); httpd_cgi_add(&adrs);
httpd_cgi_add(&nbrs); httpd_cgi_add(&nbrs);
httpd_cgi_add(&rtes); httpd_cgi_add(&rtes);

View file

@ -342,7 +342,7 @@ httpd_init(void)
memb_init(&conns); memb_init(&conns);
httpd_cgi_init(); httpd_cgi_init();
} }
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
uint8_t uint8_t
httpd_sprint_ip6(uip_ip6addr_t addr, char * result) httpd_sprint_ip6(uip_ip6addr_t addr, char * result)
@ -374,5 +374,5 @@ httpd_sprint_ip6(uip_ip6addr_t addr, char * result)
*result=0; *result=0;
return (result - starting); return (result - starting);
} }
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/

View file

@ -59,8 +59,8 @@ struct httpd_state {
void httpd_init(void); void httpd_init(void);
void httpd_appcall(void *state); void httpd_appcall(void *state);
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
uint8_t httpd_sprint_ip6(uip_ip6addr_t addr, char * result); uint8_t httpd_sprint_ip6(uip_ip6addr_t addr, char * result);
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
#endif /* HTTPD_H_ */ #endif /* HTTPD_H_ */

View file

@ -67,7 +67,7 @@ webserver_log_file(uip_ipaddr_t *requester, char *file)
#if LOG_CONF_ENABLED #if LOG_CONF_ENABLED
/* Print out IP address of requesting host. */ /* Print out IP address of requesting host. */
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
char buf[48]; char buf[48];
uint8_t j; uint8_t j;
j=httpd_sprint_ip6((uip_ip6addr_t)*requester, buf); j=httpd_sprint_ip6((uip_ip6addr_t)*requester, buf);
@ -76,7 +76,7 @@ webserver_log_file(uip_ipaddr_t *requester, char *file)
char buf[20]; char buf[20];
sprintf(buf, "%d.%d.%d.%d: ", requester->u8[0], requester->u8[1], sprintf(buf, "%d.%d.%d.%d: ", requester->u8[0], requester->u8[1],
requester->u8[2], requester->u8[3]); requester->u8[2], requester->u8[3]);
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
log_message(buf, file); log_message(buf, file);
#endif /* LOG_CONF_ENABLED */ #endif /* LOG_CONF_ENABLED */

View file

@ -123,11 +123,11 @@
* project-specific configuration to save memory. * project-specific configuration to save memory.
*/ */
/* UIP_CONF_IPV6 specifies whether or not IPv6 should be used. If IPv6 /* NETSTACK_CONF_WITH_IPV6 specifies whether or not IPv6 should be used. If IPv6
is not used, IPv4 is used instead. */ is not used, IPv4 is used instead. */
#ifndef UIP_CONF_IPV6 #ifndef NETSTACK_CONF_WITH_IPV6
#define UIP_CONF_IPV6 0 #define NETSTACK_CONF_WITH_IPV6 0
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
/* UIP_CONF_BUFFER_SIZE specifies how much memory should be reserved /* UIP_CONF_BUFFER_SIZE specifies how much memory should be reserved
for the uIP packet buffer. This sets an upper bound on the largest for the uIP packet buffer. This sets an upper bound on the largest

View file

@ -45,10 +45,10 @@
#include "net/ip/uip-udp-packet.h" #include "net/ip/uip-udp-packet.h"
#include "net/ip/simple-udp.h" #include "net/ip/simple-udp.h"
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
#include "net/ipv6/uip-icmp6.h" #include "net/ipv6/uip-icmp6.h"
#include "net/ipv6/uip-ds6.h" #include "net/ipv6/uip-ds6.h"
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
#include "net/ip/resolv.h" #include "net/ip/resolv.h"

View file

@ -96,7 +96,6 @@ slip_set_input_callback(void (*c)(void))
/* slip_send: forward (IPv4) packets with {UIP_FW_NETIF(..., slip_send)} /* slip_send: forward (IPv4) packets with {UIP_FW_NETIF(..., slip_send)}
* was used in slip-bridge.c * was used in slip-bridge.c
*/ */
//#if WITH_UIP
uint8_t uint8_t
slip_send(void) slip_send(void)
{ {
@ -125,7 +124,6 @@ slip_send(void)
return UIP_FW_OK; return UIP_FW_OK;
} }
//#endif /* WITH_UIP */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
uint8_t uint8_t
slip_write(const void *_ptr, int len) slip_write(const void *_ptr, int len)
@ -264,7 +262,7 @@ PROCESS_THREAD(slip_process, ev, data)
/* Move packet from rxbuf to buffer provided by uIP. */ /* Move packet from rxbuf to buffer provided by uIP. */
uip_len = slip_poll_handler(&uip_buf[UIP_LLH_LEN], uip_len = slip_poll_handler(&uip_buf[UIP_LLH_LEN],
UIP_BUFSIZE - UIP_LLH_LEN); UIP_BUFSIZE - UIP_LLH_LEN);
#if !UIP_CONF_IPV6 #if !NETSTACK_CONF_WITH_IPV6
if(uip_len == 4 && strncmp((char*)&uip_buf[UIP_LLH_LEN], "?IPA", 4) == 0) { if(uip_len == 4 && strncmp((char*)&uip_buf[UIP_LLH_LEN], "?IPA", 4) == 0) {
char buf[8]; char buf[8];
memcpy(&buf[0], "=IPA", 4); memcpy(&buf[0], "=IPA", 4);
@ -298,7 +296,7 @@ PROCESS_THREAD(slip_process, ev, data)
uip_len = 0; uip_len = 0;
SLIP_STATISTICS(slip_ip_drop++); SLIP_STATISTICS(slip_ip_drop++);
} }
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
if(uip_len > 0) { if(uip_len > 0) {
if(input_callback) { if(input_callback) {
input_callback(); input_callback();
@ -309,7 +307,7 @@ PROCESS_THREAD(slip_process, ev, data)
tcpip_input(); tcpip_input();
#endif #endif
} }
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
} }
PROCESS_END(); PROCESS_END();

View file

@ -151,8 +151,13 @@ mmem_free(struct mmem *m)
void void
mmem_init(void) mmem_init(void)
{ {
static int inited = 0;
if(inited) {
return;
}
list_init(mmemlist); list_init(mmemlist);
avail_memory = MMEM_SIZE; avail_memory = MMEM_SIZE;
inited = 1;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/

View file

@ -185,7 +185,7 @@ strcasecmp(const char *s1, const char *s2)
#define DNS_TYPE_ANY 255 #define DNS_TYPE_ANY 255
#define DNS_TYPE_NSEC 47 #define DNS_TYPE_NSEC 47
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
#define NATIVE_DNS_TYPE DNS_TYPE_AAAA /* IPv6 */ #define NATIVE_DNS_TYPE DNS_TYPE_AAAA /* IPv6 */
#else #else
#define NATIVE_DNS_TYPE DNS_TYPE_A /* IPv4 */ #define NATIVE_DNS_TYPE DNS_TYPE_A /* IPv4 */
@ -227,19 +227,16 @@ struct dns_hdr {
uint16_t numextrarr; uint16_t numextrarr;
}; };
#define RESOLV_ENCODE_INDEX(i) (uip_htons(i+1))
#define RESOLV_DECODE_INDEX(i) (unsigned char)(uip_ntohs(i-1))
/** These default values for the DNS server are Google's public DNS: /** These default values for the DNS server are Google's public DNS:
* <https://developers.google.com/speed/public-dns/docs/using> * <https://developers.google.com/speed/public-dns/docs/using>
*/ */
static uip_ipaddr_t resolv_default_dns_server = static uip_ipaddr_t resolv_default_dns_server =
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
{ { 0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00, { { 0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x88 } }; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x88 } };
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
{ { 8, 8, 8, 8 } }; { { 8, 8, 8, 8 } };
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
/** \internal The DNS answer message structure. */ /** \internal The DNS answer message structure. */
struct dns_answer { struct dns_answer {
@ -249,7 +246,7 @@ struct dns_answer {
uint16_t class; uint16_t class;
uint16_t ttl[2]; uint16_t ttl[2];
uint16_t len; uint16_t len;
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
uint8_t ipaddr[16]; uint8_t ipaddr[16];
#else #else
uint8_t ipaddr[4]; uint8_t ipaddr[4];
@ -264,6 +261,7 @@ struct namemap {
#define STATE_DONE 4 #define STATE_DONE 4
uint8_t state; uint8_t state;
uint8_t tmr; uint8_t tmr;
uint16_t id;
uint8_t retries; uint8_t retries;
uint8_t seqno; uint8_t seqno;
#if RESOLV_SUPPORTS_RECORD_EXPIRATION #if RESOLV_SUPPORTS_RECORD_EXPIRATION
@ -315,13 +313,13 @@ enum {
static uint8_t mdns_state; static uint8_t mdns_state;
static const uip_ipaddr_t resolv_mdns_addr = static const uip_ipaddr_t resolv_mdns_addr =
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
{ { 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, { { 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfb } }; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfb } };
#include "net/ipv6/uip-ds6.h" #include "net/ipv6/uip-ds6.h"
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
{ { 224, 0, 0, 251 } }; { { 224, 0, 0, 251 } };
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
static int mdns_needs_host_announce; static int mdns_needs_host_announce;
PROCESS(mdns_probe_process, "mDNS probe"); PROCESS(mdns_probe_process, "mDNS probe");
@ -506,9 +504,7 @@ start_name_collision_check(clock_time_t after)
static unsigned char * static unsigned char *
mdns_write_announce_records(unsigned char *queryptr, uint8_t *count) mdns_write_announce_records(unsigned char *queryptr, uint8_t *count)
{ {
struct dns_answer *ans; #if NETSTACK_CONF_WITH_IPV6
#if UIP_CONF_IPV6
uint8_t i; uint8_t i;
for(i = 0; i < UIP_DS6_ADDR_NB; ++i) { for(i = 0; i < UIP_DS6_ADDR_NB; ++i) {
@ -524,7 +520,6 @@ mdns_write_announce_records(unsigned char *queryptr, uint8_t *count)
*queryptr++ = 0xc0; *queryptr++ = 0xc0;
*queryptr++ = sizeof(struct dns_hdr); *queryptr++ = sizeof(struct dns_hdr);
} }
ans = (struct dns_answer *)queryptr;
*queryptr++ = (uint8_t) ((NATIVE_DNS_TYPE) >> 8); *queryptr++ = (uint8_t) ((NATIVE_DNS_TYPE) >> 8);
*queryptr++ = (uint8_t) ((NATIVE_DNS_TYPE)); *queryptr++ = (uint8_t) ((NATIVE_DNS_TYPE));
@ -545,7 +540,9 @@ mdns_write_announce_records(unsigned char *queryptr, uint8_t *count)
++(*count); ++(*count);
} }
} }
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
struct dns_answer *ans;
queryptr = encode_name(queryptr, resolv_hostname); queryptr = encode_name(queryptr, resolv_hostname);
ans = (struct dns_answer *)queryptr; ans = (struct dns_answer *)queryptr;
ans->type = UIP_HTONS(NATIVE_DNS_TYPE); ans->type = UIP_HTONS(NATIVE_DNS_TYPE);
@ -556,7 +553,7 @@ mdns_write_announce_records(unsigned char *queryptr, uint8_t *count)
uip_gethostaddr((uip_ipaddr_t *) ans->ipaddr); uip_gethostaddr((uip_ipaddr_t *) ans->ipaddr);
queryptr = (unsigned char *)ans + sizeof(*ans); queryptr = (unsigned char *)ans + sizeof(*ans);
++(*count); ++(*count);
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
return queryptr; return queryptr;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -585,17 +582,17 @@ mdns_prep_host_announce_packet(void)
0x00, 0x00,
0x04, 0x04,
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x08, 0x08,
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
0x40, 0x40,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
} }
}; };
@ -603,8 +600,6 @@ mdns_prep_host_announce_packet(void)
uint8_t total_answers = 0; uint8_t total_answers = 0;
struct dns_answer *ans;
/* Be aware that, unless `ARCH_DOESNT_NEED_ALIGNED_STRUCTS` is set, /* Be aware that, unless `ARCH_DOESNT_NEED_ALIGNED_STRUCTS` is set,
* writing directly to the uint16_t members of this struct is an error. */ * writing directly to the uint16_t members of this struct is an error. */
struct dns_hdr *hdr = (struct dns_hdr *)uip_appdata; struct dns_hdr *hdr = (struct dns_hdr *)uip_appdata;
@ -703,7 +698,8 @@ check_entries(void)
} }
hdr = (struct dns_hdr *)uip_appdata; hdr = (struct dns_hdr *)uip_appdata;
memset(hdr, 0, sizeof(struct dns_hdr)); memset(hdr, 0, sizeof(struct dns_hdr));
hdr->id = RESOLV_ENCODE_INDEX(i); hdr->id = random_rand();
namemapptr->id = hdr->id;
#if RESOLV_CONF_SUPPORTS_MDNS #if RESOLV_CONF_SUPPORTS_MDNS
if(!namemapptr->is_mdns || namemapptr->is_probe) { if(!namemapptr->is_mdns || namemapptr->is_probe) {
hdr->flags1 = DNS_FLAG1_RD; hdr->flags1 = DNS_FLAG1_RD;
@ -903,10 +899,13 @@ newdata(void)
} else } else
#endif /* RESOLV_CONF_SUPPORTS_MDNS */ #endif /* RESOLV_CONF_SUPPORTS_MDNS */
{ {
/* The ID in the DNS header should be our entry into the name table. */ for(i = 0; i < RESOLV_ENTRIES; ++i) {
i = RESOLV_DECODE_INDEX(hdr->id); namemapptr = &names[i];
if(namemapptr->state == STATE_ASKING &&
namemapptr = &names[i]; namemapptr->id == hdr->id) {
break;
}
}
if(i >= RESOLV_ENTRIES || i < 0 || namemapptr->state != STATE_ASKING) { if(i >= RESOLV_ENTRIES || i < 0 || namemapptr->state != STATE_ASKING) {
PRINTF("resolver: DNS response has bad ID (%04X) \n", uip_ntohs(hdr->id)); PRINTF("resolver: DNS response has bad ID (%04X) \n", uip_ntohs(hdr->id));
@ -1141,7 +1140,7 @@ PROCESS_THREAD(resolv_process, ev, data)
PRINTF("resolver: Supports MDNS.\n"); PRINTF("resolver: Supports MDNS.\n");
uip_udp_bind(resolv_conn, UIP_HTONS(MDNS_PORT)); uip_udp_bind(resolv_conn, UIP_HTONS(MDNS_PORT));
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
uip_ds6_maddr_add(&resolv_mdns_addr); uip_ds6_maddr_add(&resolv_mdns_addr);
#else #else
/* TODO: Is there anything we need to do here for IPv4 multicast? */ /* TODO: Is there anything we need to do here for IPv4 multicast? */
@ -1200,6 +1199,16 @@ PROCESS_THREAD(resolv_process, ev, data)
PROCESS_END(); PROCESS_END();
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void
init(void)
{
static uint8_t initialized = 0;
if(!initialized) {
process_start(&resolv_process, NULL);
initialized = 1;
}
}
/*---------------------------------------------------------------------------*/
#if RESOLV_AUTO_REMOVE_TRAILING_DOTS #if RESOLV_AUTO_REMOVE_TRAILING_DOTS
static const char * static const char *
remove_trailing_dots(const char *name) { remove_trailing_dots(const char *name) {
@ -1233,6 +1242,8 @@ resolv_query(const char *name)
register struct namemap *nameptr = 0; register struct namemap *nameptr = 0;
init();
lseq = lseqi = 0; lseq = lseqi = 0;
/* Remove trailing dots, if present. */ /* Remove trailing dots, if present. */
@ -1316,12 +1327,12 @@ resolv_lookup(const char *name, uip_ipaddr_t ** ipaddr)
#if UIP_CONF_LOOPBACK_INTERFACE #if UIP_CONF_LOOPBACK_INTERFACE
if(strcmp(name, "localhost")) { if(strcmp(name, "localhost")) {
static uip_ipaddr_t loopback = static uip_ipaddr_t loopback =
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
{ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 } }; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 } };
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
{ { 127, 0, 0, 1 } }; { { 127, 0, 0, 1 } };
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
if(ipaddr) { if(ipaddr) {
*ipaddr = &loopback; *ipaddr = &loopback;
} }
@ -1369,7 +1380,8 @@ resolv_lookup(const char *name, uip_ipaddr_t ** ipaddr)
#if VERBOSE_DEBUG #if VERBOSE_DEBUG
switch (ret) { switch (ret) {
case RESOLV_STATUS_CACHED:{ case RESOLV_STATUS_CACHED:
if(ipaddr) {
PRINTF("resolver: Found \"%s\" in cache.\n", name); PRINTF("resolver: Found \"%s\" in cache.\n", name);
const uip_ipaddr_t *addr = *ipaddr; const uip_ipaddr_t *addr = *ipaddr;
@ -1428,7 +1440,7 @@ resolv_found(char *name, uip_ipaddr_t * ipaddr)
#if RESOLV_CONF_SUPPORTS_MDNS #if RESOLV_CONF_SUPPORTS_MDNS
if(strncasecmp(resolv_hostname, name, strlen(resolv_hostname)) == 0 && if(strncasecmp(resolv_hostname, name, strlen(resolv_hostname)) == 0 &&
ipaddr ipaddr
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
&& !uip_ds6_is_my_addr(ipaddr) && !uip_ds6_is_my_addr(ipaddr)
#else #else
&& uip_ipaddr_cmp(&uip_hostaddr, ipaddr) != 0 && uip_ipaddr_cmp(&uip_hostaddr, ipaddr) != 0

View file

@ -44,7 +44,7 @@
/** /**
* \defgroup simple-udp * \defgroup simple-udp A simple UDP API
* *
* The default Contiki UDP API is difficult to use. The simple-udp * The default Contiki UDP API is difficult to use. The simple-udp
* module provides a significantly simpler API. * module provides a significantly simpler API.

View file

@ -42,7 +42,7 @@
#include "net/ip/uip-split.h" #include "net/ip/uip-split.h"
#include "net/ip/uip-packetqueue.h" #include "net/ip/uip-packetqueue.h"
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
#include "net/ipv6/uip-nd6.h" #include "net/ipv6/uip-nd6.h"
#include "net/ipv6/uip-ds6.h" #include "net/ipv6/uip-ds6.h"
#endif #endif
@ -80,7 +80,7 @@ process_event_t tcpip_icmp6_event;
/* Periodic check of active connections. */ /* Periodic check of active connections. */
static struct etimer periodic; static struct etimer periodic;
#if UIP_CONF_IPV6 && UIP_CONF_IPV6_REASSEMBLY #if NETSTACK_CONF_WITH_IPV6 && UIP_CONF_IPV6_REASSEMBLY
/* Timer for reassembly. */ /* Timer for reassembly. */
extern struct etimer uip_reass_timer; extern struct etimer uip_reass_timer;
#endif #endif
@ -107,7 +107,7 @@ enum {
}; };
/* Called on IP packet output. */ /* Called on IP packet output. */
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
static uint8_t (* outputfunc)(const uip_lladdr_t *a); static uint8_t (* outputfunc)(const uip_lladdr_t *a);
@ -194,7 +194,7 @@ packet_input(void)
#if UIP_CONF_TCP_SPLIT #if UIP_CONF_TCP_SPLIT
uip_split_output(); uip_split_output();
#else /* UIP_CONF_TCP_SPLIT */ #else /* UIP_CONF_TCP_SPLIT */
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
tcpip_ipv6_output(); tcpip_ipv6_output();
#else #else
PRINTF("tcpip packet_input forward output len %d\n", uip_len); PRINTF("tcpip packet_input forward output len %d\n", uip_len);
@ -213,7 +213,7 @@ packet_input(void)
#if UIP_CONF_TCP_SPLIT #if UIP_CONF_TCP_SPLIT
uip_split_output(); uip_split_output();
#else /* UIP_CONF_TCP_SPLIT */ #else /* UIP_CONF_TCP_SPLIT */
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
tcpip_ipv6_output(); tcpip_ipv6_output();
#else #else
PRINTF("tcpip packet_input output len %d\n", uip_len); PRINTF("tcpip packet_input output len %d\n", uip_len);
@ -331,11 +331,11 @@ udp_broadcast_new(uint16_t port, void *appstate)
uip_ipaddr_t addr; uip_ipaddr_t addr;
struct uip_udp_conn *conn; struct uip_udp_conn *conn;
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
uip_create_linklocal_allnodes_mcast(&addr); uip_create_linklocal_allnodes_mcast(&addr);
#else #else
uip_ipaddr(&addr, 255,255,255,255); uip_ipaddr(&addr, 255,255,255,255);
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
conn = udp_new(&addr, port, appstate); conn = udp_new(&addr, port, appstate);
if(conn != NULL) { if(conn != NULL) {
udp_bind(conn, port); udp_bind(conn, port);
@ -434,7 +434,7 @@ eventhandler(process_event_t ev, process_data_t data)
connections. */ connections. */
etimer_restart(&periodic); etimer_restart(&periodic);
uip_periodic(i); uip_periodic(i);
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
tcpip_ipv6_output(); tcpip_ipv6_output();
#else #else
if(uip_len > 0) { if(uip_len > 0) {
@ -442,7 +442,7 @@ eventhandler(process_event_t ev, process_data_t data)
tcpip_output(); tcpip_output();
PRINTF("tcpip_output after periodic len %d\n", uip_len); PRINTF("tcpip_output after periodic len %d\n", uip_len);
} }
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
} }
} }
#endif /* UIP_TCP */ #endif /* UIP_TCP */
@ -451,7 +451,7 @@ eventhandler(process_event_t ev, process_data_t data)
#endif /* UIP_CONF_IP_FORWARD */ #endif /* UIP_CONF_IP_FORWARD */
} }
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
#if UIP_CONF_IPV6_REASSEMBLY #if UIP_CONF_IPV6_REASSEMBLY
/* /*
* check the timer for reassembly * check the timer for reassembly
@ -483,7 +483,7 @@ eventhandler(process_event_t ev, process_data_t data)
uip_ds6_periodic(); uip_ds6_periodic();
tcpip_ipv6_output(); tcpip_ipv6_output();
} }
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
} }
break; break;
@ -491,14 +491,14 @@ eventhandler(process_event_t ev, process_data_t data)
case TCP_POLL: case TCP_POLL:
if(data != NULL) { if(data != NULL) {
uip_poll_conn(data); uip_poll_conn(data);
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
tcpip_ipv6_output(); tcpip_ipv6_output();
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
if(uip_len > 0) { if(uip_len > 0) {
PRINTF("tcpip_output from tcp poll len %d\n", uip_len); PRINTF("tcpip_output from tcp poll len %d\n", uip_len);
tcpip_output(); tcpip_output();
} }
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
/* Start the periodic polling, if it isn't already active. */ /* Start the periodic polling, if it isn't already active. */
start_periodic_tcp_timer(); start_periodic_tcp_timer();
} }
@ -508,7 +508,7 @@ eventhandler(process_event_t ev, process_data_t data)
case UDP_POLL: case UDP_POLL:
if(data != NULL) { if(data != NULL) {
uip_udp_periodic_conn(data); uip_udp_periodic_conn(data);
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
tcpip_ipv6_output(); tcpip_ipv6_output();
#else #else
if(uip_len > 0) { if(uip_len > 0) {
@ -530,12 +530,12 @@ tcpip_input(void)
{ {
process_post_synch(&tcpip_process, PACKET_INPUT, NULL); process_post_synch(&tcpip_process, PACKET_INPUT, NULL);
uip_len = 0; uip_len = 0;
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
uip_ext_len = 0; uip_ext_len = 0;
#endif /*UIP_CONF_IPV6*/ #endif /*NETSTACK_CONF_WITH_IPV6*/
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
void void
tcpip_ipv6_output(void) tcpip_ipv6_output(void)
{ {
@ -616,7 +616,7 @@ tcpip_ipv6_output(void)
rpl_repair_root(instance->instance_id); rpl_repair_root(instance->instance_id);
} }
#endif /* UIP_CONF_RPL */ #endif /* UIP_CONF_IPV6_RPL */
uip_ds6_route_rm(route); uip_ds6_route_rm(route);
/* We don't have a nexthop to send the packet to, so we drop /* We don't have a nexthop to send the packet to, so we drop
@ -729,7 +729,7 @@ tcpip_ipv6_output(void)
uip_len = 0; uip_len = 0;
uip_ext_len = 0; uip_ext_len = 0;
} }
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if UIP_UDP #if UIP_UDP
void void
@ -818,7 +818,7 @@ PROCESS_THREAD(tcpip_process, ev, data)
UIP_FALLBACK_INTERFACE.init(); UIP_FALLBACK_INTERFACE.init();
#endif #endif
/* initialize RPL if configured for using RPL */ /* initialize RPL if configured for using RPL */
#if UIP_CONF_IPV6 && UIP_CONF_IPV6_RPL #if NETSTACK_CONF_WITH_IPV6 && UIP_CONF_IPV6_RPL
rpl_init(); rpl_init();
#endif /* UIP_CONF_IPV6_RPL */ #endif /* UIP_CONF_IPV6_RPL */

View file

@ -340,7 +340,7 @@ CCIF void tcpip_input(void);
* \brief Output packet to layer 2 * \brief Output packet to layer 2
* The eventual parameter is the MAC address of the destination. * The eventual parameter is the MAC address of the destination.
*/ */
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
uint8_t tcpip_output(const uip_lladdr_t *); uint8_t tcpip_output(const uip_lladdr_t *);
void tcpip_set_outputfunc(uint8_t (* f)(const uip_lladdr_t *)); void tcpip_set_outputfunc(uint8_t (* f)(const uip_lladdr_t *));
#else #else
@ -351,7 +351,7 @@ void tcpip_set_outputfunc(uint8_t (* f)(void));
/** /**
* \brief This function does address resolution and then calls tcpip_output * \brief This function does address resolution and then calls tcpip_output
*/ */
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
void tcpip_ipv6_output(void); void tcpip_ipv6_output(void);
#endif #endif

View file

@ -47,7 +47,7 @@ uip_debug_ipaddr_print(const uip_ipaddr_t *addr)
printf("(NULL IP addr)"); printf("(NULL IP addr)");
return; return;
} }
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
uint16_t a; uint16_t a;
unsigned int i; unsigned int i;
int f; int f;
@ -66,9 +66,9 @@ uip_debug_ipaddr_print(const uip_ipaddr_t *addr)
PRINTA("%x", a); PRINTA("%x", a);
} }
} }
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
PRINTA("%u.%u.%u.%u", addr->u8[0], addr->u8[1], addr->u8[2], addr->u8[3]); PRINTA("%u.%u.%u.%u", addr->u8[0], addr->u8[1], addr->u8[2], addr->u8[3]);
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void

View file

@ -73,33 +73,33 @@ uip_split_output(void)
/* Create the first packet. This is done by altering the length /* Create the first packet. This is done by altering the length
field of the IP header and updating the checksums. */ field of the IP header and updating the checksums. */
uip_len = len1 + UIP_TCPIP_HLEN; uip_len = len1 + UIP_TCPIP_HLEN;
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
/* For IPv6, the IP length field does not include the IPv6 IP header /* For IPv6, the IP length field does not include the IPv6 IP header
length. */ length. */
BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8); BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8);
BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff); BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff);
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
BUF->len[0] = uip_len >> 8; BUF->len[0] = uip_len >> 8;
BUF->len[1] = uip_len & 0xff; BUF->len[1] = uip_len & 0xff;
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
/* Recalculate the TCP checksum. */ /* Recalculate the TCP checksum. */
BUF->tcpchksum = 0; BUF->tcpchksum = 0;
BUF->tcpchksum = ~(uip_tcpchksum()); BUF->tcpchksum = ~(uip_tcpchksum());
#if !UIP_CONF_IPV6 #if !NETSTACK_CONF_WITH_IPV6
/* Recalculate the IP checksum. */ /* Recalculate the IP checksum. */
BUF->ipchksum = 0; BUF->ipchksum = 0;
BUF->ipchksum = ~(uip_ipchksum()); BUF->ipchksum = ~(uip_ipchksum());
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
/* Transmit the first packet. */ /* Transmit the first packet. */
/* uip_fw_output();*/ /* uip_fw_output();*/
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
tcpip_ipv6_output(); tcpip_ipv6_output();
#else #else
tcpip_output(); tcpip_output();
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
/* Now, create the second packet. To do this, it is not enough to /* Now, create the second packet. To do this, it is not enough to
just alter the length field, but we must also update the TCP just alter the length field, but we must also update the TCP
@ -107,15 +107,15 @@ uip_split_output(void)
memory. This place is detemined by the length of the first memory. This place is detemined by the length of the first
packet (len1). */ packet (len1). */
uip_len = len2 + UIP_TCPIP_HLEN; uip_len = len2 + UIP_TCPIP_HLEN;
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
/* For IPv6, the IP length field does not include the IPv6 IP header /* For IPv6, the IP length field does not include the IPv6 IP header
length. */ length. */
BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8); BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8);
BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff); BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff);
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
BUF->len[0] = uip_len >> 8; BUF->len[0] = uip_len >> 8;
BUF->len[1] = uip_len & 0xff; BUF->len[1] = uip_len & 0xff;
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
/* uip_appdata += len1;*/ /* uip_appdata += len1;*/
memcpy(uip_appdata, (uint8_t *)uip_appdata + len1, len2); memcpy(uip_appdata, (uint8_t *)uip_appdata + len1, len2);
@ -130,29 +130,29 @@ uip_split_output(void)
BUF->tcpchksum = 0; BUF->tcpchksum = 0;
BUF->tcpchksum = ~(uip_tcpchksum()); BUF->tcpchksum = ~(uip_tcpchksum());
#if !UIP_CONF_IPV6 #if !NETSTACK_CONF_WITH_IPV6
/* Recalculate the IP checksum. */ /* Recalculate the IP checksum. */
BUF->ipchksum = 0; BUF->ipchksum = 0;
BUF->ipchksum = ~(uip_ipchksum()); BUF->ipchksum = ~(uip_ipchksum());
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
/* Transmit the second packet. */ /* Transmit the second packet. */
/* uip_fw_output();*/ /* uip_fw_output();*/
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
tcpip_ipv6_output(); tcpip_ipv6_output();
#else #else
tcpip_output(); tcpip_output();
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
return; return;
} }
#endif /* UIP_TCP */ #endif /* UIP_TCP */
/* uip_fw_output();*/ /* uip_fw_output();*/
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
tcpip_ipv6_output(); tcpip_ipv6_output();
#else #else
tcpip_output(); tcpip_output();
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
} }
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/

View file

@ -66,7 +66,7 @@ uip_udp_packet_send(struct uip_udp_conn *c, const void *data, int len)
} }
#endif /* UIP_IPV6_MULTICAST */ #endif /* UIP_IPV6_MULTICAST */
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
tcpip_ipv6_output(); tcpip_ipv6_output();
#else #else
if(uip_len > 0) { if(uip_len > 0) {

View file

@ -53,12 +53,12 @@
#define UIP_H_ #define UIP_H_
/* Header sizes. */ /* Header sizes. */
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
#define UIP_IPH_LEN 40 #define UIP_IPH_LEN 40
#define UIP_FRAGH_LEN 8 #define UIP_FRAGH_LEN 8
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
#define UIP_IPH_LEN 20 /* Size of IP header */ #define UIP_IPH_LEN 20 /* Size of IP header */
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
#define UIP_UDPH_LEN 8 /* Size of UDP header */ #define UIP_UDPH_LEN 8 /* Size of UDP header */
#define UIP_TCPH_LEN 20 /* Size of TCP header */ #define UIP_TCPH_LEN 20 /* Size of TCP header */
@ -75,7 +75,7 @@
+ IP header */ + IP header */
#define UIP_LLIPH_LEN (UIP_LLH_LEN + UIP_IPH_LEN) /* size of L2 #define UIP_LLIPH_LEN (UIP_LLH_LEN + UIP_IPH_LEN) /* size of L2
+ IP header */ + IP header */
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
/** /**
* The sums below are quite used in ND. When used for uip_buf, we * The sums below are quite used in ND. When used for uip_buf, we
* include link layer length when used for uip_len, we do not, hence * include link layer length when used for uip_len, we do not, hence
@ -86,7 +86,7 @@
#define uip_l2_l3_icmp_hdr_len (UIP_LLH_LEN + UIP_IPH_LEN + uip_ext_len + UIP_ICMPH_LEN) #define uip_l2_l3_icmp_hdr_len (UIP_LLH_LEN + UIP_IPH_LEN + uip_ext_len + UIP_ICMPH_LEN)
#define uip_l3_hdr_len (UIP_IPH_LEN + uip_ext_len) #define uip_l3_hdr_len (UIP_IPH_LEN + uip_ext_len)
#define uip_l3_icmp_hdr_len (UIP_IPH_LEN + uip_ext_len + UIP_ICMPH_LEN) #define uip_l3_icmp_hdr_len (UIP_IPH_LEN + uip_ext_len + UIP_ICMPH_LEN)
#endif /*UIP_CONF_IPV6*/ #endif /*NETSTACK_CONF_WITH_IPV6*/
#include "net/ip/uipopt.h" #include "net/ip/uipopt.h"
@ -108,11 +108,11 @@ typedef union uip_ip6addr_t {
uint16_t u16[8]; uint16_t u16[8];
} uip_ip6addr_t; } uip_ip6addr_t;
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
typedef uip_ip6addr_t uip_ipaddr_t; typedef uip_ip6addr_t uip_ipaddr_t;
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
typedef uip_ip4addr_t uip_ipaddr_t; typedef uip_ip4addr_t uip_ipaddr_t;
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -1056,11 +1056,11 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, uint16_t rport);
(addr1)->u16[1] == (addr2)->u16[1]) (addr1)->u16[1] == (addr2)->u16[1])
#define uip_ip6addr_cmp(addr1, addr2) (memcmp(addr1, addr2, sizeof(uip_ip6addr_t)) == 0) #define uip_ip6addr_cmp(addr1, addr2) (memcmp(addr1, addr2, sizeof(uip_ip6addr_t)) == 0)
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
#define uip_ipaddr_cmp(addr1, addr2) uip_ip6addr_cmp(addr1, addr2) #define uip_ipaddr_cmp(addr1, addr2) uip_ip6addr_cmp(addr1, addr2)
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
#define uip_ipaddr_cmp(addr1, addr2) uip_ip4addr_cmp(addr1, addr2) #define uip_ipaddr_cmp(addr1, addr2) uip_ip4addr_cmp(addr1, addr2)
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
/** /**
* Compare two IP addresses with netmasks * Compare two IP addresses with netmasks
@ -1494,13 +1494,13 @@ struct uip_stats {
checksum. */ checksum. */
} udp; /**< UDP statistics. */ } udp; /**< UDP statistics. */
#endif /* UIP_UDP */ #endif /* UIP_UDP */
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
struct { struct {
uip_stats_t drop; /**< Number of dropped ND6 packets. */ uip_stats_t drop; /**< Number of dropped ND6 packets. */
uip_stats_t recv; /**< Number of recived ND6 packets */ uip_stats_t recv; /**< Number of recived ND6 packets */
uip_stats_t sent; /**< Number of sent ND6 packets */ uip_stats_t sent; /**< Number of sent ND6 packets */
} nd6; } nd6;
#endif /*UIP_CONF_IPV6*/ #endif /*NETSTACK_CONF_WITH_IPV6*/
}; };
@ -1610,7 +1610,7 @@ void uip_process(uint8_t flag);
/* The TCP and IP headers. */ /* The TCP and IP headers. */
struct uip_tcpip_hdr { struct uip_tcpip_hdr {
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
/* IPv6 header. */ /* IPv6 header. */
uint8_t vtc, uint8_t vtc,
tcflow; tcflow;
@ -1618,7 +1618,7 @@ struct uip_tcpip_hdr {
uint8_t len[2]; uint8_t len[2];
uint8_t proto, ttl; uint8_t proto, ttl;
uip_ip6addr_t srcipaddr, destipaddr; uip_ip6addr_t srcipaddr, destipaddr;
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
/* IPv4 header. */ /* IPv4 header. */
uint8_t vhl, uint8_t vhl,
tos, tos,
@ -1629,7 +1629,7 @@ struct uip_tcpip_hdr {
proto; proto;
uint16_t ipchksum; uint16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr; uip_ipaddr_t srcipaddr, destipaddr;
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
/* TCP header. */ /* TCP header. */
uint16_t srcport, uint16_t srcport,
@ -1646,7 +1646,7 @@ struct uip_tcpip_hdr {
/* The ICMP and IP headers. */ /* The ICMP and IP headers. */
struct uip_icmpip_hdr { struct uip_icmpip_hdr {
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
/* IPv6 header. */ /* IPv6 header. */
uint8_t vtc, uint8_t vtc,
tcf; tcf;
@ -1654,7 +1654,7 @@ struct uip_icmpip_hdr {
uint8_t len[2]; uint8_t len[2];
uint8_t proto, ttl; uint8_t proto, ttl;
uip_ip6addr_t srcipaddr, destipaddr; uip_ip6addr_t srcipaddr, destipaddr;
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
/* IPv4 header. */ /* IPv4 header. */
uint8_t vhl, uint8_t vhl,
tos, tos,
@ -1665,21 +1665,21 @@ struct uip_icmpip_hdr {
proto; proto;
uint16_t ipchksum; uint16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr; uip_ipaddr_t srcipaddr, destipaddr;
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
/* ICMP header. */ /* ICMP header. */
uint8_t type, icode; uint8_t type, icode;
uint16_t icmpchksum; uint16_t icmpchksum;
#if !UIP_CONF_IPV6 #if !NETSTACK_CONF_WITH_IPV6
uint16_t id, seqno; uint16_t id, seqno;
uint8_t payload[1]; uint8_t payload[1];
#endif /* !UIP_CONF_IPV6 */ #endif /* !NETSTACK_CONF_WITH_IPV6 */
}; };
/* The UDP and IP headers. */ /* The UDP and IP headers. */
struct uip_udpip_hdr { struct uip_udpip_hdr {
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
/* IPv6 header. */ /* IPv6 header. */
uint8_t vtc, uint8_t vtc,
tcf; tcf;
@ -1687,7 +1687,7 @@ struct uip_udpip_hdr {
uint8_t len[2]; uint8_t len[2];
uint8_t proto, ttl; uint8_t proto, ttl;
uip_ip6addr_t srcipaddr, destipaddr; uip_ip6addr_t srcipaddr, destipaddr;
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
/* IP header. */ /* IP header. */
uint8_t vhl, uint8_t vhl,
tos, tos,
@ -1698,7 +1698,7 @@ struct uip_udpip_hdr {
proto; proto;
uint16_t ipchksum; uint16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr; uip_ipaddr_t srcipaddr, destipaddr;
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
/* UDP header. */ /* UDP header. */
uint16_t srcport, uint16_t srcport,
@ -1714,7 +1714,7 @@ struct uip_udpip_hdr {
*/ */
/* The IP header */ /* The IP header */
struct uip_ip_hdr { struct uip_ip_hdr {
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
/* IPV6 header */ /* IPV6 header */
uint8_t vtc; uint8_t vtc;
uint8_t tcflow; uint8_t tcflow;
@ -1722,7 +1722,7 @@ struct uip_ip_hdr {
uint8_t len[2]; uint8_t len[2];
uint8_t proto, ttl; uint8_t proto, ttl;
uip_ip6addr_t srcipaddr, destipaddr; uip_ip6addr_t srcipaddr, destipaddr;
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
/* IPV4 header */ /* IPV4 header */
uint8_t vhl, uint8_t vhl,
tos, tos,
@ -1733,7 +1733,7 @@ struct uip_ip_hdr {
proto; proto;
uint16_t ipchksum; uint16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr; uip_ipaddr_t srcipaddr, destipaddr;
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
}; };
@ -1842,9 +1842,9 @@ struct uip_tcp_hdr {
struct uip_icmp_hdr { struct uip_icmp_hdr {
uint8_t type, icode; uint8_t type, icode;
uint16_t icmpchksum; uint16_t icmpchksum;
#if !UIP_CONF_IPV6 #if !NETSTACK_CONF_WITH_IPV6
uint16_t id, seqno; uint16_t id, seqno;
#endif /* !UIP_CONF_IPV6 */ #endif /* !NETSTACK_CONF_WITH_IPV6 */
}; };
@ -1880,7 +1880,7 @@ struct uip_udp_hdr {
#define UIP_PROTO_ICMP6 58 #define UIP_PROTO_ICMP6 58
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
/** @{ */ /** @{ */
/** \brief extension headers types */ /** \brief extension headers types */
#define UIP_PROTO_HBHO 0 #define UIP_PROTO_HBHO 0
@ -1917,7 +1917,7 @@ struct uip_udp_hdr {
/** @} */ /** @} */
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
#if UIP_FIXEDADDR #if UIP_FIXEDADDR
@ -1937,7 +1937,7 @@ CCIF extern uip_lladdr_t uip_lladdr;
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
/** Length of the link local prefix */ /** Length of the link local prefix */
#define UIP_LLPREF_LEN 10 #define UIP_LLPREF_LEN 10
@ -2162,7 +2162,7 @@ CCIF extern uip_lladdr_t uip_lladdr;
(((a)->u8[14]) == ((b)->u8[14])) && \ (((a)->u8[14]) == ((b)->u8[14])) && \
(((a)->u8[15]) == ((b)->u8[15]))) (((a)->u8[15]) == ((b)->u8[15])))
#endif /*UIP_CONF_IPV6*/ #endif /*NETSTACK_CONF_WITH_IPV6*/
/** /**
* Calculate the Internet checksum over a buffer. * Calculate the Internet checksum over a buffer.

View file

@ -41,7 +41,7 @@
#include "net/ip/uip-debug.h" #include "net/ip/uip-debug.h"
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
int int
uiplib_ip6addrconv(const char *addrstr, uip_ip6addr_t *ipaddr) uiplib_ip6addrconv(const char *addrstr, uip_ip6addr_t *ipaddr)
{ {
@ -103,7 +103,7 @@ uiplib_ip6addrconv(const char *addrstr, uip_ip6addr_t *ipaddr)
return 1; return 1;
} }
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
/* Parse a IPv4-address from a string. Returns the number of characters read /* Parse a IPv4-address from a string. Returns the number of characters read
* for the address. */ * for the address. */

View file

@ -67,11 +67,11 @@
* \retval 0 If the IP address could not be parsed. * \retval 0 If the IP address could not be parsed.
* \retval Non-zero If the IP address was parsed. * \retval Non-zero If the IP address was parsed.
*/ */
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
#define uiplib_ipaddrconv uiplib_ip6addrconv #define uiplib_ipaddrconv uiplib_ip6addrconv
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
#define uiplib_ipaddrconv uiplib_ip4addrconv #define uiplib_ipaddrconv uiplib_ip4addrconv
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
CCIF int uiplib_ip4addrconv(const char *addrstr, uip_ip4addr_t *addr); CCIF int uiplib_ip4addrconv(const char *addrstr, uip_ip4addr_t *addr);
CCIF int uiplib_ip6addrconv(const char *addrstr, uip_ip6addr_t *addr); CCIF int uiplib_ip6addrconv(const char *addrstr, uip_ip6addr_t *addr);

View file

@ -282,9 +282,9 @@ void uip_log(char *msg);
/** The maximum transmission unit at the IP Layer*/ /** The maximum transmission unit at the IP Layer*/
#define UIP_LINK_MTU 1280 #define UIP_LINK_MTU 1280
#ifndef UIP_CONF_IPV6 #ifndef NETSTACK_CONF_WITH_IPV6
/** Do we use IPv6 or not (default: no) */ /** Do we use IPv6 or not (default: no) */
#define UIP_CONF_IPV6 0 #define NETSTACK_CONF_WITH_IPV6 0
#endif #endif
#ifndef UIP_CONF_IPV6_QUEUE_PKT #ifndef UIP_CONF_IPV6_QUEUE_PKT
@ -351,7 +351,7 @@ void uip_log(char *msg);
#ifdef UIP_CONF_UDP_CHECKSUMS #ifdef UIP_CONF_UDP_CHECKSUMS
#define UIP_UDP_CHECKSUMS (UIP_CONF_UDP_CHECKSUMS) #define UIP_UDP_CHECKSUMS (UIP_CONF_UDP_CHECKSUMS)
#else #else
#define UIP_UDP_CHECKSUMS (UIP_CONF_IPV6) #define UIP_UDP_CHECKSUMS (NETSTACK_CONF_WITH_IPV6)
#endif #endif
/** /**

View file

@ -35,6 +35,8 @@
#include "ip64-conf.h" #include "ip64-conf.h"
#include "lib/random.h"
#include <string.h> #include <string.h>
#ifdef IP64_ADDRMAP_CONF_ENTRIES #ifdef IP64_ADDRMAP_CONF_ENTRIES
@ -173,10 +175,8 @@ ip64_addrmap_lookup_port(uint16_t mapped_port, uint8_t protocol)
static void static void
increase_mapped_port(void) increase_mapped_port(void)
{ {
mapped_port++; mapped_port = (random_rand() % (LAST_MAPPED_PORT - FIRST_MAPPED_PORT)) +
if(mapped_port >= LAST_MAPPED_PORT) { FIRST_MAPPED_PORT;
mapped_port = FIRST_MAPPED_PORT;
}
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
struct ip64_addrmap_entry * struct ip64_addrmap_entry *

View file

@ -34,7 +34,7 @@
#include "net/ipv4/uip-fw.h" #include "net/ipv4/uip-fw.h"
#if !UIP_CONF_IPV6 #if !NETSTACK_CONF_WITH_IPV6
PROCESS(uip_fw_process, "IP forwarding"); PROCESS(uip_fw_process, "IP forwarding");
@ -51,4 +51,4 @@ PROCESS_THREAD(uip_fw_process, ev, data)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */

View file

@ -75,15 +75,15 @@
#include "net/ipv4/uip_arp.h" #include "net/ipv4/uip_arp.h"
#include "net/ip/uip_arch.h" #include "net/ip/uip_arch.h"
#if !UIP_CONF_IPV6 /* If UIP_CONF_IPV6 is defined, we compile the #if !NETSTACK_CONF_WITH_IPV6 /* If NETSTACK_CONF_WITH_IPV6 is defined, we compile the
uip6.c file instead of this one. Therefore uip6.c file instead of this one. Therefore
this #ifndef removes the entire compilation this #ifndef removes the entire compilation
output of the uip.c file */ output of the uip.c file */
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
#include "net/ipv4/uip-neighbor.h" #include "net/ipv4/uip-neighbor.h"
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
#include <string.h> #include <string.h>
@ -106,12 +106,12 @@ uip_ipaddr_t uip_hostaddr, uip_draddr, uip_netmask;
#endif /* UIP_FIXEDADDR */ #endif /* UIP_FIXEDADDR */
const uip_ipaddr_t uip_broadcast_addr = const uip_ipaddr_t uip_broadcast_addr =
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
{ { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } }; 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } };
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
{ { 0xff, 0xff, 0xff, 0xff } }; { { 0xff, 0xff, 0xff, 0xff } };
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
const uip_ipaddr_t uip_all_zeroes_addr = { { 0x0, /* rest is 0 */ } }; const uip_ipaddr_t uip_all_zeroes_addr = { { 0x0, /* rest is 0 */ } };
#if UIP_FIXEDETHADDR #if UIP_FIXEDETHADDR
@ -322,11 +322,11 @@ upper_layer_chksum(uint8_t proto)
uint16_t upper_layer_len; uint16_t upper_layer_len;
uint16_t sum; uint16_t sum;
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
upper_layer_len = (((uint16_t)(BUF->len[0]) << 8) + BUF->len[1]); upper_layer_len = (((uint16_t)(BUF->len[0]) << 8) + BUF->len[1]);
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
upper_layer_len = (((uint16_t)(BUF->len[0]) << 8) + BUF->len[1]) - UIP_IPH_LEN; upper_layer_len = (((uint16_t)(BUF->len[0]) << 8) + BUF->len[1]) - UIP_IPH_LEN;
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
/* First sum pseudoheader. */ /* First sum pseudoheader. */
@ -342,14 +342,14 @@ upper_layer_chksum(uint8_t proto)
return (sum == 0) ? 0xffff : uip_htons(sum); return (sum == 0) ? 0xffff : uip_htons(sum);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
uint16_t uint16_t
uip_icmp6chksum(void) uip_icmp6chksum(void)
{ {
return upper_layer_chksum(UIP_PROTO_ICMP6); return upper_layer_chksum(UIP_PROTO_ICMP6);
} }
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
uint16_t uint16_t
uip_tcpchksum(void) uip_tcpchksum(void)
@ -529,7 +529,7 @@ uip_listen(uint16_t port)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* XXX: IP fragment reassembly: not well-tested. */ /* XXX: IP fragment reassembly: not well-tested. */
#if UIP_REASSEMBLY && !UIP_CONF_IPV6 #if UIP_REASSEMBLY && !NETSTACK_CONF_WITH_IPV6
#define UIP_REASS_BUFSIZE (UIP_BUFSIZE - UIP_LLH_LEN) #define UIP_REASS_BUFSIZE (UIP_BUFSIZE - UIP_LLH_LEN)
static uint8_t uip_reassbuf[UIP_REASS_BUFSIZE]; static uint8_t uip_reassbuf[UIP_REASS_BUFSIZE];
static uint8_t uip_reassbitmap[UIP_REASS_BUFSIZE / (8 * 8)]; static uint8_t uip_reassbitmap[UIP_REASS_BUFSIZE / (8 * 8)];
@ -828,7 +828,7 @@ uip_process(uint8_t flag)
/* Start of IP input header processing code. */ /* Start of IP input header processing code. */
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
/* Check validity of the IP header. */ /* Check validity of the IP header. */
if((BUF->vtc & 0xf0) != 0x60) { /* IP version and header length. */ if((BUF->vtc & 0xf0) != 0x60) { /* IP version and header length. */
UIP_STAT(++uip_stat.ip.drop); UIP_STAT(++uip_stat.ip.drop);
@ -836,7 +836,7 @@ uip_process(uint8_t flag)
UIP_LOG("ipv6: invalid version."); UIP_LOG("ipv6: invalid version.");
goto drop; goto drop;
} }
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
/* Check validity of the IP header. */ /* Check validity of the IP header. */
if(BUF->vhl != 0x45) { /* IP version and header length. */ if(BUF->vhl != 0x45) { /* IP version and header length. */
UIP_STAT(++uip_stat.ip.drop); UIP_STAT(++uip_stat.ip.drop);
@ -844,7 +844,7 @@ uip_process(uint8_t flag)
UIP_LOG("ip: invalid version or header length."); UIP_LOG("ip: invalid version or header length.");
goto drop; goto drop;
} }
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
/* Check the size of the packet. If the size reported to us in /* Check the size of the packet. If the size reported to us in
uip_len is smaller the size reported in the IP header, we assume uip_len is smaller the size reported in the IP header, we assume
@ -855,7 +855,7 @@ uip_process(uint8_t flag)
if((BUF->len[0] << 8) + BUF->len[1] <= uip_len) { if((BUF->len[0] << 8) + BUF->len[1] <= uip_len) {
uip_len = (BUF->len[0] << 8) + BUF->len[1]; uip_len = (BUF->len[0] << 8) + BUF->len[1];
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
uip_len += 40; /* The length reported in the IPv6 header is the uip_len += 40; /* The length reported in the IPv6 header is the
length of the payload that follows the length of the payload that follows the
header. However, uIP uses the uip_len variable header. However, uIP uses the uip_len variable
@ -865,13 +865,13 @@ uip_process(uint8_t flag)
contains the length of the entire packet. But contains the length of the entire packet. But
for IPv6 we need to add the size of the IPv6 for IPv6 we need to add the size of the IPv6
header (40 bytes). */ header (40 bytes). */
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
} else { } else {
UIP_LOG("ip: packet shorter than reported in IP header."); UIP_LOG("ip: packet shorter than reported in IP header.");
goto drop; goto drop;
} }
#if !UIP_CONF_IPV6 #if !NETSTACK_CONF_WITH_IPV6
/* Check the fragment flag. */ /* Check the fragment flag. */
if((BUF->ipoffset[0] & 0x3f) != 0 || if((BUF->ipoffset[0] & 0x3f) != 0 ||
BUF->ipoffset[1] != 0) { BUF->ipoffset[1] != 0) {
@ -887,13 +887,13 @@ uip_process(uint8_t flag)
goto drop; goto drop;
#endif /* UIP_REASSEMBLY */ #endif /* UIP_REASSEMBLY */
} }
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
if(uip_ipaddr_cmp(&uip_hostaddr, &uip_all_zeroes_addr)) { if(uip_ipaddr_cmp(&uip_hostaddr, &uip_all_zeroes_addr)) {
/* If we are configured to use ping IP address configuration and /* If we are configured to use ping IP address configuration and
hasn't been assigned an IP address yet, we accept all ICMP hasn't been assigned an IP address yet, we accept all ICMP
packets. */ packets. */
#if UIP_PINGADDRCONF && !UIP_CONF_IPV6 #if UIP_PINGADDRCONF && !NETSTACK_CONF_WITH_IPV6
if(BUF->proto == UIP_PROTO_ICMP) { if(BUF->proto == UIP_PROTO_ICMP) {
UIP_LOG("ip: possible ping config packet received."); UIP_LOG("ip: possible ping config packet received.");
goto icmp_input; goto icmp_input;
@ -924,12 +924,12 @@ uip_process(uint8_t flag)
#endif /* UIP_BROADCAST */ #endif /* UIP_BROADCAST */
/* Check if the packet is destined for our IP address. */ /* Check if the packet is destined for our IP address. */
#if !UIP_CONF_IPV6 #if !NETSTACK_CONF_WITH_IPV6
if(!uip_ipaddr_cmp(&BUF->destipaddr, &uip_hostaddr)) { if(!uip_ipaddr_cmp(&BUF->destipaddr, &uip_hostaddr)) {
UIP_STAT(++uip_stat.ip.drop); UIP_STAT(++uip_stat.ip.drop);
goto drop; goto drop;
} }
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
/* For IPv6, packet reception is a little trickier as we need to /* For IPv6, packet reception is a little trickier as we need to
make sure that we listen to certain multicast addresses (all make sure that we listen to certain multicast addresses (all
hosts multicast address, and the solicited-node multicast hosts multicast address, and the solicited-node multicast
@ -940,10 +940,10 @@ uip_process(uint8_t flag)
UIP_STAT(++uip_stat.ip.drop); UIP_STAT(++uip_stat.ip.drop);
goto drop; goto drop;
} }
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
} }
#if !UIP_CONF_IPV6 #if !NETSTACK_CONF_WITH_IPV6
if(uip_ipchksum() != 0xffff) { /* Compute and check the IP header if(uip_ipchksum() != 0xffff) { /* Compute and check the IP header
checksum. */ checksum. */
UIP_STAT(++uip_stat.ip.drop); UIP_STAT(++uip_stat.ip.drop);
@ -951,7 +951,7 @@ uip_process(uint8_t flag)
UIP_LOG("ip: bad checksum."); UIP_LOG("ip: bad checksum.");
goto drop; goto drop;
} }
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
#if UIP_TCP #if UIP_TCP
if(BUF->proto == UIP_PROTO_TCP) { /* Check for TCP packet. If so, if(BUF->proto == UIP_PROTO_TCP) { /* Check for TCP packet. If so,
@ -967,7 +967,7 @@ uip_process(uint8_t flag)
} }
#endif /* UIP_UDP */ #endif /* UIP_UDP */
#if !UIP_CONF_IPV6 #if !NETSTACK_CONF_WITH_IPV6
/* ICMPv4 processing code follows. */ /* ICMPv4 processing code follows. */
if(BUF->proto != UIP_PROTO_ICMP) { /* We only allow ICMP packets from if(BUF->proto != UIP_PROTO_ICMP) { /* We only allow ICMP packets from
here. */ here. */
@ -1018,7 +1018,7 @@ uip_process(uint8_t flag)
goto ip_send_nolen; goto ip_send_nolen;
/* End of IPv4 input header processing code. */ /* End of IPv4 input header processing code. */
#else /* !UIP_CONF_IPV6 */ #else /* !NETSTACK_CONF_WITH_IPV6 */
/* This is IPv6 ICMPv6 processing code. */ /* This is IPv6 ICMPv6 processing code. */
DEBUG_PRINTF("icmp6_input: length %d\n", uip_len); DEBUG_PRINTF("icmp6_input: length %d\n", uip_len);
@ -1086,7 +1086,7 @@ uip_process(uint8_t flag)
/* End of IPv6 ICMP processing. */ /* End of IPv6 ICMP processing. */
#endif /* !UIP_CONF_IPV6 */ #endif /* !NETSTACK_CONF_WITH_IPV6 */
#if UIP_UDP #if UIP_UDP
/* UDP input processing. */ /* UDP input processing. */
@ -1137,7 +1137,7 @@ uip_process(uint8_t flag)
} }
UIP_LOG("udp: no matching connection found"); UIP_LOG("udp: no matching connection found");
UIP_STAT(++uip_stat.udp.drop); UIP_STAT(++uip_stat.udp.drop);
#if UIP_CONF_ICMP_DEST_UNREACH && !UIP_CONF_IPV6 #if UIP_CONF_ICMP_DEST_UNREACH && !NETSTACK_CONF_WITH_IPV6
/* Copy fields from packet header into payload of this ICMP packet. */ /* Copy fields from packet header into payload of this ICMP packet. */
memcpy(&(ICMPBUF->payload[0]), ICMPBUF, UIP_IPH_LEN + 8); memcpy(&(ICMPBUF->payload[0]), ICMPBUF, UIP_IPH_LEN + 8);
@ -1183,15 +1183,15 @@ uip_process(uint8_t flag)
} }
uip_len = uip_slen + UIP_IPUDPH_LEN; uip_len = uip_slen + UIP_IPUDPH_LEN;
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
/* For IPv6, the IP length field does not include the IPv6 IP header /* For IPv6, the IP length field does not include the IPv6 IP header
length. */ length. */
BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8); BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8);
BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff); BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff);
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
BUF->len[0] = (uip_len >> 8); BUF->len[0] = (uip_len >> 8);
BUF->len[1] = (uip_len & 0xff); BUF->len[1] = (uip_len & 0xff);
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
BUF->ttl = uip_udp_conn->ttl; BUF->ttl = uip_udp_conn->ttl;
BUF->proto = UIP_PROTO_UDP; BUF->proto = UIP_PROTO_UDP;
@ -1894,15 +1894,15 @@ uip_process(uint8_t flag)
tcp_send_noconn: tcp_send_noconn:
BUF->ttl = UIP_TTL; BUF->ttl = UIP_TTL;
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
/* For IPv6, the IP length field does not include the IPv6 IP header /* For IPv6, the IP length field does not include the IPv6 IP header
length. */ length. */
BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8); BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8);
BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff); BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff);
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
BUF->len[0] = (uip_len >> 8); BUF->len[0] = (uip_len >> 8);
BUF->len[1] = (uip_len & 0xff); BUF->len[1] = (uip_len & 0xff);
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
BUF->urgp[0] = BUF->urgp[1] = 0; BUF->urgp[0] = BUF->urgp[1] = 0;
@ -1912,11 +1912,11 @@ uip_process(uint8_t flag)
#endif #endif
ip_send_nolen: ip_send_nolen:
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
BUF->vtc = 0x60; BUF->vtc = 0x60;
BUF->tcflow = 0x00; BUF->tcflow = 0x00;
BUF->flow = 0x00; BUF->flow = 0x00;
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
BUF->vhl = 0x45; BUF->vhl = 0x45;
BUF->tos = 0; BUF->tos = 0;
BUF->ipoffset[0] = BUF->ipoffset[1] = 0; BUF->ipoffset[0] = BUF->ipoffset[1] = 0;
@ -1927,11 +1927,11 @@ uip_process(uint8_t flag)
BUF->ipchksum = 0; BUF->ipchksum = 0;
BUF->ipchksum = ~(uip_ipchksum()); BUF->ipchksum = ~(uip_ipchksum());
DEBUG_PRINTF("uip ip_send_nolen: chkecum 0x%04x\n", uip_ipchksum()); DEBUG_PRINTF("uip ip_send_nolen: chkecum 0x%04x\n", uip_ipchksum());
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
UIP_STAT(++uip_stat.tcp.sent); UIP_STAT(++uip_stat.tcp.sent);
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
send: send:
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
DEBUG_PRINTF("Sending packet with length %d (%d)\n", uip_len, DEBUG_PRINTF("Sending packet with length %d (%d)\n", uip_len,
(BUF->len[0] << 8) | BUF->len[1]); (BUF->len[0] << 8) | BUF->len[1]);
@ -1973,6 +1973,6 @@ uip_send(const void *data, int len)
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
/** @}*/ /** @}*/

View file

@ -67,7 +67,6 @@
#define VERBOSE_PRINT_SEED(...) #define VERBOSE_PRINT_SEED(...)
#endif #endif
#if UIP_CONF_IPV6
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* Data Representation */ /* Data Representation */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -1448,5 +1447,3 @@ const struct uip_mcast6_driver roll_tm_driver = {
in, in,
}; };
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#endif /* UIP_CONF_IPV6 */

View file

@ -52,7 +52,6 @@
#define DEBUG DEBUG_NONE #define DEBUG DEBUG_NONE
#include "net/ip/uip-debug.h" #include "net/ip/uip-debug.h"
#if UIP_CONF_IPV6
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* Macros */ /* Macros */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -207,5 +206,3 @@ const struct uip_mcast6_driver smrf_driver = {
in, in,
}; };
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#endif /* UIP_CONF_IPV6 */

View file

@ -45,7 +45,6 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#if UIP_CONF_IPV6
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* Size of the multicast routing table */ /* Size of the multicast routing table */
#ifdef UIP_MCAST6_ROUTE_CONF_ROUTES #ifdef UIP_MCAST6_ROUTE_CONF_ROUTES
@ -129,5 +128,3 @@ uip_mcast6_route_init()
list_init(mcast_route_list); list_init(mcast_route_list);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#endif /* UIP_CONF_IPV6 */

View file

@ -69,8 +69,6 @@
#include "net/ipv6/sicslowpan.h" #include "net/ipv6/sicslowpan.h"
#include "net/netstack.h" #include "net/netstack.h"
#if UIP_CONF_IPV6
#include <stdio.h> #include <stdio.h>
#define DEBUG DEBUG_NONE #define DEBUG DEBUG_NONE
@ -1929,4 +1927,3 @@ const struct network_driver sicslowpan_driver = {
}; };
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
/** @} */ /** @} */
#endif /* UIP_CONF_IPV6 */

View file

@ -201,12 +201,25 @@ uip_ds6_link_neighbor_callback(int status, int numtx)
LINK_NEIGHBOR_CALLBACK(dest, status, numtx); LINK_NEIGHBOR_CALLBACK(dest, status, numtx);
#if UIP_DS6_LL_NUD #if UIP_DS6_LL_NUD
/* From RFC4861, page 72, last paragraph of section 7.3.3:
*
* "In some cases, link-specific information may indicate that a path to
* a neighbor has failed (e.g., the resetting of a virtual circuit). In
* such cases, link-specific information may be used to purge Neighbor
* Cache entries before the Neighbor Unreachability Detection would do
* so. However, link-specific information MUST NOT be used to confirm
* the reachability of a neighbor; such information does not provide
* end-to-end confirmation between neighboring IP layers."
*
* However, we assume that receiving a link layer ack ensures the delivery
* of the transmitted packed to the IP stack of the neighbour. This is a
* fair assumption and allows battery powered nodes save some battery by
* not re-testing the state of a neighbour periodically if it
* acknowledges link packets. */
if(status == MAC_TX_OK) { if(status == MAC_TX_OK) {
uip_ds6_nbr_t *nbr; uip_ds6_nbr_t *nbr;
nbr = uip_ds6_nbr_ll_lookup((uip_lladdr_t *)dest); nbr = uip_ds6_nbr_ll_lookup((uip_lladdr_t *)dest);
if(nbr != NULL && if(nbr != NULL && nbr->state != NBR_INCOMPLETE) {
(nbr->state == NBR_STALE || nbr->state == NBR_DELAY ||
nbr->state == NBR_PROBE)) {
nbr->state = NBR_REACHABLE; nbr->state = NBR_REACHABLE;
stimer_set(&nbr->reachable, UIP_ND6_REACHABLE_TIME / 1000); stimer_set(&nbr->reachable, UIP_ND6_REACHABLE_TIME / 1000);
PRINTF("uip-ds6-neighbor : received a link layer ACK : "); PRINTF("uip-ds6-neighbor : received a link layer ACK : ");
@ -227,10 +240,32 @@ uip_ds6_neighbor_periodic(void)
switch(nbr->state) { switch(nbr->state) {
case NBR_REACHABLE: case NBR_REACHABLE:
if(stimer_expired(&nbr->reachable)) { if(stimer_expired(&nbr->reachable)) {
#if UIP_CONF_IPV6_RPL
/* when a neighbor leave it's REACHABLE state and is a default router,
instead of going to STALE state it enters DELAY state in order to
force a NUD on it. Otherwise, if there is no upward traffic, the
node never knows if the default router is still reachable. This
mimics the 6LoWPAN-ND behavior.
*/
if(uip_ds6_defrt_lookup(&nbr->ipaddr) != NULL) {
PRINTF("REACHABLE: defrt moving to DELAY (");
PRINT6ADDR(&nbr->ipaddr);
PRINTF(")\n");
nbr->state = NBR_DELAY;
stimer_set(&nbr->reachable, UIP_ND6_DELAY_FIRST_PROBE_TIME);
nbr->nscount = 0;
} else {
PRINTF("REACHABLE: moving to STALE (");
PRINT6ADDR(&nbr->ipaddr);
PRINTF(")\n");
nbr->state = NBR_STALE;
}
#else /* UIP_CONF_IPV6_RPL */
PRINTF("REACHABLE: moving to STALE ("); PRINTF("REACHABLE: moving to STALE (");
PRINT6ADDR(&nbr->ipaddr); PRINT6ADDR(&nbr->ipaddr);
PRINTF(")\n"); PRINTF(")\n");
nbr->state = NBR_STALE; nbr->state = NBR_STALE;
#endif /* UIP_CONF_IPV6_RPL */
} }
break; break;
#if UIP_ND6_SEND_NA #if UIP_ND6_SEND_NA

View file

@ -36,8 +36,6 @@
#include "lib/memb.h" #include "lib/memb.h"
#include "net/nbr-table.h" #include "net/nbr-table.h"
#if UIP_CONF_IPV6
#include <string.h> #include <string.h>
/* The nbr_routes holds a neighbor table to be able to maintain /* The nbr_routes holds a neighbor table to be able to maintain
@ -216,6 +214,10 @@ uip_ds6_route_lookup(uip_ipaddr_t *addr)
uip_ipaddr_prefixcmp(addr, &r->ipaddr, r->length)) { uip_ipaddr_prefixcmp(addr, &r->ipaddr, r->length)) {
longestmatch = r->length; longestmatch = r->length;
found_route = r; found_route = r;
/* check if total match - e.g. all 128 bits do match */
if(longestmatch == 128) {
break;
}
} }
} }
@ -229,13 +231,14 @@ uip_ds6_route_lookup(uip_ipaddr_t *addr)
PRINTF("uip-ds6-route: No route found\n"); PRINTF("uip-ds6-route: No route found\n");
} }
if(found_route != NULL) { if(found_route != NULL && found_route != list_head(routelist)) {
/* If we found a route, we put it at the end of the routeslist /* If we found a route, we put it at the start of the routeslist
list. The list is ordered by how recently we looked them up: list. The list is ordered by how recently we looked them up:
the least recently used route will be at the start of the the least recently used route will be at the end of the
list. */ list - for fast lookups (assuming multiple packets to the same node). */
list_remove(routelist, found_route); list_remove(routelist, found_route);
list_add(routelist, found_route); list_push(routelist, found_route);
} }
return found_route; return found_route;
@ -282,7 +285,7 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length,
least recently used route is the first route on the list. */ least recently used route is the first route on the list. */
uip_ds6_route_t *oldest; uip_ds6_route_t *oldest;
oldest = uip_ds6_route_head(); oldest = list_tail(routelist); /* uip_ds6_route_head(); */
PRINTF("uip_ds6_route_add: dropping route to "); PRINTF("uip_ds6_route_add: dropping route to ");
PRINT6ADDR(&oldest->ipaddr); PRINT6ADDR(&oldest->ipaddr);
PRINTF("\n"); PRINTF("\n");
@ -328,7 +331,9 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length,
return NULL; return NULL;
} }
list_add(routelist, r); /* add new routes first - assuming that there is a reason to add this
and that there is a packet coming soon. */
list_push(routelist, r);
nbrr = memb_alloc(&neighborroutememb); nbrr = memb_alloc(&neighborroutememb);
if(nbrr == NULL) { if(nbrr == NULL) {
@ -386,7 +391,7 @@ uip_ds6_route_rm(uip_ds6_route_t *route)
PRINT6ADDR(&route->ipaddr); PRINT6ADDR(&route->ipaddr);
PRINTF("\n"); PRINTF("\n");
/* Remove the neighbor from the route list */ /* Remove the route from the route list */
list_remove(routelist, route); list_remove(routelist, route);
/* Find the corresponding neighbor_route and remove it. */ /* Find the corresponding neighbor_route and remove it. */
@ -624,5 +629,3 @@ uip_ds6_defrt_periodic(void)
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#endif /* UIP_CONF_IPV6 */

View file

@ -50,8 +50,6 @@
#include "net/ipv6/uip-ds6.h" #include "net/ipv6/uip-ds6.h"
#include "net/ip/uip-packetqueue.h" #include "net/ip/uip-packetqueue.h"
#if UIP_CONF_IPV6
#define DEBUG DEBUG_NONE #define DEBUG DEBUG_NONE
#include "net/ip/uip-debug.h" #include "net/ip/uip-debug.h"
@ -188,12 +186,12 @@ uip_ds6_periodic(void)
uip_ds6_neighbor_periodic(); uip_ds6_neighbor_periodic();
#if UIP_CONF_ROUTER & UIP_ND6_SEND_RA #if UIP_CONF_ROUTER && UIP_ND6_SEND_RA
/* Periodic RA sending */ /* Periodic RA sending */
if(stimer_expired(&uip_ds6_timer_ra) && (uip_len == 0)) { if(stimer_expired(&uip_ds6_timer_ra) && (uip_len == 0)) {
uip_ds6_send_ra_periodic(); uip_ds6_send_ra_periodic();
} }
#endif /* UIP_CONF_ROUTER & UIP_ND6_SEND_RA */ #endif /* UIP_CONF_ROUTER && UIP_ND6_SEND_RA */
etimer_reset(&uip_ds6_timer_periodic); etimer_reset(&uip_ds6_timer_periodic);
return; return;
} }
@ -704,6 +702,5 @@ uip_ds6_compute_reachable_time(void)
UIP_ND6_MIN_RANDOM_FACTOR(uip_ds6_if.base_reachable_time)); UIP_ND6_MIN_RANDOM_FACTOR(uip_ds6_if.base_reachable_time));
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#endif /* UIP_CONF_IPV6 */
/** @}*/ /** @}*/

View file

@ -68,8 +68,6 @@
#include "rpl/rpl.h" #include "rpl/rpl.h"
#endif /* UIP_CONF_IPV6_RPL */ #endif /* UIP_CONF_IPV6_RPL */
#if UIP_CONF_IPV6
/** \brief temporary IP address */ /** \brief temporary IP address */
static uip_ipaddr_t tmp_ipaddr; static uip_ipaddr_t tmp_ipaddr;
@ -421,4 +419,3 @@ uip_icmp6_init()
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @} */ /** @} */
#endif /* UIP_CONF_IPV6 */

View file

@ -112,7 +112,7 @@ typedef struct uip_icmp6_error{
* \brief Send an icmpv6 error message * \brief Send an icmpv6 error message
* \param type type of the error message * \param type type of the error message
* \param code of the error message * \param code of the error message
* \param type 32 bit parameter of the error message, semantic depends on error * \param param 32 bit parameter of the error message, semantic depends on error
*/ */
void void
uip_icmp6_error_output(uint8_t type, uint8_t code, uint32_t param); uip_icmp6_error_output(uint8_t type, uint8_t code, uint32_t param);

View file

@ -74,7 +74,6 @@
#include "net/ipv6/uip-ds6.h" #include "net/ipv6/uip-ds6.h"
#include "lib/random.h" #include "lib/random.h"
#if UIP_CONF_IPV6
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
#define DEBUG 0 #define DEBUG 0
#include "net/ip/uip-debug.h" #include "net/ip/uip-debug.h"
@ -1036,4 +1035,3 @@ uip_nd6_init()
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @} */ /** @} */
#endif /* UIP_CONF_IPV6 */

View file

@ -80,7 +80,6 @@
#include <string.h> #include <string.h>
#if UIP_CONF_IPV6
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* For Debug, logging, statistics */ /* For Debug, logging, statistics */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -1207,7 +1206,11 @@ uip_process(uint8_t flag)
} }
#if UIP_CONF_IPV6_RPL #if UIP_CONF_IPV6_RPL
rpl_update_header_empty(); if(rpl_update_header_empty()) {
/* Packet can not be forwarded */
PRINTF("RPL Forward Option Error\n");
goto drop;
}
#endif /* UIP_CONF_IPV6_RPL */ #endif /* UIP_CONF_IPV6_RPL */
UIP_IP_BUF->ttl = UIP_IP_BUF->ttl - 1; UIP_IP_BUF->ttl = UIP_IP_BUF->ttl - 1;
@ -2333,4 +2336,3 @@ uip_send(const void *data, int len)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @} */ /** @} */
#endif /* UIP_CONF_IPV6 */

View file

@ -87,7 +87,7 @@ anti_replay_was_replayed(struct anti_replay_info *info)
received_counter = anti_replay_get_counter(); received_counter = anti_replay_get_counter();
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) { if(packetbuf_holds_broadcast()) {
/* broadcast */ /* broadcast */
if(received_counter <= info->last_broadcast_counter) { if(received_counter <= info->last_broadcast_counter) {
return 1; return 1;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, Fraunhofer Heinrich-Hertz-Institut. * Copyright (c) 2010, Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -26,6 +26,8 @@
* 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.
* *
* This file is part of the Contiki operating system.
*
*/ */
/** /**
@ -78,6 +80,12 @@ struct hdr {
uint8_t len; uint8_t len;
}; };
/*---------------------------------------------------------------------------*/
static int
hdr_length(void)
{
return DECORATED_FRAMER.length() + sizeof(struct hdr);
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static int static int
create(void) create(void)
@ -172,6 +180,7 @@ parse(void)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
const struct framer contikimac_framer = { const struct framer contikimac_framer = {
hdr_length,
create, create,
create_and_secure, create_and_secure,
parse parse

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, Fraunhofer Heinrich-Hertz-Institut. * Copyright (c) 2010, Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -26,6 +26,8 @@
* 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.
* *
* This file is part of the Contiki operating system.
*
*/ */
/** /**

View file

@ -522,7 +522,7 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr,
/* If NETSTACK_CONF_BRIDGE_MODE is set, assume PACKETBUF_ADDR_SENDER is already set. */ /* If NETSTACK_CONF_BRIDGE_MODE is set, assume PACKETBUF_ADDR_SENDER is already set. */
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr); packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr);
#endif #endif
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) { if(packetbuf_holds_broadcast()) {
is_broadcast = 1; is_broadcast = 1;
PRINTDEBUG("contikimac: send broadcast\n"); PRINTDEBUG("contikimac: send broadcast\n");
@ -530,7 +530,7 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr,
return MAC_TX_COLLISION; return MAC_TX_COLLISION;
} }
} else { } else {
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
PRINTDEBUG("contikimac: send unicast to %02x%02x:%02x%02x:%02x%02x:%02x%02x\n", PRINTDEBUG("contikimac: send unicast to %02x%02x:%02x%02x:%02x%02x:%02x%02x\n",
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[0], packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[0],
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1], packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1],
@ -540,11 +540,11 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr,
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[5], packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[5],
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[6], packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[6],
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[7]); packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[7]);
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
PRINTDEBUG("contikimac: send unicast to %u.%u\n", PRINTDEBUG("contikimac: send unicast to %u.%u\n",
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[0], packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[0],
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1]); packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1]);
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
} }
is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) || is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) ||
packetbuf_attr(PACKETBUF_ATTR_ERELIABLE); packetbuf_attr(PACKETBUF_ATTR_ERELIABLE);
@ -878,8 +878,7 @@ input_packet(void)
packetbuf_totlen() > 0 && packetbuf_totlen() > 0 &&
(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), (linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&linkaddr_node_addr) || &linkaddr_node_addr) ||
linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), packetbuf_holds_broadcast())) {
&linkaddr_null))) {
/* This is a regular packet that is destined to us or to the /* This is a regular packet that is destined to us or to the
broadcast address. */ broadcast address. */

View file

@ -433,11 +433,11 @@ send_packet(void)
/* If NETSTACK_CONF_BRIDGE_MODE is set, assume PACKETBUF_ADDR_SENDER is already set. */ /* If NETSTACK_CONF_BRIDGE_MODE is set, assume PACKETBUF_ADDR_SENDER is already set. */
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr); packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr);
#endif #endif
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) { if(packetbuf_holds_broadcast()) {
is_broadcast = 1; is_broadcast = 1;
PRINTDEBUG("cxmac: send broadcast\n"); PRINTDEBUG("cxmac: send broadcast\n");
} else { } else {
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
PRINTDEBUG("cxmac: send unicast to %02x%02x:%02x%02x:%02x%02x:%02x%02x\n", PRINTDEBUG("cxmac: send unicast to %02x%02x:%02x%02x:%02x%02x:%02x%02x\n",
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[0], packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[0],
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1], packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1],
@ -451,7 +451,7 @@ send_packet(void)
PRINTDEBUG("cxmac: send unicast to %u.%u\n", PRINTDEBUG("cxmac: send unicast to %u.%u\n",
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[0], packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[0],
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1]); packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1]);
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
} }
/* is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) || /* is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) ||
packetbuf_attr(PACKETBUF_ATTR_ERELIABLE);*/ packetbuf_attr(PACKETBUF_ATTR_ERELIABLE);*/

View file

@ -104,7 +104,7 @@ create_frame(int type, int do_create)
/* Build the FCF. */ /* Build the FCF. */
params.fcf.frame_type = packetbuf_attr(PACKETBUF_ATTR_FRAME_TYPE); params.fcf.frame_type = packetbuf_attr(PACKETBUF_ATTR_FRAME_TYPE);
params.fcf.frame_pending = packetbuf_attr(PACKETBUF_ATTR_PENDING); params.fcf.frame_pending = packetbuf_attr(PACKETBUF_ATTR_PENDING);
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) { if(packetbuf_holds_broadcast()) {
params.fcf.ack_required = 0; params.fcf.ack_required = 0;
} else { } else {
params.fcf.ack_required = packetbuf_attr(PACKETBUF_ATTR_MAC_ACK); params.fcf.ack_required = packetbuf_attr(PACKETBUF_ATTR_MAC_ACK);
@ -159,11 +159,7 @@ create_frame(int type, int do_create)
} }
params.dest_pid = mac_dst_pan_id; params.dest_pid = mac_dst_pan_id;
/* if(packetbuf_holds_broadcast()) {
* If the output address is NULL in the Rime buf, then it is broadcast
* on the 802.15.4 network.
*/
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) {
/* Broadcast requires short address mode. */ /* Broadcast requires short address mode. */
params.fcf.dest_addr_mode = FRAME802154_SHORTADDRMODE; params.fcf.dest_addr_mode = FRAME802154_SHORTADDRMODE;
params.dest_addr[0] = 0xFF; params.dest_addr[0] = 0xFF;

View file

@ -132,8 +132,7 @@ send_one_packet(mac_callback_t sent, void *ptr)
NETSTACK_RADIO.prepare(packetbuf_hdrptr(), packetbuf_totlen()); NETSTACK_RADIO.prepare(packetbuf_hdrptr(), packetbuf_totlen());
is_broadcast = linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), is_broadcast = packetbuf_holds_broadcast();
&linkaddr_null);
if(NETSTACK_RADIO.receiving_packet() || if(NETSTACK_RADIO.receiving_packet() ||
(!is_broadcast && NETSTACK_RADIO.pending_packet())) { (!is_broadcast && NETSTACK_RADIO.pending_packet())) {
@ -282,8 +281,7 @@ packet_input(void)
#if NULLRDC_ADDRESS_FILTER #if NULLRDC_ADDRESS_FILTER
} else if(!linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), } else if(!linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&linkaddr_node_addr) && &linkaddr_node_addr) &&
!linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), !packetbuf_holds_broadcast()) {
&linkaddr_null)) {
PRINTF("nullrdc: not for us\n"); PRINTF("nullrdc: not for us\n");
#endif /* NULLRDC_ADDRESS_FILTER */ #endif /* NULLRDC_ADDRESS_FILTER */
} else { } else {

View file

@ -123,11 +123,7 @@ send_packet(mac_callback_t sent, void *ptr)
params.fcf.src_addr_mode = FRAME802154_LONGADDRMODE; params.fcf.src_addr_mode = FRAME802154_LONGADDRMODE;
params.dest_pid = mac_dst_pan_id; params.dest_pid = mac_dst_pan_id;
/* if(packetbuf_holds_broadcast()) {
* If the output address is NULL in the Rime buf, then it is broadcast
* on the 802.15.4 network.
*/
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) {
/* Broadcast requires short address mode. */ /* Broadcast requires short address mode. */
params.fcf.dest_addr_mode = FRAME802154_SHORTADDRMODE; params.fcf.dest_addr_mode = FRAME802154_SHORTADDRMODE;
params.dest_addr[0] = 0xFF; params.dest_addr[0] = 0xFF;

View file

@ -320,4 +320,11 @@ packetbuf_addr(uint8_t type)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#endif /* PACKETBUF_CONF_ATTRS_INLINE */ #endif /* PACKETBUF_CONF_ATTRS_INLINE */
int
packetbuf_holds_broadcast(void)
{
return linkaddr_cmp(&packetbuf_addrs[PACKETBUF_ADDR_RECEIVER - PACKETBUF_ADDR_FIRST].addr, &linkaddr_null);
}
/*---------------------------------------------------------------------------*/
/** @} */ /** @} */

View file

@ -453,6 +453,12 @@ int packetbuf_set_addr(uint8_t type, const linkaddr_t *addr);
const linkaddr_t *packetbuf_addr(uint8_t type); const linkaddr_t *packetbuf_addr(uint8_t type);
#endif /* PACKETBUF_CONF_ATTRS_INLINE */ #endif /* PACKETBUF_CONF_ATTRS_INLINE */
/**
* \brief Checks whether the current packet is a broadcast.
* \retval 0 iff current packet is not a broadcast
*/
int packetbuf_holds_broadcast(void);
void packetbuf_attr_clear(void); void packetbuf_attr_clear(void);
void packetbuf_attr_copyto(struct packetbuf_attr *attrs, void packetbuf_attr_copyto(struct packetbuf_attr *attrs,

View file

@ -48,8 +48,7 @@
#include "net/rime/collect.h" #include "net/rime/collect.h"
#include "net/rime/collect-neighbor.h" #include "net/rime/collect-neighbor.h"
#include "net/rime/collect-link-estimate.h" #include "net/rime/collect-link-estimate.h"
#include "net/rime/packetqueue.h"
#include "net/packetqueue.h"
#include "dev/radio-sensor.h" #include "dev/radio-sensor.h"

View file

@ -63,7 +63,7 @@
#include "net/rime/runicast.h" #include "net/rime/runicast.h"
#include "net/rime/neighbor-discovery.h" #include "net/rime/neighbor-discovery.h"
#include "net/rime/collect-neighbor.h" #include "net/rime/collect-neighbor.h"
#include "net/packetqueue.h" #include "net/rime/packetqueue.h"
#include "sys/ctimer.h" #include "sys/ctimer.h"
#include "lib/list.h" #include "lib/list.h"

View file

@ -43,7 +43,7 @@
*/ */
#include "sys/ctimer.h" #include "sys/ctimer.h"
#include "net/packetqueue.h" #include "net/rime/packetqueue.h"
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void

View file

@ -59,7 +59,6 @@
#define DEBUG DEBUG_NONE #define DEBUG DEBUG_NONE
#include "net/ip/uip-debug.h" #include "net/ip/uip-debug.h"
#if UIP_CONF_IPV6
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
extern rpl_of_t RPL_OF; extern rpl_of_t RPL_OF;
static rpl_of_t * const objective_functions[] = {&RPL_OF}; static rpl_of_t * const objective_functions[] = {&RPL_OF};
@ -93,6 +92,13 @@ rpl_dag_init(void)
nbr_table_register(rpl_parents, (nbr_table_callback *)nbr_callback); nbr_table_register(rpl_parents, (nbr_table_callback *)nbr_callback);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
rpl_parent_t *
rpl_get_parent(uip_lladdr_t *addr)
{
rpl_parent_t *p = nbr_table_get_from_lladdr(rpl_parents, (linkaddr_t *)addr);
return p;
}
/*---------------------------------------------------------------------------*/
rpl_rank_t rpl_rank_t
rpl_get_parent_rank(uip_lladdr_t *addr) rpl_get_parent_rank(uip_lladdr_t *addr)
{ {
@ -513,6 +519,7 @@ rpl_free_instance(rpl_instance_t *instance)
ctimer_stop(&instance->dio_timer); ctimer_stop(&instance->dio_timer);
ctimer_stop(&instance->dao_timer); ctimer_stop(&instance->dao_timer);
ctimer_stop(&instance->dao_lifetime_timer);
if(default_instance == instance) { if(default_instance == instance) {
default_instance = NULL; default_instance = NULL;
@ -1311,5 +1318,4 @@ rpl_lock_parent(rpl_parent_t *p)
nbr_table_lock(rpl_parents, p); nbr_table_lock(rpl_parents, p);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#endif /* UIP_CONF_IPV6 */
/** @} */ /** @} */

View file

@ -48,6 +48,7 @@
#include "net/ip/tcpip.h" #include "net/ip/tcpip.h"
#include "net/ipv6/uip-ds6.h" #include "net/ipv6/uip-ds6.h"
#include "net/rpl/rpl-private.h" #include "net/rpl/rpl-private.h"
#include "net/packetbuf.h"
#define DEBUG DEBUG_NONE #define DEBUG DEBUG_NONE
#include "net/ip/uip-debug.h" #include "net/ip/uip-debug.h"
@ -64,7 +65,6 @@
#define UIP_EXT_HDR_OPT_PADN_BUF ((struct uip_ext_hdr_opt_padn *)&uip_buf[uip_l2_l3_hdr_len + uip_ext_opt_offset]) #define UIP_EXT_HDR_OPT_PADN_BUF ((struct uip_ext_hdr_opt_padn *)&uip_buf[uip_l2_l3_hdr_len + uip_ext_opt_offset])
#define UIP_EXT_HDR_OPT_RPL_BUF ((struct uip_ext_hdr_opt_rpl *)&uip_buf[uip_l2_l3_hdr_len + uip_ext_opt_offset]) #define UIP_EXT_HDR_OPT_RPL_BUF ((struct uip_ext_hdr_opt_rpl *)&uip_buf[uip_l2_l3_hdr_len + uip_ext_opt_offset])
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if UIP_CONF_IPV6
int int
rpl_verify_header(int uip_ext_opt_offset) rpl_verify_header(int uip_ext_opt_offset)
{ {
@ -105,19 +105,12 @@ rpl_verify_header(int uip_ext_opt_offset)
route = uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr); route = uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr);
if(route != NULL) { if(route != NULL) {
uip_ds6_route_rm(route); uip_ds6_route_rm(route);
/* If we are the root and just needed to remove a DAO route,
chances are that the network needs to be repaired. The
rpl_repair_root() function will cause a global repair if we
happen to be the root node of the dag. */
PRINTF("RPL: initiate global repair\n");
rpl_repair_root(instance->instance_id);
} }
RPL_STAT(rpl_stats.forward_errors++);
/* Remove the forwarding error flag and return 0 to let the packet /* Trigger DAO retransmission */
be forwarded again. */ rpl_reset_dio_timer(instance);
UIP_EXT_HDR_OPT_RPL_BUF->flags &= ~RPL_HDR_OPT_FWD_ERR; /* drop the packet as it is not routable */
return 0; return 1;
} }
if(!instance->current_dag->joined) { if(!instance->current_dag->joined) {
@ -145,10 +138,9 @@ rpl_verify_header(int uip_ext_opt_offset)
sender_closer); sender_closer);
if(UIP_EXT_HDR_OPT_RPL_BUF->flags & RPL_HDR_OPT_RANK_ERR) { if(UIP_EXT_HDR_OPT_RPL_BUF->flags & RPL_HDR_OPT_RANK_ERR) {
PRINTF("RPL: Rank error signalled in RPL option!\n"); PRINTF("RPL: Rank error signalled in RPL option!\n");
/* We should try to repair it, not implemented for the moment */ /* Packet must be dropped and dio trickle timer reset, see RFC6550 - 11.2.2.2 */
rpl_reset_dio_timer(instance); rpl_reset_dio_timer(instance);
/* Forward the packet anyway. */ return 1;
return 0;
} }
PRINTF("RPL: Single error tolerated\n"); PRINTF("RPL: Single error tolerated\n");
UIP_EXT_HDR_OPT_RPL_BUF->flags |= RPL_HDR_OPT_RANK_ERR; UIP_EXT_HDR_OPT_RPL_BUF->flags |= RPL_HDR_OPT_RANK_ERR;
@ -183,12 +175,13 @@ set_rpl_opt(unsigned uip_ext_opt_offset)
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void int
rpl_update_header_empty(void) rpl_update_header_empty(void)
{ {
rpl_instance_t *instance; rpl_instance_t *instance;
int uip_ext_opt_offset; int uip_ext_opt_offset;
int last_uip_ext_len; int last_uip_ext_len;
rpl_parent_t *parent;
last_uip_ext_len = uip_ext_len; last_uip_ext_len = uip_ext_len;
uip_ext_len = 0; uip_ext_len = 0;
@ -211,12 +204,12 @@ rpl_update_header_empty(void)
if(UIP_EXT_HDR_OPT_RPL_BUF->opt_len != RPL_HDR_OPT_LEN) { if(UIP_EXT_HDR_OPT_RPL_BUF->opt_len != RPL_HDR_OPT_LEN) {
PRINTF("RPL: RPL Hop-by-hop option has wrong length\n"); PRINTF("RPL: RPL Hop-by-hop option has wrong length\n");
uip_ext_len = last_uip_ext_len; uip_ext_len = last_uip_ext_len;
return; return 0;
} }
instance = rpl_get_instance(UIP_EXT_HDR_OPT_RPL_BUF->instance); instance = rpl_get_instance(UIP_EXT_HDR_OPT_RPL_BUF->instance);
if(instance == NULL || !instance->used || !instance->current_dag->joined) { if(instance == NULL || !instance->used || !instance->current_dag->joined) {
PRINTF("RPL: Unable to add hop-by-hop extension header: incorrect instance\n"); PRINTF("RPL: Unable to add hop-by-hop extension header: incorrect instance\n");
return; return 0;
} }
break; break;
default: default:
@ -224,11 +217,11 @@ rpl_update_header_empty(void)
if(uip_len + RPL_HOP_BY_HOP_LEN > UIP_BUFSIZE) { if(uip_len + RPL_HOP_BY_HOP_LEN > UIP_BUFSIZE) {
PRINTF("RPL: Packet too long: impossible to add hop-by-hop option\n"); PRINTF("RPL: Packet too long: impossible to add hop-by-hop option\n");
uip_ext_len = last_uip_ext_len; uip_ext_len = last_uip_ext_len;
return; return 0;
} }
set_rpl_opt(uip_ext_opt_offset); set_rpl_opt(uip_ext_opt_offset);
uip_ext_len = last_uip_ext_len + RPL_HOP_BY_HOP_LEN; uip_ext_len = last_uip_ext_len + RPL_HOP_BY_HOP_LEN;
return; return 0;
} }
switch(UIP_EXT_HDR_OPT_BUF->type) { switch(UIP_EXT_HDR_OPT_BUF->type) {
@ -244,6 +237,15 @@ rpl_update_header_empty(void)
if(uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr) == NULL) { if(uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr) == NULL) {
UIP_EXT_HDR_OPT_RPL_BUF->flags |= RPL_HDR_OPT_FWD_ERR; UIP_EXT_HDR_OPT_RPL_BUF->flags |= RPL_HDR_OPT_FWD_ERR;
PRINTF("RPL forwarding error\n"); PRINTF("RPL forwarding error\n");
/* We should send back the packet to the originating parent,
but it is not feasible yet, so we send a No-Path DAO instead */
PRINTF("RPL generate No-Path DAO\n");
parent = rpl_get_parent((uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_SENDER));
if(parent != NULL) {
dao_output_target(parent, &UIP_IP_BUF->destipaddr, RPL_ZERO_LIFETIME);
}
/* Drop packet */
return 1;
} }
} else { } else {
/* Set the down extension flag correctly as described in Section /* Set the down extension flag correctly as described in Section
@ -262,11 +264,11 @@ rpl_update_header_empty(void)
} }
uip_ext_len = last_uip_ext_len; uip_ext_len = last_uip_ext_len;
return; return 0;
default: default:
PRINTF("RPL: Multi Hop-by-hop options not implemented\n"); PRINTF("RPL: Multi Hop-by-hop options not implemented\n");
uip_ext_len = last_uip_ext_len; uip_ext_len = last_uip_ext_len;
return; return 0;
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -375,6 +377,5 @@ rpl_insert_header(void)
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#endif /* UIP_CONF_IPV6 */
/** @}*/ /** @}*/

View file

@ -61,7 +61,6 @@
#include "net/ip/uip-debug.h" #include "net/ip/uip-debug.h"
#if UIP_CONF_IPV6
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#define RPL_DIO_GROUNDED 0x80 #define RPL_DIO_GROUNDED 0x80
#define RPL_DIO_MOP_SHIFT 3 #define RPL_DIO_MOP_SHIFT 3
@ -958,6 +957,5 @@ rpl_icmp6_register_handlers()
uip_icmp6_register_input_handler(&dao_ack_handler); uip_icmp6_register_input_handler(&dao_ack_handler);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#endif /* UIP_CONF_IPV6 */
/** @}*/ /** @}*/

View file

@ -47,8 +47,6 @@
#include "lib/random.h" #include "lib/random.h"
#include "sys/ctimer.h" #include "sys/ctimer.h"
#if UIP_CONF_IPV6
#define DEBUG DEBUG_NONE #define DEBUG DEBUG_NONE
#include "net/ip/uip-debug.h" #include "net/ip/uip-debug.h"
@ -325,6 +323,5 @@ rpl_cancel_dao(rpl_instance_t *instance)
ctimer_stop(&instance->dao_lifetime_timer); ctimer_stop(&instance->dao_lifetime_timer);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#endif /* UIP_CONF_IPV6 */
/** @}*/ /** @}*/

View file

@ -55,8 +55,6 @@
#include <limits.h> #include <limits.h>
#include <string.h> #include <string.h>
#if UIP_CONF_IPV6
#if RPL_CONF_STATS #if RPL_CONF_STATS
rpl_stats_t rpl_stats; rpl_stats_t rpl_stats;
#endif #endif
@ -316,6 +314,5 @@ rpl_init(void)
RPL_OF.reset(NULL); RPL_OF.reset(NULL);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#endif /* UIP_CONF_IPV6 */
/** @}*/ /** @}*/

View file

@ -240,13 +240,14 @@ int rpl_repair_root(uint8_t instance_id);
int rpl_set_default_route(rpl_instance_t *instance, uip_ipaddr_t *from); int rpl_set_default_route(rpl_instance_t *instance, uip_ipaddr_t *from);
rpl_dag_t *rpl_get_any_dag(void); rpl_dag_t *rpl_get_any_dag(void);
rpl_instance_t *rpl_get_instance(uint8_t instance_id); rpl_instance_t *rpl_get_instance(uint8_t instance_id);
void rpl_update_header_empty(void); int rpl_update_header_empty(void);
int rpl_update_header_final(uip_ipaddr_t *addr); int rpl_update_header_final(uip_ipaddr_t *addr);
int rpl_verify_header(int); int rpl_verify_header(int);
void rpl_insert_header(void); void rpl_insert_header(void);
void rpl_remove_header(void); void rpl_remove_header(void);
uint8_t rpl_invert_header(void); uint8_t rpl_invert_header(void);
uip_ipaddr_t *rpl_get_parent_ipaddr(rpl_parent_t *nbr); uip_ipaddr_t *rpl_get_parent_ipaddr(rpl_parent_t *nbr);
rpl_parent_t *rpl_get_parent(uip_lladdr_t *addr);
rpl_rank_t rpl_get_parent_rank(uip_lladdr_t *addr); rpl_rank_t rpl_get_parent_rank(uip_lladdr_t *addr);
uint16_t rpl_get_parent_link_metric(const uip_lladdr_t *addr); uint16_t rpl_get_parent_link_metric(const uip_lladdr_t *addr);
void rpl_dag_init(void); void rpl_dag_init(void);

View file

@ -51,7 +51,7 @@ CONTIKI_SOURCEFILES += $(CTK) ctk-conio.c petsciiconv.c cfs-posix-dir.c \
$(CONTIKI_TARGET_SOURCEFILES) $(CONTIKI_CPU_SOURCEFILES) \ $(CONTIKI_TARGET_SOURCEFILES) $(CONTIKI_CPU_SOURCEFILES) \
$(ETHERNET_SOURCEFILES) $(ETHERNET_SOURCEFILES)
MODULES += core/ctk core/net/ip core/net/ipv4 core/net/ipv6 MODULES += core/ctk
# Set target-specific variable values # Set target-specific variable values
${addprefix $(OBJECTDIR)/,${call oname, $(ETHERNET_SOURCEFILES)}}: ASFLAGS += -D DYN_DRV=0 ${addprefix $(OBJECTDIR)/,${call oname, $(ETHERNET_SOURCEFILES)}}: ASFLAGS += -D DYN_DRV=0

View file

@ -2,4 +2,5 @@ CONTIKI_PROJECT = ethconfig
all: $(CONTIKI_PROJECT) all: $(CONTIKI_PROJECT)
CONTIKI = ../../.. CONTIKI = ../../..
CONTIKI_WITH_IPV4 = 1
include $(CONTIKI)/Makefile.include include $(CONTIKI)/Makefile.include

View file

@ -2,4 +2,5 @@ CONTIKI_PROJECT = ipconfig
all: $(CONTIKI_PROJECT) all: $(CONTIKI_PROJECT)
CONTIKI = ../../.. CONTIKI = ../../..
CONTIKI_WITH_IPV4 = 1
include $(CONTIKI)/Makefile.include include $(CONTIKI)/Makefile.include

View file

@ -59,12 +59,12 @@ pollhandler(void)
uip_len = ethernet_poll(); uip_len = ethernet_poll();
if(uip_len > 0) { if(uip_len > 0) {
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) { if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) {
uip_neighbor_add(&IPBUF->srcipaddr, &BUF->src); uip_neighbor_add(&IPBUF->srcipaddr, &BUF->src);
tcpip_input(); tcpip_input();
} else } else
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) { if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) {
uip_len -= sizeof(struct uip_eth_hdr); uip_len -= sizeof(struct uip_eth_hdr);
tcpip_input(); tcpip_input();

View file

@ -76,7 +76,7 @@ CFLAGSNO = -I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) -I$(CONTIKI_CPU)/loader \
-I$(CONTIKI_CPU)/dbg-io \ -I$(CONTIKI_CPU)/dbg-io \
-I$(CONTIKI)/platform/$(TARGET) \ -I$(CONTIKI)/platform/$(TARGET) \
${addprefix -I,$(APPDIRS)} \ ${addprefix -I,$(APPDIRS)} \
-DWITH_UIP -DWITH_ASCII -DMCK=$(MCK) \ -DWITH_ASCII -DMCK=$(MCK) \
-Wall $(ARCH_FLAGS) -g -D SUBTARGET=$(SUBTARGET) -Wall $(ARCH_FLAGS) -g -D SUBTARGET=$(SUBTARGET)
CFLAGS += $(CFLAGSNO) -O -DRUN_AS_SYSTEM -DROM_RUN CFLAGS += $(CFLAGSNO) -O -DRUN_AS_SYSTEM -DROM_RUN

View file

@ -117,12 +117,12 @@ PROCESS_THREAD(usb_eth_process, ev , data)
uip_len = sizeof(recv_data) - recv_buffer.left; uip_len = sizeof(recv_data) - recv_buffer.left;
/* printf("Received: %d bytes\n", uip_len); */ /* printf("Received: %d bytes\n", uip_len); */
memcpy(uip_buf, recv_data, uip_len); memcpy(uip_buf, recv_data, uip_len);
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) { if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) {
uip_neighbor_add(&IPBUF->srcipaddr, &BUF->src); uip_neighbor_add(&IPBUF->srcipaddr, &BUF->src);
tcpip_input(); tcpip_input();
} else } else
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) { if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) {
uip_len -= sizeof(struct uip_eth_hdr); uip_len -= sizeof(struct uip_eth_hdr);
tcpip_input(); tcpip_input();

View file

@ -75,7 +75,7 @@ CFLAGSNO = -I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) -I$(CONTIKI_CPU)/loader \
-I$(CONTIKI_CPU)/dbg-io \ -I$(CONTIKI_CPU)/dbg-io \
-I$(CONTIKI)/platform/$(TARGET) \ -I$(CONTIKI)/platform/$(TARGET) \
${addprefix -I,$(APPDIRS)} \ ${addprefix -I,$(APPDIRS)} \
-DWITH_UIP -DWITH_ASCII -DMCK=$(MCK) \ -DWITH_ASCII -DMCK=$(MCK) \
-Wall $(ARCH_FLAGS) -g -D SUBTARGET=$(SUBTARGET) -Wall $(ARCH_FLAGS) -g -D SUBTARGET=$(SUBTARGET)
CFLAGS += $(CFLAGSNO) -O -DRUN_AS_SYSTEM -DROM_RUN CFLAGS += $(CFLAGSNO) -O -DRUN_AS_SYSTEM -DROM_RUN

View file

@ -101,6 +101,7 @@ CFLAGSNO = -Wall -mmcu=$(MCU) -gdwarf-2 -fno-strict-aliasing \
-I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) $(USB_INCLUDES) \ -I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) $(USB_INCLUDES) \
$(CONTIKI_PLAT_DEFS) $(CONTIKI_PLAT_DEFS)
CFLAGS += $(CFLAGSNO) -O$(OPTI) CFLAGS += $(CFLAGSNO) -O$(OPTI)
ASFLAGS += -mmcu=$(MCU)
ifndef BOOTLOADER_START ifndef BOOTLOADER_START
BOOTLOADER_START = 0x1F800 BOOTLOADER_START = 0x1F800
endif endif

View file

@ -72,7 +72,7 @@
#include <avr/interrupt.h> #include <avr/interrupt.h>
/* Two tick counters avoid a software divide when CLOCK_SECOND is not a power of two. */ /* Two tick counters avoid a software divide when CLOCK_SECOND is not a power of two. */
#if CLOCK_SECOND && (CLOCK_SECOND - 1) #if CLOCK_SECOND & (CLOCK_SECOND - 1)
#define TWO_COUNTERS 1 #define TWO_COUNTERS 1
#endif #endif

View file

@ -426,11 +426,7 @@ sicslowmac_dataRequest(void)
params.fcf.srcAddrMode = LONGADDRMODE; params.fcf.srcAddrMode = LONGADDRMODE;
params.dest_pid = ieee15_4ManagerAddress.get_dst_panid(); params.dest_pid = ieee15_4ManagerAddress.get_dst_panid();
/* if(packetbuf_holds_broadcast()) {
* If the output address is NULL in the Rime buf, then it is broadcast
* on the 802.15.4 network.
*/
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null) ) {
/* Broadcast requires short address mode. */ /* Broadcast requires short address mode. */
params.fcf.destAddrMode = SHORTADDRMODE; params.fcf.destAddrMode = SHORTADDRMODE;
params.dest_pid = BROADCASTPANDID; params.dest_pid = BROADCASTPANDID;

View file

@ -35,9 +35,9 @@ endef
### Banking Guesswork: ### Banking Guesswork:
### Examples outside examples/sensinode do not specify banking. ### Examples outside examples/sensinode do not specify banking.
### We automatically turn it on if its unspecified and if we are building with ### We automatically turn it on if its unspecified and if we are building with
### UIP_CONF_IPV6 ### CONTIKI_WITH_IPV6
ifndef HAVE_BANKING ifndef HAVE_BANKING
ifeq ($(UIP_CONF_IPV6),1) ifeq ($(CONTIKI_WITH_IPV6),1)
HAVE_BANKING=1 HAVE_BANKING=1
else else
HAVE_BANKING=0 HAVE_BANKING=0

View file

@ -51,9 +51,9 @@ endif
### Banking Guesswork: ### Banking Guesswork:
### Generic examples do not specify banking. ### Generic examples do not specify banking.
### We automatically turn it on if its unspecified and if we are building with ### We automatically turn it on if its unspecified and if we are building with
### UIP_CONF_IPV6 ### CONTIKI_WITH_IPV6
ifndef HAVE_BANKING ifndef HAVE_BANKING
ifeq ($(UIP_CONF_IPV6),1) ifeq ($(CONTIKI_WITH_IPV6),1)
HAVE_BANKING=1 HAVE_BANKING=1
else else
HAVE_BANKING=0 HAVE_BANKING=0

View file

@ -57,7 +57,7 @@ slip_arch_writeb(unsigned char c)
* *
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if WITH_UIP #if NETSTACK_CONF_WITH_IPV4
int int
putchar(int c) putchar(int c)
{ {
@ -83,7 +83,7 @@ putchar(int c)
return c; return c;
} }
#endif #endif /* NETSTACK_CONF_WITH_IPV4 */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** /**
* Initalize the RS232 port and the SLIP driver. * Initalize the RS232 port and the SLIP driver.

View file

@ -100,8 +100,8 @@ uart0_writeb(unsigned char c)
#endif /* TX_WITH_INTERRUPT */ #endif /* TX_WITH_INTERRUPT */
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if ! WITH_UIP /* If WITH_UIP is defined, putchar() is defined by the SLIP driver */ #if ! NETSTACK_CONF_WITH_IPV4 /* If NETSTACK_CONF_WITH_IPV4 is defined, putchar() is defined by the SLIP driver */
#endif /* ! WITH_UIP */ #endif /* ! NETSTACK_CONF_WITH_IPV4 */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** /**
* Initalize the RS232 port. * Initalize the RS232 port.

View file

@ -97,8 +97,8 @@ uart1_writeb(unsigned char c)
#endif /* TX_WITH_INTERRUPT */ #endif /* TX_WITH_INTERRUPT */
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if ! WITH_UIP /* If WITH_UIP is defined, putchar() is defined by the SLIP driver */ #if ! NETSTACK_CONF_WITH_IPV4 /* If NETSTACK_CONF_WITH_IPV4 is defined, putchar() is defined by the SLIP driver */
#endif /* ! WITH_UIP */ #endif /* ! NETSTACK_CONF_WITH_IPV4 */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** /**
* Initalize the RS232 port. * Initalize the RS232 port.

View file

@ -49,7 +49,7 @@ slip_arch_writeb(unsigned char c)
* *
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if WITH_UIP #if NETSTACK_CONF_WITH_IPV4
int int
putchar(int c) putchar(int c)
{ {
@ -75,7 +75,7 @@ putchar(int c)
return c; return c;
} }
#endif #endif /* NETSTACK_CONF_WITH_IPV4 */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** /**
* Initalize the RS232 port and the SLIP driver. * Initalize the RS232 port and the SLIP driver.

View file

@ -49,7 +49,7 @@ slip_arch_writeb(unsigned char c)
* *
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if WITH_UIP #if NETSTACK_CONF_WITH_IPV4
int int
putchar(int c) putchar(int c)
{ {
@ -75,7 +75,7 @@ putchar(int c)
return c; return c;
} }
#endif #endif /* NETSTACK_CONF_WITH_IPV4 */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** /**
* Initalize the RS232 port and the SLIP driver. * Initalize the RS232 port and the SLIP driver.

View file

@ -34,11 +34,11 @@
#include "net/ip/uip.h" #include "net/ip/uip.h"
#include "net/ip/uipopt.h" #include "net/ip/uipopt.h"
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
#include "tapdev6.h" #include "tapdev6.h"
#else #else
#include "tapdev.h" #include "tapdev.h"
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
#include "tapdev-drv.h" #include "tapdev-drv.h"
@ -48,7 +48,7 @@
PROCESS(tapdev_process, "TAP driver"); PROCESS(tapdev_process, "TAP driver");
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if !UIP_CONF_IPV6 #if !NETSTACK_CONF_WITH_IPV6
uint8_t uint8_t
tapdev_output(void) tapdev_output(void)
{ {
@ -64,16 +64,16 @@ pollhandler(void)
uip_len = tapdev_poll(); uip_len = tapdev_poll();
if(uip_len > 0) { if(uip_len > 0) {
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) { if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) {
tcpip_input(); tcpip_input();
} else } else
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) { if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) {
uip_len -= sizeof(struct uip_eth_hdr); uip_len -= sizeof(struct uip_eth_hdr);
tcpip_input(); tcpip_input();
} else if(BUF->type == uip_htons(UIP_ETHTYPE_ARP)) { } else if(BUF->type == uip_htons(UIP_ETHTYPE_ARP)) {
#if !UIP_CONF_IPV6 //math #if !NETSTACK_CONF_WITH_IPV6 //math
uip_arp_arpin(); uip_arp_arpin();
/* If the above function invocation resulted in data that /* If the above function invocation resulted in data that
should be sent out on the network, the global variable should be sent out on the network, the global variable
@ -95,7 +95,7 @@ PROCESS_THREAD(tapdev_process, ev, data)
PROCESS_BEGIN(); PROCESS_BEGIN();
tapdev_init(); tapdev_init();
#if !UIP_CONF_IPV6 #if !NETSTACK_CONF_WITH_IPV6
tcpip_set_outputfunc(tapdev_output); tcpip_set_outputfunc(tapdev_output);
#else #else
tcpip_set_outputfunc(tapdev_send); tcpip_set_outputfunc(tapdev_send);

View file

@ -36,7 +36,7 @@
#include "net/ip/uip.h" #include "net/ip/uip.h"
#include "net/ip/uipopt.h" #include "net/ip/uipopt.h"
#if !UIP_CONF_IPV6 #if !NETSTACK_CONF_WITH_IPV6
#include <fcntl.h> #include <fcntl.h>
#include <stdlib.h> #include <stdlib.h>
@ -204,4 +204,4 @@ tapdev_exit(void)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#endif /* !UIP_CONF_IPV6 */ #endif /* !NETSTACK_CONF_WITH_IPV6 */

View file

@ -36,7 +36,7 @@
#include "net/ip/uip.h" #include "net/ip/uip.h"
#include "net/ip/uipopt.h" #include "net/ip/uipopt.h"
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
#include <fcntl.h> #include <fcntl.h>
#include <stdlib.h> #include <stdlib.h>
@ -419,4 +419,4 @@ tapdev_exit(void)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */

View file

@ -64,7 +64,7 @@
PROCESS(wpcap_process, "WinPcap driver"); PROCESS(wpcap_process, "WinPcap driver");
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if !UIP_CONF_IPV6 #if !NETSTACK_CONF_WITH_IPV6
uint8_t uint8_t
wpcap_output(void) wpcap_output(void)
{ {
@ -73,7 +73,7 @@ wpcap_output(void)
return 0; return 0;
} }
#endif /* !UIP_CONF_IPV6 */ #endif /* !NETSTACK_CONF_WITH_IPV6 */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void static void
pollhandler(void) pollhandler(void)
@ -83,16 +83,16 @@ pollhandler(void)
uip_len = wpcap_poll(); uip_len = wpcap_poll();
if(uip_len > 0) { if(uip_len > 0) {
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) { if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) {
// printf("wpcap poll calls tcpip"); // printf("wpcap poll calls tcpip");
tcpip_input(); tcpip_input();
} else } else
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) { if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) {
uip_len -= sizeof(struct uip_eth_hdr); uip_len -= sizeof(struct uip_eth_hdr);
tcpip_input(); tcpip_input();
#if !UIP_CONF_IPV6 #if !NETSTACK_CONF_WITH_IPV6
} else if(BUF->type == uip_htons(UIP_ETHTYPE_ARP)) { } else if(BUF->type == uip_htons(UIP_ETHTYPE_ARP)) {
uip_arp_arpin(); //math uip_arp_arpin(); //math
/* If the above function invocation resulted in data that /* If the above function invocation resulted in data that
@ -101,7 +101,7 @@ pollhandler(void)
if(uip_len > 0) { if(uip_len > 0) {
wpcap_send(); wpcap_send();
} }
#endif /* !UIP_CONF_IPV6 */ #endif /* !NETSTACK_CONF_WITH_IPV6 */
} else { } else {
uip_len = 0; uip_len = 0;
} }
@ -125,16 +125,16 @@ pollhandler(void)
tcpip_input(); tcpip_input();
} else } else
goto bail; goto bail;
#elif UIP_CONF_IPV6 #elif NETSTACK_CONF_WITH_IPV6
if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) { if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) {
tcpip_input(); tcpip_input();
} else } else
goto bail; goto bail;
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) { if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) {
uip_len -= sizeof(struct uip_eth_hdr); uip_len -= sizeof(struct uip_eth_hdr);
tcpip_input(); tcpip_input();
#if !UIP_CONF_IPV6 #if !NETSTACK_CONF_WITH_IPV6
} else if(BUF->type == uip_htons(UIP_ETHTYPE_ARP)) { } else if(BUF->type == uip_htons(UIP_ETHTYPE_ARP)) {
uip_arp_arpin(); //math uip_arp_arpin(); //math
/* If the above function invocation resulted in data that /* If the above function invocation resulted in data that
@ -143,7 +143,7 @@ pollhandler(void)
if(uip_len > 0) { if(uip_len > 0) {
wfall_send(); wfall_send();
} }
#endif /* !UIP_CONF_IPV6 */ #endif /* !NETSTACK_CONF_WITH_IPV6 */
} else { } else {
bail: bail:
uip_len = 0; uip_len = 0;
@ -161,13 +161,13 @@ PROCESS_THREAD(wpcap_process, ev, data)
wpcap_init(); wpcap_init();
#if !UIP_CONF_IPV6 #if !NETSTACK_CONF_WITH_IPV6
tcpip_set_outputfunc(wpcap_output); tcpip_set_outputfunc(wpcap_output);
#else #else
#if !FALLBACK_HAS_ETHERNET_HEADERS #if !FALLBACK_HAS_ETHERNET_HEADERS
tcpip_set_outputfunc(wpcap_send); tcpip_set_outputfunc(wpcap_send);
#endif #endif
#endif /* !UIP_CONF_IPV6 */ #endif /* !NETSTACK_CONF_WITH_IPV6 */
process_poll(&wpcap_process); process_poll(&wpcap_process);

View file

@ -68,7 +68,7 @@
#define FALLBACK_HAS_ETHERNET_HEADERS 1 #define FALLBACK_HAS_ETHERNET_HEADERS 1
#endif #endif
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
#include <ws2tcpip.h> #include <ws2tcpip.h>
struct in6_addr addr6; struct in6_addr addr6;
char addr6str[64]; char addr6str[64];
@ -122,7 +122,7 @@ sprint_ip6addr(struct in6_addr addr, char * result)
return (result - starting); return (result - starting);
} }
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
#ifdef __CYGWIN__ #ifdef __CYGWIN__
@ -158,7 +158,7 @@ static struct pcap *pcap;
/* uip_lladdr is defined in uip.c. It is not used in uip6.c. /* uip_lladdr is defined in uip.c. It is not used in uip6.c.
* If needed for some purpose it can be defined here * If needed for some purpose it can be defined here
*/ */
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
//struct uip_eth_addr uip_lladdr; //struct uip_eth_addr uip_lladdr;
#endif #endif
@ -174,7 +174,7 @@ static int (* pcap_sendpacket)(struct pcap *, unsigned char *, int);
#ifdef UIP_FALLBACK_INTERFACE #ifdef UIP_FALLBACK_INTERFACE
static struct pcap *pfall; static struct pcap *pfall;
struct in_addr addrfall; struct in_addr addrfall;
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
struct in_addr6 addrfall6; struct in_addr6 addrfall6;
#endif #endif
@ -265,7 +265,7 @@ set_ethaddr(struct in_addr addr)
adapters->PhysicalAddress[2], adapters->PhysicalAddress[3], adapters->PhysicalAddress[2], adapters->PhysicalAddress[3],
adapters->PhysicalAddress[4], adapters->PhysicalAddress[5]); adapters->PhysicalAddress[4], adapters->PhysicalAddress[5]);
log_message("set_ethaddr: ethernetaddr: ", buffer); log_message("set_ethaddr: ethernetaddr: ", buffer);
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
// int i;for (i=0;i<6;i++) uip_lladdr.addr[i] = adapters->PhysicalAddress[i]; // int i;for (i=0;i<6;i++) uip_lladdr.addr[i] = adapters->PhysicalAddress[i];
#else #else
uip_setethaddr((*(struct uip_eth_addr *)adapters->PhysicalAddress)); uip_setethaddr((*(struct uip_eth_addr *)adapters->PhysicalAddress));
@ -281,7 +281,7 @@ set_ethaddr(struct in_addr addr)
} }
} }
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void static void
set_ethaddr6(struct in_addr6 addr) set_ethaddr6(struct in_addr6 addr)
@ -327,7 +327,7 @@ set_ethaddr6(struct in_addr6 addr)
adapters->PhysicalAddress[2], adapters->PhysicalAddress[3], adapters->PhysicalAddress[2], adapters->PhysicalAddress[3],
adapters->PhysicalAddress[4], adapters->PhysicalAddress[5]); adapters->PhysicalAddress[4], adapters->PhysicalAddress[5]);
log_message("set_ethaddr: ethernetaddr: ", buffer); log_message("set_ethaddr: ethernetaddr: ", buffer);
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
// int i;for (i=0;i<6;i++) uip_lladdr.addr[i] = adapters->PhysicalAddress[i]; //does this need doing? // int i;for (i=0;i<6;i++) uip_lladdr.addr[i] = adapters->PhysicalAddress[i]; //does this need doing?
#else #else
uip_setethaddr((*(struct uip_eth_addr *)adapters->PhysicalAddress)); uip_setethaddr((*(struct uip_eth_addr *)adapters->PhysicalAddress));
@ -396,7 +396,7 @@ init_pcap(struct in_addr addr)
} }
#endif #endif
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
} else if(paddr->addr != NULL && paddr->addr->sa_family == AF_INET6) { } else if(paddr->addr != NULL && paddr->addr->sa_family == AF_INET6) {
struct in6_addr interface_addr; struct in6_addr interface_addr;
@ -431,7 +431,7 @@ init_pcap(struct in_addr addr)
return; return;
} }
#endif #endif
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
} }
} }
} }
@ -457,13 +457,13 @@ wpcap_init(void)
#ifdef __CYGWIN__ #ifdef __CYGWIN__
if ((*__argv)[1]) { if ((*__argv)[1]) {
addr.s_addr = inet_addr((*__argv)[1]); addr.s_addr = inet_addr((*__argv)[1]);
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
uiplib_ipaddrconv((*__argv)[1],(uip_ipaddr_t*) &addr6.s6_addr); uiplib_ipaddrconv((*__argv)[1],(uip_ipaddr_t*) &addr6.s6_addr);
#endif #endif
#ifdef UIP_FALLBACK_INTERFACE #ifdef UIP_FALLBACK_INTERFACE
if ((*__argv)[2]) { if ((*__argv)[2]) {
addrfall.s_addr = inet_addr((*__argv)[2]); addrfall.s_addr = inet_addr((*__argv)[2]);
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
uiplib_ipaddrconv((*__argv)[2],(uip_ipaddr_t*) &addrfall6.s6_addr); uiplib_ipaddrconv((*__argv)[2],(uip_ipaddr_t*) &addrfall6.s6_addr);
#endif #endif
} }
@ -473,13 +473,13 @@ wpcap_init(void)
#else /* __CYGWIN__ */ #else /* __CYGWIN__ */
/* VC++ build on win32 platform. Currently the platform has no ipv6 support */ /* VC++ build on win32 platform. Currently the platform has no ipv6 support */
addr.s_addr = inet_addr(__argv[1]); addr.s_addr = inet_addr(__argv[1]);
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
if((__argv)[1]) if((__argv)[1])
uiplib_ipaddrconv((__argv)[1],(uip_ipaddr_t*) &addr6.s6_addr); uiplib_ipaddrconv((__argv)[1],(uip_ipaddr_t*) &addr6.s6_addr);
#endif #endif
#ifdef UIP_FALLBACK_INTERFACE #ifdef UIP_FALLBACK_INTERFACE
addrfall.s_addr = inet_addr(__argv[2]); addrfall.s_addr = inet_addr(__argv[2]);
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
if((__argv)[2]) if((__argv)[2])
uiplib_ipaddrconv((__argv)[2],(uip_ipaddr_t*) &addrfall6.s6_addr); uiplib_ipaddrconv((__argv)[2],(uip_ipaddr_t*) &addrfall6.s6_addr);
#endif #endif
@ -498,7 +498,7 @@ wpcap_init(void)
#endif #endif
/* Use build defaults if not enough addresses passed */ /* Use build defaults if not enough addresses passed */
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
#ifdef UIP_FALLBACK_INTERFACE #ifdef UIP_FALLBACK_INTERFACE
if(addrfall.s_addr == INADDR_NONE) { if(addrfall.s_addr == INADDR_NONE) {
@ -561,7 +561,7 @@ wpcap_init(void)
#endif #endif
log_message("usage: <program> <ip addr of ethernet card to share>\n-->I'll try guessing ", inet_ntoa(addr)); log_message("usage: <program> <ip addr of ethernet card to share>\n-->I'll try guessing ", inet_ntoa(addr));
} }
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
#if DEBUG #if DEBUG
log_message("wpcap_init:Using ipv4 ", inet_ntoa(addr)); log_message("wpcap_init:Using ipv4 ", inet_ntoa(addr));
@ -610,7 +610,7 @@ wpcap_poll(void)
return 0; return 0;
} }
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
/* Since pcap_setdirection(PCAP_D_IN) is not implemented in winpcap all outgoing packets /* Since pcap_setdirection(PCAP_D_IN) is not implemented in winpcap all outgoing packets
* will be echoed back. The stack will ignore any packets not addressed to it, but initial * will be echoed back. The stack will ignore any packets not addressed to it, but initial
* ipv6 neighbor solicitations are addressed to everyone and the echoed NS sent on startup * ipv6 neighbor solicitations are addressed to everyone and the echoed NS sent on startup
@ -649,7 +649,7 @@ wpcap_poll(void)
} }
#endif #endif
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
if(packet_header->caplen > UIP_BUFSIZE) { if(packet_header->caplen > UIP_BUFSIZE) {
return 0; return 0;
@ -673,7 +673,7 @@ wfall_poll(void)
case 0: case 0:
return 0; return 0;
} }
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
#if FALLBACK_HAS_ETHERNET_HEADERS #if FALLBACK_HAS_ETHERNET_HEADERS
#define ETHERNET_LLADDR_LEN 6 #define ETHERNET_LLADDR_LEN 6
#else #else
@ -692,7 +692,7 @@ wfall_poll(void)
PRINTF("Discarding echoed packet\n"); PRINTF("Discarding echoed packet\n");
return 0; return 0;
} }
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
if(packet_header->caplen > UIP_BUFSIZE) { if(packet_header->caplen > UIP_BUFSIZE) {
return 0; return 0;
@ -706,7 +706,7 @@ wfall_poll(void)
#endif #endif
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
uint8_t uint8_t
wpcap_send(const uip_lladdr_t *lladdr) wpcap_send(const uip_lladdr_t *lladdr)
{ {
@ -777,7 +777,7 @@ wfall_send(const uip_lladdr_t *lladdr)
return 0; return 0;
} }
#endif #endif
#else /* UIP_CONF_IPV6 */ #else /* NETSTACK_CONF_WITH_IPV6 */
void void
wpcap_send(void) wpcap_send(void)
{ {
@ -792,7 +792,7 @@ wpcap_send(void)
error_exit("error on send\n"); error_exit("error on send\n");
} }
} }
#endif /* UIP_CONF_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
wpcap_exit(void) wpcap_exit(void)

View file

@ -38,7 +38,7 @@
void wpcap_init(void); void wpcap_init(void);
uint16_t wpcap_poll(void); uint16_t wpcap_poll(void);
uint16_t wfall_poll(void); uint16_t wfall_poll(void);
#if UIP_CONF_IPV6 #if NETSTACK_CONF_WITH_IPV6
uint8_t wpcap_send(const uip_lladdr_t *lladdr); uint8_t wpcap_send(const uip_lladdr_t *lladdr);
uint8_t wfall_send(const uip_lladdr_t *lladdr); uint8_t wfall_send(const uip_lladdr_t *lladdr);
#else #else

View file

@ -120,9 +120,9 @@ uart1_writeb(unsigned char c)
#endif /* TX_WITH_INTERRUPT */ #endif /* TX_WITH_INTERRUPT */
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if ! WITH_UIP #if ! NETSTACK_CONF_WITH_IPV4
/* If WITH_UIP is defined, putchar() is defined by the SLIP driver */ /* If NETSTACK_CONF_WITH_IPV4 is defined, putchar() is defined by the SLIP driver */
#endif /* ! WITH_UIP */ #endif /* ! NETSTACK_CONF_WITH_IPV4 */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* /*
* Initalize the RS232 port. * Initalize the RS232 port.

View file

@ -33,7 +33,7 @@ init:
@echo "> Scanning files" @echo "> Scanning files"
# This target requires and graphviz and doxygen # This target requires and graphviz and doxygen
doxygen.log: docdirs = $(sort ,$(foreach dir,$(basedirs),${shell find ../${dir} -type d -not -path "*/.*" -not -path "*/obj_*"})) doxygen.log: docdirs = $(sort $(foreach dir,$(basedirs),${shell find ../${dir} -type d -not -path "*/.*" -not -path "*/obj_*"}))
doxygen.log: docsrc = $(docdirs) $(foreach dir,$(docdirs),${shell find $(dir) -type f $(filetypes)}) $(manuals) doxygen.log: docsrc = $(docdirs) $(foreach dir,$(docdirs),${shell find $(dir) -type f $(filetypes)}) $(manuals)
doxygen.log: doxygen.log:
@doxygen Doxyfile @doxygen Doxyfile

View file

@ -36,9 +36,9 @@ are part of the uIP IPv6 stack. A complete description can be found in the
corresponding IETF standards which are available at corresponding IETF standards which are available at
http://www.ietf.org/rfc.html. http://www.ietf.org/rfc.html.
\note The #UIP_CONF_IPV6 compilation flag is used to enable IPv6 (and \note The #NETSTACK_CONF_WITH_IPV6 compilation flag is used to enable IPv6.
disable IPv4). It is also recommended to set #UIP_CONF_IPV6_CHECKS to It is also recommended to set #UIP_CONF_IPV6_CHECKS to 1
1 if one cannot guarantee that the incoming packets are correctly formed. if one cannot guarantee that the incoming packets are correctly formed.
\subsection ipv6 IPv6 (RFC 2460) \subsection ipv6 IPv6 (RFC 2460)
The IP packets are processed in the #uip_process function. The IP packets are processed in the #uip_process function.
@ -236,15 +236,15 @@ This section just lists all IPv6 related compile time flags. Each flag
function is documented in this page in the appropriate section. function is documented in this page in the appropriate section.
\code \code
/*Boolean flags*/ /*Boolean flags*/
UIP_CONF_IPV6 NETSTACK_CONF_WITH_IPV6
UIP_CONF_IPV6_CHECKS UIP_CONF_IPV6_CHECKS
UIP_CONF_IPV6_QUEUE_PKT UIP_CONF_IPV6_QUEUE_PKT
UIP_CONF_IPV6_REASSEMBLY UIP_CONF_IPV6_REASSEMBLY
/*Integer flags*/ /*Integer flags*/
UIP_NETIF_MAX_ADDRESSES UIP_CONF_NETIF_MAX_ADDRESSES
UIP_ND6_MAX_PREFIXES UIP_CONF_ND6_MAX_PREFIXES
UIP_ND6_MAX_NEIGHBORS UIP_CONF_ND6_MAX_DEFROUTERS
UIP_ND6_MAX_DEFROUTER NBR_TABLE_CONF_MAX_NEIGHBORS
\endcode \endcode
<HR> <HR>
@ -257,10 +257,10 @@ reass "fragment reassembly" is enabled an additional buffer of the
same size is used. same size is used.
The only difference with the IPv4 code is the per %neighbor buffering The only difference with the IPv4 code is the per %neighbor buffering
that is available when #UIP_CONF_QUEUE_PKT is set to 1. This that is available when #UIP_CONF_IPV6_QUEUE_PKT is set to 1. This
additional buffering is used to queue one packet per %neighbor while additional buffering is used to queue one packet per %neighbor while
performing address resolution for it. This is a very costly feature as performing address resolution for it. This is a very costly feature as
it increases the RAM usage by approximately #UIP_ND6_MAX_NEIGHBORS * it increases the RAM usage by approximately #NBR_TABLE_CONF_MAX_NEIGHBORS *
#UIP_LINK_MTU bytes. #UIP_LINK_MTU bytes.
<HR> <HR>
@ -340,7 +340,7 @@ We will soon support RFC4944 transmission of IPv6 packets over 802.15.4\n
<b>IP layer</b><br> <b>IP layer</b><br>
\li IPv6 RFC2460 (MUST): When the compile flags UIP_CONF_IPV6_CHECKS and UIP_CONF_REASSEMBLY are set, full support \li IPv6 RFC2460 (MUST): When the compile flags UIP_CONF_IPV6_CHECKS and UIP_CONF_REASSEMBLY are set, full support
\li Neighbor Discovery RFC4861 (MUST): When the UIP_CONF_CHECKS and UIP_CONF_QUEUE_PKT flag are set, full support except redirect function \li Neighbor Discovery RFC4861 (MUST): When the UIP_CONF_CHECKS and UIP_CONF_IPV6_QUEUE_PKT flag are set, full support except redirect function
\li Address Autoconfiguration RFC4862 (MUST): When the UIP_CONF_CHECKS flag is set, full support except sending MLD report (see MLD) \li Address Autoconfiguration RFC4862 (MUST): When the UIP_CONF_CHECKS flag is set, full support except sending MLD report (see MLD)
\li Path MTU Discovery RFC 1981 (SHOULD): no support \li Path MTU Discovery RFC 1981 (SHOULD): no support
\li Jumbograms RFC 2675 (MAY): no support \li Jumbograms RFC 2675 (MAY): no support
@ -377,7 +377,5 @@ We pass all the tests for phase 2 except:
<HR> <HR>
@{
*/ */
/** @} */ /** @} */
/** @} */

View file

@ -5,4 +5,5 @@ SMALL = 1
all: netdb-client netdb-server all: netdb-client netdb-server
CONTIKI_WITH_RIME = 1
include $(CONTIKI)/Makefile.include include $(CONTIKI)/Makefile.include

View file

@ -7,4 +7,5 @@ SMALL = 1
all: shell-db all: shell-db
CONTIKI_WITH_RIME = 1
include $(CONTIKI)/Makefile.include include $(CONTIKI)/Makefile.include

View file

@ -3,4 +3,5 @@ CONTIKI_PROJECT = hello-world blink-hello timer-test sensors-demo
all: $(CONTIKI_PROJECT) all: $(CONTIKI_PROJECT)
CONTIKI = ../.. CONTIKI = ../..
CONTIKI_WITH_RIME = 1
include $(CONTIKI)/Makefile.include include $(CONTIKI)/Makefile.include

View file

@ -2,8 +2,6 @@ DEFINES+=PROJECT_CONF_H=\"project-conf.h\"
# We need uIPv6, therefore we also need banking # We need uIPv6, therefore we also need banking
HAVE_BANKING=1 HAVE_BANKING=1
UIP_CONF_IPV6=1
UIP_CONF_RPL=1
PROJECT_SOURCEFILES += slip-bridge.c PROJECT_SOURCEFILES += slip-bridge.c
@ -12,5 +10,5 @@ CONTIKI_PROJECT = border-router
all: $(CONTIKI_PROJECT) all: $(CONTIKI_PROJECT)
CONTIKI = ../../.. CONTIKI = ../../..
CONTIKI_WITH_IPV6 = 1
include $(CONTIKI)/Makefile.include include $(CONTIKI)/Makefile.include

View file

@ -5,4 +5,5 @@ DEFINES+=MODELS_CONF_CC2531_USB_STICK=1
all: $(CONTIKI_PROJECT) all: $(CONTIKI_PROJECT)
CONTIKI = ../../.. CONTIKI = ../../..
CONTIKI_WITH_RIME = 1
include $(CONTIKI)/Makefile.include include $(CONTIKI)/Makefile.include

View file

@ -7,4 +7,5 @@ all: $(CONTIKI_PROJECT)
CONTIKI = ../../.. CONTIKI = ../../..
CONTIKI_WITH_RIME = 1
include $(CONTIKI)/Makefile.include include $(CONTIKI)/Makefile.include

View file

@ -1,8 +1,6 @@
DEFINES+=PROJECT_CONF_H=\"project-conf.h\" DEFINES+=PROJECT_CONF_H=\"project-conf.h\"
HAVE_BANKING=1 HAVE_BANKING=1
UIP_CONF_IPV6=1
UIP_CONF_RPL=1
PROJECT_SOURCEFILES += ping6.c PROJECT_SOURCEFILES += ping6.c
@ -11,5 +9,7 @@ CONTIKI_PROJECT = client server
all: $(CONTIKI_PROJECT) all: $(CONTIKI_PROJECT)
CONTIKI = ../../.. CONTIKI = ../../..
CONTIKI_WITH_IPV6 = 1
# needed for rimestats
CONTIKI_WITH_RIME = 1
include $(CONTIKI)/Makefile.include include $(CONTIKI)/Makefile.include

View file

@ -4,4 +4,5 @@ CONTIKI_PROJECT = cc2538-demo timer-test
all: $(CONTIKI_PROJECT) all: $(CONTIKI_PROJECT)
CONTIKI = ../.. CONTIKI = ../..
CONTIKI_WITH_RIME = 1
include $(CONTIKI)/Makefile.include include $(CONTIKI)/Makefile.include

View file

@ -6,5 +6,5 @@ CONTIKI_PROJECT = sniffer
all: $(CONTIKI_PROJECT) all: $(CONTIKI_PROJECT)
CONTIKI = ../../.. CONTIKI = ../../..
CONTIKI_WITH_RIME = 1
include $(CONTIKI)/Makefile.include include $(CONTIKI)/Makefile.include

View file

@ -1,10 +1,7 @@
UIP_CONF_IPV6=1
UIP_CONF_RPL=1
CONTIKI_PROJECT = udp-echo-server CONTIKI_PROJECT = udp-echo-server
all: $(CONTIKI_PROJECT) all: $(CONTIKI_PROJECT)
CONTIKI = ../../.. CONTIKI = ../../..
CONTIKI_WITH_IPV6 = 1
include $(CONTIKI)/Makefile.include include $(CONTIKI)/Makefile.include

View file

@ -4,4 +4,5 @@ all: $(CONTIKI_PROJECT)
APPS = serial-shell powertrace collect-view APPS = serial-shell powertrace collect-view
CONTIKI = ../.. CONTIKI = ../..
CONTIKI_WITH_RIME = 1
include $(CONTIKI)/Makefile.include include $(CONTIKI)/Makefile.include

View file

@ -3,4 +3,5 @@ all: $(CONTIKI_PROJECT)
TARGET=mbxxx TARGET=mbxxx
CONTIKI = ../.. CONTIKI = ../..
CONTIKI_WITH_RIME = 1
include $(CONTIKI)/Makefile.include include $(CONTIKI)/Makefile.include

View file

@ -4,4 +4,5 @@ all: $(CONTIKI_PROJECT)
APPS = email APPS = email
CONTIKI = ../.. CONTIKI = ../..
CONTIKI_WITH_IPV4 = 1
include $(CONTIKI)/Makefile.include include $(CONTIKI)/Makefile.include

View file

@ -3,12 +3,6 @@ all: er-example-server er-example-client
CONTIKI=../.. CONTIKI=../..
# Contiki IPv6 configuration
WITH_UIP6=1
UIP_CONF_IPV6=1
CFLAGS += -DUIP_CONF_IPV6=1
CFLAGS += -DUIP_CONF_IPV6_RPL=1
CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\" CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\"
# automatically build RESTful resources # automatically build RESTful resources
@ -37,6 +31,7 @@ APPS += rest-engine
#CUSTOM_RULE_C_TO_OBJECTDIR_O = 1 #CUSTOM_RULE_C_TO_OBJECTDIR_O = 1
#CUSTOM_RULE_S_TO_OBJECTDIR_O = 1 #CUSTOM_RULE_S_TO_OBJECTDIR_O = 1
CONTIKI_WITH_IPV6 = 1
include $(CONTIKI)/Makefile.include include $(CONTIKI)/Makefile.include
# minimal-net target is currently broken in Contiki # minimal-net target is currently broken in Contiki
@ -46,7 +41,7 @@ ${info INFO: er-example compiling with large buffers}
CFLAGS += -DUIP_CONF_BUFFER_SIZE=1300 CFLAGS += -DUIP_CONF_BUFFER_SIZE=1300
CFLAGS += -DREST_MAX_CHUNK_SIZE=1024 CFLAGS += -DREST_MAX_CHUNK_SIZE=1024
CFLAGS += -DCOAP_MAX_HEADER_SIZE=176 CFLAGS += -DCOAP_MAX_HEADER_SIZE=176
CFLAGS += -DUIP_CONF_IPV6_RPL=0 CONTIKI_WITH_RPL=0
endif endif
# optional rules to get assembly # optional rules to get assembly

Some files were not shown because too many files have changed in this diff Show more