Loading src/app/main/shutdown.c +2 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include "core/or/circuitlist.h" #include "core/or/circuitmux_ewma.h" #include "core/or/circuitpadding.h" #include "core/or/conflux_pool.h" #include "core/or/connection_edge.h" #include "core/or/dos.h" #include "core/or/scheduler.h" Loading Loading @@ -120,6 +121,7 @@ tor_free_all(int postfork) rep_hist_free_all(); bwhist_free_all(); circuit_free_all(); conflux_pool_free_all(); circpad_machines_free(); entry_guards_free_all(); pt_free_all(); Loading src/app/main/subsystem_list.c +2 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ #include "lib/cc/torint.h" #include "core/mainloop/mainloop_sys.h" #include "core/or/conflux_sys.h" #include "core/or/dos_sys.h" #include "core/or/or_sys.h" #include "feature/control/btrack_sys.h" Loading Loading @@ -64,6 +65,7 @@ const subsys_fns_t *tor_subsystems[] = { &sys_process, &sys_mainloop, &sys_conflux, &sys_or, &sys_dos, Loading src/core/or/circuit_st.h +8 −0 Original line number Diff line number Diff line Loading @@ -261,6 +261,14 @@ struct circuit_t { * CIRCUIT_PURPOSE_CONFLUX_UNLINKED. */ struct conflux_t *conflux; /** If set, this circuit is considered *unlinked* and in the pending pool. * The nonce value is used to find the other legs. Origin circuits that * have this set are in the CIRCUIT_PURPOSE_CONFLUX_UNLINKED purpose. * * If this is NULL, and conflux object is set, it means this circuit is * linked and thus part of a usable set. */ uint8_t *conflux_pending_nonce; }; #endif /* !defined(CIRCUIT_ST_H) */ src/core/or/circuitbuild.c +45 −0 Original line number Diff line number Diff line Loading @@ -465,6 +465,8 @@ origin_circuit_init(uint8_t purpose, int flags) ((flags & CIRCLAUNCH_IS_INTERNAL) ? 1 : 0); circ->build_state->is_ipv6_selftest = ((flags & CIRCLAUNCH_IS_IPV6_SELFTEST) ? 1 : 0); circ->build_state->need_conflux = ((flags & CIRCLAUNCH_NEED_CONFLUX) ? 1 : 0); circ->base_.purpose = purpose; return circ; } Loading Loading @@ -507,6 +509,47 @@ circuit_establish_circuit(uint8_t purpose, extend_info_t *exit_ei, int flags) return circ; } /** * Build a new conflux circuit for <b>purpose</b>. If <b>exit</b> is defined, * then use that as your exit router, else choose a suitable exit node. * The <b>flags</b> argument is a bitfield of CIRCLAUNCH_* flags, see * circuit_launch_by_extend_info() for more details. * * Also launch a connection to the first OR in the chosen path, if * it's not open already. */ MOCK_IMPL(origin_circuit_t *, circuit_establish_circuit_conflux,(const uint8_t *conflux_nonce, uint8_t purpose, extend_info_t *exit_ei, int flags)) { origin_circuit_t *circ; int err_reason = 0; /* Right now, only conflux client circuits use this function */ tor_assert(purpose == CIRCUIT_PURPOSE_CONFLUX_UNLINKED); circ = origin_circuit_init(purpose, flags); TO_CIRCUIT(circ)->conflux_pending_nonce = tor_memdup(conflux_nonce, DIGEST256_LEN); if (onion_pick_cpath_exit(circ, exit_ei, 0) < 0 || onion_populate_cpath(circ) < 0) { circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_NOPATH); return NULL; } circuit_event_status(circ, CIRC_EVENT_LAUNCHED, 0); if ((err_reason = circuit_handle_first_hop(circ)) < 0) { circuit_mark_for_close(TO_CIRCUIT(circ), -err_reason); return NULL; } tor_trace(TR_SUBSYS(circuit), TR_EV(establish), circ); return circ; } /** Return the guard state associated with <b>circ</b>, which may be NULL. */ circuit_guard_state_t * origin_circuit_get_guard_state(origin_circuit_t *circ) Loading Loading @@ -2105,6 +2148,8 @@ onion_pick_cpath_exit(origin_circuit_t *circ, extend_info_t *exit_ei, flags |= CRN_DIRECT_CONN; if (is_hs_v3_rp_circuit) flags |= CRN_RENDEZVOUS_V3; if (state->need_conflux) flags |= CRN_CONFLUX; const node_t *node = choose_good_exit_server(circ, flags, state->is_internal); if (!node) { Loading src/core/or/circuitbuild.h +6 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,12 @@ origin_circuit_t *origin_circuit_init(uint8_t purpose, int flags); origin_circuit_t *circuit_establish_circuit(uint8_t purpose, extend_info_t *exit, int flags); MOCK_DECL(origin_circuit_t *, circuit_establish_circuit_conflux, ( const uint8_t *nonce, uint8_t purpose, extend_info_t *exit, int flags)); struct circuit_guard_state_t *origin_circuit_get_guard_state( origin_circuit_t *circ); int circuit_handle_first_hop(origin_circuit_t *circ); Loading Loading
src/app/main/shutdown.c +2 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include "core/or/circuitlist.h" #include "core/or/circuitmux_ewma.h" #include "core/or/circuitpadding.h" #include "core/or/conflux_pool.h" #include "core/or/connection_edge.h" #include "core/or/dos.h" #include "core/or/scheduler.h" Loading Loading @@ -120,6 +121,7 @@ tor_free_all(int postfork) rep_hist_free_all(); bwhist_free_all(); circuit_free_all(); conflux_pool_free_all(); circpad_machines_free(); entry_guards_free_all(); pt_free_all(); Loading
src/app/main/subsystem_list.c +2 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ #include "lib/cc/torint.h" #include "core/mainloop/mainloop_sys.h" #include "core/or/conflux_sys.h" #include "core/or/dos_sys.h" #include "core/or/or_sys.h" #include "feature/control/btrack_sys.h" Loading Loading @@ -64,6 +65,7 @@ const subsys_fns_t *tor_subsystems[] = { &sys_process, &sys_mainloop, &sys_conflux, &sys_or, &sys_dos, Loading
src/core/or/circuit_st.h +8 −0 Original line number Diff line number Diff line Loading @@ -261,6 +261,14 @@ struct circuit_t { * CIRCUIT_PURPOSE_CONFLUX_UNLINKED. */ struct conflux_t *conflux; /** If set, this circuit is considered *unlinked* and in the pending pool. * The nonce value is used to find the other legs. Origin circuits that * have this set are in the CIRCUIT_PURPOSE_CONFLUX_UNLINKED purpose. * * If this is NULL, and conflux object is set, it means this circuit is * linked and thus part of a usable set. */ uint8_t *conflux_pending_nonce; }; #endif /* !defined(CIRCUIT_ST_H) */
src/core/or/circuitbuild.c +45 −0 Original line number Diff line number Diff line Loading @@ -465,6 +465,8 @@ origin_circuit_init(uint8_t purpose, int flags) ((flags & CIRCLAUNCH_IS_INTERNAL) ? 1 : 0); circ->build_state->is_ipv6_selftest = ((flags & CIRCLAUNCH_IS_IPV6_SELFTEST) ? 1 : 0); circ->build_state->need_conflux = ((flags & CIRCLAUNCH_NEED_CONFLUX) ? 1 : 0); circ->base_.purpose = purpose; return circ; } Loading Loading @@ -507,6 +509,47 @@ circuit_establish_circuit(uint8_t purpose, extend_info_t *exit_ei, int flags) return circ; } /** * Build a new conflux circuit for <b>purpose</b>. If <b>exit</b> is defined, * then use that as your exit router, else choose a suitable exit node. * The <b>flags</b> argument is a bitfield of CIRCLAUNCH_* flags, see * circuit_launch_by_extend_info() for more details. * * Also launch a connection to the first OR in the chosen path, if * it's not open already. */ MOCK_IMPL(origin_circuit_t *, circuit_establish_circuit_conflux,(const uint8_t *conflux_nonce, uint8_t purpose, extend_info_t *exit_ei, int flags)) { origin_circuit_t *circ; int err_reason = 0; /* Right now, only conflux client circuits use this function */ tor_assert(purpose == CIRCUIT_PURPOSE_CONFLUX_UNLINKED); circ = origin_circuit_init(purpose, flags); TO_CIRCUIT(circ)->conflux_pending_nonce = tor_memdup(conflux_nonce, DIGEST256_LEN); if (onion_pick_cpath_exit(circ, exit_ei, 0) < 0 || onion_populate_cpath(circ) < 0) { circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_NOPATH); return NULL; } circuit_event_status(circ, CIRC_EVENT_LAUNCHED, 0); if ((err_reason = circuit_handle_first_hop(circ)) < 0) { circuit_mark_for_close(TO_CIRCUIT(circ), -err_reason); return NULL; } tor_trace(TR_SUBSYS(circuit), TR_EV(establish), circ); return circ; } /** Return the guard state associated with <b>circ</b>, which may be NULL. */ circuit_guard_state_t * origin_circuit_get_guard_state(origin_circuit_t *circ) Loading Loading @@ -2105,6 +2148,8 @@ onion_pick_cpath_exit(origin_circuit_t *circ, extend_info_t *exit_ei, flags |= CRN_DIRECT_CONN; if (is_hs_v3_rp_circuit) flags |= CRN_RENDEZVOUS_V3; if (state->need_conflux) flags |= CRN_CONFLUX; const node_t *node = choose_good_exit_server(circ, flags, state->is_internal); if (!node) { Loading
src/core/or/circuitbuild.h +6 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,12 @@ origin_circuit_t *origin_circuit_init(uint8_t purpose, int flags); origin_circuit_t *circuit_establish_circuit(uint8_t purpose, extend_info_t *exit, int flags); MOCK_DECL(origin_circuit_t *, circuit_establish_circuit_conflux, ( const uint8_t *nonce, uint8_t purpose, extend_info_t *exit, int flags)); struct circuit_guard_state_t *origin_circuit_get_guard_state( origin_circuit_t *circ); int circuit_handle_first_hop(origin_circuit_t *circ); Loading