diff options
Diffstat (limited to 'meta-networking/recipes-connectivity/dibbler/dibbler')
4 files changed, 210 insertions, 0 deletions
diff --git a/meta-networking/recipes-connectivity/dibbler/dibbler/0001-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch b/meta-networking/recipes-connectivity/dibbler/dibbler/0001-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch new file mode 100644 index 0000000000..d48d7265d4 --- /dev/null +++ b/meta-networking/recipes-connectivity/dibbler/dibbler/0001-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch @@ -0,0 +1,125 @@ +From 9e9d94566d39eef3e4606f806aa418bf5534fab9 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Sun, 15 Jan 2023 22:04:31 -0800 +Subject: [PATCH 1/2] Define alignof using _Alignof when using C11 or newer + +WG14 N2350 made very clear that it is an UB having type definitions +within "offsetof" [1]. This patch enhances the implementation of macro +alignof to use builtin "_Alignof" to avoid undefined behavior on +when using std=c11 or newer + +clang 16+ has started to flag this [2] + +Fixes build when using -std >= gnu11 and using clang16+ + +Older compilers gcc < 4.9 or clang < 8 has buggy _Alignof even though it +may support C11, exclude those compilers too + +[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm +[2] https://reviews.llvm.org/D133574 + +Upstream-Status: Pending + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + Misc/md5-coreutils.c | 12 +++++++++++- + Misc/sha1.c | 12 +++++++++++- + Misc/sha256.c | 12 +++++++++++- + Misc/sha512.c | 12 +++++++++++- + 4 files changed, 44 insertions(+), 4 deletions(-) + +diff --git a/Misc/md5-coreutils.c b/Misc/md5-coreutils.c +index d6503e02..2ffb6050 100644 +--- a/Misc/md5-coreutils.c ++++ b/Misc/md5-coreutils.c +@@ -154,7 +154,17 @@ md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx) + if (len >= 64) + { + #if !_STRING_ARCH_unaligned +-# define alignof(type) offsetof (struct { char c; type x; }, x) ++/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 ++ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. ++ clang versions < 8.0.0 have the same bug. */ ++# if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ ++ || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ ++ && !defined __clang__) \ ++ || (defined __clang__ && __clang_major__ < 8)) ++# define alignof(type) offsetof (struct { char c; type x; }, x) ++# else ++# define alignof(type) _Alignof(type) ++# endif + # define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0) + if (UNALIGNED_P (buffer)) + while (len > 64) +diff --git a/Misc/sha1.c b/Misc/sha1.c +index 18ceb845..a170efe3 100644 +--- a/Misc/sha1.c ++++ b/Misc/sha1.c +@@ -149,7 +149,17 @@ sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx) + if (len >= 64) + { + #if !_STRING_ARCH_unaligned +-# define alignof(type) offsetof (struct { char c; type x; }, x) ++/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 ++ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. ++ clang versions < 8.0.0 have the same bug. */ ++# if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ ++ || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ ++ && !defined __clang__) \ ++ || (defined __clang__ && __clang_major__ < 8)) ++# define alignof(type) offsetof (struct { char c; type x; }, x) ++# else ++# define alignof(type) _Alignof(type) ++# endif + # define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0) + if (UNALIGNED_P (buffer)) + while (len > 64) +diff --git a/Misc/sha256.c b/Misc/sha256.c +index 68292326..da59e81d 100644 +--- a/Misc/sha256.c ++++ b/Misc/sha256.c +@@ -372,7 +372,17 @@ sha256_process_bytes (const void *buffer, size_t len, struct sha256_ctx *ctx) + if (len >= 64) + { + #if !_STRING_ARCH_unaligned +-# define alignof(type) offsetof (struct { char c; type x; }, x) ++/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 ++ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. ++ clang versions < 8.0.0 have the same bug. */ ++# if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ ++ || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ ++ && !defined __clang__) \ ++ || (defined __clang__ && __clang_major__ < 8)) ++# define alignof(type) offsetof (struct { char c; type x; }, x) ++# else ++# define alignof(type) _Alignof(type) ++# endif + # define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0) + if (UNALIGNED_P (buffer)) + while (len > 64) +diff --git a/Misc/sha512.c b/Misc/sha512.c +index db86c659..38e162fc 100644 +--- a/Misc/sha512.c ++++ b/Misc/sha512.c +@@ -190,7 +190,17 @@ sha512_process_bytes (const void *buffer, size_t len, struct sha512_ctx *ctx) + if (len >= 128) + { + #if !_STRING_ARCH_unaligned +-# define alignof(type) offsetof (struct { char c; type x; }, x) ++/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 ++ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. ++ clang versions < 8.0.0 have the same bug. */ ++# if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ ++ || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ ++ && !defined __clang__) \ ++ || (defined __clang__ && __clang_major__ < 8)) ++# define alignof(type) offsetof (struct { char c; type x; }, x) ++# else ++# define alignof(type) _Alignof(type) ++# endif + # define UNALIGNED_P(p) (((size_t) p) % alignof (uint64_t) != 0) + if (UNALIGNED_P (buffer)) + while (len > 128) +-- +2.39.0 + diff --git a/meta-networking/recipes-connectivity/dibbler/dibbler/0001-port-linux-Re-order-header-includes.patch b/meta-networking/recipes-connectivity/dibbler/dibbler/0001-port-linux-Re-order-header-includes.patch new file mode 100644 index 0000000000..884be404b5 --- /dev/null +++ b/meta-networking/recipes-connectivity/dibbler/dibbler/0001-port-linux-Re-order-header-includes.patch @@ -0,0 +1,33 @@ +From cbb33e1548fe526c3e7dead294617bde1f087ae3 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Wed, 24 Aug 2022 16:40:38 -0700 +Subject: [PATCH] port-linux: Re-order header includes + +linux/if.h when included before net/if.h casues duplicate definitions + +Upstream-Status: Inappropriate [Upstream is Dead] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + Port-linux/interface.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Port-linux/interface.c b/Port-linux/interface.c +index 18777e91..19aefb2b 100644 +--- a/Port-linux/interface.c ++++ b/Port-linux/interface.c +@@ -25,7 +25,6 @@ + #include <sys/types.h> + #include <sys/socket.h> + #include <sys/ioctl.h> +-#include <linux/if.h> + #include <syslog.h> + #include <string.h> + #include <errno.h> +@@ -42,6 +41,7 @@ + #include <stdarg.h> + #include <linux/sockios.h> + #include <linux/if_ether.h> ++#include <linux/if.h> + + int interface_auto_up = 0; + int interface_do_message = 0; diff --git a/meta-networking/recipes-connectivity/dibbler/dibbler/0002-make-Do-not-enforce-c99.patch b/meta-networking/recipes-connectivity/dibbler/dibbler/0002-make-Do-not-enforce-c99.patch new file mode 100644 index 0000000000..8889130a3b --- /dev/null +++ b/meta-networking/recipes-connectivity/dibbler/dibbler/0002-make-Do-not-enforce-c99.patch @@ -0,0 +1,50 @@ +From e826206c58bbaa1c256f55b103d5eb7b0182f152 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Sun, 15 Jan 2023 22:05:53 -0800 +Subject: [PATCH 2/2] make: Do not enforce c99 + +Latest gcc/clang from OE defaults to c11 or newer and stickly to c99 +means we can not use _AlignOf + +Upstream-Status: Pending + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + Misc/Makefile.am | 4 +--- + Port-linux/Makefile.am | 1 - + 2 files changed, 1 insertion(+), 4 deletions(-) + +diff --git a/Misc/Makefile.am b/Misc/Makefile.am +index d881525a..8d71d2d4 100644 +--- a/Misc/Makefile.am ++++ b/Misc/Makefile.am +@@ -6,8 +6,6 @@ endif + + noinst_LIBRARIES = libMisc.a + +-libMisc_a_CFLAGS = -std=c99 +- + libMisc_a_CPPFLAGS = -I$(top_srcdir) + + libMisc_a_SOURCES = addrpack.c +@@ -27,4 +25,4 @@ libMisc_a_SOURCES += lowlevel-posix.c + + libMisc_a_SOURCES += hmac-sha-md5.h hmac-sha-md5.c + libMisc_a_SOURCES += md5-coreutils.c md5.h +-libMisc_a_SOURCES += sha1.c sha1.h sha256.c sha256.h sha512.c sha512.h +\ No newline at end of file ++libMisc_a_SOURCES += sha1.c sha1.h sha256.c sha256.h sha512.c sha512.h +diff --git a/Port-linux/Makefile.am b/Port-linux/Makefile.am +index 72b0a5e3..635998ea 100644 +--- a/Port-linux/Makefile.am ++++ b/Port-linux/Makefile.am +@@ -1,6 +1,5 @@ + noinst_LIBRARIES = libLowLevel.a + +-libLowLevel_a_CFLAGS = -std=c99 + libLowLevel_a_CPPFLAGS = -I$(top_srcdir)/Misc + + libLowLevel_a_SOURCES = daemon.cpp daemon.h ethtool-kernel.h ethtool-local.h interface.c interface.h ip_common.h iproute.c libnetlink.c libnetlink.h ll_map.c ll_map.h ll_types.c lowlevel-linux.c lowlevel-linux-link-state.c lowlevel-options-linux.c rtm_map.h rt_names.h utils.c utils.h +-- +2.39.0 + diff --git a/meta-networking/recipes-connectivity/dibbler/dibbler/dibbler_fix_getSize_crash.patch b/meta-networking/recipes-connectivity/dibbler/dibbler/dibbler_fix_getSize_crash.patch index 42d2627a1a..439ef1177d 100644 --- a/meta-networking/recipes-connectivity/dibbler/dibbler/dibbler_fix_getSize_crash.patch +++ b/meta-networking/recipes-connectivity/dibbler/dibbler/dibbler_fix_getSize_crash.patch @@ -1,3 +1,5 @@ +Upstream-Status: Pending + Index: git/ClntMessages/ClntMsgRequest.cpp =================================================================== --- git.orig/ClntMessages/ClntMsgRequest.cpp |