From: Simon Kuenzer Date: Mon, 16 Aug 2021 13:29:18 +0000 (+0200) Subject: Point to Unikraft's lwIP fork X-Git-Tag: RELEASE-0.6~5 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=86dfd854ce451bf56d354748f52f9469227580d3;p=unikraft%2Flibs%2Flwip.git Point to Unikraft's lwIP fork With this commit the build system is going to download lwIP 2.1.2 from our official fork on GitHub. Some patch files had to be adopted (whitespaces) to still apply. Signed-off-by: Simon Kuenzer Reviewed-by: Sergiu Moga Tested-by: Unikraft CI GitHub-Pull-Request: #9 --- diff --git a/Makefile.uk b/Makefile.uk index fb612ed..54a4ed7 100644 --- a/Makefile.uk +++ b/Makefile.uk @@ -41,8 +41,11 @@ $(eval $(call addlib_s,liblwip,$(CONFIG_LIBLWIP))) ################################################################################ # Sources ################################################################################ -LIBLWIP_ZIPNAME=lwip-2.1.2 -LIBLWIP_URL=http://download.savannah.nongnu.org/releases/lwip/$(LIBLWIP_ZIPNAME).zip +LIBLWIP_TAG=STABLE-2_1_2_RELEASE +LIBLWIP_ZIPNAME=fork-lwip-$(LIBLWIP_TAG) +LIBLWIP_URL=https://github.com/unikraft/fork-lwip/archive/refs/tags/$(LIBLWIP_TAG).zip +LIBLWIP_ORIGIN_SHA256=8f0ae46e2702720ce852b00de5d304adb2809b0203741f299876594bb8be7890 + LIBLWIP_PATCHDIR=$(LIBLWIP_BASE)/patches $(eval $(call fetch,liblwip,$(LIBLWIP_URL))) $(eval $(call patch,liblwip,$(LIBLWIP_PATCHDIR),$(LIBLWIP_ZIPNAME))) @@ -69,7 +72,7 @@ LIBLWIP_CFLAGS-y += -Wno-type-limits -Wno-unused-parameter LIBLWIP_CFLAGS-$(CONFIG_LWIP_DEBUG) += -DUK_DEBUG LIBLWIP_CFLAGS-y += -D__IN_LIBLWIP__ LIBLWIP_CXXFLAGS-y += -D__IN_LIBLWIP__ - + ################################################################################ # Core ################################################################################ diff --git a/patches/0001-timeval-for-socket-c.patch b/patches/0001-timeval-for-socket-c.patch index f1663ef..4fdec77 100644 --- a/patches/0001-timeval-for-socket-c.patch +++ b/patches/0001-timeval-for-socket-c.patch @@ -1,11 +1,11 @@ --- a/src/api/sockets.c 2018-03-05 16:12:39.917974880 +0100 +++ b/src/api/sockets.c 2018-03-05 16:12:24.577997842 +0100 @@ -44,6 +44,8 @@ - * - */ - -+#include -+ - #include "lwip/opt.h" - - #if LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */ + * + */ + ++#include ++ + #include "lwip/opt.h" + + #if LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */ diff --git a/patches/0002-Don-t-provide-file-status-flags-when-we-have-a-libc.patch b/patches/0002-Don-t-provide-file-status-flags-when-we-have-a-libc.patch index 34a4238..627b6c2 100644 --- a/patches/0002-Don-t-provide-file-status-flags-when-we-have-a-libc.patch +++ b/patches/0002-Don-t-provide-file-status-flags-when-we-have-a-libc.patch @@ -17,30 +17,30 @@ index d70d36c4..72169cd0 100644 --- a/src/include/lwip/sockets.h +++ b/src/include/lwip/sockets.h @@ -39,6 +39,8 @@ - #ifndef LWIP_HDR_SOCKETS_H - #define LWIP_HDR_SOCKETS_H - -+#include -+ - #include "lwip/opt.h" - - #if LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */ -@@ -438,6 +440,7 @@ typedef struct ipv6_mreq { - #define F_SETFL 4 - #endif - -+#ifndef CONFIG_HAVE_LIBC - /* File status flags and file access modes for fnctl, - these are bits in an int. */ - #ifndef O_NONBLOCK -@@ -455,6 +458,7 @@ typedef struct ipv6_mreq { - #ifndef O_RDWR - #define O_RDWR (O_RDONLY|O_WRONLY) - #endif -+#endif /* CONFIG_HAVE_LIBC */ - - #ifndef SHUT_RD - #define SHUT_RD 0 + #ifndef LWIP_HDR_SOCKETS_H + #define LWIP_HDR_SOCKETS_H + ++#include ++ + #include "lwip/opt.h" + + #if LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */ +@@ -447,6 +449,7 @@ typedef struct ipv6_mreq { + #define F_SETFL 4 + #endif + ++#ifndef CONFIG_HAVE_LIBC + /* File status flags and file access modes for fnctl, + these are bits in an int. */ + #ifndef O_NONBLOCK +@@ -464,6 +467,7 @@ typedef struct ipv6_mreq { + #ifndef O_RDWR + #define O_RDWR (O_RDONLY|O_WRONLY) + #endif ++#endif /* CONFIG_HAVE_LIBC */ + + #ifndef SHUT_RD + #define SHUT_RD 0 -- 2.21.0 diff --git a/patches/0003-Declare-mem_-functions-only-for-lwip-internal-use.patch b/patches/0003-Declare-mem_-functions-only-for-lwip-internal-use.patch index c43106a..c92476d 100644 --- a/patches/0003-Declare-mem_-functions-only-for-lwip-internal-use.patch +++ b/patches/0003-Declare-mem_-functions-only-for-lwip-internal-use.patch @@ -1,16 +1,16 @@ --- a/src/include/lwip/mem.h +++ b/src/include/lwip/mem.h @@ -69,11 +69,13 @@ - #endif /* MEM_SIZE > 64000 */ - #endif - -+#ifdef __IN_LIBLWIP__ - void mem_init(void); - void *mem_trim(void *mem, mem_size_t size); - void *mem_malloc(mem_size_t size); - void *mem_calloc(mem_size_t count, mem_size_t size); - void mem_free(void *mem); -+#endif - - #ifdef __cplusplus - } + #endif /* MEM_SIZE > 64000 */ + #endif + ++#ifdef __IN_LIBLWIP__ + void mem_init(void); + void *mem_trim(void *mem, mem_size_t size); + void *mem_malloc(mem_size_t size); + void *mem_calloc(mem_size_t count, mem_size_t size); + void mem_free(void *mem); ++#endif + + #ifdef __cplusplus + } diff --git a/patches/0004-src-include-lwip-sockets.h-Add-ipi_spec_dst-field-to.patch b/patches/0004-src-include-lwip-sockets.h-Add-ipi_spec_dst-field-to.patch index f4661a8..f9673f7 100644 --- a/patches/0004-src-include-lwip-sockets.h-Add-ipi_spec_dst-field-to.patch +++ b/patches/0004-src-include-lwip-sockets.h-Add-ipi_spec_dst-field-to.patch @@ -3,10 +3,10 @@ index ace9885..4e333ae 100644 --- a/src/include/lwip/sockets.h +++ b/src/include/lwip/sockets.h @@ -327,6 +327,7 @@ typedef struct ip_mreq { - #if LWIP_IPV4 - struct in_pktinfo { - unsigned int ipi_ifindex; /* Interface index */ + #if LWIP_IPV4 + struct in_pktinfo { + unsigned int ipi_ifindex; /* Interface index */ + struct in_addr ipi_spec_dst; /* Routing destination address */ - struct in_addr ipi_addr; /* Destination (from header) address */ - }; - #endif /* LWIP_IPV4 */ + struct in_addr ipi_addr; /* Destination (from header) address */ + }; + #endif /* LWIP_IPV4 */ diff --git a/patches/0005-patches-Add-more-fields-to-struct-ifreq.patch b/patches/0005-patches-Add-more-fields-to-struct-ifreq.patch index aa8126c..db5e95d 100644 --- a/patches/0005-patches-Add-more-fields-to-struct-ifreq.patch +++ b/patches/0005-patches-Add-more-fields-to-struct-ifreq.patch @@ -3,9 +3,9 @@ index ace9885..a6cec38 100644 --- a/src/include/lwip/sockets.h +++ b/src/include/lwip/sockets.h @@ -184,8 +184,38 @@ will need to increase long long */ - #define IFNAMSIZ NETIF_NAMESIZE - struct ifreq { - char ifr_name[IFNAMSIZ]; /* Interface name */ + #define IFNAMSIZ NETIF_NAMESIZE + struct ifreq { + char ifr_name[IFNAMSIZ]; /* Interface name */ + union { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; @@ -20,8 +20,8 @@ index ace9885..a6cec38 100644 + char ifru_newname[IFNAMSIZ]; + char *ifru_data; + } ifr_ifru; - }; - + }; + +#define ifr_hwaddr ifr_ifru.ifru_hwaddr +#define ifr_addr ifr_ifru.ifru_addr +#define ifr_dstaddr ifr_ifru.ifru_dstaddr @@ -38,6 +38,6 @@ index ace9885..a6cec38 100644 +#define ifr_qlen ifr_ifru.ifru_ivalue +#define ifr_newname ifr_ifru.ifru_newname + - /* Socket protocol types (TCP/UDP/RAW) */ - #define SOCK_STREAM 1 - #define SOCK_DGRAM 2 + /* Socket protocol types (TCP/UDP/RAW) */ + #define SOCK_STREAM 1 + #define SOCK_DGRAM 2