From: Joan Lledó <[email protected]>

---
 debian/patches/posixlib | 107 +++++++++++++++++++++++++++++-----------
 1 file changed, 79 insertions(+), 28 deletions(-)

diff --git a/debian/patches/posixlib b/debian/patches/posixlib
index 38b6c82..2e8fcc9 100644
--- a/debian/patches/posixlib
+++ b/debian/patches/posixlib
@@ -3,8 +3,10 @@ Forwarded: https://savannah.nongnu.org/patch/?10536
 Author: Joan Lledó <[email protected]>
 Last-Update: 2024-01-13
 
---- a/contrib/ports/unix/posixlib/CMakeLists.txt
-+++ b/contrib/ports/unix/posixlib/CMakeLists.txt
+Index: lwip-deb/contrib/ports/unix/posixlib/CMakeLists.txt
+===================================================================
+--- lwip-deb.orig/contrib/ports/unix/posixlib/CMakeLists.txt   2026-01-04 
19:31:57.000000000 +0100
++++ lwip-deb/contrib/ports/unix/posixlib/CMakeLists.txt        2026-01-04 
19:31:57.000000000 +0100
 @@ -1,8 +1,8 @@
  cmake_minimum_required(VERSION 3.8)
  project(liblwip
@@ -65,8 +67,10 @@ Last-Update: 2024-01-13
  add_custom_target(uninstall
    "${CMAKE_COMMAND}" -P "${PROJECT_SOURCE_DIR}/Uninstall.cmake")
  
---- /dev/null
-+++ b/contrib/ports/unix/posixlib/lwip.pc.in
+Index: lwip-deb/contrib/ports/unix/posixlib/lwip.pc.in
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ lwip-deb/contrib/ports/unix/posixlib/lwip.pc.in    2026-01-04 
19:31:57.000000000 +0100
 @@ -0,0 +1,10 @@
 +prefix=@CMAKE_INSTALL_PREFIX@
 +exec_prefix=${prefix}
@@ -78,8 +82,10 @@ Last-Update: 2024-01-13
 +Version: @LWIP_VERSION_MAJOR@.@LWIP_VERSION_MINOR@.@LWIP_VERSION_REVISION@
 +Libs: -L${libdir} -llwip
 +Cflags: -I${includedir}
---- a/contrib/ports/unix/port/sys_arch.c
-+++ b/contrib/ports/unix/port/sys_arch.c
+Index: lwip-deb/contrib/ports/unix/port/sys_arch.c
+===================================================================
+--- lwip-deb.orig/contrib/ports/unix/port/sys_arch.c   2026-01-04 
19:31:57.000000000 +0100
++++ lwip-deb/contrib/ports/unix/port/sys_arch.c        2026-01-04 
19:31:57.000000000 +0100
 @@ -73,9 +73,6 @@
  static pthread_key_t sys_thread_sem_key;
  #endif
@@ -142,8 +148,10 @@ Last-Update: 2024-01-13
      }
    }
    sem->c--;
---- a/contrib/ports/unix/posixlib/include/posix/inet.h
-+++ b/contrib/ports/unix/posixlib/include/posix/inet.h
+Index: lwip-deb/contrib/ports/unix/posixlib/include/posix/inet.h
+===================================================================
+--- lwip-deb.orig/contrib/ports/unix/posixlib/include/posix/inet.h     
2026-01-04 19:31:57.000000000 +0100
++++ lwip-deb/contrib/ports/unix/posixlib/include/posix/inet.h  2026-01-04 
19:31:57.000000000 +0100
 @@ -1,5 +1,5 @@
  /*
 - * Copyright (C) 2023 Joan Lled� <[email protected]>
@@ -162,14 +170,32 @@ Last-Update: 2024-01-13
  
  #include <arpa/inet.h>
  #include <netinet/in.h>
-@@ -73,4 +73,4 @@
+@@ -44,15 +44,6 @@
+ #define inet_addr_from_ip4addr(target_inaddr, source_ipaddr) 
((target_inaddr)->s_addr = ip4_addr_get_u32(source_ipaddr))
+ #define inet_addr_to_ip4addr(target_ipaddr, source_inaddr)   
(ip4_addr_set_u32(target_ipaddr, (source_inaddr)->s_addr))
+ 
+-#ifdef LWIP_UNIX_HURD
+-#define IP_PKTINFO  8
+-
+-struct in_pktinfo {
+-  unsigned int   ipi_ifindex;  /* Interface index */
+-  struct in_addr ipi_addr;     /* Destination (from header) address */
+-};
+-#endif /* LWIP_UNIX_HURD */
+-
+ #endif /* LWIP_IPV4 */
+ 
+ #if LWIP_IPV6
+@@ -73,4 +64,4 @@
  }
  #endif
  
 -#endif /* HURD_LWIP_POSIX_INET_H */
 +#endif /* POSIX_LWIP_POSIX_INET_H */
