buglwIP - A Lightweight TCP/IP stack - Bugs: bug #30402, CHECKSUM_GEN_IP_INLINE does not...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #30402: CHECKSUM_GEN_IP_INLINE does not add IP options

Submitter:  Stephane Lesage <slesage>
Submitted:  Fri 09 Jul 2010 09:39:32 PM UTC
   
 
Category:  IPv4 Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Fixed
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned Release:  None
lwIP version:  CVS Head

Wed 21 Jul 2010 12:11:54 PM UTC, comment #3: 

Fixed again, thanks.

Simon Goldschmidt <goldsimon>
Group administrator
Wed 21 Jul 2010 11:49:44 AM UTC, comment #2: 

Hi,

you restyled my patch

from

    u16_t* opt = (u16_t*)p->payload;
    for (i=0; i<optlen_aligned/2; i++) {
        chk_sum += *opt++;
    }
to
    for (i = 0; i < optlen_aligned; i += sizeof(u16_t)) {
        chk_sum += ((u16_t*)p->payload)[i];
    }

But this is wrong because you mix byte index in the loop counter and word index in the array.

please fix with:

for (i = 0; i < optlen_aligned/2; i++) {
    chk_sum += ((u16_t*)p->payload)[i];
}

Stephane Lesage <slesage>
Sat 10 Jul 2010 12:02:52 PM UTC, comment #1: 

Fixed, thanks for reporting.

Simon Goldschmidt <goldsimon>
Group administrator
Fri 09 Jul 2010 09:39:32 PM UTC, original submission:  

Hi,

the new LWIP_INLINE_IP_CHKSUM defaults to 1, and with CHECKSUM_GEN_IP enabled, CHECKSUM_GEN_IP_INLINE is enabled.

ip_output_if_opt() was working fine, but now the inline checksum generation forgets to add the IP options.

I detected that using IGMP (we want IP_OPTIONS_SEND to add the Router Alert option)

Here's a simple patch to add options to the checksum.

One might want to combine checksum and copy, but mixing with unaligned option length is not trivial. Shall we force caller to use aligned options and ASSERT ?




Stephane Lesage <slesage>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #20933:  ip.c.patch added by slesage (1KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by slesage (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-07-10 goldsimon StatusNone Fixed
        Assigned toNone goldsimon
        Open/ClosedOpen Closed
    2010-07-09 slesage Attached File- Added ip.c.patch, #20933

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code