Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
contiki-ng
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
NATAF Emmanuel
contiki-ng
Commits
3fa14d3c
Commit
3fa14d3c
authored
13 years ago
by
Adam Dunkels
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of
ssh://contiki.git.sourceforge.net/gitroot/contiki/contiki
parents
8fee2a50
606b0771
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/net/rpl/rpl-icmp6.c
+19
-17
19 additions, 17 deletions
core/net/rpl/rpl-icmp6.c
core/net/rpl/rpl-private.h
+12
-11
12 additions, 11 deletions
core/net/rpl/rpl-private.h
with
31 additions
and
28 deletions
core/net/rpl/rpl-icmp6.c
+
19
−
17
View file @
3fa14d3c
...
...
@@ -169,6 +169,8 @@ dio_input(void)
uip_ipaddr_t
from
;
uip_ds6_nbr_t
*
nbr
;
memset
(
&
dio
,
0
,
sizeof
(
dio
));
dio
.
dag_intdoubl
=
DEFAULT_DIO_INTERVAL_DOUBLINGS
;
dio
.
dag_intmin
=
DEFAULT_DIO_INTERVAL_MIN
;
dio
.
dag_redund
=
DEFAULT_DIO_REDUNDANCY
;
...
...
@@ -227,7 +229,7 @@ dio_input(void)
/* Check if there are any DIO suboptions. */
for
(;
i
<
buffer_length
;
i
+=
len
)
{
subopt_type
=
buffer
[
i
];
if
(
subopt_type
==
RPL_
DIO_SUB
OPT_PAD1
)
{
if
(
subopt_type
==
RPL_OPT
ION
_PAD1
)
{
len
=
1
;
}
else
{
/* Suboption with a two-byte header + payload */
...
...
@@ -240,10 +242,10 @@ dio_input(void)
return
;
}
PRINTF
(
"RPL: DIO
sub
option %u, length: %u
\n
"
,
subopt_type
,
len
-
2
);
PRINTF
(
"RPL: DIO option %u, length: %u
\n
"
,
subopt_type
,
len
-
2
);
switch
(
subopt_type
)
{
case
RPL_
DIO_SUB
OPT_DAG_METRIC_CONTAINER
:
case
RPL_OPT
ION
_DAG_METRIC_CONTAINER
:
if
(
len
<
6
)
{
PRINTF
(
"RPL: Invalid DAG MC, len = %d
\n
"
,
len
);
RPL_STAT
(
rpl_stats
.
malformed_msgs
++
);
...
...
@@ -276,7 +278,7 @@ dio_input(void)
return
;
}
break
;
case
RPL_
DIO_SUB
OPT_ROUTE_INFO
:
case
RPL_OPT
ION
_ROUTE_INFO
:
if
(
len
<
9
)
{
PRINTF
(
"RPL: Invalid destination prefix option, len = %d
\n
"
,
len
);
RPL_STAT
(
rpl_stats
.
malformed_msgs
++
);
...
...
@@ -288,7 +290,7 @@ dio_input(void)
dio
.
destination_prefix
.
flags
=
buffer
[
i
+
3
];
dio
.
destination_prefix
.
lifetime
=
get32
(
buffer
,
i
+
4
);
if
(((
dio
.
destination_prefix
.
length
+
7
)
/
8
)
+
8
<=
len
&&
if
(((
dio
.
destination_prefix
.
length
+
7
)
/
8
)
+
8
<=
len
&&
dio
.
destination_prefix
.
length
<=
128
)
{
PRINTF
(
"RPL: Copying destination prefix
\n
"
);
memcpy
(
&
dio
.
destination_prefix
.
prefix
,
&
buffer
[
i
+
8
],
...
...
@@ -300,7 +302,7 @@ dio_input(void)
}
break
;
case
RPL_
DIO_SUB
OPT_DAG_CONF
:
case
RPL_OPT
ION
_DAG_CONF
:
if
(
len
!=
16
)
{
PRINTF
(
"RPL: Invalid DAG configuration option, len = %d
\n
"
,
len
);
RPL_STAT
(
rpl_stats
.
malformed_msgs
++
);
...
...
@@ -322,7 +324,7 @@ dio_input(void)
dio
.
dag_max_rankinc
,
dio
.
dag_min_hoprankinc
,
dio
.
ocp
,
dio
.
default_lifetime
,
dio
.
lifetime_unit
);
break
;
case
RPL_
DIO_SUB
OPT_PREFIX_INFO
:
case
RPL_OPT
ION
_PREFIX_INFO
:
if
(
len
!=
32
)
{
PRINTF
(
"RPL: DAG Prefix info not ok, len != 32
\n
"
);
RPL_STAT
(
rpl_stats
.
malformed_msgs
++
);
...
...
@@ -382,7 +384,7 @@ dio_output(rpl_dag_t *dag, uip_ipaddr_t *uc_addr)
if
(
dag
->
mc
.
type
!=
RPL_DAG_MC_NONE
)
{
dag
->
of
->
update_metric_container
(
dag
);
buffer
[
pos
++
]
=
RPL_
DIO_SUB
OPT_DAG_METRIC_CONTAINER
;
buffer
[
pos
++
]
=
RPL_OPT
ION
_DAG_METRIC_CONTAINER
;
buffer
[
pos
++
]
=
6
;
buffer
[
pos
++
]
=
dag
->
mc
.
type
;
buffer
[
pos
++
]
=
dag
->
mc
.
flags
>>
1
;
...
...
@@ -405,7 +407,7 @@ dio_output(rpl_dag_t *dag, uip_ipaddr_t *uc_addr)
}
/* Always add a sub-option for DAG configuration. */
buffer
[
pos
++
]
=
RPL_
DIO_SUB
OPT_DAG_CONF
;
buffer
[
pos
++
]
=
RPL_OPT
ION
_DAG_CONF
;
buffer
[
pos
++
]
=
14
;
buffer
[
pos
++
]
=
0
;
/* No Auth, PCS = 0 */
buffer
[
pos
++
]
=
dag
->
dio_intdoubl
;
...
...
@@ -425,7 +427,7 @@ dio_output(rpl_dag_t *dag, uip_ipaddr_t *uc_addr)
/* Check if we have a prefix to send also. */
if
(
dag
->
prefix_info
.
length
>
0
)
{
buffer
[
pos
++
]
=
RPL_
DIO_SUB
OPT_PREFIX_INFO
;
buffer
[
pos
++
]
=
RPL_OPT
ION
_PREFIX_INFO
;
buffer
[
pos
++
]
=
30
;
/* always 30 bytes + 2 long */
buffer
[
pos
++
]
=
dag
->
prefix_info
.
length
;
buffer
[
pos
++
]
=
dag
->
prefix_info
.
flags
;
...
...
@@ -522,25 +524,25 @@ dao_input(void)
pos
+=
16
;
}
/* Check if there are any
DIO sub-options
. */
/* Check if there are any
RPL options present
. */
i
=
pos
;
for
(;
i
<
buffer_length
;
i
+=
len
)
{
subopt_type
=
buffer
[
i
];
if
(
subopt_type
==
RPL_
DIO_SUB
OPT_PAD1
)
{
if
(
subopt_type
==
RPL_OPT
ION
_PAD1
)
{
len
=
1
;
}
else
{
/*
Sub-
option
with
a two-byte header and payload */
/*
The
option
consists of
a two-byte header and
a
payload
.
*/
len
=
2
+
buffer
[
i
+
1
];
}
switch
(
subopt_type
)
{
case
RPL_
DIO_SUB
OPT_TARGET
:
case
RPL_OPT
ION
_TARGET
:
/* handle the target option */
prefixlen
=
buffer
[
i
+
3
];
memset
(
&
prefix
,
0
,
sizeof
(
prefix
));
memcpy
(
&
prefix
,
buffer
+
i
+
4
,
(
prefixlen
+
7
)
/
CHAR_BIT
);
break
;
case
RPL_
DIO_SUB
OPT_TRANSIT
:
case
RPL_OPT
ION
_TRANSIT
:
/* The path sequence and control are ignored. */
pathcontrol
=
buffer
[
i
+
3
];
pathsequence
=
buffer
[
i
+
4
];
...
...
@@ -651,7 +653,7 @@ dao_output(rpl_parent_t *n, rpl_lifetime_t lifetime)
/* create target subopt */
prefixlen
=
sizeof
(
prefix
)
*
CHAR_BIT
;
buffer
[
pos
++
]
=
RPL_
DIO_SUB
OPT_TARGET
;
buffer
[
pos
++
]
=
RPL_OPT
ION
_TARGET
;
buffer
[
pos
++
]
=
2
+
((
prefixlen
+
7
)
/
CHAR_BIT
);
buffer
[
pos
++
]
=
0
;
/* reserved */
buffer
[
pos
++
]
=
prefixlen
;
...
...
@@ -659,7 +661,7 @@ dao_output(rpl_parent_t *n, rpl_lifetime_t lifetime)
pos
+=
((
prefixlen
+
7
)
/
CHAR_BIT
);
/* Create a transit information sub-option. */
buffer
[
pos
++
]
=
RPL_
DIO_SUB
OPT_TRANSIT
;
buffer
[
pos
++
]
=
RPL_OPT
ION
_TRANSIT
;
buffer
[
pos
++
]
=
4
;
buffer
[
pos
++
]
=
0
;
/* flags - ignored */
buffer
[
pos
++
]
=
0
;
/* path control - ignored */
...
...
This diff is collapsed.
Click to expand it.
core/net/rpl/rpl-private.h
+
12
−
11
View file @
3fa14d3c
...
...
@@ -79,19 +79,20 @@
#define RPL_CODE_SEC_DAO 0x82
/* Secure DAO */
#define RPL_CODE_SEC_DAO_ACK 0x83
/* Secure DAO ACK */
/* RPL DIO/DAO suboption types */
#define RPL_DIO_SUBOPT_PAD1 0
#define RPL_DIO_SUBOPT_PADN 1
#define RPL_DIO_SUBOPT_DAG_METRIC_CONTAINER 2
#define RPL_DIO_SUBOPT_ROUTE_INFO 3
#define RPL_DIO_SUBOPT_DAG_CONF 4
#define RPL_DIO_SUBOPT_TARGET 5
#define RPL_DIO_SUBOPT_TRANSIT 6
#define RPL_DIO_SUBOPT_SOLICITED_INFO 7
#define RPL_DIO_SUBOPT_PREFIX_INFO 8
/* RPL control message options. */
#define RPL_OPTION_PAD1 0
#define RPL_OPTION_PADN 1
#define RPL_OPTION_DAG_METRIC_CONTAINER 2
#define RPL_OPTION_ROUTE_INFO 3
#define RPL_OPTION_DAG_CONF 4
#define RPL_OPTION_TARGET 5
#define RPL_OPTION_TRANSIT 6
#define RPL_OPTION_SOLICITED_INFO 7
#define RPL_OPTION_PREFIX_INFO 8
#define RPL_OPTION_TARGET_DESC 9
#define RPL_DAO_K_FLAG 0x80
/* DAO ACK requested */
#define RPL_DAO_D_FLAG 0x40
/* DODAG ID
P
resent */
#define RPL_DAO_D_FLAG 0x40
/* DODAG ID
p
resent */
/*---------------------------------------------------------------------------*/
/* Default values for RPL constants and variables. */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment