8. Path MTU/DF 处理
对 outbound packet 应用 AH 或 ESP 会增大 packet size, 因而可能导致 packet 超过其将要经过的 SA 的 PMTU. IPsec implementation 也可能收到 unprotected ICMP PMTU message, 如果它选择根据该 message 行动, 结果会影响 outbound traffic processing. 本节描述 IPsec implementation 处理这两个 PMTU 问题所需的处理过程.
8.1. DF Bit
当 traffic 通过 tunnel mode SA 承载时, 所有 IPsec implementation MUST 支持将 DF bit 从 outbound packet 复制到其发出的 tunnel mode header 的选项. 这意味着 MUST 能够为每个 SA 配置实现对 DF bit 的处理方式 (set, clear, copy from inner header). 这适用于 inner 和 outer header 均为 IPv4 的 SA.
8.2. Path MTU (PMTU) Discovery
本节讨论 IPsec 对 unprotected Path MTU Discovery message 的处理. 这里使用 ICMP PMTU 指代如下 ICMP message:
IPv4 (RFC 792 [Pos81b]):
- Type = 3 (Destination Unreachable)
- Code = 4 (Fragmentation needed and DF set)
- Next-Hop MTU in the low-order 16 bits of the second word of the ICMP header (labeled "unused" in RFC 792), with high-order 16 bits set to zero
IPv6 (RFC 2463 [CD98]):
- Type = 2 (Packet Too Big)
- Code = 0 (Fragmentation needed)
- Next-Hop MTU in the 32-bit MTU field of the ICMP6 message
8.2.1. Propagation of PMTU
当 IPsec implementation 收到 unauthenticated PMTU message, 且被配置为处理 (而不是忽略) 此类 message 时, 它会将该 message 映射到对应 SA. 此映射通过从 PMTU message 的 payload 中提取 header 信息并应用 第 5.2 节 所述过程来实现. 该 message 确定的 PMTU 用于更新 SAD PMTU field, 同时考虑将要应用的 AH 或 ESP header 大小, 任何 crypto synchronization data, 以及在 tunnel mode SA 情况下额外 IP header 施加的开销.
在 native host implementation 中, 可以以与 unprotected communication 相同的粒度维护 PMTU data, 因而不会损失功能. PMTU 信息的 signaling 在 host 内部完成. 对于所有其他 IPsec implementation 选项, PMTU data 必须通过合成的 ICMP PMTU 传播. 在这些情况下, IPsec implementation SHOULD 等待 outbound traffic 被映射到 SAD entry. 当此类 traffic 到达时, 如果该 traffic 将超过更新后的 PMTU value, 则 MUST 按如下方式处理:
Case 1: 原始 (cleartext) packet 是 IPv4 且设置了 DF bit. 实现 SHOULD 丢弃该 packet 并发送 PMTU ICMP message.
Case 2: 原始 (cleartext) packet 是 IPv4 且 DF bit 清除. 实现 SHOULD 根据其配置进行 fragment (encryption 之前或之后), 然后转发 fragment. 它 SHOULD NOT 发送 PMTU ICMP message.
Case 3: 原始 (cleartext) packet 是 IPv6. 实现 SHOULD 丢弃该 packet 并发送 PMTU ICMP message.
8.2.2. PMTU Aging
在所有 IPsec implementation 中, 与 SA 关联的 PMTU MUST 被 "aged", 且需要某种机制及时更新 PMTU, 尤其是用于发现 PMTU 是否小于当前网络条件所需值. 给定 PMTU 必须保持足够长时间, 使 packet 能从 SA source 到达 peer, 并在当前 PMTU 过大时传播 ICMP error message.
实现 SHOULD 使用 Path MTU Discovery 文档 (RFC 1191 [MD90], 第 6.3 节) 中描述的方法, 该方法建议定期将 PMTU 重置为 first-hop data-link MTU, 然后让正常 PMTU Discovery 过程按需更新 PMTU. 周期 SHOULD 可配置.
相关小节: