* Daniel Fuchs: > Hi Florian, > > On 04/10/2019 16:25, Florian Weimer wrote: >> Doesn't it introduce a race condition where the socket has a port and >> queue packets, but the kernel will not perform source address checking >> because it is unconnected? > > The long standing behavior of DatagramSocket::connect is to throw out > any packet in the queue after connecting, so this changes nothing. > > See at line 897: > http://cr.openjdk.java.net/~dfuchs/webrev_8231260/webrev.00/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java.frames.html
Yes, sorry, it's a bit non-obvious though. Maybe add a comment that arriving packets are either flushed by the kernel or by connect() further down? Thanks, Florian