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

fix(kad): Skip invalid multiaddr #3280

Merged
merged 5 commits into from
Dec 26, 2022
Merged

Conversation

mxinden
Copy link
Member

@mxinden mxinden commented Dec 23, 2022

Description

With this commit libp2p-kad no longer discards the whole peer payload in case an addr is invalid, but instead logs the failure, skips the invalid multiaddr and parses the remaining payload.

See #3244 for details.

Notes

Targets the v0.50 branch.

Links to any relevant issues

Open Questions

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

With this commit `libp2p-kad` no longer discards the whole peer payload in case an addr is invalid,
but instead logs the failure, skips the invalid multiaddr and parses the remaining payload.

See libp2p#3244 for details.
Copy link
Contributor

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing this!

Comment on lines 3 to 5
- Skip invalid multiaddr in `Peer` `addrs`. See [PR XXX].

[PR XXX]: https://github.com/libp2p/rust-libp2p/pull/XXX
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Skip invalid multiaddr in `Peer` `addrs`. See [PR XXX].
[PR XXX]: https://github.com/libp2p/rust-libp2p/pull/XXX
- Skip invalid multiaddr in `Peer` `addrs`. See [PR 3280].
[PR 3280]: https://github.com/libp2p/rust-libp2p/pull/3280

protocols/kad/CHANGELOG.md Outdated Show resolved Hide resolved
@@ -35,6 +35,7 @@ use futures::prelude::*;
use instant::Instant;
use libp2p_core::upgrade::{InboundUpgrade, OutboundUpgrade, UpgradeInfo};
use libp2p_core::{Multiaddr, PeerId};
use log::debug;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personal preference only but I like not importing these because they often come and go with refactorings and log::debug is actually very expressive.

protocols/kad/src/protocol.rs Outdated Show resolved Hide resolved
@thomaseizinger
Copy link
Contributor

Mergify can backport PRs btw: https://docs.mergify.com/actions/backport/

It might interact oddly with our version bumping and changelog entries though.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
protocols/kad/CHANGELOG.md Outdated Show resolved Hide resolved
mxinden and others added 2 commits December 24, 2022 09:53
Copy link
Member

@jxs jxs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mxinden mxinden merged commit 773c370 into libp2p:v0.50 Dec 26, 2022
@mxinden
Copy link
Member Author

mxinden commented Dec 26, 2022

Tagged and published.

mxinden added a commit to mxinden/rust-libp2p that referenced this pull request Dec 26, 2022
With this commit `libp2p-kad` no longer discards the whole peer payload in case an addr is invalid,
but instead logs the failure, skips the invalid multiaddr and parses the remaining payload.

See libp2p#3244 for details.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
@mxinden mxinden mentioned this pull request Dec 26, 2022
4 tasks
mxinden added a commit to mxinden/rust-libp2p that referenced this pull request Jan 2, 2023
With this commit `libp2p-dcutr` no longer discards the whole remote payload in case an addr is
unparsable, but instead logs the failure and skips the unparsable multiaddr.

See libp2p#3244 for details.
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.

4 participants