Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] add olsr2 routing algorithm #765

Closed
wants to merge 48 commits into from
Closed

Conversation

benpicco
Copy link
Contributor

This adds an implementation of the OLSRv2 routing protocol (without metrics), based on oonf_api.
The interface offered to applications currently consists of only a olsr_init function which will set up and start a sender and receiver thread for RFC5444 based (UDP on port 269) HELLO and Topology Control messages.
That means that every HELLO_REFRESH_INTERVAL (2s + random jitter) a non-forwarded HELLO message is send for neighborhood discovery. Every TC_REFRESH_INTERVAL (5s + random jitter) a topology control message is broadcast (only by selected flooding MPRs) through the network.

This happens transparent to the application, IP packets are now routed to known hosts within the MANET once a path has been established.

print_topology_set will output the forwarding table with all known mesh nodes.

Does work well on native with #680, but still crashes on the testbed after some time.
Each known MANET router requires 72 byte of memory + 12 bytes for each alternative route to the node.

Depends on #630

@benpicco
Copy link
Contributor Author

What is necessary to make the example application work with buildtest?

@LudwigKnuepfer
Copy link
Member

I thought you would just need to fill out the whitelist/blacklist .. you can take a look at the other examples/buildtest output for reference.

But looking at the output, it appears that the application does not build at all.. Therefore I'd say you need to fix the bugs ;-)

    Building application: olsr2

failed: avsextrem, chronos, mbed_lpc1768, msb-430, msb-430h, msba2, native, pttu, redbee-econotag, telosb, wsn430-v1_3b, wsn430-v1_4

@LudwigKnuepfer
Copy link
Member

you also need to model the oonf_api dependency

@benpicco
Copy link
Contributor Author

#1142 should fix buildtest, it triggered a problem with the oonf_api Makefile

@LudwigKnuepfer
Copy link
Member

you also need to model the oonf_api dependency

I thought it failed the first time I built it, now this does not happen anymore even if I delete everything ... not sure what I did there..

@LudwigKnuepfer
Copy link
Member

I get errors when building for msba2:

