diff options
author | Chris Kuiper <ckuiper@google.com> | 2018-12-16 23:04:56 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-12-16 23:05:59 -0800 |
commit | e491ebbacf548a2a2f818f1093b09d6f1c13e7e0 (patch) | |
tree | 054813166ec5294ff089682c8528a43fdf704a66 /pkg/tcpip/stack/stack.go | |
parent | f74eed464b55d9640432432cd96d811578e9081e (diff) |
Allow sending of multicast and IPv6 link-local packets w/o route.
Same as with broadcast packets, sending of a multicast packet shouldn't require
accessing the route table. The same applies to IPv6 link-local addresses, which
aren't routable at all (they don't belong to any subnet by definition).
PiperOrigin-RevId: 225775870
Change-Id: Ic53e6560c125a83be2be9c3d112e66b36e8dfe7b
Diffstat (limited to 'pkg/tcpip/stack/stack.go')
-rw-r--r-- | pkg/tcpip/stack/stack.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pkg/tcpip/stack/stack.go b/pkg/tcpip/stack/stack.go index d39878a88..0ac116675 100644 --- a/pkg/tcpip/stack/stack.go +++ b/pkg/tcpip/stack/stack.go @@ -729,8 +729,11 @@ func (s *Stack) FindRoute(id tcpip.NICID, localAddr, remoteAddr tcpip.Address, n s.mu.RLock() defer s.mu.RUnlock() - // We don't require a route in the table to send a broadcast out on a NIC. - if id != 0 && remoteAddr == header.IPv4Broadcast { + // We don't require a route in the table to send a broadcast, multicast or + // IPv6 link-local packet out on a NIC. + isBroadcast := remoteAddr == header.IPv4Broadcast + isMulticast := header.IsV4MulticastAddress(remoteAddr) || header.IsV6MulticastAddress(remoteAddr) + if id != 0 && (isBroadcast || isMulticast || header.IsV6LinkLocalAddress(remoteAddr)) { if nic, ok := s.nics[id]; ok { if ref := s.getRefEP(nic, localAddr, netProto); ref != nil { return makeRoute(netProto, ref.ep.ID().LocalAddress, remoteAddr, nic.linkEP.LinkAddress(), ref), nil |