Skip to content

Commit cf23d5d

Browse files
authored
Only run IPv6 tests if the loopback device itself supports IPv6
1 parent c7b4801 commit cf23d5d

File tree

15 files changed

+477
-68
lines changed

15 files changed

+477
-68
lines changed

examples/m_ntcu02/ntcu02.m.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void execute()
6363
{
6464
// Only run this example on machines assigned an IPv6 address.
6565

66-
if (!ntsf::System::supportsIpv6()) {
66+
if (!ntsf::System::supportsIpv6Loopback()) {
6767
return;
6868
}
6969

examples/m_ntcu11/ntcu11.m.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,7 +1693,7 @@ void execute()
16931693
{
16941694
// Only run this example on machines assigned an IPv6 address.
16951695

1696-
if (!ntsf::System::supportsIpv6()) {
1696+
if (!ntsf::System::supportsIpv6Loopback()) {
16971697
return;
16981698
}
16991699

@@ -1834,7 +1834,7 @@ void execute()
18341834
{
18351835
// Only run this example on machines assigned an IPv6 address.
18361836

1837-
if (!ntsf::System::supportsIpv6()) {
1837+
if (!ntsf::System::supportsIpv6Loopback()) {
18381838
return;
18391839
}
18401840

examples/m_ntsu02/ntsu02.m.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ int main()
2929

3030
// Only run this example on machines assigned an IPv6 address.
3131

32-
if (!ntsf::System::supportsIpv6()) {
32+
if (!ntsf::System::supportsIpv6Loopback()) {
3333
return 0;
3434
}
3535

examples/m_ntsu05/ntsu05.m.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ int main()
2828

2929
// Only run this example on machines assigned an IPv6 address.
3030

31-
if (!ntsf::System::supportsIpv6()) {
31+
if (!ntsf::System::supportsIpv6Loopback()) {
3232
return 0;
3333
}
3434

groups/ntc/ntcf/ntcf_system.t.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6440,7 +6440,7 @@ void SystemTest::concernDataExchange(
64406440
#else
64416441
addressFamilyList.push_back(test::TransferParameters::e_IPV4);
64426442
{
6443-
if (ntsu::AdapterUtil::supportsIpv6()) {
6443+
if (ntsu::AdapterUtil::supportsIpv6Loopback()) {
64446444
addressFamilyList.push_back(test::TransferParameters::e_IPV6);
64456445
}
64466446
}

groups/ntc/ntcp/ntcp_interface.t.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ NTSCFG_TEST_FUNCTION(ntcp::InterfaceTest::verifyCase2)
326326
}
327327
#endif
328328

329-
BSLS_LOG_INFO("Testing driver (%s) (%s)",
329+
BSLS_LOG_DEBUG("Testing driver (%s) (%s)",
330330
(dynamicLoadBalancing ? "dynamic" : "static"),
331331
(dynamicThreadCount ? "resizable" : "fixed"));
332332

groups/ntc/ntcr/ntcr_interface.t.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ NTSCFG_TEST_FUNCTION(ntcr::InterfaceTest::verifyCase2)
324324
}
325325
#endif
326326

327-
BSLS_LOG_INFO("Testing driver (%s) (%s)",
327+
BSLS_LOG_DEBUG("Testing driver (%s) (%s)",
328328
(dynamicLoadBalancing ? "dynamic" : "static"),
329329
(dynamicThreadCount ? "resizable" : "fixed"));
330330

groups/nts/ntsf/ntsf_system.cpp

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,6 +1311,16 @@ bool System::supportsIpv4()
13111311
return ntsu::AdapterUtil::supportsIpv4();
13121312
}
13131313

1314+
bool System::supportsIpv4Loopback()
1315+
{
1316+
ntsa::Error error;
1317+
1318+
error = ntsf::System::initialize();
1319+
BSLS_ASSERT_OPT(!error);
1320+
1321+
return ntsu::AdapterUtil::supportsIpv4Loopback();
1322+
}
1323+
13141324
bool System::supportsIpv4Multicast()
13151325
{
13161326
ntsa::Error error;
@@ -1321,6 +1331,16 @@ bool System::supportsIpv4Multicast()
13211331
return ntsu::AdapterUtil::supportsIpv4Multicast();
13221332
}
13231333

1334+
bool System::supportsIpv4MulticastLoopback()
1335+
{
1336+
ntsa::Error error;
1337+
1338+
error = ntsf::System::initialize();
1339+
BSLS_ASSERT_OPT(!error);
1340+
1341+
return ntsu::AdapterUtil::supportsIpv4MulticastLoopback();
1342+
}
1343+
13241344
bool System::supportsIpv6()
13251345
{
13261346
ntsa::Error error;
@@ -1331,6 +1351,16 @@ bool System::supportsIpv6()
13311351
return ntsu::AdapterUtil::supportsIpv6();
13321352
}
13331353

1354+
bool System::supportsIpv6Loopback()
1355+
{
1356+
ntsa::Error error;
1357+
1358+
error = ntsf::System::initialize();
1359+
BSLS_ASSERT_OPT(!error);
1360+
1361+
return ntsu::AdapterUtil::supportsIpv6Loopback();
1362+
}
1363+
13341364
bool System::supportsIpv6Multicast()
13351365
{
13361366
ntsa::Error error;
@@ -1341,6 +1371,16 @@ bool System::supportsIpv6Multicast()
13411371
return ntsu::AdapterUtil::supportsIpv6Multicast();
13421372
}
13431373

1374+
bool System::supportsIpv6MulticastLoopback()
1375+
{
1376+
ntsa::Error error;
1377+
1378+
error = ntsf::System::initialize();
1379+
BSLS_ASSERT_OPT(!error);
1380+
1381+
return ntsu::AdapterUtil::supportsIpv6MulticastLoopback();
1382+
}
1383+
13441384
bool System::supportsTcp()
13451385
{
13461386
ntsa::Error error;
@@ -1351,6 +1391,16 @@ bool System::supportsTcp()
13511391
return ntsu::AdapterUtil::supportsTcp();
13521392
}
13531393

1394+
bool System::supportsTcpLoopback()
1395+
{
1396+
ntsa::Error error;
1397+
1398+
error = ntsf::System::initialize();
1399+
BSLS_ASSERT_OPT(!error);
1400+
1401+
return ntsu::AdapterUtil::supportsTcpLoopback();
1402+
}
1403+
13541404
bool System::supportsUdp()
13551405
{
13561406
ntsa::Error error;
@@ -1361,6 +1411,16 @@ bool System::supportsUdp()
13611411
return ntsu::AdapterUtil::supportsUdp();
13621412
}
13631413

1414+
bool System::supportsUdpLoopback()
1415+
{
1416+
ntsa::Error error;
1417+
1418+
error = ntsf::System::initialize();
1419+
BSLS_ASSERT_OPT(!error);
1420+
1421+
return ntsu::AdapterUtil::supportsUdpLoopback();
1422+
}
1423+
13641424
bool System::supportsLocalStream()
13651425
{
13661426
ntsa::Error error;
@@ -1391,6 +1451,16 @@ bool System::supportsTransport(ntsa::Transport::Value transport)
13911451
return ntsu::AdapterUtil::supportsTransport(transport);
13921452
}
13931453

1454+
bool System::supportsTransportLoopback(ntsa::Transport::Value transport)
1455+
{
1456+
ntsa::Error error;
1457+
1458+
error = ntsf::System::initialize();
1459+
BSLS_ASSERT_OPT(!error);
1460+
1461+
return ntsu::AdapterUtil::supportsTransportLoopback(transport);
1462+
}
1463+
13941464
ntsa::Error System::loadTcpCongestionControlAlgorithmSupport(
13951465
bsl::vector<bsl::string>* result)
13961466
{

groups/nts/ntsf/ntsf_system.h

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,27 +1551,55 @@ struct System {
15511551
/// function when possible.
15521552
static bool supportsIpv4();
15531553

1554+
/// Return true if the current machine has its loopback adapter assigned an
1555+
/// IPv4 address, otherwise return false. Note that this function loads
1556+
/// descriptions of all network adapters currently available on the
1557+
/// system, which may be expensive; prefer to cache the results of this
1558+
/// function when possible.
1559+
static bool supportsIpv4Loopback();
1560+
15541561
/// Return true if the current machine has any adapter assigned an
15551562
/// IPv4 address that supports multicast, otherwise return false. Note
15561563
/// that this function loads descriptions of all network adapters
15571564
/// currently available on the system, which may be expensive; prefer to
15581565
/// cache the results of this function when possible.
15591566
static bool supportsIpv4Multicast();
15601567

1568+
/// Return true if the current machine has its loopback adapter assigned an
1569+
/// IPv4 address that supports multicast, otherwise return false. Note
1570+
/// that this function loads descriptions of all network adapters
1571+
/// currently available on the system, which may be expensive; prefer to
1572+
/// cache the results of this function when possible.
1573+
static bool supportsIpv4MulticastLoopback();
1574+
15611575
/// Return true if the current machine has any adapter assigned an
15621576
/// IPv6 address, otherwise return false. Note that this function loads
15631577
/// descriptions of all network adapters currently available on the
15641578
/// system, which may be expensive; prefer to cache the results of this
15651579
/// function when possible.
15661580
static bool supportsIpv6();
15671581

1582+
/// Return true if the current machine has its loopback adapter assigned an
1583+
/// IPv6 address, otherwise return false. Note that this function loads
1584+
/// descriptions of all network adapters currently available on the
1585+
/// system, which may be expensive; prefer to cache the results of this
1586+
/// function when possible.
1587+
static bool supportsIpv6Loopback();
1588+
15681589
/// Return true if the current machine has any adapter assigned an
15691590
/// IPv6 address that supports multicast, otherwise return false. Note
15701591
/// that this function loads descriptions of all network adapters
15711592
/// currently available on the system, which may be expensive; prefer to
15721593
/// cache the results of this function when possible.
15731594
static bool supportsIpv6Multicast();
15741595

1596+
/// Return true if the current machine has its loopback adapter assigned an
1597+
/// IPv6 address that supports multicast, otherwise return false. Note
1598+
/// that this function loads descriptions of all network adapters
1599+
/// currently available on the system, which may be expensive; prefer to
1600+
/// cache the results of this function when possible.
1601+
static bool supportsIpv6MulticastLoopback();
1602+
15751603
/// Return true if the current machine has any adapter assigned to
15761604
/// either an IPv4 or IPv6 address that supports the Transport Control
15771605
/// Protocol (TCP), otherwise return false. Note that this function
@@ -1580,6 +1608,14 @@ struct System {
15801608
/// this function when possible.
15811609
static bool supportsTcp();
15821610

1611+
/// Return true if the current machine has its loopback adapter assigned to
1612+
/// either an IPv4 or IPv6 address that supports the Transport Control
1613+
/// Protocol (TCP), otherwise return false. Note that this function
1614+
/// loads descriptions of all network adapters currently available on
1615+
/// the system, which may be expensive; prefer to cache the results of
1616+
/// this function when possible.
1617+
static bool supportsTcpLoopback();
1618+
15831619
/// Return true if the current machine has any adapter assigned to
15841620
/// either an IPv4 or IPv6 address that supports the User Datagram
15851621
/// Protocol (UDP), otherwise return false. Note that this function
@@ -1588,6 +1624,14 @@ struct System {
15881624
/// this function when possible.
15891625
static bool supportsUdp();
15901626

1627+
/// Return true if the current machine has its loopback adapter assigned to
1628+
/// either an IPv4 or IPv6 address that supports the User Datagram
1629+
/// Protocol (UDP), otherwise return false. Note that this function
1630+
/// loads descriptions of all network adapters currently available on
1631+
/// the system, which may be expensive; prefer to cache the results of
1632+
/// this function when possible.
1633+
static bool supportsUdpLoopback();
1634+
15911635
/// Return true if the current machine supports local (a.k.a Unix)
15921636
/// domain stream sockets, otherwise return false.
15931637
static bool supportsLocalStream();
@@ -1596,13 +1640,20 @@ struct System {
15961640
/// domain datagram sockets, otherwise return false.
15971641
static bool supportsLocalDatagram();
15981642

1599-
/// Return true if the current machine supports the specified
1600-
/// 'transport', otherwise return false. Note that this function loads
1601-
/// descriptions of all network adapters currently available on the
1643+
/// Return true if the current machine has any adapter that supports the
1644+
/// specified 'transport', otherwise return false. Note that this function
1645+
/// loads descriptions of all network adapters currently available on the
16021646
/// system, which may be expensive; prefer to cache the results of this
16031647
/// function when possible.
16041648
static bool supportsTransport(ntsa::Transport::Value transport);
16051649

1650+
/// Return true if the current machine has a loopback adapter that supports
1651+
/// the specified 'transport', otherwise return false. Note that this
1652+
/// function loads descriptions of all network adapters currently available
1653+
/// on the system, which may be expensive; prefer to cache the results of
1654+
/// this function when possible.
1655+
static bool supportsTransportLoopback(ntsa::Transport::Value transport);
1656+
16061657
/// Load into the specified `result` names of tcp congestion control
16071658
/// algorithms available for the process. Return the error.
16081659
static ntsa::Error loadTcpCongestionControlAlgorithmSupport(

groups/nts/ntsf/ntsf_system.t.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -643,15 +643,17 @@ NTSCFG_TEST_FUNCTION(ntsf::SystemTest::verifyCase6)
643643
&supportedAlgorithms);
644644

645645
#if defined(BSLS_PLATFORM_OS_LINUX)
646-
NTSCFG_TEST_OK(error);
647-
648-
for (bsl::vector<bsl::string>::const_iterator it =
649-
supportedAlgorithms.cbegin();
650-
it != supportedAlgorithms.cend();
651-
++it)
652-
{
653-
NTSCFG_TEST_TRUE(
654-
ntsf::System::testTcpCongestionControlAlgorithmSupport(*it));
646+
if (error != ntsa::Error(ntsa::Error::e_EOF)) {
647+
NTSCFG_TEST_OK(error);
648+
649+
for (bsl::vector<bsl::string>::const_iterator it =
650+
supportedAlgorithms.cbegin();
651+
it != supportedAlgorithms.cend();
652+
++it)
653+
{
654+
NTSCFG_TEST_TRUE(
655+
ntsf::System::testTcpCongestionControlAlgorithmSupport(*it));
656+
}
655657
}
656658
#else
657659
NTSCFG_TEST_ERROR(error, ntsa::Error::e_NOT_IMPLEMENTED);

0 commit comments

Comments
 (0)