Commit graph

2237 commits

Author SHA1 Message Date
Adam Dunkels faff1c2a7e Preliminary support for RPL node types. This change allows a node to be in any of three given types:
* Mesh: this is the normal case. Nodes route data on behalf of others and the node can be reached via a DAO route.
* Leaf: the node does not route data on behalf of others, but others can route data to the node (it has a RPL DAO route).
* Feather: this is a new type of node. A feather node routes data on behalf of others, but does not install DAO routes in the network. Feather nodes allow having a larger number of nodes than the RPL network can sustain in terms of routing tables.

This commit introduces the RPL node types and the feather mode, but does not add support for the leaf node type.
2013-11-24 15:17:52 +01:00
Adam Dunkels af24d07848 Forward no-path DAOs up the tree to allow the root to repair the network if needed 2013-11-24 15:17:52 +01:00
Adam Dunkels 9039b0ecd8 Remove references to the now unused dag->parents list 2013-11-24 15:17:52 +01:00
Adam Dunkels 4e6fe7dda6 Add a neighbor table entry if a DAO is received from a node where we don't yet have a neighbor table entry. 2013-11-24 15:17:52 +01:00
Adam Dunkels 490791eaa4 Add a check for the case when the parent neighbor may have gone away to avoid using a NULL pointer 2013-11-24 15:17:52 +01:00
Adam Dunkels 0ed7db0f9b Slight improvements in debug messages 2013-11-24 15:17:52 +01:00
Adam Dunkels fc1adec1b8 Made it a bit more clear what function that gets called when a neighbor is removed 2013-11-24 15:17:51 +01:00
Adam Dunkels 61ea7fbb1c RPL DAO timers and management:
* Added a DAO lifetime timer that sends out a new DAO after half the lifetime of the DAO. This allows implementing DAO route soft state that avoids routing tables in the network keeping stale routes for ever.
* Added ways to schedule a new DAO transmission as well as cancelling an active DAO transmit timer, which makes it possible to do nodes that don't send DAOs.
2013-11-24 15:17:51 +01:00
Adam Dunkels 454088c117 Removed old, unused rawpacket code 2013-11-24 11:02:35 +01:00
Adam Dunkels 19b32c54c0 Removed the old unused hc.[ch] code 2013-11-24 11:02:35 +01:00
Adam Dunkels 9819c5b5b8 Rewrote the IPv6 route management so that all routes are maintained on a list that is ordered by the time at which the route was accessed. If a new route is added to the system, the oldest route is dropped. 2013-11-22 18:00:47 +01:00
Adam Dunkels ea4bc3816f Produce an error if the UIP_TCP_MSS is too large for UIP_BUFSIZE 2013-11-22 15:46:48 +01:00
Adam Dunkels 61a8fa9977 Allow the default TTL to be configured with UIP_CONF_TTL 2013-11-22 15:44:48 +01:00
Adam Dunkels d577d03e21 Bugfix: correctly handle the case if uip_sappdata is NULL. 2013-11-22 15:38:20 +01:00
Adam Dunkels f31d6f271f Bugfix: if a SYN is received in the SYN_RCVD state we should not send a blank SYN, but a SYNACK in response. 2013-11-22 15:37:21 +01:00
Adam Dunkels b31e84649a If the 6lowpan layer is currently reassembling a packet, and a non-fragmented packet comes along, this is a sign that one of the fragments were lost (as they normally would arrive back-to-back, in sequence). So we'll grab the non-fragmented packet instead of dropping it. 2013-11-22 15:12:02 +01:00
Adam Dunkels 3788b08780 Added a way to get the RSSI of the last received packet 2013-11-22 15:10:44 +01:00
Ari Suutari c1c64dd1cc Received UDP packet was counted twice in statistics, first in udp_input and then again in udp_found.
Fix this to use same logic as in uip.c: valid packet is counted only in udp_found.
2013-11-22 08:16:05 +02:00
Oliver Schmidt 1fdeb4c788 Changed handling of predefined macros in cc65 allows for simplification. 2013-11-20 20:55:56 +01:00
Nicolas Tsiftes 0e24fb0bc0 Merge pull request #432 from adamdunkels/push/154-len
Allow the 802.15.4/6lowpan code to operate on packets larger than 256 bytes
2013-11-20 05:23:26 -08:00
Nicolas Tsiftes 263e212427 Merge pull request #431 from adamdunkels/push/ipv6-const
Make IP addresses const
2013-11-20 04:26:05 -08:00
Nicolas Tsiftes d183b87f4b Merge pull request #434 from adamdunkels/push/cleanup-sys
Remove old unused code from the core/sys/ directory
2013-11-19 09:53:57 -08:00
Adam Dunkels 30c0c5eaf6 Removed old unused timetable code 2013-11-19 08:29:23 +01:00
Adam Dunkels 84fd0f9ae1 Removed out-commented timetable code 2013-11-19 08:21:53 +01:00
Adam Dunkels 5e9a76d38e Removed old unused tcpdump.c code 2013-11-19 00:24:18 +01:00
Adam Dunkels 563c9d1577 Removed old unused sys/ files 2013-11-19 00:23:13 +01:00
Adam Dunkels f9cb6ec2fa Added the const keyword to IP address arguments that are not (and should not be) changed by the callee 2013-11-18 00:55:57 +01:00
Adam Dunkels f26e35cffa Allow the 6lowpan code to handle packets larger than 256 bytes 2013-11-16 14:44:14 +01:00
Adam Dunkels bec721d313 Allow payload len to be larger than 256 bytes 2013-11-16 14:22:48 +01:00
Laurent Deru fd97136fee As RPL Root, drop an incoming DIO from the same instance but different DAG 2013-11-15 08:48:29 +01:00
Adam Dunkels a6227e1e3e Merge pull request #350 from AriZuu/udp-stats-fix
Fix UDP statistics.
2013-11-14 23:39:16 -08:00
Ari Suutari 8ffd29616a Fix UDP statistics also in ipv6 code. 2013-11-15 08:00:41 +02:00
Nicolas Tsiftes 5688650f6d Merge pull request #391 from cetic/fix-duplicate
Removed duplicate code in rpl-icmp6
2013-11-14 12:35:24 -08:00
Simon Duquennoy 03dcca15cb Implement a truncated exponential backoff for csma 2013-11-14 15:02:36 +01:00
Moritz 'Morty' Strübe c67c048cac Clean up setting channel and CCA-threshold for CC2420 based motes.
The CCA-threshold now defaults to -46 which give better simulation
results and typically also better experimental results.
This adjustment is also needed due to commit 0a13f99 in mspsim. As
promised in https://github.com/mspsim/mspsim/pull/18 it broke the
regression tests.
2013-11-07 17:28:33 +01:00
Sébastien Dawans a60d3bf6cf Removed duplicate code in rpl-icmp6 2013-10-23 15:43:16 +02:00
Enrico Joerns 4ba22102fd [core/net/mac] Removed invalid struct member u8 in PRINTADDR 2013-10-15 01:43:26 +02:00
Simon Duquennoy 677b5ede16 Fixed printout that used deprectated rpl_parent_t structure 2013-10-08 14:46:55 +02:00
Adam Dunkels 4e1beb3ed3 Merge pull request #361 from nvt/rpl-mrhof-fix
MRHOF fixes
2013-10-07 11:45:31 -07:00
Nicolas Tsiftes 1698c439c5 Merge pull request #359 from g-oikonomou/trickle-timer-stop
Add a method to stop running trickle timers
2013-09-30 05:47:23 -07:00
George Oikonomou 060b00c4b5 Use TRICKLE_TIMER_IS_STOPPED in trickle_timer_stop() 2013-09-30 12:37:03 +01:00
Adam Dunkels bf7edf6c4c Merge pull request #354 from lab11/core-net-fixes
Small fixes to networking files
2013-09-26 23:43:07 -07:00
Nicolas Tsiftes 43b5425493 Cleaned up various fragments and fixed a compilation error that occured when switching metric container.
Fixed a wrapping problem in the ETX EWMA calculation.

