summaryrefslogtreecommitdiffstats
path: root/tests/auto/network/kernel/qhostaddress
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2014-12-24 14:07:31 -0200
committerThiago Macieira <thiago.macieira@intel.com>2015-03-06 07:53:50 +0000
commitc64d27a9f7e33c9d8748e98e3c3a41ff1ce79729 (patch)
tree3cb759387caa690ae8a97c20c09da46ae8fcab9e /tests/auto/network/kernel/qhostaddress
parentf6e6ef46b382e1a7f827afc5f70ce6e5deaa7e86 (diff)
QHostAddress: Revert auto-converting of IPv6 v4-mapped addresses to IPv4
In 85136496bc8517951dcc3e670d1a46d340819f0d, Shane made QHostAddress automatically convert any IPv6 address that was v4-mapped to IPv4 in QHostAddress. While that is an interesting trick, it prevents us from being specific about what we want. On some OS (like FreeBSD and OS X), the distinction is relevant, so keep it. Moreover, it was inconsistent: it might fail depending on how the QHostAddress was constructed and the order of comparison. [ChangeLog][Important Behavior Changes] QHostAddress will no longer convert IPv6 addresses of type "v4-mapped" to IPv4. To perform this conversion manually, construct another QHostAddress with the result of toIPv4Address(). Change-Id: I06afbc7018539804bb3044ef1fe6a49ac7a5f240 Reviewed-by: Richard J. Moore <rich@kde.org>
Diffstat (limited to 'tests/auto/network/kernel/qhostaddress')
-rw-r--r--tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp
index 49a030aaaa..60b96d38b7 100644
--- a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp
+++ b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp
@@ -313,6 +313,10 @@ void tst_QHostAddress::compare_data()
QTest::newRow("5") << QHostAddress(QHostAddress::LocalHost) << QHostAddress(QHostAddress::Broadcast) << false;
QTest::newRow("6") << QHostAddress(QHostAddress::LocalHost) << QHostAddress(QHostAddress::LocalHostIPv6) << false;
QTest::newRow("7") << QHostAddress() << QHostAddress(QHostAddress::LocalHostIPv6) << false;
+
+ Q_IPV6ADDR localhostv4mapped = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 127, 0, 0, 1 };
+ QTest::newRow("v4-v4mapped") << QHostAddress(QHostAddress::LocalHost) << QHostAddress("::ffff:127.0.0.1") << false;
+ QTest::newRow("v4-v4mapped-2") << QHostAddress(QHostAddress::LocalHost) << QHostAddress(localhostv4mapped) << false;
}
void tst_QHostAddress::compare()
@@ -322,6 +326,7 @@ void tst_QHostAddress::compare()
QFETCH(bool, result);
QCOMPARE(first == second, result);
+ QCOMPARE(second == first, result);
if (result == true)
QVERIFY(qHash(first) == qHash(second));
}