我试图使用IPv6原始套接字发送内容。出于某种原因,我需要IPv6流标签为空。 Linux似乎在未由用户设置时分配随机流标签。
我找到的是IPV6_FLOWLABEL_MGR
和IPV6_FLOWINFO_SEND
。通过将IPV6_FLOWLABEL_MGR
设置为true,我可以使用in6_flowlabel_req
和IPV6_FLOWINFO_SEND
自行分配标签。
但是,我找不到禁用自动分配行为的选项。我尝试手动将标签设置为0 - 但是当用户将标签设置为0时,Linux为其分配了一个新标签。
我错过了什么吗?
答案 0 :(得分:4)
请参阅sysctl:
/proc/sys/net/ipv6/auto_flowlabels - INTEGER
Automatically generate flow labels based on a flow hash of the
packet. This allows intermediate devices, such as routers, to
identify packet flows for mechanisms like Equal Cost Multipath
Routing (see RFC 6438).
0: automatic flow labels are completely disabled
1: automatic flow labels are enabled by default, they can be
disabled on a per socket basis using the IPV6_AUTOFLOWLABEL
socket option
2: automatic flow labels are allowed, they may be enabled on a
per socket basis using the IPV6_AUTOFLOWLABEL socket option
3: automatic flow labels are enabled and enforced, they cannot
be disabled by the socket option
Default: 1