devtools/gossipwith: don't count "padding" pings towards max-messages count.
What changed, and why it matters
This is a small change to a developer testing tool (gossipwith) used to simulate Lightning network peers. It adjusts how the tool counts ping messages so that 'padding' pings—used only to keep packet sizes constant—do not reduce the limit on how many real messages the tool will process. The change is not in production node code and does not appear to fix a security vulnerability.
No security action required. Treat as a normal development/testing tool maintenance commit.
Security signals we found
No security-relevant signals in commit message or diff
Change is confined to a developer tool, not production daemon code
No memory safety, cryptographic, or authorization changes observed
Commit explicitly states motivation is to avoid upsetting tests
Evidence from the diff
The patch modifies devtools/gossipwith.c so that when a ping message is handled by check_ping_make_pong(), the code distinguishes between a real ping (which generates a pong reply) and a ‘padding’ ping (where check_ping_make_pong returns true but pong is NULL). Only non-padding messages decrement max_messages. This is preparatory work for a future change that will use padding pings to make packet sizes constant during tests. The tool is a test/dev utility, not part of the live Lightning daemon.
Changed components
devtools/gossipwith.cInspect captured patch +15 / −7
diff --git a/devtools/gossipwith.c b/devtools/gossipwith.c
index 7f85e8ee..c282c992 100644
--- a/devtools/gossipwith.c
+++ b/devtools/gossipwith.c
@@ -256,16 +256,22 @@ static struct io_plan *handshake_success(struct io_conn *conn,
}
} else if (pollfd[1].revents & POLLIN) {
u8 *pong;
+ bool is_padding;
msg = sync_crypto_read(NULL, peer_fd, cs);
if (!msg)
err(1, "Reading msg");
- if (handle_pings
- && fromwire_peektype(msg) == WIRE_PING
- && check_ping_make_pong(tmpctx, msg, &pong)
- && pong) {
- sync_crypto_write(peer_fd, cs, take(pong));
- }
+ if (check_ping_make_pong(tmpctx, msg, &pong)) {
+ if (!pong)
+ is_padding = true;
+ else {
+ is_padding = false;
+ if (handle_pings)
+ sync_crypto_write(peer_fd, cs, take(pong));
+ }
+ } else
+ is_padding = false;
+
if (!accept_message(msg)) {
tal_free(msg);
continue;
@@ -278,7 +284,9 @@ static struct io_plan *handshake_success(struct io_conn *conn,
|| !write_all(STDOUT_FILENO, msg, tal_bytelen(msg)))
err(1, "Writing out msg");
}
- --max_messages;
+ /* Don't count "padding" pings as real messages */
+ if (!is_padding)
+ --max_messages;
tal_free(msg);
}
}
Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.