trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject [trafficserver] branch master updated: ink_inet: Fix family string printing, add IpAddr::isAnyAddr.
Date Wed, 20 Feb 2019 17:09:23 GMT
This is an automated email from the ASF dual-hosted git repository.

amc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 03cfef1  ink_inet: Fix family string printing, add IpAddr::isAnyAddr.
03cfef1 is described below

commit 03cfef14f3d3bcb165879464287dca4a6360a063
Author: Alan M. Carroll <amc@apache.org>
AuthorDate: Fri Feb 15 09:43:08 2019 -0600

    ink_inet: Fix family string printing, add IpAddr::isAnyAddr.
---
 include/tscore/ink_inet.h | 9 +++++++++
 src/tscore/ink_inet.cc    | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/tscore/ink_inet.h b/include/tscore/ink_inet.h
index b72aefa..364d6be 100644
--- a/include/tscore/ink_inet.h
+++ b/include/tscore/ink_inet.h
@@ -1282,6 +1282,9 @@ struct IpAddr {
   /// Test for loopback
   bool isLoopback() const;
 
+  /// Test for any addr
+  bool isAnyAddr() const;
+
   uint16_t _family; ///< Protocol family.
   /// Address data.
   union {
@@ -1341,6 +1344,12 @@ IpAddr::isLoopback() const
   return (AF_INET == _family && 0x7F == _addr._byte[0]) || (AF_INET6 == _family &&
IN6_IS_ADDR_LOOPBACK(&_addr._ip6));
 }
 
+inline bool
+IpAddr::isAnyAddr() const
+{
+  return (AF_INET == _family && INADDR_ANY == _addr._ip4) || (AF_INET6 == _family
&& IN6_IS_ADDR_UNSPECIFIED(&_addr._ip6));
+}
+
 /// Assign sockaddr storage.
 inline IpAddr &
 IpAddr::assign(sockaddr const *addr)
diff --git a/src/tscore/ink_inet.cc b/src/tscore/ink_inet.cc
index c52c316..3f276c4 100644
--- a/src/tscore/ink_inet.cc
+++ b/src/tscore/ink_inet.cc
@@ -841,7 +841,7 @@ bwformat(BufferWriter &w, BWFSpec const &spec, IpAddr const &addr)
     if (spec.has_numeric_type()) {
       bwformat(w, local_spec, static_cast<uintmax_t>(addr.family()));
     } else {
-      bwformat(w, local_spec, addr.family());
+      bwformat(w, local_spec, ats_ip_family_name(addr.family()));
     }
   }
   return w;


Mime
View raw message