| 1736 | } |
| 1737 | |
| 1738 | static const struct sockaddr * |
| 1739 | getClientAddr(TSHttpTxn txnp, int txn_private_slot) |
| 1740 | { |
| 1741 | const struct sockaddr *addr = nullptr; |
| 1742 | int addr_len; |
| 1743 | |
| 1744 | PrivateSlotData private_data; |
| 1745 | private_data.raw = reinterpret_cast<uint64_t>(TSUserArgGet(txnp, txn_private_slot)); |
| 1746 | switch (private_data.ip_source) { |
| 1747 | case IP_SRC_PEER: |
| 1748 | addr = TSHttpTxnClientAddrGet(txnp); |
| 1749 | break; |
| 1750 | case IP_SRC_PROXY: |
| 1751 | TSVConnPPInfoGet(TSHttpSsnClientVConnGet(TSHttpTxnSsnGet(txnp)), TS_PP_INFO_SRC_ADDR, reinterpret_cast<const char **>(&addr), |
| 1752 | &addr_len); |
| 1753 | break; |
| 1754 | default: |
| 1755 | Dbg(pi_dbg_ctl, "Unknown IP source (%d) was specified", private_data.ip_source); |
| 1756 | addr = TSHttpTxnClientAddrGet(txnp); |
| 1757 | break; |
| 1758 | } |
| 1759 | return addr; |
| 1760 | } |
no test coverage detected