-
Notifications
You must be signed in to change notification settings - Fork 37.7k
correct -onion default to -proxy behavior #14729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Pushed a fix to the comment to reflect the new behavior and rebased. |
src/torcontrol.cpp
Outdated
if (gArgs.GetArg("-onion", "") == "") { | ||
// Now that we know Tor is running, setup the proxy for onion addresses | ||
// if -onion and -proxy isn't set to something else. | ||
if (gArgs.GetArg("-onion", "-proxy") == "") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default must be set to a value, not the name of the arg it should default to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I might have fixed it now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MarcoFalke I noticed in another spots this was handled differently. Would it be more preferable like this:
// Now that we know Tor is running setup the proxy for onion addresses
// if -onion isn't set to something else.
std::string onion = gArgs.GetArg("-onion", "");
std::string proxy = gArgs.GetArg("-proxy", "");
if (onion.empty() && proxy.empty()) {
- fixes #14722 - only use default tor ip:port (127.0.0.1:9050) if -onion and -proxy not set - fix comment to reflect new behavior
Thank you for reviewing. I think I may have done this the correct way now. If not, I will stop wasting your time and close this so someone more suited can take it up. Lines 525 to 527 in 38640a0
|
if (gArgs.GetArg("-onion", "") == "") { | ||
// Now that we know Tor is running, setup the proxy for onion addresses | ||
// if -onion and -proxy isn't set to something else. | ||
if (gArgs.GetArg("-onion", "") == "" && gArgs.GetArg("-proxy", "") == "") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this will work in most cases.
Though ideally we'd query Net's state directly here for "is there a proxy for onion already" instead of indirectly divising it from the arguments. This would really solve the problem of the current code here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this will work in most cases.
Though ideally we'd query Net's state directly here for "is there a proxy for onion already" instead of indirectly divising it from the arguments. This would really solve the problem of the current code here.
Hi, @qubenix
diff --git a/src/torcontrol.cpp b/src/torcontrol.cpp
index bec64fbf2..b632513c3 100644
--- a/src/torcontrol.cpp
+++ b/src/torcontrol.cpp
@@ -524,7 +524,8 @@ void TorController::auth_cb(TorControlConnection& _conn, const TorControlReply&
// Now that we know Tor is running, setup the proxy for onion addresses
// if -onion and -proxy isn't set to something else.
- if (gArgs.GetArg("-onion", "") == "" && gArgs.GetArg("-proxy", "") == "") {
+ proxyType addrOnion;
+ if (gArgs.GetArg("-onion", "") == "" && !GetProxy(NET_ONION, addrOnion)) {
CService resolved(LookupNumeric("127.0.0.1", 9050));
proxyType addrOnion = proxyType(resolved, true);
SetProxy(NET_ONION, addrOnion);
This litle patch should do the trick and fix the problem and that should be in line what @laanwj suggested, please feel free to copy paste. ;-)
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
I think when using the Tor controller, we probably want to use the Tor's own listening config (see #15423) over a |
@luke-jr Could be better to listen to the control port, just don't forget about situations where In Whonix there is a dedicated port for Bitcoin traffic,
Probably best to rely on the controller and systems using This PR was only meant to correct the defined behavior of defaulting to
Sorry, I'm not sure how to do that. I only wanted to help, but I'm afraid the existence of this PR may be keeping others from doing it the ideal way which you suggested. Just let me know if closing this is more help. |
The last travis run for this pull request was 273 days ago and is thus outdated. To trigger a fresh travis build, this pull request should be closed and re-opened. |
@qubenix bumping here to see if you are planning on continuing to push this forward. |
@adamjonas I don't what I can/should be doing to push this forward. This PR fixes the bug, but if it's not done in an acceptable way then there's nothing more I can do. I'm not a coder by trade, I just found a bug and offered a solution that I was able to figure out. |
Hi @qubenix might take a look at #19358? I run in the same problem and found that other settings are also ignored by this footgun proxy fallback, so i took the freedom and pushed this alternative fix. |
Anyone interested in this PR should instead review #19358. |
I'm not sure if this is done correctly, but it does fix the behavior in my tests. I will not be offended if this gets rejected for a more appropriate method.