[riot-devel] Adding Fibroute addr on RIOT interface

Landsmann, Martin Martin.Landsmann at haw-hamburg.de
Fri Sep 9 13:24:03 CEST 2016


Hi,

I would suggest to use the functions directly instead of "sailing" around them with shell commands.

You will need the following:

// the :: destination address [1]. (Alternatively it can be set anywhere using [2] or [3])
ipv6_addr_t dest = IPV6_ADDR_UNSPECIFIED;

// your next-hop
ipv6_addr_t next = IPV6_ADDR_UNSPECIFIED;

// for example you can use [3] to get the ipv6 address from a string (or set the values manually)
ipv6_addr_from_str(&next, "fe80::1ac0:ffee:1ac0:ffee");

// get your interface pid of your transceiver handling the address [4]
kernel_pid_t iface = gnrc_ipv6_netif_find_by_addr(NULL, next);

// prepare FIB flags with prefix length of your destination, i.e. 128 for ::
uint32_t dst_flags = ((uint32_t)128 << FIB_FLAG_NET_PREFIX_SHIFT);

// and finally add the entry to the FIB [5]
fib_add_entry(
              &gnrc_ipv6_fib_table, // the FIB table is accessible when GNRC+FIB is used [6]
              iface,
              dest.u8, sizeof(ipv6_addr_t), dst_flags,
              next.u8, sizeof(ipv6_addr_t), 0,
              FIB_LIFETIME_NO_EXPIRE // prevents auto-removing of this entry by the FIB
              );

I haven't tested the code-snips, but in general this should work.
I hope it helps a bit.

Best Regards,
Martin

[1] https://github.com/RIOT-OS/RIOT/blob/master/sys/include/net/ipv6/addr.h#L88
[2] https://github.com/RIOT-OS/RIOT/blob/master/sys/include/net/ipv6/addr.h#L559
[3] https://github.com/RIOT-OS/RIOT/blob/master/sys/include/net/ipv6/addr.h#L730
[4] https://github.com/RIOT-OS/RIOT/blob/master/sys/include/net/gnrc/ipv6/netif.h#L466
[5] https://github.com/RIOT-OS/RIOT/blob/master/sys/include/net/fib.h#L135
[6] https://github.com/RIOT-OS/RIOT/blob/master/sys/include/net/gnrc/ipv6.h#L99
________________________________
Von: devel [devel-bounces at riot-os.org]" im Auftrag von "ALESSANDRO NICOLI [alessandro.nicoli at studenti.unipr.it]
Gesendet: Freitag, 9. September 2016 12:18
An: RIoT Dev List
Betreff: Re: [riot-devel] Adding Fibroute addr on RIOT interface

Hi Kaspar,

Thanks for the tip, but while i was waiting for the reply i did it ;)
Include the "shell_commands.h" and try something like :

char** argum[] = {"fibroute", "add", "::", "via", "fe80::1ac0:ffee:1ac0:ffee"};
_fib_route_handler(5, argum);


This above is just an example with a fixed root ipv6 address.


best regards,
Alessandro

2016-09-09 12:00 GMT+02:00 <devel-request at riot-os.org<mailto:devel-request at riot-os.org>>:
Send devel mailing list submissions to
        devel at riot-os.org<mailto:devel at riot-os.org>

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.riot-os.org/mailman/listinfo/devel
or, via email, send a message with subject or body 'help' to
        devel-request at riot-os.org<mailto:devel-request at riot-os.org>

You can reach the person managing the list at
        devel-owner at riot-os.org<mailto:devel-owner at riot-os.org>

When replying, please edit your Subject line so it is more specific
than "Re: Contents of devel digest..."


Today's Topics:

   1. Re: nrf52, nordic soft device and riot-os (Robert Hazbun)
   2. Adding Fibroute addr on RIOT interface (ALESSANDRO NICOLI)
   3. Re: Adding Fibroute addr on RIOT interface (Kaspar Schleiser)


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

Message: 1
Date: Thu, 8 Sep 2016 22:14:40 -0700
From: Robert Hazbun <robert at sephix.com<mailto:robert at sephix.com>>
To: Kaspar Schleiser <kaspar at schleiser.de<mailto:kaspar at schleiser.de>>, RIOT OS kernel developers
        <devel at riot-os.org<mailto:devel at riot-os.org>>
