Commit d3e6247
committed
net: don't extra bind for Tor if binds are restricted
The semantic of `-bind` is to restrict the binding only to some address.
If not specified, then the user does not care and we bind to `0.0.0.0`.
If specified then we should honor the restriction and bind only to the
specified address.
Before this change, if no `-bind` is given then we would bind to
`0.0.0.0` and to `127.0.0.1:8334` (incoming Tor) which is ok - the user
does not care to restrict the binding. However:
* If only `-bind=addr` is given (without `-bind=...=onion`) then we
would bind to `addr` _and_ to `127.0.0.1:8334` in addition which may
be unexpected assuming the perception of `-bind=addr` is
"bind _only_ to `addr`".
* If only `-bind=addr=onion` is given (without ordinary `-bind=`)
then we would bind to `addr` _and_ to `0.0.0.0` in addition.
Change the above two cases to not do the additional bind. If `-bind`
is given then only bind to the specified address:
* If only `-bind=addr` is given (without `-bind=...=onion`) then bind to
`addr` (only). If we are creating tor hidden service then use `addr`
as target. Same behavior as before
bitcoin#19991.
* If only `-bind=addr=onion` is given (without ordinary `-bind=`)
then bind to `addr` (only) and consider incoming connections as Tor
and do not advertise `addr`. I.e. a Tor-only node.1 parent 4976e91 commit d3e6247
File tree
5 files changed
+156
-29
lines changed- src
- test/functional
5 files changed
+156
-29
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1965 | 1965 | | |
1966 | 1966 | | |
1967 | 1967 | | |
1968 | | - | |
1969 | | - | |
1970 | | - | |
1971 | | - | |
1972 | | - | |
1973 | | - | |
1974 | | - | |
1975 | | - | |
1976 | | - | |
1977 | | - | |
1978 | | - | |
1979 | | - | |
1980 | 1968 | | |
1981 | 1969 | | |
1982 | 1970 | | |
1983 | 1971 | | |
1984 | 1972 | | |
1985 | 1973 | | |
1986 | 1974 | | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
1987 | 2001 | | |
1988 | 2002 | | |
1989 | 2003 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2391 | 2391 | | |
2392 | 2392 | | |
2393 | 2393 | | |
2394 | | - | |
2395 | | - | |
2396 | | - | |
2397 | | - | |
| 2394 | + | |
2398 | 2395 | | |
2399 | 2396 | | |
2400 | | - | |
| 2397 | + | |
2401 | 2398 | | |
2402 | 2399 | | |
2403 | | - | |
| 2400 | + | |
2404 | 2401 | | |
2405 | 2402 | | |
2406 | | - | |
| 2403 | + | |
| 2404 | + | |
| 2405 | + | |
| 2406 | + | |
2407 | 2407 | | |
2408 | 2408 | | |
2409 | 2409 | | |
2410 | 2410 | | |
2411 | 2411 | | |
2412 | 2412 | | |
2413 | | - | |
2414 | | - | |
2415 | | - | |
2416 | | - | |
2417 | | - | |
2418 | 2413 | | |
2419 | 2414 | | |
2420 | 2415 | | |
| |||
2433 | 2428 | | |
2434 | 2429 | | |
2435 | 2430 | | |
2436 | | - | |
| 2431 | + | |
2437 | 2432 | | |
2438 | 2433 | | |
2439 | 2434 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
220 | 223 | | |
221 | 224 | | |
222 | 225 | | |
| |||
415 | 418 | | |
416 | 419 | | |
417 | 420 | | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
| 421 | + | |
422 | 422 | | |
423 | 423 | | |
424 | 424 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
| |||
0 commit comments