IPv6 support: discovery and listeners bind IPv4 only

Đang mở
#853 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 6 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
18/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
networking

Hướng nghiên cứu

Start in bin/ethlambda/src/main.rs: run_node builds p2p_socket on 0.0.0.0, and build_swarm listens on /ip4/0.0.0.0 for QUIC/TCP; spawn_discovery hands one UDP socket to ethrex. Read read_ip and Options::validate_ports for ENR and flag handling, plus #825 for the bootnode refusal. Done means IPv6 listeners/discovery (or a documented ethrex dependency), ip6/udp6/tcp6/quic6 read and written, CLI flags validated, and tests covering dual-stack and IPv6-only peers.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Problem

The node binds IPv4 sockets only, so IPv6 works only for outbound connections:

  • Discovery (discv5) is IPv4-only. run_node builds p2p_socket on 0.0.0.0 (bin/ethlambda/src/main.rs) and passes its IP as DiscoverySpawnConfig::bind_ip. spawn_discovery opens one UdpSocket there and hands it to ethrex's DiscoveryServer. An IPv4 socket cannot send to an IPv6 address or receive from one, so discv5 never reaches an IPv6-only peer, whether it was found by discovery or given as a bootnode.
  • The swarm listens on IPv4 only. build_swarm listens on /ip4/0.0.0.0 for QUIC and TCP, so no peer can connect in over IPv6. Outbound dials to IPv6 do work: libp2p-quic opens a [::]:0 dialer endpoint when no IPv6 listener exists, and TCP opens a socket of the target's family.
  • --discovery.advertise-ip accepts an IPv6 address. It writes ip6 into the ENR, but the sockets behind the record are IPv4, so the published record is one no peer can reach.
  • ENRs from peers. read_ip prefers ip over ip6, and the IPv6-specific ports (udp6, tcp6, quic6) are never read or written.

Today this matters only for IPv6-only peers. A dual-stack record carries ip, which wins.

What support would take

Lighthouse runs dual-stack: --listen-address can be given once per family, the IPv6 ports have their own flags (--port6, --discovery-port6, --quic-port6), and discv5 gets one socket per family. Covering that here means:

  1. Discovery on IPv6 too. ethrex's DiscoveryServer takes a single socket, so this needs either a dual-stack socket with IPv4-mapped addresses handled throughout, or ethrex accepting a second socket.
  2. QUIC and TCP listeners on :: as well as 0.0.0.0.
  3. The ENR's ip6/udp6/tcp6/quic6 entries, written for our record and read from peers'.
  4. CLI flags for the IPv6 listen address and ports, and Options::validate_ports rules for them.
  5. Refusing an IPv6 --discovery.advertise-ip until the above exists, or warning that the record is unreachable.

Related

#825 (open) makes beacon --bootnodes refuse an IPv6 entry that is only a discv5 contact (a bare /ip6/.../udp/<port> multiaddr, or an ENR whose only address is ip6 and whose only port is udp) when discovery is bound to IPv4. The caller passes in the bind address, so the refusal lifts on its own once discovery binds IPv6.

Ngôn ngữ chính
Rust
Star
86
Fork
34
Merge trung bình
9 ngày 20 giờ
Pull request đã merge (30 ngày)
77

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của lambdaclass/ethlambda

Tất cả issue của lambdaclass/ethlambda

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.