You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2021/11/08 18:47:12 UTC

[trafficserver] branch 9.2.x updated: Fix SSLAddressLookup Test (#8436)

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.2.x by this push:
     new b0f8557  Fix SSLAddressLookup Test (#8436)
b0f8557 is described below

commit b0f8557bafa84fabbc6fa71c4e5429ebb22f32fe
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Fri Oct 22 08:15:24 2021 +0900

    Fix SSLAddressLookup Test (#8436)
    
    (cherry picked from commit c92cef82a835390776069463316959773d23fd39)
---
 iocore/net/test_certlookup.cc | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/iocore/net/test_certlookup.cc b/iocore/net/test_certlookup.cc
index 4344ad8..0ffb580 100644
--- a/iocore/net/test_certlookup.cc
+++ b/iocore/net/test_certlookup.cc
@@ -25,15 +25,6 @@
 #include "tscore/TestBox.h"
 #include <fstream>
 
-static IpEndpoint
-make_endpoint(const char *address)
-{
-  IpEndpoint ip;
-
-  assert(ats_ip_pton(address, &ip) == 0);
-  return ip;
-}
-
 REGRESSION_TEST(SSLCertificateLookup)(RegressionTest *t, int /* atype ATS_UNUSED */, int *pstatus)
 {
   TestBox box(t, pstatus);
@@ -127,16 +118,21 @@ REGRESSION_TEST(SSLAddressLookup)(RegressionTest *t, int /* atype ATS_UNUSED */,
   SSLCertContext ip4_cc(context.ip4);
   SSLCertContext ip4p_cc(context.ip4p);
 
-  endpoint.ip6  = make_endpoint("fe80::7ed1:c3ff:fe90:2582");
-  endpoint.ip6p = make_endpoint("[fe80::7ed1:c3ff:fe90:2582]:80");
-  endpoint.ip4  = make_endpoint("10.0.0.5");
-  endpoint.ip4p = make_endpoint("10.0.0.5:80");
+  ats_ip_pton("fe80::7ed1:c3ff:fe90:2582", &endpoint.ip6);
+  ats_ip_pton("[fe80::7ed1:c3ff:fe90:2582]:80", &endpoint.ip6p);
+  ats_ip_pton("10.0.0.5", &endpoint.ip4);
+  ats_ip_pton("10.0.0.5:80", &endpoint.ip4p);
 
   box = REGRESSION_TEST_PASSED;
 
   // For each combination of address with port and address without port, make sure that we find the
   // the most specific match (ie. find the context with the port if it is available) ...
 
+  box.check(endpoint.ip6.isValid(), "Invalid IpEndpoint");
+  box.check(endpoint.ip6p.isValid(), "Invalid IpEndpoint");
+  box.check(endpoint.ip4.isValid(), "Invalid IpEndpoint");
+  box.check(endpoint.ip4p.isValid(), "Invalid IpEndpoint");
+
   box.check(lookup.insert(endpoint.ip6, ip6_cc) >= 0, "insert IPv6 address");
   box.check(lookup.find(endpoint.ip6)->getCtx().get() == context.ip6, "IPv6 exact match lookup");
   box.check(lookup.find(endpoint.ip6p)->getCtx().get() == context.ip6, "IPv6 exact match lookup w/ port");