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 [[email protected]]" im Auftrag von "ALESSANDRO NICOLI
[[email protected]]
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
<[email protected]<mailto:[email protected]>>:
Send devel mailing list submissions to
[email protected]<mailto:[email protected]>
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
[email protected]<mailto:[email protected]>
You can reach the person managing the list at
[email protected]<mailto:[email protected]>
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 <[email protected]<mailto:[email protected]>>
To: Kaspar Schleiser <[email protected]<mailto:[email protected]>>, RIOT OS
kernel developers
<[email protected]<mailto:[email protected]>>
Subject: Re: [riot-devel] nrf52, nordic soft device and riot-os
Message-ID:
<[email protected]<mailto:[email protected]>>
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
<[email protected]<mailto:[email protected]>>
To: RIoT Dev List <[email protected]<mailto:[email protected]>>
Subject: [riot-devel] Adding Fibroute addr on RIOT interface
Message-ID:
<CAFsA-_0=+NdyZD1HYB=0oeojcrzv5fovbp4t9d2ktwf7h5k...@mail.gmail.com<mailto:[email protected]>>
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 <[email protected]<mailto:[email protected]>>
To: RIOT OS kernel developers <[email protected]<mailto:[email protected]>>
Subject: Re: [riot-devel] Adding Fibroute addr on RIOT interface
Message-ID:
<[email protected]<mailto:[email protected]>>
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
[email protected]<mailto:[email protected]>
https://lists.riot-os.org/mailman/listinfo/devel
------------------------------
End of devel Digest, Vol 43, Issue 12
*************************************
_______________________________________________
devel mailing list
[email protected]
https://lists.riot-os.org/mailman/listinfo/devel