This repository was archived by the owner on May 20, 2020. It is now read-only.
This repository was archived by the owner on May 20, 2020. It is now read-only.
udp.ForwarderRequest.CreateEndpoint doesn't set endpoint.effectiveNetProtos #27
Open
Description
The endpoint returned by udp.ForwarderRequest.CreateEndpoint
doesn't have effectiveNetProtos
filled (it's nil
).
Maybe I'm missing something and I should do some initialization by hand?
There're two things that make me think this is not true:
- Endpoints returned by
tcp.ForwarderRequest.CreateEndpoint
have theireffectiveNetProtos
set. - A test that uses
udp.Forwarder
at https://github.com/google/gvisor/blob/master/pkg/tcpip/adapters/gonet/gonet_test.go#L354 doesn't do anything more thanCreateEndpoint
.
Missing effectiveNetProtos
means that such endpoint won't be closed correctly: while stack.RegisterTransportEndpoint
is called with hardcoded netProtos
in ForwarderRequest.CreateEndpoints
, the UnregisterTransportEndpoint
in endpoint.Close
is called with netprotos == nil
.
This means that the code as simple as
...
var wq waiter.Queue
f := udp.NewForwarder(s, func(r *udp.ForwarderRequest) {
if zalupa, err := r.CreateEndpoint(&wq); err == nil {
log.Printf("Packet received: %v", r.ID())
zalupa.Close()
}
})
s.SetTransportProtocolHandler(udp.ProtocolNumber, f.HandlePacket)
...
misses new packets if the source port is reused.
Metadata
Metadata
Assignees
Labels
No labels