Skip to content

Commit feb1784

Browse files
committed
Remove fragment/PMTU handling dropped by RFC 8200
The new IPv6 specification (RFC 8200 / STD 86) drops some IPv6 features, so we can simplify. We now drop ICMP "Packet Too Big" messages reporting a size less than the minimum 1280 MTU, and we won't create atomic fragments with fragment headers in response to them. Change-Id: I38451ca13842b9c5b89a2f95c4793a326dacae23
1 parent 073f7e8 commit feb1784

File tree

2 files changed

+7
-34
lines changed

2 files changed

+7
-34
lines changed

source/Common_Protocols/icmpv6.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ buffer_t *icmpv6_packet_too_big_handler(buffer_t *buf)
280280
const uint8_t *ptr = buffer_data_pointer(buf);
281281
uint32_t mtu = common_read_32_bit(ptr);
282282

283+
/* RFC 8201 - ignore MTU smaller than minimum */
284+
if (mtu < IPV6_MIN_LINK_MTU) {
285+
return buffer_free(buf);
286+
}
287+
283288
ptr = buffer_data_strip_header(buf, 4);
284289

285290
/* Check source is us */

source/Common_Protocols/ipv6_fragmentation.c

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,12 @@
2121
* References:
2222
*
2323
* RFC 815 IP Datagram Reassembly Algorithms
24-
* RFC 2460 Internet Protocol. Version 6 (IPv6) Specification
2524
* RFC 3168 The Addition of Explicit Congestion Notification (ECN) to IP
26-
* RFC 5722 Handling of Overlapping IPv6 Fragments
2725
* RFC 6040 Tunnelling of Explicit Congestion Notification
28-
* RFC 6145 IP/ICMP Translation Algorithm [sections on Path MTU]
2926
* RFC 6660 Encoding Three Pre-Congestion Notification (PCN) States in the
3027
* IP Header Using a Single Diffserv Codepoint (DSCP)
31-
* RFC 6946 Processing of IPv6 "Atomic" Fragments
32-
* RFC 7112 Implications of Oversized IPv6 Header Chains
28+
* RFC 8200 Internet Protocol, Version 6 (IPv6) Specification
29+
* RFC 8201 Path MTU Discovery for IP version 6
3330
*/
3431
#include "nsconfig.h"
3532
#include "ns_types.h"
@@ -656,35 +653,6 @@ buffer_t *ipv6_frag_down(buffer_t *dgram_buf)
656653

657654
*nh_ptr = IPV6_NH_FRAGMENT;
658655

659-
/* Special case for atomic fragments (caused by a small PMTU) */
660-
/* Note that we DO have the option of actually fragmenting and obeying
661-
* a small PMTU, which would avoid this special case.
662-
*/
663-
if (buffer_data_length(dgram_buf) <= IPV6_MIN_LINK_MTU - 8) {
664-
dgram_buf = buffer_headroom(dgram_buf, 8);
665-
if (!dgram_buf) {
666-
return NULL;
667-
}
668-
669-
/* Move unfragmentable section back 8 bytes; increase IP length field */
670-
ip_ptr = buffer_data_reserve_header(dgram_buf, 8);
671-
memmove(ip_ptr, ip_ptr + 8, unfrag_len);
672-
common_write_16_bit(common_read_16_bit(ip_ptr + 4) + 8, ip_ptr + 4);
673-
674-
/* Write atomic fragment header into the gap */
675-
frag_hdr = ip_ptr + unfrag_len;
676-
frag_hdr[0] = nh;
677-
frag_hdr[1] = 0;
678-
common_write_16_bit(0, frag_hdr + 2);
679-
common_write_32_bit(++dest->fragment_id, frag_hdr + 4);
680-
return dgram_buf;
681-
}
682-
683-
/* We won't fragment below minimum MTU. (Although we could...) */
684-
if (pmtu < IPV6_MIN_LINK_MTU) {
685-
pmtu = IPV6_MIN_LINK_MTU;
686-
}
687-
688656
/* Check for silly situation - can't fit any fragment data (8 for fragment
689657
* header, 8 for minimum fragment payload) */
690658
if (unfrag_len + 8 + 8 > pmtu) {

0 commit comments

Comments
 (0)