Improve sliding window inclusion in ICMPv6 messages

Don't include a sliding window in the ICMPv6 datagram
unless the window has at least one active datagram
associated with it
This commit is contained in:
George Oikonomou 2014-02-20 15:53:34 +00:00
parent 7fb99ed7c2
commit 775928fa3f

View file

@ -826,20 +826,18 @@ icmp_output()
if(SLIDING_WINDOW_GET_M(iterswptr)) { if(SLIDING_WINDOW_GET_M(iterswptr)) {
sl->flags |= SEQUENCE_LIST_M_BIT; sl->flags |= SEQUENCE_LIST_M_BIT;
} }
sl->seq_len = iterswptr->count;
seed_id_cpy(&sl->seed_id, &iterswptr->seed_id); seed_id_cpy(&sl->seed_id, &iterswptr->seed_id);
PRINTF("ROLL TM: ICMPv6 Out - Seq. F=0x%02x, L=%u, Seed ID=", sl->flags, PRINTF("ROLL TM: ICMPv6 Out - Seq. F=0x%02x, Seed ID=", sl->flags);
sl->seq_len);
PRINT_SEED(&sl->seed_id); PRINT_SEED(&sl->seed_id);
buffer = (uint8_t *)sl + sizeof(struct sequence_list_header); buffer = (uint8_t *)sl + sizeof(struct sequence_list_header);
payload_len += sizeof(struct sequence_list_header);
for(locmpptr = &buffered_msgs[ROLL_TM_BUFF_NUM - 1]; for(locmpptr = &buffered_msgs[ROLL_TM_BUFF_NUM - 1];
locmpptr >= buffered_msgs; locmpptr--) { locmpptr >= buffered_msgs; locmpptr--) {
if(MCAST_PACKET_IS_USED(locmpptr)) { if(MCAST_PACKET_IS_USED(locmpptr)) {
if(locmpptr->sw == iterswptr) { if(locmpptr->sw == iterswptr) {
sl->seq_len++;
PRINTF(", %u", locmpptr->seq_val); PRINTF(", %u", locmpptr->seq_val);
*buffer = (uint8_t)(locmpptr->seq_val >> 8); *buffer = (uint8_t)(locmpptr->seq_val >> 8);
buffer++; buffer++;
@ -848,11 +846,15 @@ icmp_output()
} }
} }
} }
PRINTF("\n"); PRINTF(", Len=%u\n", sl->seq_len);
payload_len += sl->seq_len * 2;
/* Scrap the entire window if it has no content */
if(sl->seq_len > 0) {
payload_len += sizeof(struct sequence_list_header) + sl->seq_len * 2;
sl = (struct sequence_list_header *)buffer; sl = (struct sequence_list_header *)buffer;
} }
} }
}
if(payload_len == 0) { if(payload_len == 0) {
VERBOSE_PRINTF("ROLL TM: ICMPv6 Out - nothing to send\n"); VERBOSE_PRINTF("ROLL TM: ICMPv6 Out - nothing to send\n");