[Contiki-developers] RPL-Border-Router doesn't set Prefix for nodes!

212 views
Skip to first unread message

Patrick

unread,
Nov 21, 2011, 9:59:16 AM11/21/11
to contiki-d...@lists.sourceforge.net
Hello everybody, i'am working with the following three Boards:
1. Econotag ( RPL-Border-Router )
2. Econotag ( RPL-UDP-Client )
3. Raven ( RPL-UDP-Client )

Now I'am trying to set my RPL-Border-Router so, that he gives every new Node an
prefix like aaaa:: or bbbb::

I'am a little bit confused, because I have once a code-snippet in "udp-client.c"
and one in "contiki-main.c" where the address/prefix is set.

set_global_address(void)
{
uip_ipaddr_t ipaddr;
uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
...

so it looks in my client. I agree the now every client i flash got the prefix
aaaa ! But I don't want a static prefix. I want that my RPL-Border Router gives
every node an prefix like "aaaa"!
Did some body could help me or give me some helpfull tips!

Thank you.

greetz
Patrick


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Contiki-developers mailing list
Contiki-d...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/contiki-developers

Mohammad Abdellatif

unread,
Nov 21, 2011, 10:32:23 AM11/21/11
to Contiki developer mailing list
The clients do set their own ip addresses using this code u mentioned.
However, as soon as they received the DIO from the Border-route which includes the new prefix, they change their IPs to fit in the new created DAG
always a good idea is to stay away from the aaaa prefix as it is the default value used

Mohammad Abdellatif

Phd student at Faculty of Engineering University of Porto (FEUP)
Researcher at Inesc Porto, UTM, WiN 

M Pouillot

unread,
Nov 21, 2011, 10:32:55 AM11/21/11
to Contiki developer mailing list
Hello Patrick,

The prefix of the RPL-Border-router is dissiminated in the DIO message. When your RPL-UDP-Client receives the DIO message for the first time, it calls the join-dag function in which the new prefix is set.(aaaa:: or other one)

regards,

Mathieu

-----Message d'origine-----
De : Patrick [mailto:patri...@googlemail.com]
Envoyé : lundi 21 novembre 2011 15:59
À : contiki-d...@lists.sourceforge.net
Objet : [Contiki-developers] RPL-Border-Router doesn't set Prefix for nodes!

David Kopf

unread,
Nov 21, 2011, 10:36:35 AM11/21/11
to contiki-d...@lists.sourceforge.net
The RPL border will send its prefix to the nodes and they will pick that up whether or not they already have one assigned manually
(if you have at least 3 entries in the address table). So you could comment out any manual node prefix, except then you would have
to set server and client addresses after getting one (could be seconds or minutes after boot). The send routine could abort if the
prefix is null or construct the client/server addresses at that time (or each time).
Just leaving everything aaaa:: simplifies the setup.


-----Original Message-----
From: Patrick
Sent: Monday, November 21, 2011 9:59 AM
To: contiki-d...@lists.sourceforge.net
Subject: [Contiki-developers] RPL-Border-Router doesn't set Prefix for nodes!

Hello everybody, i'am working with the following three Boards:
1. Econotag ( RPL-Border-Router )
2. Econotag ( RPL-UDP-Client )
3. Raven ( RPL-UDP-Client )

Now I'am trying to set my RPL-Border-Router so, that he gives every new Node an
prefix like aaaa:: or bbbb::

I'am a little bit confused, because I have once a code-snippet in "udp-client.c"
and one in "contiki-main.c" where the address/prefix is set.

set_global_address(void)
{
uip_ipaddr_t ipaddr;
uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
...

so it looks in my client. I agree the now every client i flash got the prefix
aaaa ! But I don't want a static prefix. I want that my RPL-Border Router gives
every node an prefix like "aaaa"!
Did some body could help me or give me some helpfull tips!

David Kopf

unread,
Nov 21, 2011, 12:14:48 PM11/21/11
to Contiki developer mailing list
A couple of other points, the link local prefix fe80:: is put at the end of
the prefix table and new ones are added downwards. So the first entry with
isused set will be the last prefix acquired.
PRINTA("Server IPv6 addresses:\n");
for(i = 0; i < UIP_DS6_ADDR_NB; i++) {
state = uip_ds6_if.addr_list[i].state;
if(uip_ds6_if.addr_list[i].isused &&
(state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) {
PRINTA(" ");
uip_debug_ipaddr_print(&uip_ds6_if.addr_list[i].ipaddr);
PRINTA("\n");
}
}

aaaa:: has the advantage of making smaller 6lowpan packets since it is the
default stateful prefix. Wireshark dumps will be confusing unless this is
mechanism is understood, so I agree start with something else that will have
long 6lowpan ipv6 addresses (which might be an assigned ipv6 subnet) and
later make that the stateful prefix when you want to minimize packet
lengths.

Abdellatif
Sent: Monday, November 21, 2011 10:32 AM
To: Contiki developer mailing list
Subject: Re: [Contiki-developers] RPL-Border-Router doesn't set Prefix
fornodes!

The clients do set their own ip addresses using this code u mentioned.

Patrick

unread,
Nov 21, 2011, 12:48:43 PM11/21/11
to contiki-d...@lists.sourceforge.net
Thanks for your Replys.
But what still confusing me now is that I have two parts in the code where the
prefix is set.
Let's assume that, we flash now the UDP-Client on a Raven Board.
Then i have two source files which I need to edit, once the "contiki-raven-
main.c" and the "rpl-udp-client.c"
In the source file "rpl-udp-client" I find the following paragraph which is
important:
---------------------------------------------------------------
static void
set_global_address(void)
{
uip_ipaddr_t ipaddr;

uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);

/* Here is the prefix aaaa set! */
uip_netif_addr_add(&ipaddr, 64, 0, AUTOCONF);
}
------------------------------------------------------------
And in the source file"contiki-raven-main.c" i found the following important
paragraph:
-------------------------------------------------------------------
/* Add addresses for testing */
#if 0
{
uip_ip6addr_t ipaddr;


uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);

uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
// uip_ds6_prefix_add(&ipaddr,64,0);
}
#endif
-------------------------------------------------


But now if i comment out some lines with the aaaa in the source file "rpl-udp-
client.c" the prefix will taken if I flash the board from the contiki-raven-
main.c
Could someone please tell me what i need to change in the two files that the UDP
Client will get an Prefix from the RPL-Border-Router `?

Thanks

David Kopf

unread,
Nov 21, 2011, 1:05:06 PM11/21/11
to contiki-d...@lists.sourceforge.net
That platform code is not compiled in, it is just for testing. Note a
platform can (well, should) be built on all examples and some don't get a
prefix assigned any other way.

What version of contiki are you using? That uip_netif_addr_add is the pre
contiki-2. call I think.

-----Original Message-----
From: Patrick
Sent: Monday, November 21, 2011 12:48 PM
To: contiki-d...@lists.sourceforge.net
Subject: Re: [Contiki-developers] RPL-Border-Router doesn't set Prefix
fornodes!

Patrick

unread,
Nov 22, 2011, 5:13:25 AM11/22/11
to contiki-d...@lists.sourceforge.net
Hello David today I downloaded the newiest Contiki-Version 2.5 and tryed to
do the same i described.
First i edited the Source File border-router.c where i set prefix_set = 1;
that he runs the following while loop. Now i edited the
contiki-mc1322x-main.c File for the econotag Board where I set my Channel etc.
There I saw the following lines:
--------------------------------------------------------------------
if(1) {
uip_ipaddr_t ipaddr;
int i;

uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
uip_ds6_addr_add(&ipaddr, 0, ADDR_TENTATIVE);
...
--------------------------------------------------------------------
If i understand it right, there will set the prefix "aaaa" for the
Border-Router. If I now flash the Border-Router i see finally the output that
he gets the following two IPv6-Addresses:
fe80::11:22ff:fe33:4451
aaaa::11:22ff:fe33:4451
That's allright. Now I abort the Flash Process and start tunslip6, that I
could open the Webbrowser and see Nodes and Routes which also works!

After that i edited the following Files for the UDP-CLient. First i edited
the udp-client.c File where i had the following Part:
/*---------------------------------------------------------------------------*/


static void
set_global_address(void)
{
uip_ipaddr_t ipaddr;

uip_ip6addr(&ipaddr, 0xbbbb, 0, 0, 0, 0, 0, 0, 0);


uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);


Here i set the Prefix "bbbb", because i wanted to see that the UDP-CLient
gets the "aaaa" Prefix from the RPL-Border-Router! Now i flashed the UDP-Client
which works and i also could see him in the webbrowser. But if i sniff the
UDP-Traffic
with an Raven-Sniffer on RF-Channel 26 i only see that the UDP Client has
the IPv6-Address: bbbb::11:22ff:fe33:4452 but doesn't get an "aaaa" Prefix
from the Border-Router!
Did I have to edit something else in the Border-Router or my UDP-CLient ?

Greetz

Mohammad Abdellatif

unread,
Nov 22, 2011, 6:37:50 AM11/22/11
to Contiki developer mailing list
The border router in the example doesnt generate the prefix automatically but rather wait to receive it from the pc through the slip connection.
if u want to set it automatically to bbbb for example .. u will have to replace
rpl_set_prefix(dag, &prefix, 64);
with something like

uip_ip6addr(&ipaddr, 0xbbbb, 0, 0, 0, 0, 0, 0, 0);
rpl_set_prefix(dag, &ipaddr, 64);


Mohammad Abdellatif

Phd student at Faculty of Engineering University of Porto (FEUP)
Researcher at Inesc Porto, UTM, WiN 




Patrick

unread,
Nov 22, 2011, 7:13:42 AM11/22/11
to contiki-d...@lists.sourceforge.net
Hello Mohammad,
thanks for your very helpfull Reply. I changed now my border-router.c File so:
---------------------------------------------------
dag = rpl_set_root((uip_ip6addr_t *)dag_id);
if(dag != NULL) {
//rpl_set_prefix(dag, &prefix, 64);
uip_ip6addr(&ipaddr,0xbaab,0,0,0,0,0,0,0);
rpl_set_prefix(dag, &ipaddr, 64);
PRINTF("created a new RPL dag\n");
}
--------------------------------------------------------
Now my Raven Board got the "baab" Prefix from the Border-Router! But my Econotag
( UDP-CLient ) doesn't get this Prefix. The UDP-Client from the Econotag takes
every time his Tentative Ipv6-Address.
my Udp-CLient (Econotag) looks so:
--------------------------------------------------------

static void
set_global_address(void)
{
uip_ipaddr_t ipaddr;

uip_ip6addr(&ipaddr, 0xbcbc, 0, 0, 0, 0, 0, 0, 0);


uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);

...
--------------------------------------------------------
And in the contiki-mc1322x.c i see the following part from which the UDP-CLient
takes his IPv6-Address with Prefix.


--------------------------------------------------------
if(1) {
uip_ipaddr_t ipaddr;
int i;
uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
uip_ds6_addr_add(&ipaddr, 0, ADDR_TENTATIVE);
...
--------------------------------------------------------

If i flashed my UDP-CLient Econotag the function print_local_addresses shows me
that:
bcbc::11:22ff:fe33:4451


aaaa::11:22ff:fe33:4451
fe80::11:22ff:fe33:4451

And wth my Raven Sniffer i see that the UDP-CLient has the Ipv6-Address:
aaaa::11:22ff:fe33:4451, that which i gets from the contiki-mc.1322x.c

Maybe somebody could help me why it is so ?

David Kopf

unread,
Nov 22, 2011, 7:51:24 AM11/22/11
to contiki-d...@lists.sourceforge.net
All those prefixes are confusing. If you take all the manual assignments out
of the nodes and let the border router do the configuration it will become
apparent if a node does not pick up any prefix (e.g. is the econotag client
a RPL build?). Then if no prefix you can post a wireshark pcap of the failed
rpl exchanges.

-----Original Message-----
From: Patrick
Sent: Tuesday, November 22, 2011 7:13 AM
To: contiki-d...@lists.sourceforge.net
Subject: Re: [Contiki-developers]RPL-Border-Router doesn't set Prefix
fornodes!

Mohammad Abdellatif

unread,
Nov 22, 2011, 8:03:21 AM11/22/11
to Contiki developer mailing list
i was just gonna suggest posting the pcap :))
also try enabling the debug prints in the rpl source files.. it will give u an understanding about how these messages r functioning


Mohammad Abdellatif

Phd student at Faculty of Engineering University of Porto (FEUP)
Researcher at Inesc Porto, UTM, WiN 




Patrick

unread,
Nov 22, 2011, 9:19:32 AM11/22/11
to contiki-d...@lists.sourceforge.net
Hello David, Mohammad and everybody helped me,
now i got it working :)!
Big Thanks for your help.
Reply all
Reply to author
Forward
0 new messages