UDP/DTLS sockets communication pattern is broken in Cygwin

Oleg Moskalenko oleg.moskalenko@citrix.com
Fri Apr 12 02:35:00 GMT 2013


I am sending the test case in the attachment. 

In the attachment, you will find source code for two programs - udpbugserver and udpbugclient. "make" will build them both. They work perfectly together in Linux, FreeBSD and Solaris. But they fail in Cygwin.

Thanks
Oleg

> 
> On Thu, Apr 11, 2013 at 02:19:25PM -0700, Oleg Moskalenko wrote:
> >Hi All
> >
> >I found a non-standard behavior of UDP sockets in Cygwin. Normally, people =
> do not experience it, but the communication pattern that I am going to desc=
> ribe here is often used in DTLS (actually, this is virtually the only way t= o make
> OpenSSL working with DTLS on the server side), so I suppose that wit= h the
> growing DTLS popularity people will experience the problem often.
> >
> >So this is how to reproduce the problem in "plain" UDP (without actually using
> DTLS):
> >
> >1)      Server application: open a UDP socket (socket A);
> >
> >2)      Server application: bind socket A to a local server address (say,
> 172.17.17.107:3478);
> >
> >3)      Server application: wait for a packet from a client application;
> >
> >4)      Client application: open a UDP socket (socket C);
> >
> >5)      Client application: bind socket C it to a local client address (say,
> 168.16.16.106:12345);
> >
> >6)      Client application: send a UDP packet P1 from socket C to server socket A
> (to 172.17.17.107:3478);
> >
> >7)      Server application: socket A receives the packet P1 from socket C;
> >
> >8)      Server application: create another UDP socket B;
> >
> >9)      Server application: bind socket B TO THE SAME LOCAL ADDRESS as socket
> A (172.17.17.107:3478);
> >
> >10)   Server application: connect socket B to the remote address of socket C
> (168.16.16.106:12345) by calling connect() on the datagram socket B.
> >
> >11)   Server application: send packet P2 from socket B to socket C (to
> 168.16.16.106:12345).
> >
> >12)   Client application: on socket C, receive packet P2 from socket B (from
> 172.17.17.107:3478).
> >
> >13)   Client application: from socket C, send packet P3 to the server address
> 172.17.17.107:3478.
> >
> >14)   Server application: socket A receives the packet P3 from the client socket.
> ERROR !!!
> >
> >Step 14 is wrong: the packet P3 must be delivered to socket B, because socket
> B is "connected"
> >to the remote address 168.16.16.106:12345, but socket A  is "unconnected".
> >Both sockets (A and B) are "bound" to the same server ad= dress
> >(172.17.17.107:3478) but the connected one (socket B) must be obtaining
> packets from the remote address that it is connected to.
> >
> >This is a very essential functionality for anybody who wants to implement the
> server-side DTLS communications.
> >
> >This patterns works in any OS that I tried (all FreeBSD versions, all Linux
> versions and Solaris) but Cygwin fails, unfortunately.
> >
> >I am trying to migrate (port) our server application to Cygwin, and it stops us
> completely. It works everywhere else.
> >
> >Please take a look if this is something that can be fixed quickly.
> 
> How about a simple test case?
> 
> cgf
> 
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygwinbug.tar.gz
Type: application/x-gzip
Size: 3537 bytes
Desc: cygwinbug.tar.gz
URL: <http://cygwin.com/pipermail/cygwin/attachments/20130412/980377db/attachment.bin>
-------------- next part --------------
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


More information about the Cygwin mailing list