Uploaded image for project: 'Traffic Server'
  1. Traffic Server
  2. TS-4574

Let TSHttpTxnServerAddrSet clear the address

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 7.1.0
    • Component/s: TS API
    • Labels:
      None

      Description

      After using TSHttpTxnServerAddrSet to route requests to a specific destination, you might change your mind and decide to allow an internal DNS lookup.

      I propose that we allow TSHttpTxnServerAddrSet to take a NULL argument to clear and API DNS result that was previously set.

      diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
      index 5772c12..362bf32 100644
      --- a/proxy/InkAPI.cc
      +++ b/proxy/InkAPI.cc
      @@ -5336,6 +5336,13 @@ TSHttpTxnServerAddrSet(TSHttpTxn txnp, struct sockaddr const *addr)
         sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
      
         HttpSM *sm = reinterpret_cast<HttpSM *>(txnp);
      +
      +  if (addr == NULL) {
      +    sm->t_state.api_server_addr_set = false;
      +    sm->t_state.server_info.dst_addr.setToAnyAddr(AF_INET);
      +    return TS_SUCCESS;
      +  }
      +
         if (ats_ip_copy(&sm->t_state.server_info.dst_addr.sa, addr)) {
           sm->t_state.api_server_addr_set = true;
           return TS_SUCCESS;
      

        Attachments

          Activity

            People

            • Assignee:
              jamespeach James Peach
              Reporter:
              jamespeach James Peach
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: