From d311eea6bc5b2c88984cfc16340970ea1459b74a Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Sat, 11 Feb 2017 10:32:53 -0800 Subject: [PATCH] msg/simple/Pipe: support IPv6 QoS. Extend DSCP marking for heartbeat packets to IPv6, as commit 9b9a682fe035c985e416ee1c112fa58f9045a27c only implemented support for IPv4. Conflicts: Cherry-picked 91a29bc490fdfbbef0875fa620c7ba1a1a6492ae from master to avoid conflict. Backport: jewel, luminious Fixes: http://tracker.ceph.com/issues/18887 Signed-off-by: Robin H. Johnson (cherry picked from commit 2d6021fbf7a728f73c2998be17e9224f14b83a30) --- src/msg/simple/Pipe.cc | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/msg/simple/Pipe.cc b/src/msg/simple/Pipe.cc index 9fa567eb22483..0a8c78f92a110 100644 --- a/src/msg/simple/Pipe.cc +++ b/src/msg/simple/Pipe.cc @@ -857,11 +857,24 @@ void Pipe::set_socket_options() int r = -1; #ifdef IPTOS_CLASS_CS6 int iptos = IPTOS_CLASS_CS6; - r = ::setsockopt(sd, IPPROTO_IP, IP_TOS, &iptos, sizeof(iptos)); - if (r < 0) { + + if (peer_addr.get_family() == AF_INET) { + r = ::setsockopt(sd, IPPROTO_IP, IP_TOS, &iptos, sizeof(iptos)); r = -errno; - ldout(msgr->cct,0) << "couldn't set IP_TOS to " << iptos - << ": " << cpp_strerror(r) << dendl; + if (r < 0) { + ldout(msgr->cct,0) << "couldn't set IP_TOS to " << iptos + << ": " << cpp_strerror(r) << dendl; + } + } else if (peer_addr.get_family() == AF_INET6) { + r = ::setsockopt(sd, IPPROTO_IPV6, IPV6_TCLASS, &iptos, sizeof(iptos)); + r = -errno; + if (r < 0) { + ldout(msgr->cct,0) << "couldn't set IPV6_TCLASS to " << iptos + << ": " << cpp_strerror(r) << dendl; + } + } else { + ldout(msgr->cct,0) << "couldn't set ToS of unknown family to " << iptos + << dendl; } #endif #if defined(SO_PRIORITY) -- 2.39.5