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

Do some cleanup on Connection::fast_connect and Connection::bind_connect




      Action Plan:

      Unify bind_connect, fast_connect.

      1. Split out the binding of the target address in to a new method
      Connection::bind_target(target_ip, target_port);

      This simply copies to the target IP address and port to Connection::sa. As far as I can tell this is the only thing the calls to bind_connection from IPC.cc do. We can then change those calls to direct calls to bind_target. Then we should be able to eliminate all the bool flags on bind_connect which aren't used elsewhere.

      2. Remove the my_ip argument from bind_connect. Use spoof_ip in NetVCOptions instead. At this point the signatures for fast_connect and bind_connect are now identical.

      3. Add support for the IP_TRANSPARENT sock opt provided by TPROXY in to NetVCOptions, either as a separate flag or (better) merged in to NetVCOptions::sockopt_flags. This would mean that spoof_ip is treated as a local address (i.e., an address already assigned to an interface on the local system) if not set, or as an arbitrary address requiring TPROXY support if set. If we conditionally define the mask as IP_TRANSPARENT or 0 depending on TPROXY availability we should be able to limit conditional compilation to that location (as the check will always fail if IP_TRANSPARENT is not available).

      4. Move SO_REUSEADDR to NetVCOptions::sockopt_flags. This is set in bind_connect but not fast_connect.

      5. Put an TCP vs. UDP flag in NetVCOptions. This would follow from the code, but as far as I can tell this is never used. It is passed in from the ICP logic but, because that also sets the "no bind" flag, it doesn't get invoked. It may be that bind_connect should just be implicitly TCP.

      6. Verify that NetVCOptions default constructed values are such that bind_connect with a default constructed NetVCOptions does the same thing that fast_connect does.

      7. Add an option (in the signature or in NetVCOptions) to handle the epoll support. AFAICT this is done in all cases where either fast_connect or bind_connect is called other than IPC (which we have already removed) so we could hard wire it. Comments in the code indicated this is already considered a problem.

      After all of this, we can replace all invocations of fast_connect with bind_connect with no change in functionality.

      Note: This is in preparation for working on TS-291.


        1. ts-320-patch.txt
          44 kB
          Alan M. Carroll

        Issue Links



              amc Alan M. Carroll
              amc Alan M. Carroll
              0 Vote for this issue
              1 Start watching this issue



                Time Tracking

                  Original Estimate - 168h
                  Remaining Estimate - 168h
                  Time Spent - Not Specified
                  Not Specified