lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] [lwip] Buglet in lwip_recvfrom() [patch]


From: Duncan Palmer
Subject: [lwip-users] [lwip] Buglet in lwip_recvfrom() [patch]
Date: Wed, 08 Jan 2003 23:16:34 -0000

--Boundary_(ID_RGQaZD0WQPkHi2dMZa5MMA)
Content-type: text/plain; charset=iso-8859-1
Content-transfer-encoding: quoted-printable

lwip_recvfrom() was converting the port number of the incoming connection=
=20
into network byte order which is incorrect - the socket structures are sp=
osed=20
to contain information in host byte order. udp_input() and tcp_input()=20
convert port numbers into host byte order, and udp_send() and tcp_output(=
)=20
convert the port numbers back into network byte order. One-liner patch=20
attached...

--Boundary_(ID_RGQaZD0WQPkHi2dMZa5MMA)
Content-type: text/x-c; name=sockets.c.patch; charset=iso-8859-1
Content-disposition: attachment; filename=sockets.c.patch
Content-transfer-encoding: 8bit

--- lwip-cvs-20020529/src/api/sockets.c Wed May 29 15:00:16 2002
+++ tcpip/src/api/sockets.c     Thu Aug  1 19:03:57 2002
@@ -269,7 +269,7 @@
   /* Check to see from where the data was. */
   if(from != NULL && fromlen != NULL) {
     addr = netbuf_fromaddr(buf);
-    port = htons(netbuf_fromport(buf));  
+    port = netbuf_fromport(buf);  
     ((struct sockaddr_in *)from)->sin_addr.s_addr = addr->addr;
     ((struct sockaddr_in *)from)->sin_port = port;
     *fromlen = sizeof(struct sockaddr_in);

--Boundary_(ID_RGQaZD0WQPkHi2dMZa5MMA)--
[This message was sent through the lwip discussion list.]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]