[Top][All Lists]

[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)


                 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?


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.


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:

File Attachments:

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



Reply to this item at:


Message sent via Savannah

reply via email to

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