---- a/contrib/ports/unix/posixlib/include/posix/sockets.h
-+++ b/contrib/ports/unix/posixlib/include/posix/sockets.h
+Index: lwip-deb/contrib/ports/unix/posixlib/include/posix/sockets.h
+===================================================================
+--- lwip-deb.orig/contrib/ports/unix/posixlib/include/posix/sockets.h  
2026-01-04 19:31:57.000000000 +0100
++++ lwip-deb/contrib/ports/unix/posixlib/include/posix/sockets.h       
2026-01-04 19:32:21.000000000 +0100
 @@ -1,5 +1,5 @@
  /*
 - * Copyright (C) 2023 Joan Lled� <[email protected]>
@@ -177,7 +203,7 @@ Last-Update: 2024-01-13
   *
   * Redistribution and use in source and binary forms, with or without 
modification,
   * are permitted provided that the following conditions are met:
-@@ -24,40 +24,30 @@
+@@ -24,40 +24,36 @@
   * OF SUCH DAMAGE.
   */
  
@@ -217,24 +243,31 @@ Last-Update: 2024-01-13
 -      (sin6)->sin6_len = sizeof(struct sockaddr_in6)
 -#define IPADDR_SOCKADDR_GET_LEN(addr) \
 -      (addr)->sa.sa_len
--#else
++/* struct in_pktinfo includes ipi_spec_dst in Linux and the Hurd */
++#if defined(LWIP_UNIX_LINUX) || defined(LWIP_UNIX_HURD)
++#define LWIP_SOCKET_HAVE_IPI_SPEC_DST   1
+ #else
 -#define IP4ADDR_SOCKADDR_SET_LEN(addr)
 -#define IP6ADDR_SOCKADDR_SET_LEN(addr)
 -#define IPADDR_SOCKADDR_GET_LEN(addr) \
 -      ((addr)->sa.sa_family == AF_INET ? sizeof(struct sockaddr_in) \
 -        : ((addr)->sa.sa_family == AF_INET6 ? sizeof(struct sockaddr_in6) : 
0))
 -#endif /* HAVE_SA_LEN */
++#define LWIP_SOCKET_HAVE_IPI_SPEC_DST   0
++#endif
  
  #define SIN_ZERO_LEN  sizeof (struct sockaddr) - \
                             __SOCKADDR_COMMON_SIZE - \
-@@ -147,4 +137,4 @@
+@@ -147,4 +143,4 @@
  }
  #endif
  
 -#endif /* HURD_LWIP_POSIX_SOCKET_H */
 +#endif /* POSIX_LWIP_POSIX_SOCKET_H */
---- a/contrib/ports/unix/posixlib/lwipopts.h
-+++ b/contrib/ports/unix/posixlib/lwipopts.h
+Index: lwip-deb/contrib/ports/unix/posixlib/lwipopts.h
+===================================================================
+--- lwip-deb.orig/contrib/ports/unix/posixlib/lwipopts.h       2026-01-04 
19:31:57.000000000 +0100
++++ lwip-deb/contrib/ports/unix/posixlib/lwipopts.h    2026-01-04 
19:31:57.000000000 +0100
 @@ -1,5 +1,5 @@
  /*
 - * Copyright (C) 2023 Joan Lled� <[email protected]>
@@ -267,7 +300,15 @@ Last-Update: 2024-01-13
  
  /* Use Glibc malloc()/free() */
  #define MEM_LIBC_MALLOC   1
-@@ -112,6 +110,11 @@
+@@ -97,6 +95,7 @@
+ #define LWIP_SO_LINGER              1
+ #define SO_REUSE                    1
+ #define LWIP_MULTICAST_TX_OPTIONS   1
++#define LWIP_NETBUF_RECVINFO        1
+ 
+ /* Enable modules */
+ #define LWIP_ARP              1
+@@ -112,6 +111,11 @@
  #define LWIP_ICMP6            1
  #define LWIP_IPV6_MLD         1
  
