lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #63312] sockets bug? Port endianness


From: Brendan McDonnell
Subject: [lwip-devel] [bug #63312] sockets bug? Port endianness
Date: Thu, 3 Nov 2022 16:04:27 -0400 (EDT)

URL:
  <https://savannah.nongnu.org/bugs/?63312>

                 Summary: sockets bug? Port endianness
                 Project: lwIP - A Lightweight TCP/IP stack
               Submitter: bmcdonnell_npm
               Submitted: Thu 03 Nov 2022 08:04:25 PM UTC
                Category: sockets/netconn
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: Other


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Thu 03 Nov 2022 08:04:25 PM UTC By: Brendan McDonnell <bmcdonnell_npm>
My socket-based IPv4 only program doesn't work with lwIP. It seems that there
is an endian issue with the UDP/TCP ports. As shown in the attached
screenshot, I have to modify lwIP's IP4ADDR_PORT_TO_SOCKADDR() and
SOCKADDR4_TO_IP4ADDR_PORT() macros by removing the byte swaps on the ports
(i.e. removing lwip_htons() and lwip_ntohs()), to make my program work, and
for the TCP/UDP ports to show as expected in Wireshark. Is this an lwIP bug,
or is there somehow something wrong with my configuration?

Details:

The attached zip contains sample code from NXP for their i.MX RT1170
Evaluation Kit (board URL below). The included lwIP appears to be based on the
2.2.0 development branch. It does not include my sockets code, nor the patch
to lwIP in my screenshot.

https://www.nxp.com/design/development-boards/i-mx-evaluation-and-development-boards/i-mx-rt1170-evaluation-kit:MIMXRT1170-EVK

I checked out the sample using MCUXpresso IDE v11.6.1 (Quickstart Panel ->
Import SDK example(s)).

Relevant lwipopts:
#define LWIP_SOCKET  1
#define LWIP_IPV4    1
#define LWIP_IPV6    0

Via platform #defines / #ifdefs:
BYTE_ORDER == _LITTLE_ENDIAN == 1234






    _______________________________________________________
File Attachments:


-------------------------------------------------------
Date: Thu 03 Nov 2022 08:04:25 PM UTC  Name: lwip-git-diff.png  Size: 36KiB  
By: bmcdonnell_npm

<http://savannah.nongnu.org/bugs/download.php?file_id=53926>

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?63312>

_______________________________________________
Message sent via Savannah
https://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]