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

User Agent suffix is not set in libp2p #9456

Closed
3 tasks done
aschmahmann opened this issue Dec 5, 2022 · 1 comment · Fixed by #9457
Closed
3 tasks done

User Agent suffix is not set in libp2p #9456

aschmahmann opened this issue Dec 5, 2022 · 1 comment · Fixed by #9457
Assignees
Labels
kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization

Comments

@aschmahmann
Copy link
Contributor

Checklist

Installation method

built from source

Version

No response

Config

No response

Description

Create two nodes A and B. Start node A with --user-agent-suffix=foo. On node B run ipfs id <node A id> and see that the suffix is missing 😢.

The implementation in #8419 seems to have been implemented incorrectly and the sharness test "verifying behavior" only tests that the node itself knows about the suffix but not that it broadcasts it.

The issue stems from

var UserAgent = simpleOpt(libp2p.UserAgent(version.GetUserAgentVersion()))

where the user agent option is created. While the option is itself a function which will get called and run after the suffix has been processed and SetUserAgentSuffix called, the string passed into libp2p.UserAgent is fetched on package load.

func SetUserAgentSuffix(suffix string) {

Any fix that delays the setting of the user agent string until fx has asked for it should be fine. As for testing, I'd recommend using the scenario above to reproduce.

@aschmahmann aschmahmann added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels Dec 5, 2022
@lidel
Copy link
Member

lidel commented Dec 5, 2022

Just found it independently, really unfortunate bug: we had test for this, but it only tested ipfs id of local node :(
Will prepare fix, and p2p test, and include them in 0.18.0-rc1. (done: #9457)

cc probe-lab/network-measurements#24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants