-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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: allow empty IP when decoding Ping's from field #9953
Conversation
crates/net/discv4/Cargo.toml
Outdated
@@ -31,7 +31,7 @@ secp256k1 = { workspace = true, features = [ | |||
enr.workspace = true | |||
|
|||
# async/futures | |||
tokio = { workspace = true, features = ["io-util", "net", "time"] } | |||
tokio = { workspace = true, features = ["io-util", "net", "time", "rt-multi-thread"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably not, left over from something being messed up with my setup, for some reason I can't test discv4 without it
crates/net/discv4/src/proto.rs
Outdated
impl From<NodeRecord> for PingNodeEndpoint { | ||
fn from(NodeRecord { address, tcp_port, udp_port, .. }: NodeRecord) -> Self { | ||
Self(NodeEndpoint { address, tcp_port, udp_port }) | ||
} | ||
} | ||
|
||
impl From<NodeEndpoint> for PingNodeEndpoint { | ||
fn from(value: NodeEndpoint) -> Self { | ||
Self(value) | ||
} | ||
} | ||
|
||
impl PingNodeEndpoint { | ||
/// Creates a new [`PingNodeEndpoint`] from a given UDP address and TCP port. | ||
pub const fn from_udp_address(udp_address: &std::net::SocketAddr, tcp_port: u16) -> Self { | ||
Self(NodeEndpoint { address: udp_address.ip(), udp_port: udp_address.port(), tcp_port }) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need these?
we only need the .0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need these
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This sets the IP to
UNSPECIFIED
when0x80
is encountered as aPing
packetfrom
field.