Skip to content

Commit 096c079

Browse files
committed
revert e0d6f3c connectd: DNS Bolt7 #911 no longer EXPERIMENTAL
Most mainnet implementations are still broken when it comes to propagate `node_announcent` that have IP/Tor and also DNS names in them. They should propagate entries entries they do not understand, but instead they drop it. Having this feature live would make nodes inaccessible that try to use DNS. We need to re-evaluate this in a couple of month.
1 parent dfb963e commit 096c079

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

connectd/connectd.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,12 +766,14 @@ static void try_connect_one_addr(struct connecting *connect)
766766
bool use_proxy = connect->daemon->always_use_proxy;
767767
const struct wireaddr_internal *addr = &connect->addrs[connect->addrnum];
768768
struct io_conn *conn;
769+
#if EXPERIMENTAL_FEATURES /* BOLT7 DNS RFC #911 */
769770
bool use_dns = connect->daemon->use_dns;
770771
struct addrinfo hints, *ais, *aii;
771772
struct wireaddr_internal addrhint;
772773
int gai_err;
773774
struct sockaddr_in *sa4;
774775
struct sockaddr_in6 *sa6;
776+
#endif
775777

776778
assert(!connect->conn);
777779

@@ -821,6 +823,7 @@ static void try_connect_one_addr(struct connecting *connect)
821823
af = AF_INET6;
822824
break;
823825
case ADDR_TYPE_DNS:
826+
#if EXPERIMENTAL_FEATURES /* BOLT7 DNS RFC #911 */
824827
if (use_proxy) /* hand it to the proxy */
825828
break;
826829
if (!use_dns) { /* ignore DNS when we can't use it */
@@ -872,6 +875,12 @@ static void try_connect_one_addr(struct connecting *connect)
872875
addr = &connect->addrs[connect->addrnum];
873876
}
874877
freeaddrinfo(ais);
878+
#endif
879+
tal_append_fmt(&connect->errors,
880+
"%s: EXPERIMENTAL_FEATURES needed. ",
881+
type_to_string(tmpctx,
882+
struct wireaddr_internal,
883+
addr));
875884
goto next;
876885
case ADDR_TYPE_WEBSOCKET:
877886
af = -1;
@@ -1627,8 +1636,10 @@ static void add_seed_addrs(struct wireaddr_internal **addrs,
16271636
NULL, broken_reply, NULL);
16281637
if (new_addrs) {
16291638
for (size_t j = 0; j < tal_count(new_addrs); j++) {
1639+
#if EXPERIMENTAL_FEATURES /* BOLT7 DNS RFC #911 */
16301640
if (new_addrs[j].type == ADDR_TYPE_DNS)
16311641
continue;
1642+
#endif
16321643
struct wireaddr_internal a;
16331644
a.itype = ADDR_INTERNAL_WIREADDR;
16341645
a.u.wireaddr = new_addrs[j];

lightningd/options.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ static char *opt_set_accept_extra_tlv_types(const char *arg,
193193
return NULL;
194194
}
195195

196+
#if EXPERIMENTAL_FEATURES /* BOLT7 DNS RFC #911 */
196197
/* Returns the number of wireaddr types already announced */
197198
static size_t num_announced_types(enum wire_addr_type type, struct lightningd *ld)
198199
{
@@ -207,6 +208,7 @@ static size_t num_announced_types(enum wire_addr_type type, struct lightningd *l
207208
}
208209
return num;
209210
}
211+
#endif
210212

211213
static char *opt_add_addr_withtype(const char *arg,
212214
struct lightningd *ld,
@@ -253,6 +255,7 @@ static char *opt_add_addr_withtype(const char *arg,
253255
tal_arr_expand(&ld->proposed_wireaddr, wi);
254256
}
255257

258+
#if EXPERIMENTAL_FEATURES /* BOLT7 DNS RFC #911 */
256259
/* Add ADDR_TYPE_DNS to announce DNS hostnames */
257260
if (is_dnsaddr(address) && ala & ADDR_ANNOUNCE) {
258261
/* BOLT-hostnames #7:
@@ -277,6 +280,7 @@ static char *opt_add_addr_withtype(const char *arg,
277280
tal_arr_expand(&ld->proposed_listen_announce, ADDR_ANNOUNCE);
278281
tal_arr_expand(&ld->proposed_wireaddr, wi);
279282
}
283+
#endif
280284

281285
return NULL;
282286

tests/test_gossip.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from pyln.client import RpcError, Millisatoshi
66
from utils import (
77
DEVELOPER, wait_for, TIMEOUT, only_one, sync_blockheight,
8-
expected_node_features,
8+
expected_node_features, COMPAT, EXPERIMENTAL_FEATURES,
99
mine_funding_to_announce, default_ln_port
1010
)
1111

@@ -124,6 +124,13 @@ def test_announce_address(node_factory, bitcoind):
124124
'::'],
125125
'log-level': 'io',
126126
'dev-allow-localhost': None}
127+
if not EXPERIMENTAL_FEATURES: # BOLT7 DNS RFC #911
128+
opts = {'disable-dns': None, 'announce-addr':
129+
['4acth47i6kxnvkewtm6q7ib2s3ufpo5sqbsnzjpbi7utijcltosqemad.onion',
130+
'1.2.3.4:1234',
131+
'::'],
132+
'log-level': 'io',
133+
'dev-allow-localhost': None}
127134
l1, l2 = node_factory.get_nodes(2, opts=[opts, {}])
128135

129136
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
@@ -133,6 +140,14 @@ def test_announce_address(node_factory, bitcoind):
133140
l1.wait_channel_active(scid)
134141
l2.wait_channel_active(scid)
135142

143+
if not EXPERIMENTAL_FEATURES: # BOLT7 DNS RFC #911
144+
l1.daemon.wait_for_log(r"\[OUT\] 0101.*47"
145+
"010102030404d2"
146+
"017f000001...."
147+
"0200000000000000000000000000000000...."
148+
"04e00533f3e8f2aedaa8969b3d0fa03a96e857bbb28064dca5e147e934244b9ba5023003....")
149+
return
150+
136151
# We should see it send node announce with all addresses (257 = 0x0101)
137152
# Note: local ephemeral port is masked out.
138153
# Note: Since we `disable-dns` it should not announce a resolved IPv4
@@ -158,6 +173,7 @@ def test_announce_address(node_factory, bitcoind):
158173
assert addresses_dns[0]['port'] == 1236
159174

160175

176+
@unittest.skipIf(not EXPERIMENTAL_FEATURES, "BOLT7 DNS RFC #911")
161177
@pytest.mark.developer("gossip without DEVELOPER=1 is slow")
162178
def test_announce_and_connect_via_dns(node_factory, bitcoind):
163179
""" Test that DNS annoucements propagate and can be used when connecting.
@@ -222,6 +238,7 @@ def test_announce_and_connect_via_dns(node_factory, bitcoind):
222238
l4.rpc.connect(l1.info['id'])
223239

224240

241+
@unittest.skipIf(not EXPERIMENTAL_FEATURES, "BOLT7 DNS RFC #911")
225242
def test_only_announce_one_dns(node_factory, bitcoind):
226243
# and test that we can't announce more than one DNS address
227244
l1 = node_factory.get_node(expect_fail=True, start=False,
@@ -230,6 +247,7 @@ def test_only_announce_one_dns(node_factory, bitcoind):
230247
wait_for(lambda: l1.daemon.is_in_stderr("Only one DNS can be announced"))
231248

232249

250+
@unittest.skipIf(not EXPERIMENTAL_FEATURES, "BOLT7 DNS RFC #911")
233251
def test_announce_dns_without_port(node_factory, bitcoind):
234252
""" Checks that the port of a DNS announcement is set to the corresponding
235253
network port. In this case regtest 19846

0 commit comments

Comments
 (0)