c - Linux C IPv6 原始套接字 - 告诉套接字不要分配流标签

标签 c linux sockets ipv6

我试图使用 IPv6 原始套接字发送一些内容。由于某种原因,我需要 IPv6 流标签为空。当用户未设置时,Linux 似乎会分配随机流标签。

我发现的是IPV6_FLOWLABEL_MGRIPV6_FLOWINFO_SEND。通过将 IPV6_FLOWINFO_SEND 设置为 true,我可以使用 IPV6_FLOWLABEL_MGRin6_flowlabel_req 自行分配标签。

但是,我找不到禁用自动分配行为的选项。我尝试手动将标签设置为 0 - 但当用户将标签设置为 0 时,Linux 为其分配了一个新标签。

我错过了什么吗?

最佳答案

请参阅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

关于c - Linux C IPv6 原始套接字 - 告诉套接字不要分配流标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48310068/

相关文章:

javascript - Socket.io - 将数据从推送流发送到客户端

python - python 字符串实际上在硬件级别上是不可变的吗?

linux - 原始套接字与 TUN 设备

javascript - 我可以在不使用外部服务的情况下在 Chrome 应用程序中获取我的 IP 地址吗?

linux - Dose 域中的附加点是有效域

c++ - Qt5 静态链接在 Ubuntu Linux 上失败

python - 从 python 启动和停止外部进程

c++ - 数字 xor K - K = 数字 + K xor K,为什么?

c++ - 将文本光标移动到特定的屏幕坐标?

c++ - 使用结构体指针显示一维数组