1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #2216 from cgundogan/rpl_wireshark_dio_malformed_packet

rpl: wrong length of DIO options
This commit is contained in:
Fabian Brandt 2015-02-03 11:02:40 +01:00
commit e9168b5efc
3 changed files with 20 additions and 18 deletions

View File

@ -48,18 +48,20 @@ enum RPL_MSG_CODE {
};
/* packet base lengths */
#define DIO_BASE_LEN 24
#define DIS_BASE_LEN 2
#define DAO_BASE_LEN 4
#define DAO_D_LEN 24
#define DAO_ACK_LEN 4
#define DAO_ACK_D_LEN 24
#define RPL_OPT_LEN 2
#define RPL_OPT_DODAG_CONF_LEN 16
#define RPL_OPT_PREFIX_INFO_LEN 32
#define RPL_OPT_SOLICITED_INFO_LEN 21
#define RPL_OPT_TARGET_LEN 20
#define RPL_OPT_TRANSIT_LEN 22
#define DIO_BASE_LEN 24
#define DIS_BASE_LEN 2
#define DAO_BASE_LEN 4
#define DAO_D_LEN 24
#define DAO_ACK_LEN 4
#define DAO_ACK_D_LEN 24
#define RPL_OPT_LEN 2
#define RPL_OPT_DODAG_CONF_LEN 14
#define RPL_OPT_DODAG_CONF_LEN_WITH_OPT_LEN (RPL_OPT_DODAG_CONF_LEN + RPL_OPT_LEN)
#define RPL_OPT_PREFIX_INFO_LEN 30
#define RPL_OPT_PREFIX_INFO_LEN_WITH_OPT_LEN (RPL_OPT_PREFIX_INFO_LEN + RPL_OPT_LEN)
#define RPL_OPT_SOLICITED_INFO_LEN 21
#define RPL_OPT_TARGET_LEN 20
#define RPL_OPT_TRANSIT_LEN 22
/* message options */
#define RPL_OPT_PAD1 0

View File

@ -276,7 +276,7 @@ void rpl_send_DIO_mode(ipv6_addr_t *destination)
rpl_send_opt_dodag_conf_buf->default_lifetime = mydodag->default_lifetime;
rpl_send_opt_dodag_conf_buf->lifetime_unit = mydodag->lifetime_unit;
opt_hdr_len += RPL_OPT_DODAG_CONF_LEN;
opt_hdr_len += RPL_OPT_DODAG_CONF_LEN_WITH_OPT_LEN;
uint16_t plen = ICMPV6_HDR_LEN + DIO_BASE_LEN + opt_hdr_len;
@ -483,7 +483,7 @@ void rpl_recv_DIO_mode(void)
dio_dodag.default_lifetime = rpl_opt_dodag_conf_buf->default_lifetime;
dio_dodag.lifetime_unit = rpl_opt_dodag_conf_buf->lifetime_unit;
dio_dodag.of = (struct rpl_of_t *) rpl_get_of_for_ocp(rpl_opt_dodag_conf_buf->ocp);
len += RPL_OPT_DODAG_CONF_LEN;
len += RPL_OPT_DODAG_CONF_LEN_WITH_OPT_LEN;
break;
}
@ -493,7 +493,7 @@ void rpl_recv_DIO_mode(void)
return;
}
len += RPL_OPT_PREFIX_INFO_LEN;
len += RPL_OPT_PREFIX_INFO_LEN_WITH_OPT_LEN;
break;
}

View File

@ -274,7 +274,7 @@ void rpl_send_DIO_mode(ipv6_addr_t *destination)
rpl_send_opt_dodag_conf_buf->default_lifetime = mydodag->default_lifetime;
rpl_send_opt_dodag_conf_buf->lifetime_unit = mydodag->lifetime_unit;
opt_hdr_len += RPL_OPT_DODAG_CONF_LEN;
opt_hdr_len += RPL_OPT_DODAG_CONF_LEN_WITH_OPT_LEN;
uint16_t plen = ICMPV6_HDR_LEN + DIO_BASE_LEN + opt_hdr_len;
rpl_send(destination, (uint8_t *)icmp_send_buf, plen, IPV6_PROTO_NUM_ICMPV6);
@ -514,7 +514,7 @@ void rpl_recv_DIO_mode(void)
dio_dodag.default_lifetime = rpl_opt_dodag_conf_buf->default_lifetime;
dio_dodag.lifetime_unit = rpl_opt_dodag_conf_buf->lifetime_unit;
dio_dodag.of = (struct rpl_of_t *) rpl_get_of_for_ocp(rpl_opt_dodag_conf_buf->ocp);
len += RPL_OPT_DODAG_CONF_LEN;
len += RPL_OPT_DODAG_CONF_LEN_WITH_OPT_LEN;
break;
}
@ -524,7 +524,7 @@ void rpl_recv_DIO_mode(void)
return;
}
len += RPL_OPT_PREFIX_INFO_LEN;
len += RPL_OPT_PREFIX_INFO_LEN_WITH_OPT_LEN;
break;
}