cukiernik commented on a change in pull request #7821:
URL: https://github.com/apache/trafficserver/pull/7821#discussion_r632809727
##########
File path: src/tscore/ink_inet.cc
##########
@@ -463,6 +463,27 @@ IpAddr::toString(char *dest, size_t len) const
return dest;
}
+sockaddr *
+IpAddr::toSockAddr(sockaddr *dest) const
+{
+ if (AF_INET == _family) {
+ dest->sa_family = AF_INET;
+ ats_ip4_addr_cast(dest) = _addr._ip4;
+#if HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
+ dest->sin_len = sizeof(sockaddr_in);
+#endif
+ } else if (AF_INET6 == _family) {
+ dest->sa_family = AF_INET6;
+ ats_ip6_addr_cast(dest) = _addr._ip6;
+#if HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
+ dest->sin6_len = sizeof(sockaddr_in6);
+#endif
+ } else {
+ dest->sa_family = AF_UNSPEC;
Review comment:
maybe return nullptr, as a fail indicator?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]