1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-30 08:51:19 +01:00

rpl: wrong length of DIO options

Currently, the DIO options `dodag conf` and `prefix info` are off by two
bytes in their `length` field. The RFC states, that the length field
should not include the option `type` field and the `length` field (two bytes).

For Prefix Info Option: Option Length: 30 (RFC 6550, P.61)
For Dodag Conf  Option: Option Length: 14 (RFC 6550, P.52)

Wireshark complains about DIOs as malformed packets, otherwise.
Can be reproduced by running the rpl_udp example and logging the DIOs
via wireshark.
This commit is contained in:
Cenk Gündoğan 2014-12-18 11:50:11 +01:00
parent 9b65000f8f
commit 432688accb
2 changed files with 6 additions and 6 deletions

View File

@ -263,7 +263,7 @@ void rpl_send_DIO_mode(ipv6_addr_t *destination)
/* DODAG configuration option */
rpl_send_opt_dodag_conf_buf = get_rpl_send_opt_dodag_conf_buf(DIO_BASE_LEN);
rpl_send_opt_dodag_conf_buf->type = RPL_OPT_DODAG_CONF;
rpl_send_opt_dodag_conf_buf->length = RPL_OPT_DODAG_CONF_LEN;
rpl_send_opt_dodag_conf_buf->length = (RPL_OPT_DODAG_CONF_LEN - RPL_OPT_LEN);
rpl_send_opt_dodag_conf_buf->flags_a_pcs = 0;
rpl_send_opt_dodag_conf_buf->DIOIntDoubl = mydodag->dio_interval_doubling;
rpl_send_opt_dodag_conf_buf->DIOIntMin = mydodag->dio_min;
@ -468,7 +468,7 @@ void rpl_recv_DIO_mode(void)
case (RPL_OPT_DODAG_CONF): {
has_dodag_conf_opt = 1;
if (rpl_opt_buf->length != RPL_OPT_DODAG_CONF_LEN) {
if (rpl_opt_buf->length != (RPL_OPT_DODAG_CONF_LEN - RPL_OPT_LEN)) {
DEBUGF("DODAG configuration is malformed.\n");
/* error malformed */
return;
@ -488,7 +488,7 @@ void rpl_recv_DIO_mode(void)
}
case (RPL_OPT_PREFIX_INFO): {
if (rpl_opt_buf->length != RPL_OPT_PREFIX_INFO_LEN) {
if (rpl_opt_buf->length != (RPL_OPT_PREFIX_INFO_LEN - RPL_OPT_LEN)) {
/* error malformed */
return;
}

View File

@ -262,7 +262,7 @@ void rpl_send_DIO_mode(ipv6_addr_t *destination)
/* DODAG configuration option */
rpl_send_opt_dodag_conf_buf = get_rpl_send_opt_dodag_conf_buf(DIO_BASE_LEN);
rpl_send_opt_dodag_conf_buf->type = RPL_OPT_DODAG_CONF;
rpl_send_opt_dodag_conf_buf->length = RPL_OPT_DODAG_CONF_LEN;
rpl_send_opt_dodag_conf_buf->length = (RPL_OPT_DODAG_CONF_LEN - RPL_OPT_LEN);
rpl_send_opt_dodag_conf_buf->flags_a_pcs = 0;
rpl_send_opt_dodag_conf_buf->DIOIntDoubl = mydodag->dio_interval_doubling;
rpl_send_opt_dodag_conf_buf->DIOIntMin = mydodag->dio_min;
@ -499,7 +499,7 @@ void rpl_recv_DIO_mode(void)
case (RPL_OPT_DODAG_CONF): {
has_dodag_conf_opt = 1;
if (rpl_opt_buf->length != RPL_OPT_DODAG_CONF_LEN) {
if (rpl_opt_buf->length != (RPL_OPT_DODAG_CONF_LEN - RPL_OPT_LEN)) {
DEBUGF("DODAG configuration is malformed.\n");
/* error malformed */
return;
@ -519,7 +519,7 @@ void rpl_recv_DIO_mode(void)
}
case (RPL_OPT_PREFIX_INFO): {
if (rpl_opt_buf->length != RPL_OPT_PREFIX_INFO_LEN) {
if (rpl_opt_buf->length != (RPL_OPT_PREFIX_INFO_LEN - RPL_OPT_LEN)) {
/* error malformed */
return;
}