mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
netstack: verify stack supports protocol before finding route
Not doing so breaks the assumption of later code that netProto is supported by the stack. PiperOrigin-RevId: 571436763
This commit is contained in:
committed by
gVisor bot
parent
ba1c60263e
commit
9cb26fd34f
@@ -1305,6 +1305,11 @@ func (s *Stack) FindRoute(id tcpip.NICID, localAddr, remoteAddr tcpip.Address, n
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
|
||||
// Reject attempts to use unsupported protocols.
|
||||
if !s.CheckNetworkProtocol(netProto) {
|
||||
return nil, &tcpip.ErrUnknownProtocol{}
|
||||
}
|
||||
|
||||
isLinkLocal := header.IsV6LinkLocalUnicastAddress(remoteAddr) || header.IsV6LinkLocalMulticastAddress(remoteAddr)
|
||||
isLocalBroadcast := remoteAddr == header.IPv4Broadcast
|
||||
isMulticast := header.IsV4MulticastAddress(remoteAddr) || header.IsV6MulticastAddress(remoteAddr)
|
||||
|
||||
Reference in New Issue
Block a user