mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Allow rebinding packet socket protocol
...to change the network protocol a packet socket may receive packets from. This CL is a portion of an originally larger CL that was split with https://github.com/google/gvisor/commit/a8ad692fd36cbaf7f5a6b9af39d601053dbee338 being the dependent CL. That CL (accidentally) included the change in the endpoint's `afterLoad` method to take the required lock when accessing the endpoint's netProto field. That change should have been in this CL. The CL that made the change mentioned in the commit message is cl/396946187. PiperOrigin-RevId: 397412582
This commit is contained in:
committed by
gVisor bot
parent
4076153be6
commit
7dacdbef52
@@ -672,13 +672,10 @@ func (s *socketOpsCommon) Bind(t *kernel.Task, sockaddr []byte) *syserr.Error {
|
||||
}
|
||||
a.UnmarshalBytes(sockaddr[:sockAddrLinkSize])
|
||||
|
||||
if a.Protocol != uint16(s.protocol) {
|
||||
return syserr.ErrInvalidArgument
|
||||
}
|
||||
|
||||
addr = tcpip.FullAddress{
|
||||
NIC: tcpip.NICID(a.InterfaceIndex),
|
||||
Addr: tcpip.Address(a.HardwareAddr[:header.EthernetAddressSize]),
|
||||
Port: socket.Ntohs(a.Protocol),
|
||||
}
|
||||
} else {
|
||||
if s.minSockAddrLen() > len(sockaddr) {
|
||||
|
||||
Reference in New Issue
Block a user