buglwIP - A Lightweight TCP/IP stack - Bugs: bug #29970, DHCP endian issues parsing option...

 
 

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

bug #29970: DHCP endian issues parsing option responses (w/ patch)

Submitted by:  Matt Darland <mdarland>
Submitted on:  Wed 26 May 2010 02:34:52 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

Tue 15 Jun 2010 08:20:24 PM UTC, comment #2:

Fixed like suggested in comment #1, please reopen if it didn't work like I expected.

Thanks for reporting, Matt!

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Sat 12 Jun 2010 06:57:01 PM UTC, comment #1:

Sorry for needing so long to reply (I've been on holiday for some time..).

Reading your patch, wouldn't it be enough to change the last else case to:

+ value = ((u8_t*)value)[0];

I would have expected the other two cases being correct (as they use htonl). This way, we could save an extra copy and prevent implement extra shifting macros (as some processors might have special instructions for htonl that are faster).

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Wed 26 May 2010 02:34:52 PM UTC, original submission:

DHCP options parsing makes assumptions about endianess that are incorrect and leads to faulty options parsing. In particular, reading a raw byte sequence directly into a u32_t* and then reading the integer as a 1-byte value does not work for all platforms. Attached is the patch.

Matt Darland <mdarland>

 

Attached Files
file #20627:  dhcp.c.diff added by mdarland (2KiB - text/x-patch - Patch against CVS head dhcp.c)

 

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 mdarland (Submitted the item)
  • -unavailable- added by mdarland
  •  

    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 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 15 Jun 2010 08:20:24 PM UTCgoldsimonOpen/ClosedOpen=>Closed
    Tue 15 Jun 2010 08:20:23 PM UTCgoldsimonStatusIn Progress=>Fixed
    Sat 12 Jun 2010 06:57:01 PM UTCgoldsimonStatusNone=>In Progress
      Assigned toNone=>goldsimon
      Planned Release=>1.4.0
    Wed 26 May 2010 02:34:52 PM UTCmdarlandAttached File-=>Added dhcp.c.diff, #20627
      Carbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1