Corrected the multiplier of the link metric, and simplified the configuration
so that the user does not need to specify the multiplier.
2013-09-23 15:58:42 +02:00
George Oikonomou 995a9c92d9 Only schedule a trickle interval doubling for running timers 2013-09-16 11:53:39 +01:00
George Oikonomou fa7219d0b8 Add a way to determine whether a trickle timer is running 2013-09-16 11:53:39 +01:00
Adam Dunkels 50395666fc Merge pull request #341 from ismb-pert/fix-lladdr
Fixed fail to build from source due to a bad &nbr->lladdr
2013-09-14 03:24:12 -07:00
Zhen-Huan Hwang e75dacb5fa 1. Added a missing '&' in lib/trickle-timer.h
2. Removed executable permissions of lib/trickle-timer.c & .h
2013-09-11 18:31:06 +03:00
Zhen-Huan Hwang b5815e8509 Fixed a typo in net/uipopt.h 2013-09-11 18:30:31 +03:00
Brad Campbell bc762b6dd6 Small fixes to networking files
1. Added #include header
2. Fixed #defines that weren't updated
3. Small change to comment that now points to correct RFC section
2013-09-09 20:48:11 -04:00
Oliver Schmidt c4bba3e89a Removed unnecessary code from resolver. 2013-09-09 21:35:51 +02:00
Gianfranco Costamagna 2afea590f7 Fixed fail to build from source due to a bad "&nbr->lladdr" reference 2013-09-06 22:11:19 +02:00
Ari Suutari 35c7314093 Fix UDP statistics. 2013-09-05 20:37:01 +03:00
Oliver Schmidt e0ddea2a17 Removed unnecessary code from resolver. 2013-09-01 20:23:11 +02:00
Sébastien Dawans 78e807403c Inserts missing IPv6 Hop-By-Hop RPL Option at first hop 2013-08-19 21:40:24 +02:00
Adam Dunkels 86e247025a Removed debugging printout that came before a local variable declaration, which seems to have broken sdcc 2013-08-19 17:48:33 +02:00
Adam Dunkels bfd7e5f25b Fixed a few bugs in the route handling code. While bughunting, rewrote parts of the code to make its intention clearer. Also added a bunch of comments to make the logic of the code more evident. 2013-08-19 17:48:32 +02:00
Adam Dunkels 8dc4e46968 Check if the nexthop neighbor for a given route has disappeared. If so, we drop the route too. If we happen to be the RPL root, we also initiate a global repair as the neighbor may moved. 2013-08-19 17:48:32 +02:00
Adam Dunkels d0a939afb0 Bugfix: must multiply with ETX divisor to turn into fixed-point format. 2013-08-19 17:48:32 +02:00
Adam Dunkels 4d0ecaae02 Make sure our parent's IP address isn't NULL. 2013-08-19 17:48:32 +02:00
Adam Dunkels e5a6565137 Loop detection via DAO: if we get a DAO from a parent, that parent thinks we are its parent. We poison it and recalulate our parents. 2013-08-19 17:48:32 +02:00
Adam Dunkels 34119b7ef2 Poor man's loop reparation: reset the DIO timer and hope the neighbor learns a better route. 2013-08-19 17:48:32 +02:00
Adam Dunkels d830e9df3f Implement forwarding error handling: if a packet changes direction, we set the FWD_ERR flag. If we see the FWD_ERR flag, we drop the route that we sent it to. If we are the root node, we also initiate a global repair. 2013-08-19 17:48:31 +02:00
Adam Dunkels abb3ef9b3b Bugfix: don't set the parent if the dag is NULL 2013-08-19 17:48:31 +02:00
Adam Dunkels 08761dfd8a Added a function uip_ds6_nbr_num() for getting the number of neighbors 2013-08-19 17:48:31 +02:00
Adam Dunkels a027832f94 Fixed a bunch of compiler warnings 2013-08-19 17:48:31 +02:00
Adam Dunkels 9a74ada90c Added a function rpl_get_parent_link_metric() for obtaining the link metric of a given parent 2013-08-19 17:48:31 +02:00
Adam Dunkels c52fc2fd19 Defensive programming: check for the argument being NULL. 2013-08-19 17:48:31 +02:00
Adam Dunkels b42ccaed1b Added function prototypes to a number of functions with void arguments 2013-08-19 17:48:31 +02:00
Adam Dunkels 82e8eb420d Added and updated debugging printouts and reformatted code to make it a little easier to read. 2013-08-19 17:48:31 +02:00
Simon Duquennoy 248301a041 Fix naming issues and includes in uip-ds6-nbr.h 2013-08-19 17:48:30 +02:00
Simon Duquennoy ff093a2b50 Removed now unused per-module neighbor table size configs. Use NEIGHBOR_CONF_MAX_NEIGHBORS instead. 2013-08-19 17:48:30 +02:00
Simon Duquennoy c3f62b24c8 Moved ETX management from neighbor-info to rpl-of-etx. Avoids conversions between different fixed point representations, and simplifies neighbor management. Makes more clear how default-ETX and noack-ETX actually affect the rank. Removed neighbor-info and neighbor-attr. 2013-08-19 17:48:30 +02:00
Simon Duquennoy c50d10aa53 Make RPL use neighbor tables. RPL locks the neighbor used as preferred parent. 2013-08-19 17:48:30 +02:00
Simon Duquennoy 09d26f8060 Make uip-ds6-route use neighbor table. Instead of storing a global list of routing entries that contain both the next hop and the destination, we have a separate list of reachable destination for each neighbor in the global table. 2013-08-19 17:48:30 +02:00
Simon Duquennoy ec609b49eb Make DS6 neighbors use neighbor-table, and move all DS6 neighbor management from uip-ds6 to a new uip-ds6-neighbor module. 2013-08-19 17:48:30 +02:00
Simon Duquennoy 5a1d8d8006 Make phase module use neighbor-table. 2013-08-19 17:48:29 +02:00
Simon Duquennoy cfb3bbdad9 Added new neighbor-table module, a centralized place where to store all data about neighbors, indexed by link-layer address. Meant for use in other Contiki modules such as rpl, ds6, ds6-route, phase, neighbor-info. 2013-08-19 17:48:29 +02:00
Fredrik Osterlind 8041f66d8c link-layer acks support for cooja motes 2013-08-15 14:32:35 +02:00
Adam Dunkels f5307fc01e Bugfix: must set the SICSLOWPAM_MAX_MAC_TRANSMISSIONS attribute after clearing the buffer, otherwise it will not be used for outoing packets. 2013-08-11 14:27:21 +02:00
Adam Dunkels 0aa448f190 6lowpan fragmentation bugfix: the 6lowpan code had an unfortunate
interaction with the behavior of the rdc layer. If the first packet of a
fragment transmission was lost, the remaining packets would get dropped
on reception. Moreover, the reception code contained a bug that
sometimes would cause fragments to be misidentified as fragments. Taken
together, these problems would result in a pathelogical network
breakdown if too many fragmented packets would occur simultaneously.
2013-08-11 14:27:20 +02:00
Adam Dunkels 02c0b8a4e4 Parse rodata too 2013-08-06 21:33:03 +02:00
Oliver Schmidt ff5d6e091d Recent changes in telnetd make exporting of those two necessary. 2013-07-31 00:04:43 +02:00
Adam Dunkels 54f2109134 Merge pull request #290 from simonduq/rpl-mrhof-etx-nomc
Update of RPL MRHOF (use no metric container with ETX [RFC6719])
2013-07-29 00:56:25 -07:00
Adam Dunkels 945f217a11 Merge pull request #220 from lebrush/uip-ds6-least-lifetime
Add method to get the first neighbour which is about to expire
2013-07-28 16:43:41 -07:00
Nicolas Tsiftes d228cb57a5 Merge pull request #301 from adamdunkels/hotfix-rpl-max-dio
RPL bugfix: don't ignore infinite rank DIOs
2013-07-26 06:48:26 -07:00
Adam Dunkels 500d9cc3e4 Merge pull request #300 from cetic/rpl-nopath-dao
RPL No-Path DAOs
2013-07-26 03:53:56 -07:00
Adam Dunkels 9ba5d9694c Merge pull request #299 from jdede/rpl-rm-neighbor
Default route not removed
2013-07-26 03:52:55 -07:00
Adam Dunkels 4913792d41 Minor code style fix 2013-07-26 12:38:43 +02:00
Adam Dunkels 512a339c50 Bugfix: DIOs with infinite ranks should not be ignored as they are used by RPL as a signal by nodes that have lost their routes. Instead of ignoring them, we should send out our latest information to let the node with infinite rank find their way into the network again. 2013-07-26 12:38:25 +02:00
Sébastien Dawans a05d635512 Improve readability of DAO output variables 2013-07-25 11:22:38 +02:00
Sébastien Dawans 0bd26d83c8 Ignore No-Path DAO if target is already reachable through a different route than the DAO sender 2013-07-25 11:21:04 +02:00
Sébastien Dawans c4a121bf18 No-Path DAO Propagation 2013-07-25 11:19:56 +02:00
Jens Dede 2f1bf730af Adapted comment 2013-07-23 20:01:10 +02:00
Simon Duquennoy defcc639ce Use no metric container when having MRHOF with ETX, as specified in RFC6719. Renamed rpl-of-etx to rpl-mrhof. 2013-07-23 19:36:38 +02:00
Nicolas Tsiftes f8edf41411 Merge pull request #291 from simonduq/na-config
Added a flag to optionally disable IPv6 NA/NS at compile time
2013-07-23 09:52:13 -07:00
Jens Dede 9dd5af78c8 fix: default routes are removed correctly if no DAG with preferred parent is available 2013-07-23 15:35:47 +02:00
Robert Quattlebaum 0308d3fcf0 settings: Correct a problem where sometimes CC_INLINE is not defined properly. 2013-07-02 08:46:03 -07:00
Simon Duquennoy 0e81b91fa6 Simplify periodic ds6 neighbor processing in case NA/NS is disabled. Strips out uip_nd6_ns_output from the binary. 2013-07-02 15:20:21 +02:00
Simon Duquennoy 1f38348cf9 Added a flag to optionally disable IPv6 NA/NS at compile time 2013-07-02 14:43:53 +02:00
Peter A. Bigot 8439c1bb81 core/dev/led: Allow platform to provide LED color map 2013-06-21 11:34:48 -05:00
Jelmer Tiete cf894b8b95 changed inter packet interval to 0.4ms 2013-06-21 13:15:45 +02:00
Nicolas Tsiftes 7cc8f326f4 Merge pull request #257 from adamdunkels/hotfix-csma
CSMA bugfix
2013-06-20 01:49:48 -07:00
Adam Dunkels 09f30e875d Bugfix: when a CSMA callback is received, we should remove the packet
that was transmitted and not just the first packet that happens to be on
the output queue.
2013-05-25 12:13:07 +02:00
Adam Dunkels ee64780cb6 Allow proactive probing interval to be configured 2013-05-25 12:10:27 +02:00
Adam Dunkels c9de0e49be Added a number of default options for ContikiMAC, and allow them to be overridden with contiki-conf.h configuration options 2013-05-25 12:10:27 +02:00
Adam Dunkels 0a135eeba1 Merge pull request #214 from lebrush/tcp-uip-size
Limit partially size of uip/tcpip stack when not using TCP at all
2013-05-23 09:48:17 -07:00
Adam Dunkels 0f135afb34 Merge pull request #218 from lebrush/rpl-mixed-network-bug
Fixes bug a node not using RPL joins a network which does
2013-05-22 00:26:06 -07:00
Nicolas Tsiftes ffd18aad82 Merge pull request #221 from lebrush/uip-ds6-notifications
Make DS6 route notifications optional
2013-05-21 07:10:31 -07:00
lebrush 6eafa08313 Make DS6 route notifications optional. 2013-05-21 10:05:02 +02:00
lebrush 96a1a97736 Limit size of uip/tcpip stack when not using TCP at all. 2013-05-21 10:02:17 +02:00
lebrush 5bae5e6ffd Fixes imposibility of receiving data when a node not using RPL joins a network
which does.

