google / gvisor

Application Kernel for Containers
https://gvisor.dev
Apache License 2.0
15.31k stars 1.27k forks source link

UDP sockets receive from IPv4 multicast when bound by IPv6 any #5956

Open puradox opened 3 years ago

puradox commented 3 years ago

Description

A discrepancy with Linux was found while improving a PacketImpact test for UDP socket send and receive.

On Linux, UDP sockets do not receive traffic from the IPv4 all systems multicast address, 224.0.0.1, when bound to the IPv6 any address, ::. On gVisor, UDP sockets receive traffic from 224.0.0.1 when bound to ::.

Steps to reproduce

  1. Run test //third_party/gvisor/test/packetimpact/tests:generic_dgram_socket_send_recv_native_test
  2. Run test //third_party/gvisor/test/packetimpact/tests:generic_dgram_socket_send_recv_netstack_test

Passes on native but fails on netstack with the following errors:

--- FAIL: TestSocket/Receive/udp/bindTo=::/sendTo=224.0.0.1/bindToDevice=true/expectPacket=false (0.16s)
    --- FAIL: TestSocket/Receive/udp/bindTo=::/sendTo=224.0.0.1/bindToDevice=true/expectPacket=false/random1k (0.00s)
        third_party/gvisor/test/packetimpact/tests/generic_dgram_socket_send_recv_test.go:782: Recv got unexpected result, ret=1024, payload="[...]", errno=errno 0
    --- FAIL: TestSocket/Receive/udp/bindTo=::/sendTo=224.0.0.1/bindToDevice=true/expectPacket=false/empty (0.00s)
        third_party/gvisor/test/packetimpact/tests/generic_dgram_socket_send_recv_test.go:782: Recv got unexpected result, ret=0, payload="", errno=errno 0
    --- FAIL: TestSocket/Receive/udp/bindTo=::/sendTo=224.0.0.1/bindToDevice=true/expectPacket=false/small (0.00s)
        third_party/gvisor/test/packetimpact/tests/generic_dgram_socket_send_recv_test.go:782: Recv got unexpected result, ret=11, payload="hello world", errno=errno 0
--- FAIL: TestSocket/Receive/udp/bindTo=::/sendTo=224.0.0.1/bindToDevice=false/expectPacket=false (0.11s)
    --- FAIL: TestSocket/Receive/udp/bindTo=::/sendTo=224.0.0.1/bindToDevice=false/expectPacket=false/empty (0.00s)
        third_party/gvisor/test/packetimpact/tests/generic_dgram_socket_send_recv_test.go:782: Recv got unexpected result, ret=0, payload="", errno=errno 0
    --- FAIL: TestSocket/Receive/udp/bindTo=::/sendTo=224.0.0.1/bindToDevice=false/expectPacket=false/small (0.00s)
        third_party/gvisor/test/packetimpact/tests/generic_dgram_socket_send_recv_test.go:782: Recv got unexpected result, ret=11, payload="hello world", errno=errno 0
    --- FAIL: TestSocket/Receive/udp/bindTo=::/sendTo=224.0.0.1/bindToDevice=false/expectPacket=false/random1k (0.00s)
        third_party/gvisor/test/packetimpact/tests/generic_dgram_socket_send_recv_test.go:782: Recv got unexpected result, ret=1024, payload="[...]", errno=errno 0
tamird commented 3 years ago

Do IPv4 sockets bound to IPv4 ANY receive such packets?

github-actions[bot] commented 9 months ago

A friendly reminder that this issue had no activity for 120 days.

github-actions[bot] commented 6 months ago

This issue has been closed due to lack of activity.

github-actions[bot] commented 6 months ago

There are TODOs still referencing this issue:

  1. test/packetimpact/tests/generic_dgram_socket_send_recv_test.go:737: Remove this if statement once gVisor

Search TODO

github-actions[bot] commented 2 months ago

A friendly reminder that this issue had no activity for 120 days.