Browse Source

gossipd: don't announce bound address if given with --bind-addr, even if public.

Only --addr implies announce-if-public: --bind-addr does not.

It's also possible to have --bind-addr to an automatic Tor address:
you'd have to dig the onion address out of the logs or getinfo to use
it, but it's possible.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
284f0a04c9
  1. 17
      gossipd/gossip.c

17
gossipd/gossip.c

@ -2586,10 +2586,11 @@ static struct wireaddr_internal *setup_listeners(const tal_t *ctx,
for (size_t i = 0; i < tal_count(daemon->proposed_wireaddr); i++) { for (size_t i = 0; i < tal_count(daemon->proposed_wireaddr); i++) {
struct wireaddr_internal wa = daemon->proposed_wireaddr[i]; struct wireaddr_internal wa = daemon->proposed_wireaddr[i];
bool announce = (daemon->proposed_listen_announce[i]
& ADDR_ANNOUNCE);
if (!(daemon->proposed_listen_announce[i] & ADDR_LISTEN)) { if (!(daemon->proposed_listen_announce[i] & ADDR_LISTEN)) {
assert(daemon->proposed_listen_announce[i] assert(announce);
& ADDR_ANNOUNCE);
/* You can only announce wiretypes! */ /* You can only announce wiretypes! */
assert(daemon->proposed_wireaddr[i].itype assert(daemon->proposed_wireaddr[i].itype
== ADDR_INTERNAL_WIREADDR); == ADDR_INTERNAL_WIREADDR);
@ -2608,6 +2609,7 @@ static struct wireaddr_internal *setup_listeners(const tal_t *ctx,
addrun.sun_path); addrun.sun_path);
io_new_listener(daemon, fd, connection_in, daemon); io_new_listener(daemon, fd, connection_in, daemon);
/* We don't announce socket names */ /* We don't announce socket names */
assert(!announce);
add_binding(&binding, &wa); add_binding(&binding, &wa);
continue; continue;
case ADDR_INTERNAL_AUTOTOR: case ADDR_INTERNAL_AUTOTOR:
@ -2629,7 +2631,8 @@ static struct wireaddr_internal *setup_listeners(const tal_t *ctx,
true); true);
if (ipv6_ok) { if (ipv6_ok) {
add_binding(&binding, &wa); add_binding(&binding, &wa);
if (public_address(daemon, &wa.u.wireaddr)) if (announce
&& public_address(daemon, &wa.u.wireaddr))
add_announcable(daemon, &wa.u.wireaddr); add_announcable(daemon, &wa.u.wireaddr);
} }
wa.u.wireaddr.type = ADDR_TYPE_IPV4; wa.u.wireaddr.type = ADDR_TYPE_IPV4;
@ -2638,7 +2641,8 @@ static struct wireaddr_internal *setup_listeners(const tal_t *ctx,
if (handle_wireaddr_listen(daemon, &wa.u.wireaddr, if (handle_wireaddr_listen(daemon, &wa.u.wireaddr,
ipv6_ok)) { ipv6_ok)) {
add_binding(&binding, &wa); add_binding(&binding, &wa);
if (public_address(daemon, &wa.u.wireaddr)) if (announce
&& public_address(daemon, &wa.u.wireaddr))
add_announcable(daemon, &wa.u.wireaddr); add_announcable(daemon, &wa.u.wireaddr);
} }
continue; continue;
@ -2646,7 +2650,7 @@ static struct wireaddr_internal *setup_listeners(const tal_t *ctx,
case ADDR_INTERNAL_WIREADDR: case ADDR_INTERNAL_WIREADDR:
handle_wireaddr_listen(daemon, &wa.u.wireaddr, false); handle_wireaddr_listen(daemon, &wa.u.wireaddr, false);
add_binding(&binding, &wa); add_binding(&binding, &wa);
if (public_address(daemon, &wa.u.wireaddr)) if (announce && public_address(daemon, &wa.u.wireaddr))
add_announcable(daemon, &wa.u.wireaddr); add_announcable(daemon, &wa.u.wireaddr);
continue; continue;
case ADDR_INTERNAL_FORPROXY: case ADDR_INTERNAL_FORPROXY:
@ -2663,6 +2667,9 @@ static struct wireaddr_internal *setup_listeners(const tal_t *ctx,
if (!(daemon->proposed_listen_announce[i] & ADDR_LISTEN)) if (!(daemon->proposed_listen_announce[i] & ADDR_LISTEN))
continue; continue;
if (!(daemon->proposed_listen_announce[i] & ADDR_ANNOUNCE))
continue;
if (daemon->proposed_wireaddr[i].itype != ADDR_INTERNAL_AUTOTOR) if (daemon->proposed_wireaddr[i].itype != ADDR_INTERNAL_AUTOTOR)
continue; continue;

Loading…
Cancel
Save