gvisor/pkg/tcpip
Chris Kuiper 8d9276ed56 Support binding to multicast and broadcast addresses
This fixes the issue of not being able to bind to either a multicast or
broadcast address as well as to send and receive data from it. The way to solve
this is to treat these addresses similar to the ANY address and register their
transport endpoint ID with the global stack's demuxer rather than the NIC's.
That way there is no need to require an endpoint with that multicast or
broadcast address. The stack's demuxer is in fact the only correct one to use,
because neither broadcast- nor multicast-bound sockets care which NIC a
packet was received on (for multicast a join is still needed to receive packets
on a NIC).

I also took the liberty of refactoring udp_test.go to consolidate a lot of
duplicate code and make it easier to create repetitive tests that test the same
feature for a variety of packet and socket types. For this purpose I created a
"flowType" that represents two things: 1) the type of packet being sent or
received and 2) the type of socket used for the test. E.g., a "multicastV4in6"
flow represents a V4-mapped multicast packet run through a V6-dual socket.

This allows writing significantly simpler tests. A nice example is testTTL().

PiperOrigin-RevId: 264766909
2019-08-21 22:54:25 -07:00
..
adapters/gonet Use tcpip.Subnet in tcpip.Route 2019-08-21 15:31:18 -07:00
buffer Fix various spelling issues in the documentation 2019-06-27 14:25:50 -07:00
checker Update canonical repository. 2019-06-13 16:50:15 -07:00
hash/jenkins Update canonical repository. 2019-06-13 16:50:15 -07:00
header Use tcpip.Subnet in tcpip.Route 2019-08-21 15:31:18 -07:00
iptables Plumbing for iptables sockopts. 2019-08-02 16:26:48 -07:00
link Internal change. 2019-08-19 12:43:22 -07:00
network Use tcpip.Subnet in tcpip.Route 2019-08-21 15:31:18 -07:00
ports Update canonical repository. 2019-06-13 16:50:15 -07:00
sample Use tcpip.Subnet in tcpip.Route 2019-08-21 15:31:18 -07:00
seqnum Update canonical repository. 2019-06-13 16:50:15 -07:00
stack Use tcpip.Subnet in tcpip.Route 2019-08-21 15:31:18 -07:00
transport Support binding to multicast and broadcast addresses 2019-08-21 22:54:25 -07:00
BUILD Plumbing for iptables sockopts. 2019-08-02 16:26:48 -07:00
tcpip.go Use tcpip.Subnet in tcpip.Route 2019-08-21 15:31:18 -07:00
tcpip_test.go Use tcpip.Subnet in tcpip.Route 2019-08-21 15:31:18 -07:00
time.s Change copyright notice to "The gVisor Authors" 2019-04-29 14:26:23 -07:00
time_unsafe.go Add build guard to files using go:linkname 2019-05-30 12:09:39 -07:00