]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/simple/Pipe: support IPv6 QoS.
authorRobin H. Johnson <robin.johnson@dreamhost.com>
Sat, 11 Feb 2017 18:32:53 +0000 (10:32 -0800)
committerRobin H. Johnson <robin.johnson@dreamhost.com>
Wed, 12 Apr 2017 17:10:50 +0000 (10:10 -0700)
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 <robin.johnson@dreamhost.com>
(cherry picked from commit 2d6021fbf7a728f73c2998be17e9224f14b83a30)

src/msg/simple/Pipe.cc

index 9fa567eb22483af2e1c9fb96ac9ee0bb84b89a8f..0a8c78f92a110b9817bf980a7d1e50232d186dcb 100644 (file)
@@ -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)