Subject: Re: [riot-devel] nrf52, nordic soft device and riot-os
Message-ID: <532e7761-417f-6862-7683-8cf35966fa5f at sephix.com<mailto:532e7761-417f-6862-7683-8cf35966fa5f at sephix.com>>
Content-Type: text/plain; charset=utf-8

Hi Kaspar,

Thank you for the quick response. Your suggestions were very useful.

>> I'm currently trying to use RIOT-OS with the Nordic SDK Softdevice S132.
> I assume you're not targeting the nrf52dk?
[RH] I am targeting the nrf52dk.
>> Unfortunately, when trying to use the shell, the moment that I type
>> anything into the shell and hit 'enter', I get a hard fault. Seen here:
> Does it work in the examples (e.g., gnrc_networking)?
[RH]I used the hello-world example, imported the shell module, and new
nordic sdk package. I was able to get the example running, but only with
the compiler optimizer on (ie, -Os). With the gcc optimizer off ( ie,
-O0 ), the hello world example still runs into the same problem. To be
clear, aside from initializing the softdevice handler (in cpu.c), there
is no code in main that interacts with the softdevice.

>> If I do not hit "enter" in the shell, the application / test code
>> continues to run (albeit most of the code is sitting idle except for the
>> isr that is manipulating the led).
> Are you using pyterm? (pyterm buffers serial input until enter is
> pressed). If yes, please try another terminal emulator and confirm that
> the first serial input character leads to the crash.
[RH] Using minicom, I confirmed that the first serial input character
led to the crash. (but only with optimizer off)
>> I'm looking for suggestions on what else to check. Help is appreciated.
> How I love debugging blobs. ;)
[RH] Apologies if the first email was a bit vague.

[RH] I had the optimizer off so that I could use the debugger
effectively. The optimizer was disabled by overriding the CFLAGS_OPT
variable in the example Makefile. I'm using ARM GCC (arm-none-eabi-gcc)
4.9.3 .

Is there some part of the build / OS that assumes/requires optimization
to be turned on? Or do you suppose this is simply a 'size' issue
relating to larger code size with the optimizer off?

Regards,

Robert




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

Message: 2
Date: Fri, 9 Sep 2016 11:08:23 +0200
From: ALESSANDRO NICOLI <alessandro.nicoli at studenti.unipr.it<mailto:alessandro.nicoli at studenti.unipr.it>>
To: RIoT Dev List <devel at riot-os.org<mailto:devel at riot-os.org>>
Subject: [riot-devel] Adding Fibroute addr on RIOT interface
Message-ID:
        <CAFsA-_0=+NdyZD1HYB=0OeoJcrzV5fovBp4T9d2kTwF7H5KrdA at mail.gmail.com<mailto:0OeoJcrzV5fovBp4T9d2kTwF7H5KrdA at mail.gmail.com>>
Content-Type: text/plain; charset="utf-8"

Hi all,
I'm trying to automatically set-up network parameters for a RIOT board, i
would like to know how to set a Fibroute address without using the
shell_commands.

Tanks all!
*best regards, *
*Alessandro*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/devel/attachments/20160909/6619315b/attachment-0001.html>

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

Message: 3
Date: Fri, 9 Sep 2016 11:15:20 +0200
From: Kaspar Schleiser <kaspar at schleiser.de<mailto:kaspar at schleiser.de>>
To: RIOT OS kernel developers <devel at riot-os.org<mailto:devel at riot-os.org>>
Subject: Re: [riot-devel] Adding Fibroute addr on RIOT interface
Message-ID: <5b522510-5c45-748d-04b4-68530fe6a2df at schleiser.de<mailto:5b522510-5c45-748d-04b4-68530fe6a2df at schleiser.de>>
Content-Type: text/plain; charset=utf-8

Hi,

On 09/09/2016 11:08 AM, ALESSANDRO NICOLI wrote:
> I'm trying to automatically set-up network parameters for a RIOT board,
> i would like to know how to set a Fibroute address without using the
> shell_commands.

Take a look at the uhcp client code, it sets addresses somewhere.

Kaspar


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

Subject: Digest Footer

_______________________________________________
devel mailing list
devel at riot-os.org<mailto:devel at riot-os.org>
https://lists.riot-os.org/mailman/listinfo/devel


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

End of devel Digest, Vol 43, Issue 12
*************************************

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/devel/attachments/20160909/aecda15c/attachment-0001.html>


More information about the devel mailing list