mirror of
https://github.com/nmap/nmap.git
synced 2026-01-26 16:19:03 +00:00
Fix bugs in ip6_pack_hdr so that the traffic class and flow label are
set correctly. 1. Shift the low-order bits of fc by 20 bits, not 28, because fl is a 20-bit field. 2. Use a mask in host byte order to mask fl, which is also provided in host byte order. 3. Swap | and & in combining fc and fl.
This commit is contained in:
@@ -164,8 +164,8 @@ struct ip6_ext_hdr {
|
||||
|
||||
#define ip6_pack_hdr(hdr, fc, fl, plen, nxt, hlim, src, dst) do { \
|
||||
struct ip6_hdr *ip6 = (struct ip6_hdr *)(hdr); \
|
||||
ip6->ip6_flow = htonl(((uint32_t)(fc) << 28) & \
|
||||
(IP6_FLOWLABEL_MASK | (fl))); \
|
||||
ip6->ip6_flow = htonl(((uint32_t)(fc) << 20) | \
|
||||
(0x000fffff & (fl))); \
|
||||
ip6->ip6_vfc = (IP6_VERSION | ((fc) >> 4)); \
|
||||
ip6->ip6_plen = htons((plen)); \
|
||||
ip6->ip6_nxt = (nxt); ip6->ip6_hlim = (hlim); \
|
||||
|
||||
Reference in New Issue
Block a user