google / gvisor

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

ICMP sockets do not allow multicasting or broadcasting #5681

Open puradox opened 3 years ago

puradox commented 3 years ago

Creation of the first packetimpact test for ICMP sockets have uncovered a discrepancy with Linux. ICMP sockets on gVisor do not allow sending to multicast or broadcast addresses, whereas this is supported on Linux.

Note: This issue is for sending to multicast/broadcast, not binding to. ICMP sockets on Linux do not support binding to multicast or broadcast addresses.

The packetimpact failures shows we are unable to send to multicast/broadcast when bound:

--- FAIL: TestSocket/Send/icmp/bindTo=200.82.82.10/sendTo=255.255.255.255/bindToDevice=false/expectData=true (0.13s)
    --- FAIL: TestSocket/Send/icmp/bindTo=200.82.82.10/sendTo=255.255.255.255/bindToDevice=false/expectData=true/random1k (0.00s)
        third_party/gvisor/test/packetimpact/tests/udp_send_recv_dgram_test.go:460: failed to sendto: network is unreachable
    --- FAIL: TestSocket/Send/icmp/bindTo=200.82.82.10/sendTo=255.255.255.255/bindToDevice=false/expectData=true/empty (0.00s)
        third_party/gvisor/test/packetimpact/tests/udp_send_recv_dgram_test.go:460: failed to sendto: network is unreachable
    --- FAIL: TestSocket/Send/icmp/bindTo=200.82.82.10/sendTo=255.255.255.255/bindToDevice=false/expectData=true/small (0.00s)
        third_party/gvisor/test/packetimpact/tests/udp_send_recv_dgram_test.go:460: failed to sendto: network is unreachable
--- FAIL: TestSocket/Send/icmp/bindTo=200.82.82.10/sendTo=224.0.0.1/bindToDevice=false/expectData=true (0.12s)
    --- FAIL: TestSocket/Send/icmp/bindTo=200.82.82.10/sendTo=224.0.0.1/bindToDevice=false/expectData=true/empty (0.00s)
        third_party/gvisor/test/packetimpact/tests/udp_send_recv_dgram_test.go:460: failed to sendto: network is unreachable
    --- FAIL: TestSocket/Send/icmp/bindTo=200.82.82.10/sendTo=224.0.0.1/bindToDevice=false/expectData=true/small (0.00s)
        third_party/gvisor/test/packetimpact/tests/udp_send_recv_dgram_test.go:460: failed to sendto: network is unreachable
    --- FAIL: TestSocket/Send/icmp/bindTo=200.82.82.10/sendTo=224.0.0.1/bindToDevice=false/expectData=true/random1k (0.00s)
        third_party/gvisor/test/packetimpact/tests/udp_send_recv_dgram_test.go:460: failed to sendto: network is unreachable

Additionally, when unbound, the destination IPv4 address is not correctly set to multicast/broadcast.

--- FAIL: TestSocket/Send/icmp/unbound/sendTo=255.255.255.255/bindToDevice=true/expectData=true/small (1.02s)
    third_party/gvisor/test/packetimpact/tests/udp_send_recv_dgram_test.go:466: got frames:
        (Ether matches Ether)
        IPv4: DstAddr: 200.82.82.10 255.255.255.255
        (ICMPv4 matches ICMPv4)

This issue tracks the implementation of sending to multicast and broadcast addresses with ICMP sockets.

github-actions[bot] commented 1 year ago

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

github-actions[bot] commented 9 months ago

This issue has been closed due to lack of activity.

github-actions[bot] commented 9 months ago

There are TODOs still referencing this issue:

  1. test/packetimpact/tests/generic_dgram_socket_send_recv_test.go:196: Remove this case once ICMP sockets allow

Search TODO

github-actions[bot] commented 5 months ago

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