The inet6 family is comprised of the IPv6 network protocol, Internet Control Message Protocol version 6
(ICMPv6), Transmission Control Protocol (TCP), and User Datagram Protocol (UDP). TCP is used to support
the SOCK_STREAM abstraction while UDP is used to support the SOCK_DGRAM abstraction. Note that TCP and
UDP are common to inet(4) and inet6. A raw interface to IPv6 is available by creating an Internet socket
of type SOCK_RAW. The ICMPv6 message protocol is accessible from a raw socket.
MIBVariables
A number of variables are implemented in the net.inet6 branch of the sysctl(3) MIB. In addition to the
variables supported by the transport protocols (for which the respective manual pages may be consulted),
the following general variables are defined:
IPV6CTL_FORWARDING (ip6.forwarding) Boolean: enable/disable forwarding of IPv6 packets. Also,
identify if the node is acting as a router. Defaults to off.
IPV6CTL_SENDREDIRECTS (ip6.redirect) Boolean: enable/disable sending of ICMPv6 redirects in response to
unforwardable IPv6 packets. This option is ignored unless the node is routing
IPv6 packets, and should normally be enabled on all systems. Defaults to on.
IPV6CTL_DEFHLIM (ip6.hlim) Integer: default hop limit value to use for outgoing IPv6 packets.
This value applies to all the transport protocols on top of IPv6. There are APIs
to override the value.
IPV6CTL_MAXFRAGS (ip6.maxfrags) Integer: maximum number of fragments the host will accept and
simultaneously hold across all reassembly queues in all VNETs. If set to 0,
fragment reassembly is disabled. If set to -1, this limit is not applied. This
limit is recalculated when the number of mbuf clusters is changed. This is a
global limit.
IPV6CTL_MAXFRAGPACKETS (ip6.maxfragpackets) Integer: maximum number of fragmented packets the node will
accept and simultaneously hold in the reassembly queue for a particular VNET. 0
means that the node will not accept any fragmented packets for that VNET. -1
means that the node will not apply this limit for that VNET. This limit is
recalculated when the number of mbuf clusters is changed. This is a per-VNET
limit.
IPV6CTL_MAXFRAGBUCKETSIZE
(ip6.maxfragbucketsize) Integer: maximum number of reassembly queues per bucket.
Fragmented packets are hashed to buckets. Each bucket has a list of reassembly
queues. The system must compare the incoming packets to the existing reassembly
queues in the bucket to find a matching reassembly queue. To preserve system
resources, the system limits the number of reassembly queues allowed in each
bucket. This limit is recalculated when the number of mbuf clusters is changed
or when the value of ip6.maxfragpackets changes. This is a per-VNET limit.
IPV6CTL_MAXFRAGSPERPACKET
(ip6.maxfragsperpacket) Integer: maximum number of fragments the host will accept
and hold in the ressembly queue for a packet. This is a per-VNET limit.
IPV6CTL_ACCEPT_RTADV (ip6.accept_rtadv) Boolean: the default value of a per-interface flag to
enable/disable receiving of ICMPv6 router advertisement packets, and
autoconfiguration of address prefixes and default routers. The node must be a
host (not a router) for the option to be meaningful. Defaults to off.
IPV6CTL_AUTO_LINKLOCAL (ip6.auto_linklocal) Boolean: the default value of a per-interface flag to
enable/disable performing automatic link-local address configuration. Defaults
to on.
IPV6CTL_LOG_INTERVAL (ip6.log_interval) Integer: default interval between IPv6 packet forwarding
engine log output (in seconds).
IPV6CTL_HDRNESTLIMIT (ip6.hdrnestlimit) Integer: default number of the maximum IPv6 extension headers
permitted on incoming IPv6 packets. If set to 0, the node will accept as many
extension headers as possible.
IPV6CTL_DAD_COUNT (ip6.dad_count) Integer: default number of IPv6 DAD (duplicated address
detection) probe packets. The packets will be generated when IPv6 interface
addresses are configured.
IPV6CTL_AUTO_FLOWLABEL (ip6.auto_flowlabel) Boolean: enable/disable automatic filling of IPv6 flowlabel
field, for outstanding connected transport protocol packets. The field might be
used by intermediate routers to identify packet flows. Defaults to on.
IPV6CTL_DEFMCASTHLIM (ip6.defmcasthlim) Integer: default hop limit value for an IPv6 multicast packet
sourced by the node. This value applies to all the transport protocols on top of
IPv6. There are APIs to override the value as documented in ip6(4).
IPV6CTL_GIF_HLIM (ip6.gifhlim) Integer: default maximum hop limit value for an IPv6 packet
generated by gif(4) tunnel interface.
IPV6CTL_KAME_VERSION (ip6.kame_version) String: identifies the version of KAME IPv6 stack implemented
in the kernel.
IPV6CTL_USE_DEPRECATED (ip6.use_deprecated) Boolean: enable/disable use of deprecated address, specified
in RFC2462 5.5.4. Defaults to on.
IPV6CTL_RR_PRUNE (ip6.rr_prune) Integer: default interval between IPv6 router renumbering prefix
babysitting, in seconds.
IPV6CTL_V6ONLY (ip6.v6only) Boolean: enable/disable the prohibited use of IPv4 mapped address on
AF_INET6 sockets. Defaults to on.
InteractionbetweenIPv4/v6sockets
By default, FreeBSD does not route IPv4 traffic to AF_INET6 sockets. The default behavior intentionally
violates RFC2553 for security reasons. Listen to two sockets if you want to accept both IPv4 and IPv6
traffic. IPv4 traffic may be routed with certain per-socket/per-node configuration, however, it is not
recommended to do so. Consult ip6(4) for details.
The behavior of AF_INET6 TCP/UDP socket is documented in RFC2553. Basically, it says this:
• A specific bind on an AF_INET6 socket (bind(2) with an address specified) should accept IPv6 traffic
to that address only.
• If you perform a wildcard bind on an AF_INET6 socket (bind(2) to IPv6 address ::), and there is no
wildcard bind AF_INET socket on that TCP/UDP port, IPv6 traffic as well as IPv4 traffic should be
routed to that AF_INET6 socket. IPv4 traffic should be seen as if it came from an IPv6 address like
::ffff:10.1.1.1. This is called an IPv4 mapped address.
• If there are both a wildcard bind AF_INET socket and a wildcard bind AF_INET6 socket on one TCP/UDP
port, they should behave separately. IPv4 traffic should be routed to the AF_INET socket and IPv6
should be routed to the AF_INET6 socket.
However, RFC2553 does not define the ordering constraint between calls to bind(2), nor how IPv4 TCP/UDP
port numbers and IPv6 TCP/UDP port numbers relate to each other (should they be integrated or separated).
Implemented behavior is very different from kernel to kernel. Therefore, it is unwise to rely too much
upon the behavior of AF_INET6 wildcard bind sockets. It is recommended to listen to two sockets, one for
AF_INET and another for AF_INET6, when you would like to accept both IPv4 and IPv6 traffic.
It should also be noted that malicious parties can take advantage of the complexity presented above, and
are able to bypass access control, if the target node routes IPv4 traffic to AF_INET6 socket. Users are
advised to take care handling connections from IPv4 mapped address to AF_INET6 sockets.