added my Recipes

This commit is contained in:
2024-07-11 14:16:35 +02:00
parent 38bc4f53ac
commit 09b621d929
7118 changed files with 525762 additions and 3 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -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

View File

@@ -0,0 +1,48 @@
Index: git/ClntMessages/ClntMsgRequest.cpp
===================================================================
--- git.orig/ClntMessages/ClntMsgRequest.cpp
+++ git/ClntMessages/ClntMsgRequest.cpp
@@ -142,7 +142,10 @@ TClntMsgRequest::TClntMsgRequest(List(TA
IsDone=false;
SPtr<TOpt> ptr;
ptr = new TOptDUID(OPTION_CLIENTID, ClntCfgMgr().getDUID(), this );
- Options.push_back( ptr );
+
+ if ( ptr ) {
+ Options.push_back( ptr );
+ }
if (!srvDUID) {
Log(Error) << "Unable to send REQUEST: ServerId not specified.\n" << LogEnd;
@@ -153,7 +156,9 @@ TClntMsgRequest::TClntMsgRequest(List(TA
ptr = new TOptDUID(OPTION_SERVERID, srvDUID,this);
// all IAs provided by checkSolicit
SPtr<TAddrIA> ClntAddrIA;
- Options.push_back( ptr );
+ if ( ptr ) {
+ Options.push_back( ptr );
+ }
IAs.first();
while (ClntAddrIA = IAs.get())
Index: git/Messages/Msg.cpp
===================================================================
--- git.orig/Messages/Msg.cpp
+++ git/Messages/Msg.cpp
@@ -69,10 +69,15 @@ int TMsg::getSize()
{
int pktsize=0;
TOptList::iterator opt;
+ int optionCount = 0;
for (opt = Options.begin(); opt!=Options.end(); ++opt)
{
- pktsize += (*opt)->getSize();
+ Log(Info) << "### CPE Debug - Option with index " << optionCount++ << LogEnd ;
+ Log(Info) << "### CPE Debug - Option with type " << (*opt)->getOptType() << LogEnd ;
+ pktsize += (*opt)->getSize();
}
+ Log(Info) << "### CPE Debug - Packet size of option (Add 4) " << pktsize << LogEnd ;
+
return pktsize + 4;
}

View File

@@ -0,0 +1,43 @@
SUMMARY = "Dibbler DHCPv6 client"
DESCRIPTION = "Dibbler is a portable DHCPv6 implementation. It supports stateful as well as stateless autoconfiguration for IPv6."
HOMEPAGE = "http://klub.com.pl/dhcpv6"
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://LICENSE;md5=7236695bb6d4461c105d685a8b61c4e3"
SRCREV = "a7c6cf58a88a510cb00841351e75030ce78d36bf"
SRC_URI = "git://github.com/tomaszmrugalski/dibbler;branch=master;protocol=https \
file://dibbler_fix_getSize_crash.patch \
file://0001-port-linux-Re-order-header-includes.patch \
file://0001-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch \
file://0002-make-Do-not-enforce-c99.patch \
"
PV = "1.0.1+1.0.2RC1+git${SRCREV}"
S = "${WORKDIR}/git"
PACKAGECONFIG ??= "debug bind-reuse resolvconf dns-update"
PACKAGECONFIG[debug] = "--enable-debug,,,"
PACKAGECONFIG[efence] = "--enable-efence,,,"
PACKAGECONFIG[bind-reuse] = "--enable-bind-reuse,,,"
PACKAGECONFIG[dst-addr-filter] = "--enable-dst-addr-check,,,"
PACKAGECONFIG[resolvconf] = "--enable-resolvconf,,,"
PACKAGECONFIG[dns-update] = "--enable-dns-update,,,"
PACKAGECONFIG[auth] = "--enable-auth,,,"
PACKAGECONFIG[gtest] = "--enable-gtest-static,,,"
inherit autotools
DEPENDS += "flex-native"
CPPFLAGS += "-D_GNU_SOURCE -Dregister=''"
LDFLAGS += "-pthread"
PACKAGES =+ "${PN}-requestor ${PN}-client ${PN}-relay ${PN}-server"
FILES:${PN}-client = "${sbindir}/${PN}-client"
FILES:${PN}-relay = "${sbindir}/${PN}-relay"
FILES:${PN}-requestor = "${sbindir}/${PN}-requestor"
FILES:${PN}-server = "${sbindir}/${PN}-server"