  QT_BEGIN_NAMESPACE
  
  #if defined QNATIVESOCKETENGINE_DEBUG
-@@ -223,20 +227,24 @@
+@@ -177,20 +181,24 @@ static void convertToLevelAndOption(QNativeSocketEngine::SocketOption opt,
          n = SO_KEEPALIVE;
          break;
      case QNativeSocketEngine::MulticastTtlOption:
 +#ifdef QT_HAS_IPV6
-         if (socketProtocol == QAbstractSocket::IPv6Protocol) {
+         if (socketProtocol == QAbstractSocket::IPv6Protocol || socketProtocol == QAbstractSocket::AnyIPProtocol) {
              level = IPPROTO_IPV6;
              n = IPV6_MULTICAST_HOPS;
          } else

 QNetworkInterface QNativeSocketEnginePrivate::nativeMulticastInterface() const
 {
+#ifdef QT_HAS_IPV6
     if (socketProtocol == QAbstractSocket::IPv6Protocol) {
         uint v;
         QT_SOCKOPTLEN_T sizeofv = sizeof(v);
@@ -756,6 +777,7 @@
             return QNetworkInterface();
         return QNetworkInterface::interfaceFromIndex(v);
     }

         break;
     case QNativeSocketEngine::MulticastLoopbackOption:
+#ifdef QT_HAS_IPV6
         if (socketProtocol == QAbstractSocket::IPv6Protocol || socketProtocol == QAbstractSocket::AnyIPProtocol) {
             level = IPPROTO_IPV6;
             n = IPV6_MULTICAST_LOOP;
         } else
