lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] [lwip] lwip-cvs-20020108 errors


From: Horst Garnetzke
Subject: [lwip-users] [lwip] lwip-cvs-20020108 errors
Date: Thu, 09 Jan 2003 00:39:25 -0000

Hi Adam,

in your actual cvs sources I found some problems. Perhaps you
may take the following hints over into your sources:

cvs-sources from 2002-01-08 (morning):

----------------------------------------------------------------
ip.c
in ip_input() function:

netmask-independant ip broadcast (255.255.255.255) is not recognized 
correct!

     if(ip_addr_isany(&(netif->ip_addr)) ||
        ip_addr_cmp(&(iphdr->dest), &(netif->ip_addr)) ||
        (ip_addr_isbroadcast(&(iphdr->dest), &(netif->netmask)) &&
         ip_addr_maskcmp(&(iphdr->dest), &(netif->ip_addr), 
&(netif->netmask)))) {
       break;
     }

Your function ip_addr_isbroadcast() works correct but it is ANDed with
ip_addr_maskcmp() - why? Only local broadcasts are recognized in that way.
General Broadcasts (255.255.255.255) are dropped!
Without ip_addr_maskcmp() general broadcasts are recognized too.


-----------------------------------------------------------------
inet.h

please add lower case define's (needed for big endian):

#ifndef NTOHS
#   define NTOHS HTONS
#   define ntohs htons  /*+hg added*/
#endif /* NTOHS */

#ifndef NTOHL
#   define NTOHL HTONL
#   define ntohl htonl  /*+hg added*/
#endif /* NTOHL */

because there are serveral "ntohl()" -lower case- calls
in your sources.

------------------------------------------------------------------
core/udp.c

udp_input() function

There is a problem in checksum calculation with your last changes:

   iphdr = p->payload;
   udphdr = (struct udp_hdr *)((u8_t *)p->payload + IPH_HL(iphdr) * 
4/sizeof(u8_t));

   pbuf_header(p, -(UDP_HLEN + IPH_HL(iphdr) * 4));

                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

p is adjusted to point _behind_ udp-header! This doesn't work with the 
later checksum calculation inet_chksum_pseudo()!

You should change the adjust before checksum calculation to

  pbuf_header(p, -(IPH_HL(iphdr) * 4)); /*+hg*/

and after checksum calculation with another

  pbuf_header(p, -(UDP_HLEN));  /*+hg*/

to the right data pointer.

Tested with Linux/scotty.
--------------------------------------------------------------------

So long

/Horst

-- 
Horst Garnetzke                      address@hidden
PULSAR GmbH,  Sorbenstrasse 45,   D-20537 Hamburg
++49 40 251546-11 (-17 FAX)  http://www.pulsar.de

[This message was sent through the lwip discussion list.]




reply via email to

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