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

Submitted by:  Stephane Lesage <slesage>
Submitted on:  Fri 09 Jul 2010 09:39:32 PM UTC  
 
Category: IPv4Severity: 3 - Normal
Item Group: Faulty BehaviourStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned Release: None
lwIP version: CVS Head

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

Fixed again, thanks.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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>

 

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
  • -unavailable- added by goldsimon (Posted a comment)
  • -unavailable- added by slesage (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 10 Jul 2010 12:02:52 PM UTCgoldsimonStatusNone=>Fixed
      Assigned toNone=>goldsimon
      Open/ClosedOpen=>Closed
    Fri 09 Jul 2010 09:39:32 PM UTCslesageAttached File-=>Added ip.c.patch, #20933

    Back to the top


    Powered by Savane 3.1-cleanup1