@@ -279,14 +320,16 @@ Last-Update: 2024-01-13
  /* Don't abort the whole stack when an error is detected */
  #define LWIP_NOASSERT_ON_ERROR   1
  
-@@ -177,4 +180,4 @@
+@@ -177,4 +181,4 @@
  #define IP6_DEBUG         LWIP_DBG_OFF
  #endif
  
 -#endif /* UNIX_LWIP_LWIPOPTS_H */
 +#endif /* POSIX_LWIP_LWIPOPTS_H */
---- a/src/include/lwip/sys.h
-+++ b/src/include/lwip/sys.h
+Index: lwip-deb/src/include/lwip/sys.h
+===================================================================
+--- lwip-deb.orig/src/include/lwip/sys.h       2026-01-04 19:31:57.000000000 
+0100
++++ lwip-deb/src/include/lwip/sys.h    2026-01-04 19:31:57.000000000 +0100
 @@ -86,6 +86,9 @@
  /** Return code for timeouts from sys_arch_mbox_fetch and sys_arch_sem_wait */
  #define SYS_ARCH_TIMEOUT 0xffffffffUL
@@ -297,8 +340,10 @@ Last-Update: 2024-01-13
  /** sys_mbox_tryfetch() returns SYS_MBOX_EMPTY if appropriate.
   * For now we use the same magic value, but we allow this to change in future.
   */
---- a/src/api/sockets.c
-+++ b/src/api/sockets.c
+Index: lwip-deb/src/api/sockets.c
+===================================================================
+--- lwip-deb.orig/src/api/sockets.c    2026-01-04 19:31:57.000000000 +0100
++++ lwip-deb/src/api/sockets.c 2026-01-04 19:31:57.000000000 +0100
 @@ -2118,8 +2118,8 @@
          } else if (!nready) {
            /* Still none ready, just wait to be woken */
@@ -351,8 +396,10 @@ Last-Update: 2024-01-13
      if (nready < 0) {
        /* This happens when a socket got closed while waiting */
        lwip_poll_dec_sockets_used(fds, nfds);
---- a/contrib/ports/unix/port/include/arch/cc.h
-+++ b/contrib/ports/unix/port/include/arch/cc.h
+Index: lwip-deb/contrib/ports/unix/port/include/arch/cc.h
+===================================================================
+--- lwip-deb.orig/contrib/ports/unix/port/include/arch/cc.h    2026-01-04 
19:31:57.000000000 +0100
++++ lwip-deb/contrib/ports/unix/port/include/arch/cc.h 2026-01-04 
19:31:57.000000000 +0100
 @@ -43,8 +43,6 @@
  #define LWIP_UNIX_OPENBSD
  #elif defined __FreeBSD__
@@ -380,8 +427,10 @@ Last-Update: 2024-01-13
  /* sys/types.h and signal.h bring in Darwin byte order macros. pull the
     header here and disable LwIP's version so that apps still can get
     the macros via LwIP headers and use system headers */
---- /dev/null
-+++ b/contrib/ports/unix/posixlib/lwip_hooks.c
+Index: lwip-deb/contrib/ports/unix/posixlib/lwip_hooks.c
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ lwip-deb/contrib/ports/unix/posixlib/lwip_hooks.c  2026-01-04 
19:31:57.000000000 +0100
 @@ -0,0 +1,51 @@
 +/*
 + * Copyright (C) 2025 Joan Lledó <[email protected]>
@@ -434,8 +483,10 @@ Last-Update: 2024-01-13
 +}
 +
 +#endif /* LWIP_IPV4 */
---- /dev/null
-+++ b/contrib/ports/unix/posixlib/lwip_hooks.h
+Index: lwip-deb/contrib/ports/unix/posixlib/lwip_hooks.h
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ lwip-deb/contrib/ports/unix/posixlib/lwip_hooks.h  2026-01-04 
19:31:57.000000000 +0100
 @@ -0,0 +1,39 @@
 +/*
 + * Copyright (C) 2025 Joan Lledó <[email protected]>
-- 
2.50.1


Reply via email to