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: stop generate_random_remote_enr from generating multicast ip's #1657

Merged
merged 1 commit into from
Feb 1, 2025

Conversation

KolbyML
Copy link
Member

@KolbyML KolbyML commented Feb 1, 2025

What was wrong?

generate_random_remote_enr was generating Multicast ips, we use generate_random_remote_enr() in Hive tests and most clients don't allow Multicast IP's to be used

How was it fixed?

Only generate IP's before the Multicast range and after 0.0.0.0

@KolbyML KolbyML self-assigned this Feb 1, 2025

// Generate an IP between 1.0.0.0 and 223.255.255.255
// We don't want to generate a multicast address (224.0.0.0 - 239.255.255.255)
let ip = Ipv4Addr::from(rng.gen_range(1..=0xDFFFFFFF)); // 0xDFFFFFFF == 223.255.255.255
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we want ip address to be in the 1.0.0.0 and 223.255.255.255 range, shouldn't this be:

rng.gen_range(0x01000000..=0xDFFFFFFF)

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch

@KolbyML KolbyML force-pushed the fix-generate-random-enr branch from d75d991 to 5b64e5d Compare February 1, 2025 18:56
@KolbyML KolbyML force-pushed the fix-generate-random-enr branch from 5b64e5d to 777a733 Compare February 1, 2025 19:00
@KolbyML KolbyML merged commit ca15f46 into ethereum:master Feb 1, 2025
11 checks passed
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