0
对于某些请求,我一直在模拟OVS中的“路由器公告”,因为我构建了一个除校验和之外的所有字段都正确的ICMPv6 pkt,wireshark在校验和部分给出了一个错误。OVS:如何计算ICMPV6校验和?
ICMP6校验和应包括src + dst + icmp_length + next_header
但下面的代码计算不正确。 我错过了什么吗?感谢帮助的人。
struct nd_router_advert *ra;
struct ofpbuf *ra_rsp;
struct ovs_16aligned_ip6_hdr *nh;
.
.
.
.
.
ofpbuf_set_l3(ra_rsp, nh);
nh->ip6_vfc = 0x60;
nh->ip6_plen = htons(sizeof(*ra));
nh->ip6_nxt = IPPROTO_ICMPV6;
.
.
ofpbuf_set_l4(ra_rsp, ra);
ra->nd_ra_type = ND_ROUTER_ADVERT;
ra->nd_ra_code = 0;
ra->nd_ra_cksum = htons(0);
ra->nd_ra_curhoplimit = 255;
ra->nd_ra_flags_reserved = 0;
ra->nd_ra_router_lifetime = htons(9000);
ra->nd_ra_reachable = htons(0);
ra->nd_ra_retransmit = htons(0);
packet_set_ipv6(ra_rsp, IPPROTO_ICMPV6, src, dst, 0, 0, 212);
ra->nd_ra_cksum = recalc_csum16(ra->nd_ra_cksum, 0, htons(sizeof(*ra)));
ra->nd_ra_cksum = recalc_csum32(ra->nd_ra_cksum, 0, IPPROTO_ICMPV6);