Merge branch 'develop' into fix-rpl-classic-multi-dodag-probing
This commit is contained in:
commit
980a420b44
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
/* sanity check for configured values */
|
/* sanity check for configured values */
|
||||||
#define COAP_MAX_PACKET_SIZE (COAP_MAX_HEADER_SIZE + REST_MAX_CHUNK_SIZE)
|
#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"
|
#error "UIP_CONF_BUFFER_SIZE too small for REST_MAX_CHUNK_SIZE"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ icmp_input()
|
|||||||
|
|
||||||
uip_process(UIP_UDP_SEND_CONN);
|
uip_process(UIP_UDP_SEND_CONN);
|
||||||
|
|
||||||
memcpy(&mcast_buf, uip_buf, uip_len);
|
memcpy(&mcast_buf, &uip_buf[UIP_LLH_LEN], uip_len);
|
||||||
mcast_len = uip_len;
|
mcast_len = uip_len;
|
||||||
/* pass the packet to our uip_process to check if it is allowed to
|
/* pass the packet to our uip_process to check if it is allowed to
|
||||||
* accept this packet or not */
|
* accept this packet or not */
|
||||||
@ -239,7 +239,7 @@ icmp_input()
|
|||||||
|
|
||||||
uip_process(UIP_DATA);
|
uip_process(UIP_DATA);
|
||||||
|
|
||||||
memcpy(uip_buf, &mcast_buf, mcast_len);
|
memcpy(&uip_buf[UIP_LLH_LEN], &mcast_buf, mcast_len);
|
||||||
uip_len = mcast_len;
|
uip_len = mcast_len;
|
||||||
/* Return the IP of the original Multicast sender */
|
/* Return the IP of the original Multicast sender */
|
||||||
uip_ipaddr_copy(&UIP_IP_BUF->srcipaddr, &src_ip);
|
uip_ipaddr_copy(&UIP_IP_BUF->srcipaddr, &src_ip);
|
||||||
@ -257,7 +257,7 @@ icmp_input()
|
|||||||
static void
|
static void
|
||||||
mcast_fwd(void *p)
|
mcast_fwd(void *p)
|
||||||
{
|
{
|
||||||
memcpy(uip_buf, &mcast_buf, mcast_len);
|
memcpy(&uip_buf[UIP_LLH_LEN], &mcast_buf, mcast_len);
|
||||||
uip_len = mcast_len;
|
uip_len = mcast_len;
|
||||||
UIP_IP_BUF->ttl--;
|
UIP_IP_BUF->ttl--;
|
||||||
tcpip_output(NULL);
|
tcpip_output(NULL);
|
||||||
@ -291,7 +291,7 @@ in()
|
|||||||
parent_lladdr = uip_ds6_nbr_lladdr_from_ipaddr(parent_ipaddr);
|
parent_lladdr = uip_ds6_nbr_lladdr_from_ipaddr(parent_ipaddr);
|
||||||
|
|
||||||
if(parent_lladdr == NULL) {
|
if(parent_lladdr == NULL) {
|
||||||
PRINTF("ESMRF: NO Parent exist \n");
|
PRINTF("ESMRF: No Parent found\n");
|
||||||
UIP_MCAST6_STATS_ADD(mcast_dropped);
|
UIP_MCAST6_STATS_ADD(mcast_dropped);
|
||||||
return UIP_MCAST6_DROP;
|
return UIP_MCAST6_DROP;
|
||||||
}
|
}
|
||||||
@ -309,6 +309,7 @@ in()
|
|||||||
|
|
||||||
if(UIP_IP_BUF->ttl <= 1) {
|
if(UIP_IP_BUF->ttl <= 1) {
|
||||||
UIP_MCAST6_STATS_ADD(mcast_dropped);
|
UIP_MCAST6_STATS_ADD(mcast_dropped);
|
||||||
|
PRINTF("ESMRF: TTL too low\n");
|
||||||
return UIP_MCAST6_DROP;
|
return UIP_MCAST6_DROP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,12 +351,14 @@ in()
|
|||||||
fwd_delay = fwd_delay * (1 + ((random_rand() >> 11) % fwd_spread));
|
fwd_delay = fwd_delay * (1 + ((random_rand() >> 11) % fwd_spread));
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&mcast_buf, uip_buf, uip_len);
|
memcpy(&mcast_buf, &uip_buf[UIP_LLH_LEN], uip_len);
|
||||||
mcast_len = uip_len;
|
mcast_len = uip_len;
|
||||||
ctimer_set(&mcast_periodic, fwd_delay, mcast_fwd, NULL);
|
ctimer_set(&mcast_periodic, fwd_delay, mcast_fwd, NULL);
|
||||||
}
|
}
|
||||||
PRINTF("ESMRF: %u bytes: fwd in %u [%u]\n",
|
PRINTF("ESMRF: %u bytes: fwd in %u [%u]\n",
|
||||||
uip_len, fwd_delay, fwd_spread);
|
uip_len, fwd_delay, fwd_spread);
|
||||||
|
} else {
|
||||||
|
PRINTF("ESMRF: Group unknown, dropping\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Done with this packet unless we are a member of the mcast group */
|
/* Done with this packet unless we are a member of the mcast group */
|
||||||
|
@ -1321,7 +1321,7 @@ static void
|
|||||||
out()
|
out()
|
||||||
{
|
{
|
||||||
|
|
||||||
if(uip_len + HBHO_TOTAL_LEN > UIP_BUFSIZE) {
|
if(uip_len + HBHO_TOTAL_LEN > UIP_BUFSIZE - UIP_LLH_LEN) {
|
||||||
PRINTF("ROLL TM: Multicast Out can not add HBHO. Packet too long\n");
|
PRINTF("ROLL TM: Multicast Out can not add HBHO. Packet too long\n");
|
||||||
goto drop;
|
goto drop;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ static uint8_t fwd_spread;
|
|||||||
static void
|
static void
|
||||||
mcast_fwd(void *p)
|
mcast_fwd(void *p)
|
||||||
{
|
{
|
||||||
memcpy(uip_buf, &mcast_buf, mcast_len);
|
memcpy(&uip_buf[UIP_LLH_LEN], &mcast_buf, mcast_len);
|
||||||
uip_len = mcast_len;
|
uip_len = mcast_len;
|
||||||
UIP_IP_BUF->ttl--;
|
UIP_IP_BUF->ttl--;
|
||||||
tcpip_output(NULL);
|
tcpip_output(NULL);
|
||||||
@ -106,6 +106,7 @@ in()
|
|||||||
*/
|
*/
|
||||||
d = rpl_get_any_dag();
|
d = rpl_get_any_dag();
|
||||||
if(!d) {
|
if(!d) {
|
||||||
|
PRINTF("SMRF: No DODAG\n");
|
||||||
UIP_MCAST6_STATS_ADD(mcast_dropped);
|
UIP_MCAST6_STATS_ADD(mcast_dropped);
|
||||||
return UIP_MCAST6_DROP;
|
return UIP_MCAST6_DROP;
|
||||||
}
|
}
|
||||||
@ -115,6 +116,7 @@ in()
|
|||||||
parent_lladdr = uip_ds6_nbr_lladdr_from_ipaddr(parent_ipaddr);
|
parent_lladdr = uip_ds6_nbr_lladdr_from_ipaddr(parent_ipaddr);
|
||||||
|
|
||||||
if(parent_lladdr == NULL) {
|
if(parent_lladdr == NULL) {
|
||||||
|
PRINTF("SMRF: No Parent found\n");
|
||||||
UIP_MCAST6_STATS_ADD(mcast_dropped);
|
UIP_MCAST6_STATS_ADD(mcast_dropped);
|
||||||
return UIP_MCAST6_DROP;
|
return UIP_MCAST6_DROP;
|
||||||
}
|
}
|
||||||
@ -132,6 +134,7 @@ in()
|
|||||||
|
|
||||||
if(UIP_IP_BUF->ttl <= 1) {
|
if(UIP_IP_BUF->ttl <= 1) {
|
||||||
UIP_MCAST6_STATS_ADD(mcast_dropped);
|
UIP_MCAST6_STATS_ADD(mcast_dropped);
|
||||||
|
PRINTF("SMRF: TTL too low\n");
|
||||||
return UIP_MCAST6_DROP;
|
return UIP_MCAST6_DROP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,12 +176,14 @@ in()
|
|||||||
fwd_delay = fwd_delay * (1 + ((random_rand() >> 11) % fwd_spread));
|
fwd_delay = fwd_delay * (1 + ((random_rand() >> 11) % fwd_spread));
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&mcast_buf, uip_buf, uip_len);
|
memcpy(&mcast_buf, &uip_buf[UIP_LLH_LEN], uip_len);
|
||||||
mcast_len = uip_len;
|
mcast_len = uip_len;
|
||||||
ctimer_set(&mcast_periodic, fwd_delay, mcast_fwd, NULL);
|
ctimer_set(&mcast_periodic, fwd_delay, mcast_fwd, NULL);
|
||||||
}
|
}
|
||||||
PRINTF("SMRF: %u bytes: fwd in %u [%u]\n",
|
PRINTF("SMRF: %u bytes: fwd in %u [%u]\n",
|
||||||
uip_len, fwd_delay, fwd_spread);
|
uip_len, fwd_delay, fwd_spread);
|
||||||
|
} else {
|
||||||
|
PRINTF("SMRF: Group unknown, dropping\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Done with this packet unless we are a member of the mcast group */
|
/* Done with this packet unless we are a member of the mcast group */
|
||||||
|
@ -123,7 +123,7 @@
|
|||||||
/* NOTE: In the multiple-reassembly context there is only room for the header / first fragment */
|
/* NOTE: In the multiple-reassembly context there is only room for the header / first fragment */
|
||||||
#define SICSLOWPAN_IP_BUF(buf) ((struct uip_ip_hdr *)buf)
|
#define SICSLOWPAN_IP_BUF(buf) ((struct uip_ip_hdr *)buf)
|
||||||
#define SICSLOWPAN_UDP_BUF(buf) ((struct uip_udp_hdr *)&buf[UIP_IPH_LEN])
|
#define SICSLOWPAN_UDP_BUF(buf) ((struct uip_udp_hdr *)&buf[UIP_IPH_LEN])
|
||||||
#define SICSLOWPAN_IPPAYLOAD_BUF(buf) (&buf[UIP_LLIPH_LEN])
|
#define SICSLOWPAN_IPPAYLOAD_BUF(buf) (&buf[UIP_IPH_LEN])
|
||||||
|
|
||||||
|
|
||||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||||
|
@ -472,12 +472,7 @@ output_fallback(void)
|
|||||||
#ifdef UIP_FALLBACK_INTERFACE
|
#ifdef UIP_FALLBACK_INTERFACE
|
||||||
LOG_INFO("fallback: removing ext hdrs & setting proto %d %d\n",
|
LOG_INFO("fallback: removing ext hdrs & setting proto %d %d\n",
|
||||||
uip_ext_len, *((uint8_t *)UIP_IP_BUF + 40));
|
uip_ext_len, *((uint8_t *)UIP_IP_BUF + 40));
|
||||||
if(uip_ext_len > 0) {
|
remove_ext_hdr();
|
||||||
uint8_t proto = *((uint8_t *)UIP_IP_BUF + 40);
|
|
||||||
remove_ext_hdr();
|
|
||||||
/* This should be copied from the ext header... */
|
|
||||||
UIP_IP_BUF->proto = proto;
|
|
||||||
}
|
|
||||||
/* Inform the other end that the destination is not reachable. If it's
|
/* Inform the other end that the destination is not reachable. If it's
|
||||||
* not informed routes might get lost unexpectedly until there's a need
|
* not informed routes might get lost unexpectedly until there's a need
|
||||||
* to send a new packet to the peer */
|
* to send a new packet to the peer */
|
||||||
|
@ -523,6 +523,7 @@ uip_connect(const uip_ipaddr_t *ripaddr, uint16_t rport)
|
|||||||
void
|
void
|
||||||
remove_ext_hdr(void)
|
remove_ext_hdr(void)
|
||||||
{
|
{
|
||||||
|
int last_uip_ext_len;
|
||||||
/* Remove ext header before TCP/UDP processing. */
|
/* Remove ext header before TCP/UDP processing. */
|
||||||
if(uip_ext_len > 0) {
|
if(uip_ext_len > 0) {
|
||||||
LOG_DBG("Cutting ext-header before processing (extlen: %d, uiplen: %d)\n",
|
LOG_DBG("Cutting ext-header before processing (extlen: %d, uiplen: %d)\n",
|
||||||
@ -532,15 +533,17 @@ remove_ext_hdr(void)
|
|||||||
uip_clear_buf();
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memmove(((uint8_t *)UIP_TCP_BUF), (uint8_t *)UIP_TCP_BUF + uip_ext_len,
|
last_uip_ext_len = uip_ext_len;
|
||||||
uip_len - UIP_IPH_LEN - uip_ext_len);
|
uip_ext_len = 0;
|
||||||
|
UIP_IP_BUF->proto = UIP_EXT_BUF->next;
|
||||||
|
memmove(((uint8_t *)UIP_TCP_BUF), (uint8_t *)UIP_TCP_BUF + last_uip_ext_len,
|
||||||
|
uip_len - UIP_IPH_LEN - last_uip_ext_len);
|
||||||
|
|
||||||
uip_len -= uip_ext_len;
|
uip_len -= last_uip_ext_len;
|
||||||
|
|
||||||
/* Update the IP length. */
|
/* Update the IP length. */
|
||||||
UIP_IP_BUF->len[0] = (uip_len - UIP_IPH_LEN) >> 8;
|
UIP_IP_BUF->len[0] = (uip_len - UIP_IPH_LEN) >> 8;
|
||||||
UIP_IP_BUF->len[1] = (uip_len - UIP_IPH_LEN) & 0xff;
|
UIP_IP_BUF->len[1] = (uip_len - UIP_IPH_LEN) & 0xff;
|
||||||
uip_ext_len = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
@ -1494,7 +1497,6 @@ uip_process(uint8_t flag)
|
|||||||
udp_input:
|
udp_input:
|
||||||
|
|
||||||
remove_ext_hdr();
|
remove_ext_hdr();
|
||||||
UIP_IP_BUF->proto = UIP_PROTO_UDP;
|
|
||||||
|
|
||||||
LOG_INFO("Receiving UDP packet\n");
|
LOG_INFO("Receiving UDP packet\n");
|
||||||
|
|
||||||
@ -1607,7 +1609,6 @@ uip_process(uint8_t flag)
|
|||||||
tcp_input:
|
tcp_input:
|
||||||
|
|
||||||
remove_ext_hdr();
|
remove_ext_hdr();
|
||||||
UIP_IP_BUF->proto = UIP_PROTO_TCP;
|
|
||||||
|
|
||||||
UIP_STAT(++uip_stat.tcp.recv);
|
UIP_STAT(++uip_stat.tcp.recv);
|
||||||
LOG_INFO("Receiving TCP packet\n");
|
LOG_INFO("Receiving TCP packet\n");
|
||||||
|
@ -128,6 +128,6 @@ uipbuf_clr_attr_flag(uint16_t flag)
|
|||||||
uint16_t
|
uint16_t
|
||||||
uipbuf_is_attr_flag(uint16_t flag)
|
uipbuf_is_attr_flag(uint16_t flag)
|
||||||
{
|
{
|
||||||
return (uipbuf_attrs[UIPBUF_ATTR_FLAGS] & flag) > 0;
|
return (uipbuf_attrs[UIPBUF_ATTR_FLAGS] & flag) == flag;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -35,33 +35,106 @@
|
|||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
|
||||||
/* Get the next header given the buffer - start indicates that this is
|
/**
|
||||||
start of the IPv6 header - needs to be set to 0 when in an ext hdr */
|
* \brief Get the next IPv6 header.
|
||||||
|
* \param buffer A pointer to the buffer holding the IPv6 packet
|
||||||
|
* \param size The size of the data in the buffer
|
||||||
|
* \param protocol A pointer to a variable where the protocol of the header will be stored
|
||||||
|
* \param start A flag that indicates if this is expected to be the IPv6 packet header or a later header (Extension header)
|
||||||
|
* \retval returns address of the starting position of the next header
|
||||||
|
*
|
||||||
|
* This function moves to the next header in a IPv6 packet.
|
||||||
|
*/
|
||||||
uint8_t* uipbuf_get_next_header(uint8_t *buffer, uint16_t size, uint8_t *protocol, uint8_t start);
|
uint8_t* uipbuf_get_next_header(uint8_t *buffer, uint16_t size, uint8_t *protocol, uint8_t start);
|
||||||
/* Get the final header given the buffer - that is assumed to be at start
|
|
||||||
of an IPv6 header */
|
|
||||||
|
/**
|
||||||
|
* \brief Get the last IPv6 header.
|
||||||
|
* \param buffer A pointer to the buffer holding the IPv6 packet
|
||||||
|
* \param size The size of the data in the buffer
|
||||||
|
* \param protocol A pointer to a variable where the protocol of the header will be stored
|
||||||
|
* \retval returns address of the starting position of the next header
|
||||||
|
*
|
||||||
|
* This function moves to the last header of the IPv6 packet.
|
||||||
|
*/
|
||||||
uint8_t* uipbuf_get_last_header(uint8_t *buffer, uint16_t size, uint8_t *protocol);
|
uint8_t* uipbuf_get_last_header(uint8_t *buffer, uint16_t size, uint8_t *protocol);
|
||||||
|
|
||||||
/* Attributes relating to the current packet in uipbuf */
|
|
||||||
|
/**
|
||||||
|
* \brief Get the value of the attribute
|
||||||
|
* \param type The attribute to get the value of
|
||||||
|
* \retval the value of the attribute
|
||||||
|
*
|
||||||
|
* This function gets the value of a specific uipbuf attribute.
|
||||||
|
*/
|
||||||
uint16_t uipbuf_get_attr(uint8_t type);
|
uint16_t uipbuf_get_attr(uint8_t type);
|
||||||
void uipbuf_set_attr_flag(uint16_t flag);
|
|
||||||
void uipbuf_clr_attr_flag(uint16_t flag);
|
|
||||||
uint16_t uipbuf_is_attr_flag(uint16_t flag);
|
/**
|
||||||
|
* \brief Set the value of the attribute
|
||||||
|
* \param type The attribute to set the value of
|
||||||
|
* \param value The value to set
|
||||||
|
* \retval 0 - indicates failure of setting the value
|
||||||
|
* \retval 1 - indicates success of setting the value
|
||||||
|
*
|
||||||
|
* This function sets the value of a specific uipbuf attribute.
|
||||||
|
*/
|
||||||
int uipbuf_set_attr(uint8_t type, uint16_t value);
|
int uipbuf_set_attr(uint8_t type, uint16_t value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Set bits in the uipbuf attribute flags.
|
||||||
|
* \param flag_bits The bits to set in the flag.
|
||||||
|
*
|
||||||
|
* This function sets the uipbuf attributes flag of specified bits.
|
||||||
|
*/
|
||||||
|
void uipbuf_set_attr_flag(uint16_t flag_bits);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Clear bits in the uipbuf attribute flags.
|
||||||
|
* \param flag_bits The bits to clear in the flag.
|
||||||
|
*
|
||||||
|
* This function clears the uipbuf attributes flag of specified bits.
|
||||||
|
*/
|
||||||
|
void uipbuf_clr_attr_flag(uint16_t flag_bits);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Check if bits in the uipbuf attribute flag are set.
|
||||||
|
* \param flag_bits The bits to check in the flag.
|
||||||
|
*
|
||||||
|
* This function checks if the specified bits are set in the
|
||||||
|
* uipbuf attributes flag.
|
||||||
|
*/
|
||||||
|
uint16_t uipbuf_is_attr_flag(uint16_t flag_bits);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Clear all attributes.
|
||||||
|
*
|
||||||
|
* This function clear all attributes in the uipbuf attributes
|
||||||
|
* including all flags.
|
||||||
|
*/
|
||||||
void uipbuf_clear_attr(void);
|
void uipbuf_clear_attr(void);
|
||||||
|
|
||||||
/* These flags will be used for being */
|
/**
|
||||||
|
* \brief The bits defined for uipbuf attributes flag.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
/* Avoid using NHC compression on the packet (6LoWPAN) */
|
||||||
#define UIPBUF_ATTR_FLAGS_6LOWPAN_NO_NHC_COMPRESSION 0x01
|
#define UIPBUF_ATTR_FLAGS_6LOWPAN_NO_NHC_COMPRESSION 0x01
|
||||||
|
/* Avoid using prefix compression on the packet (6LoWPAN) */
|
||||||
#define UIPBUF_ATTR_FLAGS_6LOWPAN_NO_PREFIX_COMPRESSION 0x02
|
#define UIPBUF_ATTR_FLAGS_6LOWPAN_NO_PREFIX_COMPRESSION 0x02
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief The attributes defined for uipbuf attributes function.
|
||||||
|
*
|
||||||
|
*/
|
||||||
enum {
|
enum {
|
||||||
UIPBUF_ATTR_LLSEC_LEVEL,
|
UIPBUF_ATTR_LLSEC_LEVEL, /**< Control link layer security level. */
|
||||||
UIPBUF_ATTR_LLSEC_KEY_ID,
|
UIPBUF_ATTR_LLSEC_KEY_ID, /**< Control link layer security key ID. */
|
||||||
UIPBUF_ATTR_INTERFACE_ID,
|
UIPBUF_ATTR_INTERFACE_ID, /**< The interface to output packet on */
|
||||||
UIPBUF_ATTR_PHYSICAL_NETWORK_ID,
|
UIPBUF_ATTR_PHYSICAL_NETWORK_ID, /**< Physical network ID (mapped to PAN ID)*/
|
||||||
UIPBUF_ATTR_MAX_MAC_TRANSMISSIONS,
|
UIPBUF_ATTR_MAX_MAC_TRANSMISSIONS, /**< MAX transmissions of the packet MAC */
|
||||||
UIPBUF_ATTR_FLAGS,
|
UIPBUF_ATTR_FLAGS, /**< Flags that can control lower layers. see above. */
|
||||||
UIPBUF_ATTR_MAX
|
UIPBUF_ATTR_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -370,6 +370,7 @@ rpl_set_root(uint8_t instance_id, uip_ipaddr_t *dag_id)
|
|||||||
}
|
}
|
||||||
if(dag == dag->instance->current_dag) {
|
if(dag == dag->instance->current_dag) {
|
||||||
PRINTF("RPL: Dropping a joined DAG when setting this node as root");
|
PRINTF("RPL: Dropping a joined DAG when setting this node as root");
|
||||||
|
rpl_set_default_route(instance, NULL);
|
||||||
dag->instance->current_dag = NULL;
|
dag->instance->current_dag = NULL;
|
||||||
} else {
|
} else {
|
||||||
PRINTF("RPL: Dropping a DAG when setting this node as root");
|
PRINTF("RPL: Dropping a DAG when setting this node as root");
|
||||||
@ -665,6 +666,10 @@ rpl_free_dag(rpl_dag_t *dag)
|
|||||||
if(RPL_IS_STORING(dag->instance)) {
|
if(RPL_IS_STORING(dag->instance)) {
|
||||||
rpl_remove_routes(dag);
|
rpl_remove_routes(dag);
|
||||||
}
|
}
|
||||||
|
/* Stop the DAO retransmit timer */
|
||||||
|
#if RPL_WITH_DAO_ACK
|
||||||
|
ctimer_stop(&dag->instance->dao_retransmit_timer);
|
||||||
|
#endif /* RPL_WITH_DAO_ACK */
|
||||||
|
|
||||||
/* Remove autoconfigured address */
|
/* Remove autoconfigured address */
|
||||||
if((dag->prefix_info.flags & UIP_ND6_RA_FLAG_AUTONOMOUS)) {
|
if((dag->prefix_info.flags & UIP_ND6_RA_FLAG_AUTONOMOUS)) {
|
||||||
@ -757,22 +762,17 @@ rpl_select_dag(rpl_instance_t *instance, rpl_parent_t *p)
|
|||||||
old_rank = instance->current_dag->rank;
|
old_rank = instance->current_dag->rank;
|
||||||
last_parent = instance->current_dag->preferred_parent;
|
last_parent = instance->current_dag->preferred_parent;
|
||||||
|
|
||||||
best_dag = instance->current_dag;
|
if(instance->current_dag->rank != ROOT_RANK(instance)) {
|
||||||
if(best_dag->rank != ROOT_RANK(instance)) {
|
rpl_select_parent(p->dag);
|
||||||
if(rpl_select_parent(p->dag) != NULL) {
|
}
|
||||||
if(p->dag != best_dag) {
|
|
||||||
best_dag = instance->of->best_dag(best_dag, p->dag);
|
best_dag = NULL;
|
||||||
}
|
for(dag = &instance->dag_table[0], end = dag + RPL_MAX_DAG_PER_INSTANCE; dag < end; ++dag) {
|
||||||
} else if(p->dag == best_dag) {
|
if(dag->used && dag->preferred_parent != NULL && dag->preferred_parent->rank != RPL_INFINITE_RANK) {
|
||||||
best_dag = NULL;
|
if(best_dag == NULL) {
|
||||||
for(dag = &instance->dag_table[0], end = dag + RPL_MAX_DAG_PER_INSTANCE; dag < end; ++dag) {
|
best_dag = dag;
|
||||||
if(dag->used && dag->preferred_parent != NULL && dag->preferred_parent->rank != RPL_INFINITE_RANK) {
|
} else {
|
||||||
if(best_dag == NULL) {
|
best_dag = instance->of->best_dag(best_dag, dag);
|
||||||
best_dag = dag;
|
|
||||||
} else {
|
|
||||||
best_dag = instance->of->best_dag(best_dag, dag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1323,6 +1323,9 @@ rpl_local_repair(rpl_instance_t *instance)
|
|||||||
|
|
||||||
/* no downward route anymore */
|
/* no downward route anymore */
|
||||||
instance->has_downward_route = 0;
|
instance->has_downward_route = 0;
|
||||||
|
#if RPL_WITH_DAO_ACK
|
||||||
|
ctimer_stop(&instance->dao_retransmit_timer);
|
||||||
|
#endif /* RPL_WITH_DAO_ACK */
|
||||||
|
|
||||||
rpl_reset_dio_timer(instance);
|
rpl_reset_dio_timer(instance);
|
||||||
if(RPL_IS_STORING(instance)) {
|
if(RPL_IS_STORING(instance)) {
|
||||||
|
@ -408,7 +408,7 @@ insert_srh_header(void)
|
|||||||
path_len, cmpri, cmpre, ext_len, padding);
|
path_len, cmpri, cmpre, ext_len, padding);
|
||||||
|
|
||||||
/* Check if there is enough space to store the extension header */
|
/* 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);
|
PRINTF("RPL: Packet too long: impossible to add source routing header (%u bytes)\n", ext_len);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -553,7 +553,7 @@ insert_hbh_header(const rpl_instance_t *instance)
|
|||||||
|
|
||||||
/* Insert hop-by-hop header */
|
/* Insert hop-by-hop header */
|
||||||
PRINTF("RPL: Creating hop-by-hop option\n");
|
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");
|
PRINTF("RPL: Packet too long: impossible to add hop-by-hop option\n");
|
||||||
uip_ext_len = last_uip_ext_len;
|
uip_ext_len = last_uip_ext_len;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1282,6 +1282,12 @@ dao_ack_input(void)
|
|||||||
parent = NULL;
|
parent = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(instance->current_dag->rank == ROOT_RANK(instance)) {
|
||||||
|
PRINTF("RPL: DODAG root received a DAO ACK, ignoring it\n");
|
||||||
|
uip_clear_buf();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
PRINTF("RPL: Received a DAO %s with sequence number %d (%d) and status %d from ",
|
PRINTF("RPL: Received a DAO %s with sequence number %d (%d) and status %d from ",
|
||||||
status < 128 ? "ACK" : "NACK",
|
status < 128 ? "ACK" : "NACK",
|
||||||
sequence, instance->my_dao_seqno, status);
|
sequence, instance->my_dao_seqno, status);
|
||||||
|
@ -199,13 +199,6 @@
|
|||||||
#define RPL_ROUTE_FROM_MULTICAST_DAO 2
|
#define RPL_ROUTE_FROM_MULTICAST_DAO 2
|
||||||
#define RPL_ROUTE_FROM_DIO 3
|
#define RPL_ROUTE_FROM_DIO 3
|
||||||
|
|
||||||
/* Multicast Route Lifetime as a multiple of the lifetime unit */
|
|
||||||
#ifdef RPL_CONF_MCAST_LIFETIME
|
|
||||||
#define RPL_MCAST_LIFETIME RPL_CONF_MCAST_LIFETIME
|
|
||||||
#else
|
|
||||||
#define RPL_MCAST_LIFETIME 3
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* DIS related */
|
/* DIS related */
|
||||||
#define RPL_DIS_SEND 1
|
#define RPL_DIS_SEND 1
|
||||||
|
|
||||||
|
@ -283,7 +283,7 @@ handle_dao_timer(void *ptr)
|
|||||||
if(uip_ds6_if.maddr_list[i].isused
|
if(uip_ds6_if.maddr_list[i].isused
|
||||||
&& uip_is_addr_mcast_global(&uip_ds6_if.maddr_list[i].ipaddr)) {
|
&& uip_is_addr_mcast_global(&uip_ds6_if.maddr_list[i].ipaddr)) {
|
||||||
dao_output_target(instance->current_dag->preferred_parent,
|
dao_output_target(instance->current_dag->preferred_parent,
|
||||||
&uip_ds6_if.maddr_list[i].ipaddr, RPL_MCAST_LIFETIME);
|
&uip_ds6_if.maddr_list[i].ipaddr, instance->default_lifetime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,7 +293,7 @@ handle_dao_timer(void *ptr)
|
|||||||
/* Don't send if it's also our own address, done that already */
|
/* Don't send if it's also our own address, done that already */
|
||||||
if(uip_ds6_maddr_lookup(&mcast_route->group) == NULL) {
|
if(uip_ds6_maddr_lookup(&mcast_route->group) == NULL) {
|
||||||
dao_output_target(instance->current_dag->preferred_parent,
|
dao_output_target(instance->current_dag->preferred_parent,
|
||||||
&mcast_route->group, RPL_MCAST_LIFETIME);
|
&mcast_route->group, instance->default_lifetime);
|
||||||
}
|
}
|
||||||
mcast_route = list_item_next(mcast_route);
|
mcast_route = list_item_next(mcast_route);
|
||||||
}
|
}
|
||||||
|
@ -302,7 +302,7 @@ insert_srh_header(void)
|
|||||||
path_len, cmpri, cmpre, ext_len, padding);
|
path_len, cmpri, cmpre, ext_len, padding);
|
||||||
|
|
||||||
/* Check if there is enough space to store the extension header */
|
/* 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);
|
LOG_ERR("packet too long: impossible to add source routing header (%u bytes)\n", ext_len);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -464,7 +464,7 @@ insert_hbh_header(void)
|
|||||||
|
|
||||||
/* Insert hop-by-hop header */
|
/* Insert hop-by-hop header */
|
||||||
LOG_INFO("creating hop-by-hop option\n");
|
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");
|
LOG_ERR("packet too long: impossible to add hop-by-hop option\n");
|
||||||
uip_ext_len = last_uip_ext_len;
|
uip_ext_len = last_uip_ext_len;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -61,7 +61,7 @@ struct dhcp_msg {
|
|||||||
uint8_t options[312];
|
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 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 Increase UIP_CONF_BUFFER_SIZE in your project-conf.h, or contiki-conf.h
|
||||||
#error A good size is 600 bytes
|
#error A good size is 600 bytes
|
||||||
|
Loading…
Reference in New Issue
Block a user