推荐内核版本
linux-4.19.155
下载地址:https://download.csdn.net/download/superbfly/14521687
REFERENCE
RFC 8200 - IPv6 Specification
测试流程
TN:测试设备
NUT:被测设备
TN分别发送分片包1和分片包2到NUT,其中分片包1没有包含原始报文全部ip头。NUT设备应该丢弃两个分片报文,并回复ICMPv6 error报文给TN。
判断标准
TN收到icmp parameter problem(code=3,pointer=0)报文即为通过。
解决方法
标准解决方法:修改内核,检查第一个分片报文中的各个报头,当最后一个报头不是上层报头如icmp、udp、等或no next header时,给TN节点反馈一个icmp parameter problem(code=3,pointer=0)。
取巧的方法:观察测试设备发出的测试报文都是一个分片都带一个其它头标识的简单报文。所以可以对分片报文进行判断,对next header不为tcp(6),udp(17),icmp(58)和no next header(59)的分片报文直接回复icmp parameter problem(code=3,pointer=0)消息。
ipv6头部类型与对应值表:
内核代码修改
修改文件:net/ipv6/ip6_input.c
修改函数:ip6_input_finish
/* 当preNextHdr(后面会有赋值,标识当前next header的前一个next header)为44,
* 并且当前nexthdr的值不等于6(tcp)、17(udp)、58(icmp)、59(no next header)时,
* 发送ICMPV6_PARAMPROB消息,其中code=3,pointer=0。
*/
if ( 44 == preNextHdr && (6 != nexthdr && 17 != nexthdr && 58 != nexthdr && 59 != nexthdr) )
{
icmpv6_send(skb, ICMPV6_PARAMPROB, 3, 0);
}
ret = ipprot->handler(skb);
if (ret > 0) {
if (ipprot->flags & INET6_PROTO_FINAL) {
/* Not an extension header, most likely UDP
* encapsulation. Use return value as nexthdr
* protocol not nhoff (which presumably is
* not set by handler).
*/
nexthdr = ret;
goto resubmit_final;
} else {
// 将当前next header赋值给preNextHdr
preNextHdr = nexthdr;
goto resubmit;
}
} else if (ret == 0) {
__IP6_INC_STATS(net, idev, IPSTATS_MIB_INDELIVERS);
}