buglwIP - A Lightweight TCP/IP stack - Bugs: bug #56288, IP forward problem with hardware...

 
 

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

bug #56288: IP forward problem with hardware and software checksum calculation interfaces

Submitter:  Mehran Msba <msba>
Submitted:  Wed 08 May 2019 12:12:10 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:  2.0.2

Thu 24 Feb 2022 01:40:35 PM UTC, comment #3: 

comment #2:

> Fixed by seting checksum fields of IP/UDP/TCP/ICMP to 0 in ip4_forward().


Hi Simon,

I have reviewed the commit which relates to this bug at https://git.savannah.nongnu.org/cgit/lwip.git/commit/?id=61c67fc2295e522c7a12175581d6928c3951c0bf and I believe the changes it includes may be causing an issue in our scenario.

We are using an i.MX RT 1050 EVKB with LWIP 2.2.0 which has a built in Ethernet interface, we are also using NXP's virtual RNDIS USB network driver which is software-based.

When forwarding packets from the Ethernet interface to the USB RNDIS interface (which definitely does not feature hardware checksum offload) checksums are being zeroed by the lines in this commit and then not subsequently recalculated. This is happening because CHKSUM_GEN_IP, CHKSUM_GEN_UDP, CHKSUM_GEN_TCP, CHKSUM_GEN_ICMP are all set to 1, i.e. generate checksums in software, however it would appear to me that for the software checksum use-case checksums should not be set to zero at these lines. Is this an error in the patch?

An additional observation that I had is that the other half of the if check appears to be looking to see if the output interface supports hardware-offload, however the pointer 'inp' refers to the the input interface. 'netif' is the output interface, would this be the correct interface to check for hardware offload support?

If my conclusions above are correc0t, should the check actually be more along the lines of

if (!CHECKSUM_GEN_IP || NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_IP))

? That is assuming that the latter check will be true in the case where 'netif' supports hardware offload.

Regards,
Tom Gibson

Tom Gibson <tomgibson>
Thu 30 Jan 2020 10:03:40 PM UTC, comment #2: 

Fixed by seting checksum fields of IP/UDP/TCP/ICMP to 0 in ip4_forward().

Simon Goldschmidt <goldsimon>
Group administrator
Tue 14 May 2019 07:36:34 PM UTC, comment #1: 

Well, it seems the forwarding case just has been forgotten when adding the "hw checksum per interface" feature.

Care to provide a patch?

Simon Goldschmidt <goldsimon>
Group administrator
Wed 08 May 2019 12:12:10 PM UTC, original submission:  

Test Conditions
0.IPv6 is not active
1.ETH interface with hardware checksum calculation
2.PPP over serial with software checksum calculation
3.These options are active:
#define IP_FORWARD                   1
#define LWIP_CHECKSUM_CTRL_PER_NETIF 1
#define CHECKSUM_GEN_IP      1
#define CHECKSUM_GEN_UDP     1
#define CHECKSUM_GEN_TCP     1
#define CHECKSUM_GEN_ICMP    1
#define CHECKSUM_CHECK_IP    1
#define CHECKSUM_CHECK_UDP   1
#define CHECKSUM_CHECK_TCP   1
#define CHECKSUM_CHECK_ICMP  1

4. Calculations set per interface:
  NETIF_SET_CHECKSUM_CTRL(&ethNetif,NETIF_CHECKSUM_DISABLE_ALL);
  NETIF_SET_CHECKSUM_CTRL(&ppposNetif,NETIF_CHECKSUM_ENABLE_ALL);
 
Both interface work without problem But IP forward between these interfaces have checksum error.

for more details,Consider this scenario,

--------              -------------------                -------
| PC1  |---->ETH----->| Board with LWIP |----->PPPos---->| PC2 |
--------              -------------------                -------
                 192.168.0.1/24   192.168.125.1/24

PC1 configurations are 192.168.0.2/24  ,Gateway 192.168.0.1
PC2 configurations are 192.168.125.2/24,Gateway 192.168.125.1

report of connectivity check on PC1:
1. Ping 192.168.0.1    ->Reply OK
2. Ping 192.168.125.1  ->Reply OK
3. Ping 192.168.125.2  ->Reply Timeout

report of connectivity check on PC2:
1. Ping 192.168.125.1    ->Reply OK
2. Ping 192.168.0.1      ->Reply OK
3. Ping 192.168.0.2      ->Reply Timeout

I check Wire-shark logs and see the reply of other side,but checksum of this reply is 0,so the Ping is failed.
 
I set software checksum calculation in both interfaces and there is no problem at all.

I check the forward function too and I can not find any "if" statement for Hardware or software checksum calculation.


Mehran Msba <msba>

 

(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 tomgibson (Posted a comment)
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by msba (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
    2020-01-30 goldsimon StatusNone Fixed
        Assigned toNone goldsimon
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code