"make" -C /home/ludwig/RIOT/pkg/oonf_api
make[1]: Entering directory '/home/ludwig/RIOT/pkg/oonf_api'
make -C /home/ludwig/RIOT/pkg/oonf_api/oonf_api
make[2]: Entering directory '/home/ludwig/RIOT/pkg/oonf_api/oonf_api'
mkdir -p /home/ludwig/RIOT/examples/olsr2/bin/msba2/
make[3]: Entering directory '/home/ludwig/RIOT/pkg/oonf_api/oonf_api/src-api/common'
make[3]: '/home/ludwig/RIOT/examples/olsr2/bin/msba2/oonf_common.a' is up to date.
make[3]: Leaving directory '/home/ludwig/RIOT/pkg/oonf_api/oonf_api/src-api/common'
make[3]: Entering directory '/home/ludwig/RIOT/pkg/oonf_api/oonf_api/src-api/rfc5444'
arm-none-eabi-gcc -DRIOT -DENABLE_NAME -DBOARD_MSBA2 -DINIT_ON_START -DENABLE_LEDS -DBOARD_MSBA2 -DCPU_LPC2387 -DMODULE_ARM_COMMON -DMODULE_AUTO_INIT -DMODULE_CC110X_NG -DMODULE_CC110X_SPI -DMODULE_CONFIG -DMODULE_CORE -DMODULE_CPU -DMODULE_DESTINY -DMODULE_GPIOINT -DMODULE_IEEE802154 -DMODULE_LIB -DMODULE_LPC_COMMON -DMODULE_NET_HELP -DMODULE_NET_IF -DMODULE_OLSR2 -DMODULE_OONF_API -DMODULE_OONF_COMMON -DMODULE_OONF_RFC5444 -DMODULE_POSIX -DMODULE_PROTOCOL_MULTIPLEX -DMODULE_PS -DMODULE_RANDOM -DMODULE_RTC -DMODULE_SHELL -DMODULE_SHELL_COMMANDS -DMODULE_SIXLOWPAN -DMODULE_SYS -DMODULE_TIMEX -DMODULE_TRANSCEIVER -DMODULE_UART0 -DMODULE_VTIMER -O2 -Wall -Wstrict-prototypes -mcpu=arm7tdmi-s -gdwarf-2 -std=gnu99 -fno-delete-null-pointer-checks -O2 -Wall -Wstrict-prototypes -mcpu=arm7tdmi-s -gdwarf-2 -DVERSION=\"v0.3.0-3-gf2be\" -I/home/ludwig/RIOT/core/include -I/home/ludwig/RIOT/drivers/include -I/home/ludwig/RIOT/sys/include -I/home/ludwig/RIOT/boards/msba2/include -I/home/ludwig/RIOT/boards/msba2-common/include -I/home/ludwig/RIOT/boards/msba2-common/drivers/include -I/home/ludwig/RIOT/cpu/lpc2387/include -I/home/ludwig/RIOT/cpu/arm_common/include/ -I/home/ludwig/RIOT/cpu/lpc_common/include -I/home/ludwig/RIOT/sys/net/include -I/home/ludwig/RIOT/drivers/cc110x -I/home/ludwig/RIOT/drivers/cc110x_ng/include -I/home/ludwig/RIOT/sys/posix/include -I /home/ludwig/RIOT/pkg/oonf_api/oonf_api/src-api -I/home/ludwig/RIOT/boards/msba2/include -I/home/ludwig/RIOT/boards/msba2-common/include -I/home/ludwig/RIOT/boards/msba2-common/drivers/include -I/home/ludwig/RIOT/sys/include -I/home/ludwig/RIOT/sys/net/include -I/home/ludwig/RIOT/sys/posix/include -I/home/ludwig/RIOT/sys/posix/pnet/include -c rfc5444_reader.c -o /home/ludwig/RIOT/examples/olsr2/bin/msba2/oonf_rfc5444/rfc5444_reader.o
rfc5444_reader.c:129:1: error: conflicting types for 'rfc5444_reader_handle_packet'
 rfc5444_reader_handle_packet(struct rfc5444_reader *parser, uint8_t *buffer, size_t length) {
 ^
In file included from rfc5444_reader.c:48:0:
/home/ludwig/RIOT/pkg/oonf_api/oonf_api/src-api/rfc5444/rfc5444_reader.h:312:12: note: previous declaration of 'rfc5444_reader_handle_packet' was here
 EXPORT int rfc5444_reader_handle_packet(
            ^
rfc5444_reader.c:439:1: error: conflicting types for '_parse_tlv'
 _parse_tlv(struct rfc5444_reader_tlvblock_entry *entry, uint8_t **ptr, uint8_t *eob, uint8_t addr_count) {
 ^
rfc5444_reader.c:65:12: note: previous declaration of '_parse_tlv' was here
 static int _parse_tlv(struct rfc5444_reader_tlvblock_entry *entry, uint8_t **ptr,
            ^
rfc5444_reader.c:542:1: error: conflicting types for '_parse_tlvblock'
 _parse_tlvblock(struct rfc5444_reader *parser,
 ^
rfc5444_reader.c:67:12: note: previous declaration of '_parse_tlvblock' was here
 static int _parse_tlvblock(struct rfc5444_reader *parser,
            ^
rfc5444_reader.c:605:1: error: conflicting types for '_schedule_tlvblock'
 _schedule_tlvblock(struct rfc5444_reader_tlvblock_consumer *consumer, struct rfc5444_reader_tlvblock_context *context,
 ^
rfc5444_reader.c:69:12: note: previous declaration of '_schedule_tlvblock' was here
 static int _schedule_tlvblock(struct rfc5444_reader_tlvblock_consumer *consumer,
            ^
rfc5444_reader.c:791:1: error: conflicting types for '_parse_addrblock'
 _parse_addrblock(struct rfc5444_reader_addrblock_entry *addr_entry,
 ^
rfc5444_reader.c:71:12: note: previous declaration of '_parse_addrblock' was here
 static int _parse_addrblock(struct rfc5444_reader_addrblock_entry *addr_entry,
            ^
rfc5444_reader.c:1034:1: error: conflicting types for '_handle_message'
 _handle_message(struct rfc5444_reader *parser,
 ^
rfc5444_reader.c:73:12: note: previous declaration of '_handle_message' was here
 static int _handle_message(struct rfc5444_reader *parser,
            ^
rfc5444_reader.c:67:12: warning: '_parse_tlvblock' used but never defined
 static int _parse_tlvblock(struct rfc5444_reader *parser,
            ^
rfc5444_reader.c:69:12: warning: '_schedule_tlvblock' used but never defined
 static int _schedule_tlvblock(struct rfc5444_reader_tlvblock_consumer *consumer,
            ^
rfc5444_reader.c:73:12: warning: '_handle_message' used but never defined
 static int _handle_message(struct rfc5444_reader *parser,
            ^
rfc5444_reader.c:1034:1: warning: '_handle_message' defined but not used [-Wunused-function]
 _handle_message(struct rfc5444_reader *parser,
 ^
/home/ludwig/RIOT/Makefile.base:33: recipe for target '/home/ludwig/RIOT/examples/olsr2/bin/msba2/oonf_rfc5444/rfc5444_reader.o' failed
make[3]: *** [/home/ludwig/RIOT/examples/olsr2/bin/msba2/oonf_rfc5444/rfc5444_reader.o] Error 1
make[3]: Leaving directory '/home/ludwig/RIOT/pkg/oonf_api/oonf_api/src-api/rfc5444'
Makefile:26: recipe for target 'all' failed
make[2]: *** [all] Error 1
make[2]: Leaving directory '/home/ludwig/RIOT/pkg/oonf_api/oonf_api'
Makefile:19: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/ludwig/RIOT/pkg/oonf_api'
/home/ludwig/RIOT/examples/olsr2/../../Makefile.include:143: recipe for target '/home/ludwig/RIOT/examples/olsr2/bin/msba2/oonf_api.a' failed
make: *** [/home/ludwig/RIOT/examples/olsr2/bin/msba2/oonf_api.a] Error 2

@benpicco
Copy link
Contributor Author

Now this is strange, rfc5444_reader_handle_packet really is declared as returning int in rfc5444_reader.h but defined as returning enum rfc5444_result in rfc5444_reader.c.

Why did this previously work and why is it still working for native?

@LudwigKnuepfer
Copy link
Member

Different toolchains..

@benpicco
Copy link
Contributor Author

It's the same version of gcc

arm-none-eabi-gcc (4.8.2-14ubuntu1+6) 4.8.2

vs

gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2

@LudwigKnuepfer
Copy link
Member

I meant architectures.. I mean - it's a shot in the dark anyway.. still - gcc has different code for different architectures, right?

#include <unistd.h>
#include <sys/types.h>
static uint16_t get_node_id(void) {
return getpid();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compare #854

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change that when #854 is merged

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what this comment is about, but #854 was merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but currently it's only implemented for native, stm32f1 and nrf51822. I'll drop the getpid() bit and replace it with cpuid_get(), but keep the sysconfig.id for the msba2.

@OlegHahm OlegHahm added this to the Release NEXT MAJOR milestone May 16, 2014
@benpicco
Copy link
Contributor Author

After #1210 it should build on the msba2 again

@OlegHahm OlegHahm modified the milestones: FIX ME FIRST, Release NEXT MAJOR Jun 3, 2014
@OlegHahm
Copy link
Member

A lot of warnings.

@OlegHahm
Copy link
Member

And fails for MSP based platforms. Please fix or blacklist.

@benpicco
Copy link
Contributor Author

benpicco commented Jul 7, 2014

Is there some way to find out why the build fails in travis?

@OlegHahm
Copy link
Member

OlegHahm commented Jul 7, 2014

@Kijewski, you had a hint for that, but I cannot remember. Can you provide some information and maybe put it also in the wiki?

@Kijewski
Copy link
Contributor

Kijewski commented Jul 7, 2014

Prepend .travis.yml's section script with the test that you actually want to run:

    - make -C examples/olsr2 BOARD=msba2
    - make -C examples/olsr2 BOARD=native

@OlegHahm
Copy link
Member

@benpicco, Can you fix the cppcheck warnings and add the extern C to the headers?

@OlegHahm
Copy link
Member

@benpicco, ping.

@OlegHahm
Copy link
Member

@benpicco, please rebase.

@OlegHahm OlegHahm added the Community: Hack'n'ACK candidate This PR is a candidate for review and discussion during one of RIOT's monthly Hack'n'ACK parties label Jan 6, 2015
@OlegHahm OlegHahm mentioned this pull request Jan 13, 2015
@OlegHahm
Copy link
Member

Superseeded by #2294.

@OlegHahm OlegHahm closed this Jan 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable Community: Hack'n'ACK candidate This PR is a candidate for review and discussion during one of RIOT's monthly Hack'n'ACK parties PR-award-nominee Deprecated. Will be removed soon. Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants