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);