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)

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

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>
Group administrator
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>
Group administrator
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>

 

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

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

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

    Date Changed by Updated Field Previous Value => Replaced by
    2010-06-15 goldsimon Open/ClosedOpen Closed
    2010-06-15 goldsimon StatusIn Progress Fixed
    2010-06-12 goldsimon StatusNone In Progress
        Assigned toNone goldsimon
        Planned Release 1.4.0
    2010-05-26 mdarland Attached File- Added dhcp.c.diff, #20627
        Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code