What was the motivation for adding the IPV6_V6ONLY flag?

前端 未结 7 1377
攒了一身酷
攒了一身酷 2021-02-07 00:39

In IPv6 networking, the IPV6_V6ONLY flag is used to ensure that a socket will only use IPv6, and in particular that IPv4-to-IPv6 mapping won\'t be used for that socket. On many

7条回答
  •  野性不改
    2021-02-07 00:57

    The reason most often mentioned is for the case where the server has some form of ACL (Access Control List). For instance, imagine a server with rules like:

    Allow 192.0.2.4
    Deny all
    

    It runs on IPv4. Now, someone runs it on a machine with IPv6 and, depending on some parameters, IPv4 requests are accepted on the IPv6 socket, mapped as ::192.0.2.4 and then no longer matched by the first ACL. Suddenly, access would be denied.

    Being explicit in your application (using IPV6_V6ONLY) would solve the problem, whatever default the operating system has.

提交回复
热议问题