From 8f925fdc0cc31dcff64e42224be621b5591cb5d5 Mon Sep 17 00:00:00 2001 From: Walter Karas Date: Wed, 13 Oct 2021 19:31:13 -0500 Subject: [PATCH] Rename IpEndpoint member functions named port() to network_order_port(). --- include/tscore/ink_inet.h | 70 +++++++++++++++++----------------- iocore/net/P_NetVConnection.h | 2 +- iocore/net/ProxyProtocol.cc | 4 +- iocore/net/QUICNetProcessor.cc | 2 +- iocore/net/SSLCertLookup.cc | 4 +- iocore/net/UnixConnection.cc | 6 +-- iocore/net/UnixNetAccept.cc | 5 ++- iocore/net/UnixNetProcessor.cc | 2 +- iocore/net/UnixUDPNet.cc | 6 +-- iocore/net/quic/QUICTypes.cc | 4 +- iocore/net/quic/QUICTypes.h | 8 ++-- mgmt/LocalManager.cc | 4 +- proxy/http/HttpSM.cc | 2 +- proxy/http/HttpTransact.cc | 12 +++--- proxy/http/PreWarmManager.cc | 2 +- proxy/logging/LogAccess.cc | 8 ++-- src/traffic_server/InkAPI.cc | 4 +- 17 files changed, 75 insertions(+), 70 deletions(-) diff --git a/include/tscore/ink_inet.h b/include/tscore/ink_inet.h index 4885f3d2114..332fa03ed27 100644 --- a/include/tscore/ink_inet.h +++ b/include/tscore/ink_inet.h @@ -106,7 +106,7 @@ union IpEndpoint { ); /// Assign from an @a addr and @a port. self &assign(IpAddr const &addr, ///< Address and address family. - in_port_t port = 0 ///< Port (network order). + in_port_t port = 0 ///< Port (network byte order). ); /// Test for valid IP address. @@ -129,11 +129,11 @@ union IpEndpoint { self &setToLoopback(int family ///< Address family. ); - /// Port in network order. - in_port_t &port(); - /// Port in network order. - in_port_t port() const; - /// Port in host order. + /// Port in network byte order. + in_port_t &network_order_port(); + /// Port in network byte order. + in_port_t network_order_port() const; + /// Port in host byte order. in_port_t host_order_port() const; operator sockaddr *() { return &sa; } @@ -436,7 +436,7 @@ ats_ip_addr_size(IpEndpoint const *addr ///< Address object. } /** Get a reference to the port in an address. - @note Because this is direct access, the port value is in network order. + @note Because this is direct access, the port value is in network byte order. @see ats_ip_port_host_order. @return A reference to the port value in an IPv4 or IPv6 address. @internal This is primarily for internal use but it might be handy for @@ -468,7 +468,7 @@ ats_ip_port_cast(IpEndpoint *ip) If this is not an IPv4 address a zero valued address is returned. @note This is direct access to the address so it will be in - network order. + network byte order. @return A reference to the IPv4 address in @a addr. */ @@ -483,7 +483,7 @@ ats_ip4_addr_cast(sockaddr *addr) If this is not an IPv4 address a zero valued address is returned. @note This is direct access to the address so it will be in - network order. + network byte order. @return A reference to the IPv4 address in @a addr. */ @@ -498,7 +498,7 @@ ats_ip4_addr_cast(sockaddr const *addr) If this is not an IPv4 address a zero valued address is returned. @note This is direct access to the address so it will be in - network order. + network byte order. @note Convenience overload. @return A reference to the IPv4 address in @a addr. @@ -513,7 +513,7 @@ ats_ip4_addr_cast(IpEndpoint *ip) If this is not an IPv4 address a zero valued address is returned. @note This is direct access to the address so it will be in - network order. + network byte order. @note Convenience overload. @return A reference to the IPv4 address in @a addr. @@ -528,7 +528,7 @@ ats_ip4_addr_cast(IpEndpoint const *ip) If this is not an IPv6 address a zero valued address is returned. @note This is direct access to the address so it will be in - network order. + network byte order. @return A reference to the IPv6 address in @a addr. */ @@ -778,8 +778,8 @@ ats_ip_copy(sockaddr *dst, IpEndpoint const *src) Non-IP < IPv4 < IPv6 - all non-IP addresses are the same ( including @c AF_UNSPEC ) - - IPv4 addresses are compared numerically (host order) - - IPv6 addresses are compared byte wise in network order (MSB to LSB) + - IPv4 addresses are compared numerically (host byte order) + - IPv6 addresses are compared byte wise in network byte order (MSB to LSB) @return - -1 if @a lhs is less than @a rhs. @@ -886,7 +886,7 @@ ats_ip_addr_port_eq(sockaddr const *lhs, sockaddr const *rhs) //@} /// Get IP TCP/UDP port. -/// @return The port in host order for an IPv4 or IPv6 address, +/// @return The port in host byte order for an IPv4 or IPv6 address, /// or zero if neither. inline in_port_t ats_ip_port_host_order(sockaddr const *addr ///< Address with port. @@ -898,7 +898,7 @@ ats_ip_port_host_order(sockaddr const *addr ///< Address with port. } /// Get IP TCP/UDP port. -/// @return The port in host order for an IPv4 or IPv6 address, +/// @return The port in host byte order for an IPv4 or IPv6 address, /// or zero if neither. inline in_port_t ats_ip_port_host_order(IpEndpoint const *ip ///< Address with port. @@ -910,7 +910,7 @@ ats_ip_port_host_order(IpEndpoint const *ip ///< Address with port. } /** Extract the IPv4 address. - @return Host order IPv4 address. + @return Host byte order IPv4 address. */ inline in_addr_t ats_ip4_addr_host_order(sockaddr const *addr ///< Address object. @@ -922,8 +922,8 @@ ats_ip4_addr_host_order(sockaddr const *addr ///< Address object. /// Write IPv4 data to storage @a dst. inline sockaddr * ats_ip4_set(sockaddr_in *dst, ///< Destination storage. - in_addr_t addr, ///< address, IPv4 network order. - in_port_t port = 0 ///< port, network order. + in_addr_t addr, ///< address, IPv4 network byte order. + in_port_t port = 0 ///< port, network byte order. ) { ink_zero(*dst); @@ -941,8 +941,8 @@ ats_ip4_set(sockaddr_in *dst, ///< Destination storage. */ inline sockaddr * ats_ip4_set(IpEndpoint *dst, ///< Destination storage. - in_addr_t ip4, ///< address, IPv4 network order. - in_port_t port = 0 ///< port, network order. + in_addr_t ip4, ///< address, IPv4 network byte order. + in_port_t port = 0 ///< port, network byte order. ) { return ats_ip4_set(&dst->sin, ip4, port); @@ -955,8 +955,8 @@ ats_ip4_set(IpEndpoint *dst, ///< Destination storage. */ inline sockaddr * ats_ip4_set(sockaddr *dst, ///< Destination storage. - in_addr_t ip4, ///< address, IPv4 network order. - in_port_t port = 0 ///< port, network order. + in_addr_t ip4, ///< address, IPv4 network byte order. + in_port_t port = 0 ///< port, network byte order. ) { return ats_ip4_set(ats_ip4_cast(dst), ip4, port); @@ -966,8 +966,8 @@ ats_ip4_set(sockaddr *dst, ///< Destination storage. */ inline sockaddr * ats_ip6_set(sockaddr_in6 *dst, ///< Destination storage. - in6_addr const &addr, ///< address in network order. - in_port_t port = 0 ///< Port, network order. + in6_addr const &addr, ///< address in network byte order. + in_port_t port = 0 ///< Port, network byte order. ) { ink_zero(*dst); @@ -984,8 +984,8 @@ ats_ip6_set(sockaddr_in6 *dst, ///< Destination storage. */ inline sockaddr * ats_ip6_set(sockaddr *dst, ///< Destination storage. - in6_addr const &addr, ///< address in network order. - in_port_t port = 0 ///< Port, network order. + in6_addr const &addr, ///< address in network byte order. + in_port_t port = 0 ///< Port, network byte order. ) { return ats_ip6_set(ats_ip6_cast(dst), addr, port); @@ -995,8 +995,8 @@ ats_ip6_set(sockaddr *dst, ///< Destination storage. */ inline sockaddr * ats_ip6_set(IpEndpoint *dst, ///< Destination storage. - in6_addr const &addr, ///< address in network order. - in_port_t port = 0 ///< Port, network order. + in6_addr const &addr, ///< address in network byte order. + in_port_t port = 0 ///< Port, network byte order. ) { return ats_ip6_set(&dst->sin6, addr, port); @@ -1203,7 +1203,7 @@ struct IpAddr { return this->assign(&ip.sa); } /// Assign from IPv4 raw address. - /// @param ip Network order IPv4 address. + /// @param ip Network byte order IPv4 address. self &operator=(in_addr_t ip); /// Assign from IPv6 raw address. @@ -1263,7 +1263,7 @@ struct IpAddr { int cmp(self const &that) const; /** Return a normalized hash value. - - Ipv4: the address in host order. + - Ipv4: the address in host byte order. - Ipv6: folded 32 bit of the address. - Else: 0. */ @@ -1480,7 +1480,7 @@ IpAddr::hash() const /// @return @s dst. sockaddr *ats_ip_set(sockaddr *dst, ///< Destination storage. IpAddr const &addr, ///< source address. - in_port_t port = 0 ///< port, network order. + in_port_t port = 0 ///< port, network byte order. ); /** Convert @a text to an IP address and write it to @a addr. @@ -1512,13 +1512,13 @@ IpEndpoint::assign(sockaddr const *ip) } inline in_port_t & -IpEndpoint::port() +IpEndpoint::network_order_port() { return ats_ip_port_cast(&sa); } inline in_port_t -IpEndpoint::port() const +IpEndpoint::network_order_port() const { return ats_ip_port_cast(&sa); } @@ -1526,7 +1526,7 @@ IpEndpoint::port() const inline in_port_t IpEndpoint::host_order_port() const { - return ntohs(this->port()); + return ntohs(this->network_order_port()); } inline bool diff --git a/iocore/net/P_NetVConnection.h b/iocore/net/P_NetVConnection.h index 810fed9636a..b878eabcbbd 100644 --- a/iocore/net/P_NetVConnection.h +++ b/iocore/net/P_NetVConnection.h @@ -85,7 +85,7 @@ NetVConnection::get_proxy_protocol_addr(const ProxyProtocolData src_or_dst) cons { const IpEndpoint &addr = (src_or_dst == ProxyProtocolData::SRC ? pp_info.src_addr : pp_info.dst_addr); - if ((addr.isValid() && addr.port() != 0) || (ats_is_ip4(&addr) && INADDR_ANY != ats_ip4_addr_cast(&addr)) // IPv4 + if ((addr.isValid() && addr.network_order_port() != 0) || (ats_is_ip4(&addr) && INADDR_ANY != ats_ip4_addr_cast(&addr)) // IPv4 || (ats_is_ip6(&addr) && !IN6_IS_ADDR_UNSPECIFIED(&addr.sin6.sin6_addr))) { return &addr.sa; } diff --git a/iocore/net/ProxyProtocol.cc b/iocore/net/ProxyProtocol.cc index 9cf4c8ed1b3..0b993557c42 100644 --- a/iocore/net/ProxyProtocol.cc +++ b/iocore/net/ProxyProtocol.cc @@ -189,7 +189,7 @@ proxy_protocol_v1_parse(ProxyProtocol *pp_info, ts::TextView hdr) static_cast(token.size()), token.data()); return 0; } - pp_info->src_addr.port() = htons(src_port); + pp_info->src_addr.network_order_port() = htons(src_port); // Next is the TCP destination port represented as a decimal number in the range of [0..65535] inclusive. // Final trailer is CR LF so split at CR. @@ -205,7 +205,7 @@ proxy_protocol_v1_parse(ProxyProtocol *pp_info, ts::TextView hdr) static_cast(token.size()), token.data()); return 0; } - pp_info->dst_addr.port() = htons(dst_port); + pp_info->dst_addr.network_order_port() = htons(dst_port); pp_info->version = ProxyProtocolVersion::V1; diff --git a/iocore/net/QUICNetProcessor.cc b/iocore/net/QUICNetProcessor.cc index 5bdaa2b8dc7..a2af493fca2 100644 --- a/iocore/net/QUICNetProcessor.cc +++ b/iocore/net/QUICNetProcessor.cc @@ -209,7 +209,7 @@ QUICNetProcessor::main_accept(Continuation *cont, SOCKET fd, AcceptOptions const accept_ip.setToAnyAddr(opt.ip_family); } ink_assert(0 < opt.local_port && opt.local_port < 65536); - accept_ip.port() = htons(opt.local_port); + accept_ip.network_order_port() = htons(opt.local_port); na->accept_fn = net_accept; na->server.fd = fd; diff --git a/iocore/net/SSLCertLookup.cc b/iocore/net/SSLCertLookup.cc index 39b7205e522..f0a95132380 100644 --- a/iocore/net/SSLCertLookup.cc +++ b/iocore/net/SSLCertLookup.cc @@ -326,7 +326,7 @@ SSLCertLookup::find(const IpEndpoint &address) const } // If that failed, try the address without the port. - if (address.port()) { + if (address.network_order_port()) { key.split(); if ((cc = this->ec_storage->lookup(key.get()))) { return cc; @@ -343,7 +343,7 @@ SSLCertLookup::find(const IpEndpoint &address) const } // If that failed, try the address without the port. - if (address.port()) { + if (address.network_order_port()) { key.split(); return this->ssl_storage->lookup(key.get()); } diff --git a/iocore/net/UnixConnection.cc b/iocore/net/UnixConnection.cc index 99d1785d3da..a7b4ce05785 100644 --- a/iocore/net/UnixConnection.cc +++ b/iocore/net/UnixConnection.cc @@ -134,8 +134,8 @@ Connection::open(NetVCOptions const &opt) // No local address specified, so use family option if possible. family = ats_is_ip(opt.ip_family) ? opt.ip_family : AF_INET; local_addr.setToAnyAddr(family); - is_any_address = true; - local_addr.port() = htons(opt.local_port); + is_any_address = true; + local_addr.network_order_port() = htons(opt.local_port); } res = socketManager.socket(family, sock_type, 0); @@ -196,7 +196,7 @@ Connection::open(NetVCOptions const &opt) // apply dynamic options apply_options(opt); - if (local_addr.port() || !is_any_address) { + if (local_addr.network_order_port() || !is_any_address) { if (-1 == socketManager.ink_bind(fd, &local_addr.sa, ats_ip_size(&local_addr.sa))) { return -errno; } diff --git a/iocore/net/UnixNetAccept.cc b/iocore/net/UnixNetAccept.cc index 35e56600d81..d1ecc22d185 100644 --- a/iocore/net/UnixNetAccept.cc +++ b/iocore/net/UnixNetAccept.cc @@ -267,13 +267,14 @@ NetAccept::do_listen(bool non_blocking) if (server.fd != NO_FD) { if ((res = server.setup_fd_for_listen(non_blocking, opt))) { - Warning("unable to listen on main accept port %d: errno = %d, %s", ntohs(server.accept_addr.port()), errno, strerror(errno)); + Warning("unable to listen on main accept port %d: errno = %d, %s", server.accept_addr.host_order_port(), errno, + strerror(errno)); goto Lretry; } } else { Lretry: if ((res = server.listen(non_blocking, opt))) { - Warning("unable to listen on port %d: %d %d, %s", ntohs(server.accept_addr.port()), res, errno, strerror(errno)); + Warning("unable to listen on port %d: %d %d, %s", server.accept_addr.host_order_port(), res, errno, strerror(errno)); } } diff --git a/iocore/net/UnixNetProcessor.cc b/iocore/net/UnixNetProcessor.cc index ba5062d4efb..ac981d36918 100644 --- a/iocore/net/UnixNetProcessor.cc +++ b/iocore/net/UnixNetProcessor.cc @@ -120,7 +120,7 @@ UnixNetProcessor::accept_internal(Continuation *cont, int fd, AcceptOptions cons accept_ip.setToAnyAddr(opt.ip_family); } ink_assert(0 < opt.local_port && opt.local_port < 65536); - accept_ip.port() = htons(opt.local_port); + accept_ip.network_order_port() = htons(opt.local_port); na->accept_fn = net_accept; // All callers used this. na->server.fd = fd; diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc index dfa090db78d..fa782901e42 100644 --- a/iocore/net/UnixUDPNet.cc +++ b/iocore/net/UnixUDPNet.cc @@ -637,8 +637,8 @@ UDPNetProcessor::CreateUDPSocket(int *resfd, sockaddr const *remote_addr, Action // No local address specified, so use family option if possible. int family = ats_is_ip(opt.ip_family) ? opt.ip_family : AF_INET; local_addr.setToAnyAddr(family); - is_any_address = true; - local_addr.port() = htons(opt.local_port); + is_any_address = true; + local_addr.network_order_port() = htons(opt.local_port); } *resfd = -1; @@ -698,7 +698,7 @@ UDPNetProcessor::CreateUDPSocket(int *resfd, sockaddr const *remote_addr, Action } } - if (local_addr.port() || !is_any_address) { + if (local_addr.network_order_port() || !is_any_address) { if (-1 == socketManager.ink_bind(fd, &local_addr.sa, ats_ip_size(&local_addr.sa))) { char buff[INET6_ADDRPORTSTRLEN]; Debug("udpnet", "ink bind failed on %s", ats_ip_nptop(local_addr, buff, sizeof(buff))); diff --git a/iocore/net/quic/QUICTypes.cc b/iocore/net/quic/QUICTypes.cc index 3b7d5865d4d..18ee6d9237c 100644 --- a/iocore/net/quic/QUICTypes.cc +++ b/iocore/net/quic/QUICTypes.cc @@ -570,7 +570,7 @@ QUICPreferredAddress::store(uint8_t *buf, uint16_t &len) const QUICFiveTuple::QUICFiveTuple(IpEndpoint src, IpEndpoint dst, int protocol) : _source(src), _destination(dst), _protocol(protocol) { // FIXME Generate a hash code - this->_hash_code = src.port() + dst.port() + protocol; + this->_hash_code = src.network_order_port() + dst.network_order_port() + protocol; } void QUICFiveTuple::update(IpEndpoint src, IpEndpoint dst, int protocol) @@ -580,7 +580,7 @@ QUICFiveTuple::update(IpEndpoint src, IpEndpoint dst, int protocol) this->_protocol = protocol; // FIXME Generate a hash code - this->_hash_code = src.port() + dst.port() + protocol; + this->_hash_code = src.network_order_port() + dst.network_order_port() + protocol; } IpEndpoint diff --git a/iocore/net/quic/QUICTypes.h b/iocore/net/quic/QUICTypes.h index 8b1ac9b351c..78af5ea7c89 100644 --- a/iocore/net/quic/QUICTypes.h +++ b/iocore/net/quic/QUICTypes.h @@ -468,11 +468,13 @@ class QUICPath inline bool operator==(const QUICPath &x) const { - if ((this->_local_ep.port() != 0 && x._local_ep.port() != 0) && this->_local_ep.port() != x._local_ep.port()) { + if ((this->_local_ep.network_order_port() != 0 && x._local_ep.network_order_port() != 0) && + this->_local_ep.network_order_port() != x._local_ep.network_order_port()) { return false; } - if ((this->_remote_ep.port() != 0 && x._remote_ep.port() != 0) && this->_remote_ep.port() != x._remote_ep.port()) { + if ((this->_remote_ep.network_order_port() != 0 && x._remote_ep.network_order_port() != 0) && + this->_remote_ep.network_order_port() != x._remote_ep.network_order_port()) { return false; } @@ -498,7 +500,7 @@ class QUICPathHasher std::size_t operator()(const QUICPath &k) const { - return k.remote_ep().port(); + return k.remote_ep().network_order_port(); } }; diff --git a/mgmt/LocalManager.cc b/mgmt/LocalManager.cc index 5f55df39027..9a1a0d2f4b8 100644 --- a/mgmt/LocalManager.cc +++ b/mgmt/LocalManager.cc @@ -1012,7 +1012,7 @@ LocalManager::bindUdpProxyPort(HttpProxyPort &port) } else { mgmt_fatal(0, "[bindProxyPort] Proxy port with invalid address type %d\n", port.m_family); } - ip.port() = htons(port.m_port); + ip.network_order_port() = htons(port.m_port); if (bind(port.m_fd, &ip.sa, ats_ip_size(&ip)) < 0) { mgmt_fatal(0, "[bindProxyPort] Unable to bind socket: %d : %s\n", port.m_port, strerror(errno)); } @@ -1107,7 +1107,7 @@ LocalManager::bindTcpProxyPort(HttpProxyPort &port) } else { mgmt_fatal(0, "[bindProxyPort] Proxy port with invalid address type %d\n", port.m_family); } - ip.port() = htons(port.m_port); + ip.network_order_port() = htons(port.m_port); if (bind(port.m_fd, &ip.sa, ats_ip_size(&ip)) < 0) { mgmt_fatal(0, "[bindProxyPort] Unable to bind socket: %d : %s\n", port.m_port, strerror(errno)); } diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 51da3377015..1cc299f754f 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -5032,7 +5032,7 @@ HttpSM::do_http_server_open(bool raw) t_state.req_flavor == HttpTransact::REQ_FLAVOR_REVPROXY); ink_assert(pending_action.is_empty()); - ink_assert(t_state.current.server->dst_addr.port() != 0); + ink_assert(t_state.current.server->dst_addr.network_order_port() != 0); char addrbuf[INET6_ADDRPORTSTRLEN]; SMDebug("http", "[%" PRId64 "] open connection to %s: %s", sm_id, t_state.current.server->name, diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index a7866cc79d9..b717cf966d8 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -1709,8 +1709,8 @@ HttpTransact::setup_plugin_request_intercept(State *s) s->server_info.http_version = HTTP_1_0; s->server_info.keep_alive = HTTP_NO_KEEPALIVE; s->host_db_info.app.http_data.http_version = HTTP_1_0; - s->server_info.dst_addr.setToAnyAddr(AF_INET); // must set an address or we can't set the port. - s->server_info.dst_addr.port() = htons(s->hdr_info.client_request.port_get()); // this is the info that matters. + s->server_info.dst_addr.setToAnyAddr(AF_INET); // must set an address or we can't set the port. + s->server_info.dst_addr.network_order_port() = htons(s->hdr_info.client_request.port_get()); // this is the info that matters. // Build the request to the server build_request(s, &s->hdr_info.client_request, &s->hdr_info.server_request, s->client_info.http_version); @@ -1832,7 +1832,7 @@ HttpTransact::PPDNSLookup(State *s) } else { // lookup succeeded, open connection to p.p. ats_ip_copy(&s->parent_info.dst_addr, s->host_db_info.ip()); - s->parent_info.dst_addr.port() = htons(s->parent_result.port); + s->parent_info.dst_addr.network_order_port() = htons(s->parent_result.port); get_ka_info_from_host_db(s, &s->parent_info, &s->client_info, &s->host_db_info); char addrbuf[INET6_ADDRSTRLEN]; @@ -1892,7 +1892,7 @@ HttpTransact::ReDNSRoundRobin(State *s) ink_assert(s->current.server->dst_addr.isValid() && 0 != server_port); ats_ip_copy(&s->server_info.dst_addr, s->host_db_info.ip()); - s->server_info.dst_addr.port() = htons(server_port); + s->server_info.dst_addr.network_order_port() = htons(server_port); ats_ip_copy(&s->request_data.dest_ip, &s->server_info.dst_addr); get_ka_info_from_host_db(s, &s->server_info, &s->client_info, &s->host_db_info); @@ -2014,9 +2014,9 @@ HttpTransact::OSDNSLookup(State *s) ats_ip_copy(&s->server_info.dst_addr, s->host_db_info.ip()); // If the SRV response has a port number, we should honor it. Otherwise we do the port defined in remap if (s->dns_info.srv_lookup_success) { - s->server_info.dst_addr.port() = htons(s->dns_info.srv_port); + s->server_info.dst_addr.network_order_port() = htons(s->dns_info.srv_port); } else if (!s->api_server_addr_set) { - s->server_info.dst_addr.port() = htons(s->hdr_info.client_request.port_get()); // now we can set the port. + s->server_info.dst_addr.network_order_port() = htons(s->hdr_info.client_request.port_get()); // now we can set the port. } ats_ip_copy(&s->request_data.dest_ip, &s->server_info.dst_addr); get_ka_info_from_host_db(s, &s->server_info, &s->client_info, &s->host_db_info); diff --git a/proxy/http/PreWarmManager.cc b/proxy/http/PreWarmManager.cc index 3a878d7c44e..50427a83e0a 100644 --- a/proxy/http/PreWarmManager.cc +++ b/proxy/http/PreWarmManager.cc @@ -281,7 +281,7 @@ PreWarmSM::state_dns_lookup(int event, void *data) IpEndpoint addr; ats_ip_copy(addr, info->ip()); - addr.port() = htons(_dst->port); + addr.network_order_port() = htons(_dst->port); if (is_debug_tag_set("v_prewarm_sm")) { char addrbuf[INET6_ADDRPORTSTRLEN]; diff --git a/proxy/logging/LogAccess.cc b/proxy/logging/LogAccess.cc index da82c04ced3..a370f18439f 100644 --- a/proxy/logging/LogAccess.cc +++ b/proxy/logging/LogAccess.cc @@ -1395,7 +1395,7 @@ int LogAccess::marshal_client_host_port(char *buf) { if (buf) { - uint16_t port = ntohs(m_http_sm->t_state.client_info.src_addr.port()); + uint16_t port = m_http_sm->t_state.client_info.src_addr.host_order_port(); marshal_int(buf, port); } return INK_MIN_ALIGN; @@ -2274,7 +2274,8 @@ int LogAccess::marshal_proxy_req_server_port(char *buf) { if (buf) { - uint16_t port = ntohs(m_http_sm->t_state.current.server != nullptr ? m_http_sm->t_state.current.server->src_addr.port() : 0); + uint16_t port = + m_http_sm->t_state.current.server != nullptr ? m_http_sm->t_state.current.server->src_addr.host_order_port() : 0; marshal_int(buf, port); } return INK_MIN_ALIGN; @@ -2290,7 +2291,8 @@ int LogAccess::marshal_next_hop_port(char *buf) { if (buf) { - uint16_t port = ntohs(m_http_sm->t_state.current.server != nullptr ? m_http_sm->t_state.current.server->dst_addr.port() : 0); + uint16_t port = + m_http_sm->t_state.current.server != nullptr ? m_http_sm->t_state.current.server->dst_addr.host_order_port() : 0; marshal_int(buf, port); } return INK_MIN_ALIGN; diff --git a/src/traffic_server/InkAPI.cc b/src/traffic_server/InkAPI.cc index 21f711c82d1..f63512c374a 100644 --- a/src/traffic_server/InkAPI.cc +++ b/src/traffic_server/InkAPI.cc @@ -5925,8 +5925,8 @@ TSHttpTxnClientIncomingPortSet(TSHttpTxn txnp, int port) { sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS); - HttpSM *sm = reinterpret_cast(txnp); - sm->t_state.client_info.dst_addr.port() = htons(port); + HttpSM *sm = reinterpret_cast(txnp); + sm->t_state.client_info.dst_addr.network_order_port() = htons(port); } // [amc] This might use the port. The code path should do that but it