Add missing UIP_LLH_LEN

This commit is contained in:
Laurent Deru 2017-12-11 18:28:10 +01:00
parent d2bd0d7198
commit aae6276b56
4 changed files with 6 additions and 6 deletions

View File

@ -46,7 +46,7 @@
/* sanity check for configured values */
#define COAP_MAX_PACKET_SIZE (COAP_MAX_HEADER_SIZE + REST_MAX_CHUNK_SIZE)
#if COAP_MAX_PACKET_SIZE > (UIP_BUFSIZE - UIP_IPH_LEN - UIP_UDPH_LEN)
#if COAP_MAX_PACKET_SIZE > (UIP_BUFSIZE - UIP_LLH_LEN - UIP_IPH_LEN - UIP_UDPH_LEN)
#error "UIP_CONF_BUFFER_SIZE too small for REST_MAX_CHUNK_SIZE"
#endif

View File

@ -408,7 +408,7 @@ insert_srh_header(void)
path_len, cmpri, cmpre, ext_len, padding);
/* Check if there is enough space to store the extension header */
if(uip_len + ext_len > UIP_BUFSIZE) {
if(uip_len + ext_len > UIP_BUFSIZE - UIP_LLH_LEN) {
PRINTF("RPL: Packet too long: impossible to add source routing header (%u bytes)\n", ext_len);
return 0;
}
@ -553,7 +553,7 @@ insert_hbh_header(const rpl_instance_t *instance)
/* Insert hop-by-hop header */
PRINTF("RPL: Creating hop-by-hop option\n");
if(uip_len + RPL_HOP_BY_HOP_LEN > UIP_BUFSIZE) {
if(uip_len + RPL_HOP_BY_HOP_LEN > UIP_BUFSIZE - UIP_LLH_LEN) {
PRINTF("RPL: Packet too long: impossible to add hop-by-hop option\n");
uip_ext_len = last_uip_ext_len;
return 0;

View File

@ -302,7 +302,7 @@ insert_srh_header(void)
path_len, cmpri, cmpre, ext_len, padding);
/* Check if there is enough space to store the extension header */
if(uip_len + ext_len > UIP_BUFSIZE) {
if(uip_len + ext_len > UIP_BUFSIZE - UIP_LLH_LEN) {
LOG_ERR("packet too long: impossible to add source routing header (%u bytes)\n", ext_len);
return 0;
}
@ -464,7 +464,7 @@ insert_hbh_header(void)
/* Insert hop-by-hop header */
LOG_INFO("creating hop-by-hop option\n");
if(uip_len + RPL_HOP_BY_HOP_LEN > UIP_BUFSIZE) {
if(uip_len + RPL_HOP_BY_HOP_LEN > UIP_BUFSIZE - UIP_LLH_LEN) {
LOG_ERR("packet too long: impossible to add hop-by-hop option\n");
uip_ext_len = last_uip_ext_len;
return 0;

View File

@ -61,7 +61,7 @@ struct dhcp_msg {
uint8_t options[312];
};
#if (UIP_BUFSIZE - UIP_UDPIP_HLEN) < 548
#if (UIP_BUFSIZE - UIP_LLH_LEN - UIP_UDPIP_HLEN) < 548
#error UIP_CONF_BUFFER_SIZE may be too small to accomodate DHCPv4 packets
#error Increase UIP_CONF_BUFFER_SIZE in your project-conf.h, or contiki-conf.h
#error A good size is 600 bytes