[ Team LiB ] |
27.7 IPv6 Sticky OptionsWe have described the use of ancillary data with sendmsg and recvmsg to send and receive seven different ancillary data objects:
We summarized the cmsg_level and cmsg_type values for these objects, along with the values for the other ancillary data object in Figure 14.11. When the same value will be used for all packets sent on a socket, instead of sending these options in every call to sendmsg, we can set the corresponding socket options instead. The socket options use the same constants as the ancillary data, that is, the option level is always IPPROTO_IPV6 and the option name is IPV6_DSTOPTS, IPV6_HOPLIMIT, IPV6_HOPOPTS, IPV6_NEXTHOP, IPV6_PKTINFO, IPV6_RTHDR, or IPV6_TCLASS. But, these sticky options can be overridden on a per-packet basis for a UDP socket or for a raw IPv6 socket by specifying ancillary data in a call to sendmsg. If any ancillary data is specified in a call to sendmsg, the corresponding sticky options are not sent with that datagram. The concept of sticky options can also be used with TCP because ancillary data is never sent or received by sendmsg or recvmsg on a TCP socket. Instead, a TCP application can set the corresponding socket option and specify any of the seven option types mentioned at the beginning of this section. These objects then affect all packets sent on this socket. However, retransmission of packets that were originally sent when other (or no) sticky options were set may use either the original or the new sticky options. There is no way to retrieve options received via TCP since there is no relationship between received packets and user receive operations. |
[ Team LiB ] |