xxx-separate-streams-by-port.txt 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. Filename: xxx-separate-streams-by-port.txt
  2. Title: Separate streams across circuits by destination port
  3. Author: Robert Hogan
  4. Created: 21-Oct-2008
  5. Status: Draft
  6. Here's a patch Robert Hogan wrote to use only one destination port per
  7. circuit. It's based on a wishlist item Roger wrote, to never send AIM
  8. usernames over the same circuit that we're hoping to browse anonymously
  9. through. The remaining open question is: how many extra circuits does this
  10. cause an ordinary user to create? My guess is not very many, but I'm wary
  11. of putting this in until we have some better estimate. On the other hand,
  12. not putting it in means that we have a known security flaw. Hm.
  13. Index: src/or/or.h
  14. ===================================================================
  15. --- src/or/or.h (revision 17143)
  16. +++ src/or/or.h (working copy)
  17. @@ -1874,6 +1874,7 @@
  18. uint8_t state; /**< Current status of this circuit. */
  19. uint8_t purpose; /**< Why are we creating this circuit? */
  20. + uint16_t service; /**< Port conn must have to use this circuit. */
  21. /** How many relay data cells can we package (read from edge streams)
  22. * on this circuit before we receive a circuit-level sendme cell asking
  23. Index: src/or/circuituse.c
  24. ===================================================================
  25. --- src/or/circuituse.c (revision 17143)
  26. +++ src/or/circuituse.c (working copy)
  27. @@ -62,10 +62,16 @@
  28. return 0;
  29. }
  30. - if (purpose == CIRCUIT_PURPOSE_C_GENERAL)
  31. + if (purpose == CIRCUIT_PURPOSE_C_GENERAL) {
  32. if (circ->timestamp_dirty &&
  33. circ->timestamp_dirty+get_options()->MaxCircuitDirtiness <= now)
  34. return 0;
  35. + /* If the circuit is dirty and used for services on another port,
  36. + then it is not suitable. */
  37. + if (circ->service && conn->socks_request->port &&
  38. + (circ->service != conn->socks_request->port))
  39. + return 0;
  40. + }
  41. /* decide if this circ is suitable for this conn */
  42. @@ -1351,7 +1357,9 @@
  43. if (connection_ap_handshake_send_resolve(conn) < 0)
  44. return -1;
  45. }
  46. -
  47. + if (conn->socks_request->port
  48. + && (TO_CIRCUIT(circ)->purpose == CIRCUIT_PURPOSE_C_GENERAL))
  49. + TO_CIRCUIT(circ)->service = conn->socks_request->port;
  50. return 1;
  51. }