The RPL header is processed, declared invalid and the packet discarded. This
is fixed by this commit.
2013-05-21 10:00:46 +02:00
lebrush c2a7a25a9e Code style fixes 2013-05-21 09:50:30 +02:00
lebrush 26177387fc Use memcpy, memcmp functions for the rime compare and copy functions as they
are already used all over contiki.
2013-05-21 09:50:29 +02:00
lebrush 2fb007b1e0 Code style fixes 2013-05-21 09:05:30 +02:00
Nicolas Tsiftes 83c08bdf99 Merge pull request #219 from lebrush/sicslowpan-uip-debug
Force sicslowpan to use uip-debug rather than an own system
2013-05-20 04:59:20 -07:00
Robert Quattlebaum 382308e6bf Merge pull request #242 from darconeous/pull-request/resolv-bad-nsec-fix
resolv: Fix for bad NSEC record on announce
2013-05-19 16:34:03 -07:00
Robert Quattlebaum d0b99cc3cc resolv: Fix for bad NSEC record on announce 2013-05-19 16:09:50 -07:00
Adam Dunkels 9f0de7d633 Merge pull request #211 from malvira/prefix-squash
Support prefix updates with PIO Handling
2013-05-19 15:06:02 -07:00
George Oikonomou ffeceb9164 Add a Trickle Timer Library (RFC 6206) 2013-05-19 21:51:07 +01:00
Sébastien Dawans 1be01a9c90 Support prefix udpates with PIO Handling 2013-05-19 10:51:57 -04:00
Mariano Alvira 5df586e09d Merge pull request #184 from g-oikonomou/bug-fixes/rimestats
Rimestats Fix (#183)
2013-05-19 07:45:22 -07:00
Mariano Alvira 7b9d98c5e2 change default UIP_CONF_IPV6 back to 0. This is not a complete fix:
see #227 for details. Will merge as it fixes build errors so Travis
can be useful agian.
2013-05-18 18:30:10 -04:00
Robert Quattlebaum de7b4f325e Merge pull request #229 from darconeous/pull-requests/resolv-mdns-announce-alignment
resolv: Fix for word alignment issues in `mdns_prep_host_announce_packet()`.
2013-05-18 14:49:11 -07:00
Robert Quattlebaum 535e90343c Merge pull request #144 from darconeous/pull-requests/settings-for-all-targets
core/lib/settings: Generalized settings manager to work on any platform
2013-05-18 12:03:09 -07:00
Robert Quattlebaum 0bed4b17a2 resolv: Fix for word alignment issues in mdns_prep_host_announce_packet(). 2013-05-18 10:43:09 -07:00
Robert Quattlebaum b8c0f2de6c cpu/native: Add file-backed simulated EEPROM to native cpu.
This patch removes a defunct EEPROM implementation from the native
platform and provides a new EEPROM implementation for the native cpu.
The previous implementation appears to be vestigal.

This is useful for testing code which uses the EEPROM without running
the code on the actual hardware.

By default the code will create a new temporary file as the EEPROM
backing, reinitializing each time. If you would like to preserve the
EEPROM contents or specify a specific EEPROM file to use, you can set the
`CONTIKI_EEPROM` environment variable to the name of the EEPROM file you
wish to use instead. If it already exists, its contents will be used.
If it does not already exist, it will be created and initialized by
filling it with `0xFF`---just like a real EEPROM.

A new example is also included, which was used to verify the correctness
of the implementation. It can easily be used to verify the EEPROM
implementations of other targets.
2013-05-18 10:29:41 -07:00
lebrush eef6d7a37e Removed undef 2013-05-15 16:49:36 +02:00
lebrush 82d498f3a1 Removed undef 2013-05-15 16:25:34 +02:00
lebrush 9158ff4bf1 Add method to get the first neighbour which is about to expire 2013-05-15 13:44:25 +02:00
lebrush 966e9fc484 Force sicslowpan to use uip-debug rather than an own system 2013-05-15 12:23:21 +02:00
lebrush 071cfaf1cb Corrects some leftover uncapitalized printfs which may cause some platforms
to crash.
2013-05-15 12:21:15 +02:00
Nicolas Tsiftes f8edbbb8d2 Merge pull request #178 from adamdunkels/feature-contiki-default-conf
A first stab at a default configuration system
2013-03-25 20:13:15 -07:00
George Oikonomou db078cf7e8 Replace reads of rimestats with RIMESTATS_GET(x) 2013-03-20 21:14:35 +00:00
George Oikonomou 62366813b0 Provide a macro to read rimestats when enabled 2013-03-20 21:14:34 +00:00
George Oikonomou 12860ce5d4 Fix #183 (short term fix)
This is a temporary fix for #183, so that things can
build cleanly until the issue is fixed properly.

If RIMESTATS_CONF_ENABLED is 0, rimestats.foo will always
read as 0, since RIMESTATS_ADD(foo) doesn't do anything
2013-03-20 19:59:20 +00:00
Robert Quattlebaum ed2dd29eda core/lib/settings: Added SETTINGS_CONF_SKIP_CONVENIENCE_FUNCS.
Unfortunately, some platforms don't properly drop unreferenced functions,
so on these broken platforms we can save a significant amount
of space by skipping the definition of the convenience functions.
2013-03-20 11:57:13 -07:00
Robert Quattlebaum 28a1e40ebd core/lib/settings: Generalized Settings Manager to work on any platform
This commit moves the Settings Manager from the AVR codebase
into the Contiki core library. Any platform that implements
the Contiki EEPROM API can now use the Settings Manager's
key-value store for storing their persistent configuration info.

The Settings Manager is a EEPROM-based key-value store. Keys
are 16-bit integers and values may be up to 16,383 bytes long.
It is intended to be used to store configuration-related information,
like network settings, radio channels, etc.

 * Robust data format which requires no initialization.
 * Supports multiple values with the same key.
 * Data can be appended without erasing EEPROM.
 * Max size of settings data can be easily increased in the future,
   as long as it doesn't overlap with application data.

The format was inspired by the [OLPC manufacturing data format][].

Since the beginning of EEPROM often contains application-specific
information, the best place to store settings is at the end of EEPROM
(the "top"). Because we are starting at the end of EEPROM, it makes
sense to grow the list of key-value pairs downward, toward the start of
EEPROM.

Each key-value pair is stored in memory in the following format:

Order    | Size     | Name         | Description
--------:|---------:|--------------|-------------------------------
       0 |        2 | `key`        | 16-bit key
      -2 |        1 | `size_check` | One's-complement of next byte
      -3 |   1 or 2 | `size`       | The size of `value`, in bytes
-4 or -5 | variable | `value`      | Value associated with `key`

The end of the key-value pairs is denoted by the first invalid entry.
An invalid entry has any of the following attributes:

 * The `size_check` byte doesn't match the one's compliment of the
   `size` byte (or `size_low` byte).
 * The key has a value of 0x0000.

[OLPC manufacturing data format]: http://wiki.laptop.org/go/Manufacturing_data
2013-03-20 11:57:13 -07:00
Nicolas Tsiftes 199a89bac4 Merge pull request #173 from adamdunkels/feature-ipv6-not-in-makefile
Allow IPv6 to be compiled via #define
2013-03-19 08:17:52 -07:00
Nicolas Tsiftes 7f2a842b71 Merge pull request #174 from adamdunkels/feature-net-improvements
Improvements to the core/net/ code
2013-03-18 17:12:12 -07:00
Nicolas Tsiftes 6a07172662 Merge pull request #176 from adamdunkels/feature-net-bugfixes
Network system bugfixes
2013-03-18 13:38:44 -07:00
Adam Dunkels 7742b05d8c Major bugfix: when nullrdc is asked to send a list of packets, send the list of packets and not just the first packet - this is essential for retransmissions of fragmented IP packets to work 2013-03-18 13:35:29 +01:00
Adam Dunkels f81e4071f1 Merge pull request #135 from darconeous/pull-requests/core-net-bridge-mode
core/net: Added support for "bridge mode".
2013-03-18 04:43:15 -07:00
Adam Dunkels ad28f1b396 Merge pull request #75 from cmorty/mesh_ready
Add mesh_ready() to mesh
2013-03-18 04:42:43 -07:00
Adam Dunkels 2ba293a538 Bugfix: check the size of the outgoing packet to avoid overflowing the output buffer 2013-03-18 11:22:08 +01:00
Adam Dunkels 843d2361dc Include the rimestats variable only if rimestats are enabled by the configuration 2013-03-18 11:22:06 +01:00
Adam Dunkels 4efd570cf9 Minor bugfix: explicitly cast pointer argument in debug printf 2013-03-18 11:22:05 +01:00
Adam Dunkels f2fbb4b49d Defensive programming: make sure that we don't fail completely if we get a callback for a NULL pointer 2013-03-18 11:22:04 +01:00
Adam Dunkels 82b755c017 Bugfix: keep track of receiver being awake as a local variable rather than a global, as it may have changed between invokations 2013-03-18 11:22:02 +01:00
Adam Dunkels 0670a8e1e2 Minor code style fixes to the contikimac and nullrdc code 2013-03-18 11:22:01 +01:00
Adam Dunkels ef25cc6c58 Rimestats bugfix: only compile the rimestats printout if rimestats are enabled 2013-03-18 11:22:00 +01:00
Adam Dunkels 3efa84ecc8 New mechanism for computing the 6lowpan header length dynamically, depending on how large header the framer creates. Also check the incoming packet for buffer overflow. 2013-03-18 11:19:22 +01:00
Adam Dunkels cb2336a322 Send announcements only if the node is configured to be a router 2013-03-18 11:19:21 +01:00
Adam Dunkels 5993595a8f A number of updates to nullrdc
* add a few rimestats to keep track of sent and received acks
* made a number of configuration options possible to override (ack timing)
* added the logic for sending 802.15.4 link layer ack packets, despite not being able to guarentee the 802.15.4 MAC timing
* increased the number of sequence numbers to keep track of for duplicate filtering
2013-03-18 11:19:20 +01:00
Adam Dunkels 4541d3e85b Let the framer functions use ints instead of uint8_t to make them more generic 2013-03-18 11:19:18 +01:00
Adam Dunkels 2d50a40643 A default configuraion file for Contiki
The contiki-default-conf.h file is intended as a safe fallback for
a number of configuration options in Contiki, to avoid putting too
much in the individual contiki-conf.h files.
2013-03-18 11:12:43 +01:00
Adam Dunkels 927cc8d895 Added #if UIP_CONF_IPV6 around the IPv6 code in the uIP source tree to allow the C files to be compiled even if IPv6 is not configured. 2013-03-18 09:45:30 +01:00
Adam Dunkels db1e8cdbac Separated the uIP makefile from the top-level Makefile.include into a separate core/net/Makefile.uip makefile 2013-03-18 09:45:29 +01:00
Robert Quattlebaum da81360731 core/net/resolv: Misc. updates and cleanups. 2013-03-14 19:14:32 -07:00
Robert Quattlebaum 7e9f472faa core/net/resolv: Fix for resolving CNAME records. 2013-03-14 19:13:51 -07:00
Robert Quattlebaum 639a9ca399 core/net/resolv: Fix for SDCC. 2013-03-14 19:13:04 -07:00
Oliver Schmidt 46cb6013ae Reduced code size.
Combined recent changes from darconeous...
- Refactor to decrease minimum code footprint.
- Added `RESOLV_CONF_SUPPORTS_RECORD_EXPIRATION`.
...with a few additional changes to reduce code size.
2013-03-14 22:53:52 +01:00
Oliver Schmidt d8862bd243 Some more changes improving code style conformance and code size. 2013-03-13 17:52:57 +01:00
Oliver Schmidt 7a1fa4de6c Some coding style nomalization. 2013-03-13 16:14:29 +01:00
Oliver Schmidt 8fa9767d47 Restored Contiki compatibility with non-C99 compilers.
(and compilers without non-standard extensions like void pointer arithmetic)
2013-03-13 14:40:24 +01:00
Moritz 'Morty' Strübe b1dbc2047e Add mesh_ready() to mesh
mesh_ready checkes whether a packet is queued. This allows to avoid
packet loss at application level.
2013-03-13 09:44:38 +01:00
Robert Quattlebaum c0a693672c core/net: Added support for "bridge mode".
"Bridge mode" allows devices to more easily send 802.15.4 packets as if
they were a different device. It also turns off any packet filtering
that may be implemented at layer 2. It works by allowing
`PACKETBUF_ADDR_SENDER` to be set earlier in the stack.

This is useful for implementing 6LoWPAN-ethernet bridges.

Enabled via setting `NETSTACK_CONF_BRIDGE_MODE` to 1. Disabled by
default.
2013-03-10 14:45:15 -07:00
Adam Dunkels 4e40cb8a8d Merge pull request #116 from cetic/rpl-lifetimes
RPL Lifetimes
2013-03-10 13:04:07 -07:00
Adam Dunkels 39e5a8c6dc Merge pull request #80 from darconeous/mdns-resolv
Adds IPv6 and MDNS domain name resolution.
2013-03-10 12:58:39 -07:00
Adam Dunkels 0841bce833 Merge pull request #82 from darconeous/master
Makefiles: Allow setting UIP_CONF_IPV6=0 to work as expected.
2013-03-10 12:51:03 -07:00
Robert Quattlebaum f145c17039 core/net/resolv: IPv6 and mDNS ("Bonjour") support. Major refactor.
This patch updates the DNS resolver to support IPv6 and introduces an
improved API for looking up DNS entries. This patch also adds optional
support for mDNS lookups and responses to the DNS resolver.

Here is a quick summary of the changes:

 * Added support for IPv6 lookups.
 * DNS queries now honor record expiration.
 * Added support for mDNS, compatible with "Bonjour".
 * Implemented a new lookup api, `resolv_lookup2()`, which provides
   more information about the state of the record(error, expired,
   looking-up, etc.).

About mDNS/Bonjour Support
--------------------------

This patch adds basic support for mDNS/Bonjour, which allows you to
refer to the name of a device instead of its IP address. This is
incredibly convenient for IPv6 addresses because they tend to be very
long and difficult to remember. It is especially important for
link-local IPv6 addresses, since not all programs support the '%'
notation for indicating a network interface (required on systems with
more than one network interface to disambiguate).

In other words, instead of typing in this:

 * `http://[fe80::58dc:d7ed:a644:628f%en1]/`

You can type this instead:

 * `http://contiki.local/`

Huge improvement, no?

The convenience extends beyond that: this mechanism can be used for
nodes to talk to each other based on their human-readable names instead
of their IPv6 addresses. So instead of a switch on
`aaaa::58dc:d7ed:a644:628f` triggering an actuator on
`aaaa::ed26:19c1:4bd2:f95b`, `light-switch.local` can trigger the
actuator on `living-room-lights.local`.

What you need to do to be able to look up `.local` names on your
workstation depends on a few factors:

 * Your machine needs to be able to send and receive multicast packets
   to and from the LoWPAN. You can do this easily with the Jackdaw
   firmware on an RZUSBStick. If you have a border router, you will need
   it to bridge the mDNS multicast packets across the border.

 * If you are using a Mac, you win. All Apple devices support mDNS
   lookups.

 * If you are using Windows, you can install Apple's Bonjour for Windows
   package. (This may be already installed on your machine if you have
   installed iTunes) After you install this you can easily do `.local`
   lookups.

 * If you are using a Unix machine, you can install Avahi.

The default hostname is set to `contiki.local.`. You can change the
hostname programmatically by calling `resolv_set_hostname()`. You can
change the default hostname by changing `CONTIKI_CONF_DEFAULT_HOSTNAME`.

You may disable mDNS support by setting `RESOLV_CONF_SUPPORTS_MDNS` to
`0`.

---------------------------------

core/net/resolv: `resolv_lookup2()` -> `resolv_lookup()`

Note that this patch should fix several `resolv_lookup()` bugs
that already existed. There were many cases where `resolv_lookup()`
was being called and the IP address ignored, but later code
assumed that the IP address had been fetched... ANYWAY, those
should be fixed now.

---------------------------------

examples/udp-ipv6: Updated client to use MDNS to lookup the server.

Also updated the Cooja regression test simulation.
2013-03-10 11:40:08 -07:00
Robert Quattlebaum 97e16760c3 core/net/uip-ds6: Make uip_ds6_maddr_add() and uip_ds6_maddr_lookup() const-correct. 2013-03-10 11:39:12 -07:00
Robert Quattlebaum 1d113f52ad core/net/uip: Rename uip_ethaddr to uip_lladdr.
There isn't really a good reason I can think of for these
to be different between IPv4 and IPv6.
2013-03-10 11:39:11 -07:00
Sébastien Dawans e02d480ff5 Moved RPL Lifetime configuration to rpl-conf.h 2013-03-09 16:28:43 +01:00
Sébastien Dawans b6c54faf9d Adds default route lifetime update in RPL DIO processing 2013-03-09 16:27:37 +01:00
Sébastien Dawans aaf5deabe2 Allow user configuration of RPL Lifetime and Lifetime Unit 2013-03-09 16:27:37 +01:00
Adam Dunkels 373b6c0195 Merge pull request #90 from simonduq/rpl-conf
Added missing include of contiki-conf.h in rpl-conf.h
2013-03-09 05:55:56 -08:00
Adam Dunkels ea92365cd4 Merge pull request #102 from cetic/rpl-conf-init-link-metric
Makes RPL Initial Link Metric configurable
2013-03-09 05:52:07 -08:00
Adam Dunkels 80982f97b8 Merge pull request #125 from nfi/lollipop
Bug fix: corrected the macro RPL_LOLLIPOP_INCREMENT
2013-03-09 05:49:06 -08:00
Adam Dunkels dd3a88e1bf Merge pull request #126 from rgrr/master
Bug fix: add_timer() does not set owning process
2013-03-09 05:48:14 -08:00
Adam Dunkels e91a2ac78a Merge pull request #142 from malvira/rpl-leaf-debug
Add some debug PRINTFs for RPL_LEAF_ONLY mode.
2013-03-09 05:35:48 -08:00
Oliver Schmidt 4d4b796abb Removed useless register keywords.
Modern compilers (especially GCC) ignore the register keyword anyway and the latest cc65 snapshot generates actually larger code with the register keyword at the locations in question.
2013-03-06 14:32:36 +01:00
Mariano Alvira 03fdb53af1 Add some debug PRINTFs for RPL_LEAF_ONLY mode. 2013-02-20 18:25:32 -05:00
hardy ae62a0d142 one blank less 2013-02-18 20:34:24 +01:00
Oliver Schmidt 9970a3631a The new POSIX directory access in the CBM C library comes with a d_blocks field too. 2013-02-17 01:03:51 +01:00
rgrr 7cb8148226 add_timer() does not set owning process 2013-02-13 09:15:11 +01:00
Niclas Finne 26fc2fab87 Bug fix: changed the macro RPL_LOLLIPOP_INCREMENT to update the counter instead of returning the new value since this is how the macro is used today. 2013-02-12 16:06:04 +01:00
Oliver Schmidt 1eda821a75 Fixed severe bug in PSOCK_READTO (?)
Either I found and fixed a severe bug in PSOCK_READTO() or I misunderstood something completely. To me PSOCK_READTO() is supposed to return if either the supplied character was read or if the user supplied buffer is exhausted - sor far so good.

However if the latter occurs up to now PSOCK_READTO() was continuing to process characters already read from the network (aka present in the uIP buffer) in order to check if the supplied character was found there and adjust the return value accordingly. But this means that the character processed this way were lost forever for the caller as the next call to PSOCK_READTO() would continue to read past the characters processed this way.

Therefore I removed that character processing altogether. So now if the user supplied buffer is exhausted before the supplied character is found the next call to PSOCK_READTO() starts exactly where previous call left off.
2013-02-10 15:41:34 +01:00
Oliver Schmidt 29391ef9ae Removed uiplib_ip6addrconv() from IPv4 builds.
While it may very well be beneficial to have explict uiplib_ip4addrconv() and uiplib_ip6addrconv() available for IPv6 builds I'm having a hard time to see the point in uiplib_ip6addrconv() for IPv4 builds.

Unrelated to the above the dispatching of uiplib_ipaddrconv() to either uiplib_ip4addrconv() or uiplib_ip6addrconv() can be accomplished by the C preprocessor only thus avoiding the size/speed overhead of an additional callframe.
2013-02-03 23:04:41 +01:00
Sébastien Dawans 95ab192e88 Makes RPL Initial Link Metric configurable 2013-02-01 09:02:31 +01:00
Simon Duquennoy 7c64a114aa Added missing include of contiki-conf.h 2013-01-23 16:11:02 +01:00
Robert Quattlebaum 5afcbf6fff Makefiles: Allow setting UIP_CONF_IPV6=0 to work as expected.
Setting UIP_CONF_IPV6 to zero from the make build command line is
something that seems like it should ensure that IPv6 is disabled, but in
fact it actually *enables* IPv6. This seems counter intuitive, so this
patch changes the behavior of the makefiles to handle this case
properly.
2013-01-14 22:03:42 -08:00
George Oikonomou 68f59113d6 Fix a route lifetime bug
There is a bug in the current route purge routine which would
result in a route's lifetime getting decremented more than once
during the same pass. This commit fixes it

The bug is documented here:
http://thread.gmane.org/gmane.os.contiki.devel/16209
2012-12-20 00:17:33 +00:00
Adam Dunkels 4324d74f12 Check callback pointers to avoid calling a NULL pointer 2012-12-10 01:50:37 +01:00
Adam Dunkels 83eb9a4ec3 Cleanup: removed the old routing table management functions that had previously been removed from compilation with #if 0 2012-11-27 23:04:34 +01:00
Adam Dunkels edf141046b Clean up of a few missing printf() that were converted into PRINTF()s 2012-11-27 23:04:34 +01:00
Adam Dunkels 43ecad5a99 Call the route callback API functions. 2012-11-27 23:04:33 +01:00
Adam Dunkels a9cab81d4e Added macros that allow handling IPv4 addresses even when uIP is configured to be an IPv6 stack 2012-11-27 23:04:33 +01:00
Adam Dunkels afe13b22bc Rewrote the uIP IPv6 route handling code. Instead of being nested deeply inside the uip-ds6.c file, the route management code is now in a separate file, uip-ds6-route.c. This file presents a lib/list.h API for the routes, which makes the route list much easier to use. Additionally, the uip-ds6-route.c file adds a callback API that invokes a callback when routes are added and removed. 2012-11-27 23:04:33 +01:00
Adam Dunkels b2063953ba Added a configuration option, UIP_SPLIT_CONF_SIZE, for setting the threshold at which point TCP packets get split into two. 2012-11-27 23:04:33 +01:00
Adam Dunkels f561bfc205 Added a function simple_udp_sendto_port() for sending a UDP packet to a specified port. 2012-11-27 23:04:32 +01:00