buglwIP - A Lightweight TCP/IP stack - Bugs: bug #36318, Wrong UDP data size for small...

 
 

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

bug #36318: Wrong UDP data size for small datagrams

Submitter:  dagos <dagos>
Submitted:  Thu 26 Apr 2012 03:51:52 PM UTC
   
 
Category:  UDP Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Invalid
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned Release:  None
lwIP version:  1.4.0

Fri 27 Apr 2012 12:34:23 PM UTC, comment #5: 

Padding is at Ethernet level, when ethernet frame is less than 64 bytes (including CRC)

I found the (real) problem.
It is not LWIP (sorry for this post...) but my input ethernet frame which was not correct (error in IP size field).

ethernet frame (at 0x11: 0x2e):
0000  00 30 84 89 9b 81 02 00  02 00 00 01 08 00 45 00   .0...... ......E.
0010  00 2e 1e 00 00 00 1e 11  69 a6 0a 81 00 0a 0a 81   ........ i.......
0020  00 0e 04 0e 04 fe 00 15  a0 5f 00 03 00 01 00 00   ........ ._......
0030  00 09 41 31 00 01 00 00  00 00 00 00               ..A1.... ....
instead of (at 0x11: 0x29):
0000  00 30 84 89 9b 81 02 00  02 00 00 01 08 00 45 00   .0...... ......E.
0010  00 29 1e 00 00 00 1e 11  69 a6 0a 81 00 0a 0a 81   ........ i.......
0020  00 0e 04 0e 04 fe 00 15  a0 5f 00 03 00 01 00 00   ........ ._......
0030  00 09 41 31 00 01 00 00  00 00 00 00               ..A1.... ....

So this bug can be close, sorry.

dagos <dagos>
Thu 26 Apr 2012 06:49:49 PM UTC, comment #4: 

It works for me as well. Furthermore, my Udp.c (close to if not most current) has no assignment to p->tot_len anywhere in it.

Bill Auerbach <billauerbach>
Thu 26 Apr 2012 06:39:42 PM UTC, comment #3: 

Checksums are not optional for UDP either unless the sender sets the chksum field to zero.

I'm wondering what the OP means with 'UDP datagram WITH PADDING'? Small packets have always worked correctly for me...

Simon Goldschmidt <goldsimon>
Group administrator
Thu 26 Apr 2012 06:01:22 PM UTC, comment #2: 

I'm wondering if it were true for TCP, would TCP work at all?  Checksums are not optional.

Bill Auerbach <billauerbach>
Thu 26 Apr 2012 04:04:26 PM UTC, comment #1: 

maybe same problem for TCP ? I don't yet try it...

dagos <dagos>
Thu 26 Apr 2012 03:51:52 PM UTC, original submission:  

When a UDP datagram WITH PADDING is read by LWIP, p->tot_len includes padding size.
This is wrong for 2 reasons:
- CheckSum calculation will fail (p->tot_len is used instead of UDP total size field), and the paquet is rejected (if CHECKSUM_CHECK_UDP = 1)
- Data size given by p->tot_len is wrong so more data could be read by the application.

To solve the problem, add in udp.c, l.114:
+ p->tot_len = ntohs(udphdr->len);  // DELETE PADDING

dagos <dagos>

 

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

No files currently attached

 

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 billauerbach (Posted a comment)
  • -email is unavailable- added by dagos (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-04-27 goldsimon StatusNone Invalid
        Assigned toNone goldsimon
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code