trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject [trafficserver] 05/05: ink_inet: Add UNIX socket family suport.
Date Tue, 19 Jun 2018 16:44:34 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit ad13c2f95813ad6f3432330acca199b20107ca36
Author: Alan M. Carroll <amc@apache.org>
AuthorDate: Thu Jun 7 17:05:34 2018 -0500

    ink_inet: Add UNIX socket family suport.
    
    (cherry picked from commit bc1e91d3ca447dddc647b1ee3a6f4011effdfb0b)
---
 lib/ts/ink_inet.cc | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/lib/ts/ink_inet.cc b/lib/ts/ink_inet.cc
index 4b02280..ec4d7dc 100644
--- a/lib/ts/ink_inet.cc
+++ b/lib/ts/ink_inet.cc
@@ -51,6 +51,8 @@ const std::string_view IP_PROTO_TAG_HTTP_1_0("http/1.0"sv);
 const std::string_view IP_PROTO_TAG_HTTP_1_1("http/1.1"sv);
 const std::string_view IP_PROTO_TAG_HTTP_2_0("h2"sv); // HTTP/2 over TLS
 
+const std::string_view UNIX_PROTO_TAG{"unix"sv};
+
 uint32_t
 ink_inet_addr(const char *s)
 {
@@ -147,7 +149,18 @@ ats_ip_ntop(const struct sockaddr *addr, char *dst, size_t size)
 std::string_view
 ats_ip_family_name(int family)
 {
-  return AF_INET == family ? IP_PROTO_TAG_IPV4 : AF_INET6 == family ? IP_PROTO_TAG_IPV6 :
"Unspec"sv;
+  switch (family) {
+  case AF_INET:
+    return IP_PROTO_TAG_IPV4;
+  case AF_INET6:
+    return IP_PROTO_TAG_IPV6;
+  case AF_UNIX:
+    return UNIX_PROTO_TAG;
+  case AF_UNSPEC:
+    return "unspec"sv;
+  default:
+    return "unknown"sv;
+  }
 }
 
 const char *


Mime
View raw message