From 775928fa3fc435b79e629dced4663d5af0c797c0 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Thu, 20 Feb 2014 15:53:34 +0000 Subject: [PATCH] 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 --- core/net/ipv6/multicast/roll-tm.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/core/net/ipv6/multicast/roll-tm.c b/core/net/ipv6/multicast/roll-tm.c index 75ce897ed..715032936 100644 --- a/core/net/ipv6/multicast/roll-tm.c +++ b/core/net/ipv6/multicast/roll-tm.c @@ -826,20 +826,18 @@ icmp_output() if(SLIDING_WINDOW_GET_M(iterswptr)) { sl->flags |= SEQUENCE_LIST_M_BIT; } - sl->seq_len = iterswptr->count; seed_id_cpy(&sl->seed_id, &iterswptr->seed_id); - PRINTF("ROLL TM: ICMPv6 Out - Seq. F=0x%02x, L=%u, Seed ID=", sl->flags, - sl->seq_len); + PRINTF("ROLL TM: ICMPv6 Out - Seq. F=0x%02x, Seed ID=", sl->flags); PRINT_SEED(&sl->seed_id); 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]; locmpptr >= buffered_msgs; locmpptr--) { if(MCAST_PACKET_IS_USED(locmpptr)) { if(locmpptr->sw == iterswptr) { + sl->seq_len++; PRINTF(", %u", locmpptr->seq_val); *buffer = (uint8_t)(locmpptr->seq_val >> 8); buffer++; @@ -848,9 +846,13 @@ icmp_output() } } } - PRINTF("\n"); - payload_len += sl->seq_len * 2; - sl = (struct sequence_list_header *)buffer; + PRINTF(", Len=%u\n", sl->seq_len); + + /* 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; + } } }