[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Re: [lwip] Buglet in lwip_recvfrom() [patch]
From: |
Adam Dunkels |
Subject: |
[lwip-users] Re: [lwip] Buglet in lwip_recvfrom() [patch] |
Date: |
Wed, 08 Jan 2003 23:48:09 -0000 |
Hi!
Thanks!
/adam
On Fri, 2002-08-02 at 12:10, Duncan Palmer wrote:
> lwip_recvfrom() was converting the port number of the incoming connection
> into network byte order which is incorrect - the socket structures are sposed
> to contain information in host byte order. udp_input() and tcp_input()
> convert port numbers into host byte order, and udp_send() and tcp_output()
> convert the port numbers back into network byte order. One-liner patch
> attached...
> ----
>
> --- 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);
--
Adam Dunkels <address@hidden>
http://www.dunkels.com/adam/
[This message was sent through the lwip discussion list.]