Skip to content
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

Strip the type and length prefix from the custommsg hook call #4394

Merged
merged 1 commit into from
Mar 2, 2021

Conversation

cdecker
Copy link
Member

@cdecker cdecker commented Feb 23, 2021

We were always prefixing the message field with the internal type
prefix 0x0407, followed by the length prefix. Neither is needed since
the type being constant is of no interest to the plugin and the length
being implicit due to the JSON-encoding.

Reported-by: Ilya Evdokimov

lightningd/peer_control.c Outdated Show resolved Hide resolved
tests/plugins/custommsg_a.py Show resolved Hide resolved
@cdecker cdecker force-pushed the custommsg-raw branch 2 times, most recently from 8c5553d to 276564c Compare March 1, 2021 14:36
We were always prefixing the `message` field with the internal type
prefix 0x0407, followed by the length prefix. Neither is needed since
the type being constant is of no interest to the plugin and the length
being implicit due to the JSON-encoding.

Reported-by: Ilya Evdokimov
Changelog-Fixed: plugin: The `custommsg` hook no longer includes the internal type prefix and length prefix in its `payload`
Changelog-Deprecated: plugin: The `message` field on the `custommsg` hook is deprecated in favor of the `payload` field, which skips the internal prefix.
@cdecker
Copy link
Member Author

cdecker commented Mar 1, 2021

Removed the COMPAT_V093 flag, replaced it with deprecated_apis, and squashed the two commits into one 👍

@rustyrussell
Copy link
Contributor

Ack 96e9d79

@rustyrussell rustyrussell merged commit ebb1b19 into ElementsProject:master Mar 2, 2021
cdecker added a commit to cdecker/lightning that referenced this pull request Mar 5, 2021
Looks like ElementsProject#4394 treated a symptom but not the root cause. We were
actually sending the message framed with the WIRE_CUSTOMMSG_OUT and
the length prefix over the encrypted connection to the peer. It just
happened to be a valid custommsg...

This fixes the issue, and this time I made sure we actually send the
raw message over the wire. However for backward compatibility we
needed to imitate the faulty behavior which is 90% of this patch :-)

Changelog-Fixed: plugin: `dev-sendcustommsg` included the type and length prefix when sending a message.
rustyrussell pushed a commit that referenced this pull request Mar 9, 2021
Looks like #4394 treated a symptom but not the root cause. We were
actually sending the message framed with the WIRE_CUSTOMMSG_OUT and
the length prefix over the encrypted connection to the peer. It just
happened to be a valid custommsg...

This fixes the issue, and this time I made sure we actually send the
raw message over the wire. However for backward compatibility we
needed to imitate the faulty behavior which is 90% of this patch :-)

Changelog-Fixed: plugin: `dev-sendcustommsg` included the type and length prefix when sending a message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants