[PATCH] strv: Add l_strv_eq
by Andrew Zaborowski
---
ell/ell.sym | 1 +
ell/strv.c | 20 ++++++++++++++++++++
ell/strv.h | 1 +
3 files changed, 22 insertions(+)
diff --git a/ell/ell.sym b/ell/ell.sym
index 9fcf334..10865af 100644
--- a/ell/ell.sym
+++ b/ell/ell.sym
@@ -40,6 +40,7 @@ global:
l_strv_append_printf;
l_strv_append_vprintf;
l_strv_copy;
+ l_strv_eq;
/* utf8 */
l_ascii_table;
l_utf8_get_codepoint;
diff --git a/ell/strv.c b/ell/strv.c
index 3df47be..1343519 100644
--- a/ell/strv.c
+++ b/ell/strv.c
@@ -359,3 +359,23 @@ LIB_EXPORT char **l_strv_copy(char **str_array)
return copy;
}
+
+/**
+ * l_strv_eq:
+ * @a: a %NULL terminated array of strings or %NULL
+ * @b: another %NULL terminated array of strings or %NULL
+ *
+ * Returns: Whether @a and @b's contents are identical, including the
+ * order, or @a and @b are both %NULL.
+ */
+LIB_EXPORT bool l_strv_eq(char **a, char **b)
+{
+ if (!a || !b)
+ return a == b;
+
+ for (; *a; a++, b++)
+ if (!*b || strcmp(*a, *b))
+ return false;
+
+ return !*b;
+}
diff --git a/ell/strv.h b/ell/strv.h
index e673fec..db15cc7 100644
--- a/ell/strv.h
+++ b/ell/strv.h
@@ -46,6 +46,7 @@ char **l_strv_append_vprintf(char **str_array, const char *format,
va_list args)
__attribute__((format(printf, 2, 0)));
char **l_strv_copy(char **str_array);
+bool l_strv_eq(char **a, char **b);
#ifdef __cplusplus
}
--
2.30.2
4 months
Re: AIO support
by Simon Maurer
I started testing the aio interface for ell and it seems to work, except
it's not asynchronous. Turns out libaio works only under certain
circumstances:
http://lse.sourceforge.net/io/aio.html
So it's useless. There is a newer alternative called io_uring, but only
for newer kernels (5.1) and not available to my target system. I will go
back to the POSIX AIO and use SIGEV_THREAD (writing an eventfd in the
notify function) instead of SIGEV_SIGNAL.
Regards,
Simon
9 months, 1 week
AIO support
by Simon Maurer
Hi
Awesome library! Thank you very much. I'm using it for an embedded linux
application with not so strict real time constraints. Problem is, I need
non blocking file access, because the memory card on my system is quite
slow. It turns out that this whole non-blocking access doesn't work for
files, so now I'm using the POSIX AIO interface and I've integrated it
into ELL:
https://github.com/mausys/ell/blob/master/ell/aio.c
(But needs to be linked against rt)
This is just a draft and it also works on top of ELL, but maybe other
applications need this too.
Best regards,
Simon Maurer
9 months, 2 weeks
[PATCH] Restore support for clang and other non-GCC compilers
by Charlotte Delenk
The _auto_-macro used in cert.c and tls.c uses a GCC extension that
allows for nested functions. This is not supported by other compilers,
including clang.
Compiling ell with these compilers will result error messages such as:
../ell-0.44/ell/tls.c:1895:2: error: function definition is not allowed here
_auto_(l_certchain_free) struct l_certchain *certchain = NULL;
^
../ell-0.44/ell/useful.h:71:2: note: expanded from macro '_auto_'
_AUTODESTRUCT(__COUNTER__, func)
^
../ell-0.44/ell/useful.h:68:2: note: expanded from macro '_AUTODESTRUCT'
__AUTODESTRUCT(var, func)
^
../ell-0.44/ell/useful.h:64:2: note: expanded from macro '__AUTODESTRUCT'
{ func(*(void **) ptr); } \
^
../ell-0.44/ell/tls.c:1895:2: error: use of undeclared identifier 'cleanup_0'
../ell-0.44/ell/useful.h:71:2: note: expanded from macro '_auto_'
_AUTODESTRUCT(__COUNTER__, func)
^
../ell-0.44/ell/useful.h:68:2: note: expanded from macro '_AUTODESTRUCT'
__AUTODESTRUCT(var, func)
^
../ell-0.44/ell/useful.h:65:23: note: expanded from macro '__AUTODESTRUCT'
__attribute((cleanup(cleanup_ ## var)))
^
This patch will removes the _auto_ macro and implement its functionality
manually in the two locations it is used.
It does not appear to be possible to replace this macro with a more
compatible alternative that does not involve C++.
Signed-off-by: Charlotte Delenk <darkkirb(a)darkkirb.de>
---
ell/cert.c | 6 +++++-
ell/tls.c | 6 +++++-
ell/useful.h | 11 -----------
3 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/ell/cert.c b/ell/cert.c
index 141ea1c..13a89e0 100644
--- a/ell/cert.c
+++ b/ell/cert.c
@@ -446,12 +446,16 @@ static struct l_key *cert_try_link(struct l_cert *cert, struct l_keyring *ring)
return false; \
} while (0)
+static void cleanup_keyring(void * ptr) {
+ l_keyring_free(*(void **)ptr);
+}
+
LIB_EXPORT bool l_certchain_verify(struct l_certchain *chain,
struct l_queue *ca_certs,
const char **error)
{
struct l_keyring *ca_ring = NULL;
- _auto_(l_keyring_free) struct l_keyring *verify_ring = NULL;
+ __attribute__((cleanup(cleanup_keyring))) struct l_keyring *verify_ring = NULL;
struct l_cert *cert;
struct l_key *prev_key = NULL;
int verified = 0;
diff --git a/ell/tls.c b/ell/tls.c
index c246f1f..1d0e91d 100644
--- a/ell/tls.c
+++ b/ell/tls.c
@@ -1888,11 +1888,15 @@ decode_error:
"ServerHello decode error");
}
+static void cleanup_certchain(void * ptr) {
+ l_certchain_free(*(void **)ptr);
+}
+
static void tls_handle_certificate(struct l_tls *tls,
const uint8_t *buf, size_t len)
{
size_t total;
- _auto_(l_certchain_free) struct l_certchain *certchain = NULL;
+ __attribute__((cleanup(cleanup_certchain))) struct l_certchain *certchain = NULL;
struct l_cert *leaf;
size_t der_len;
const uint8_t *der;
diff --git a/ell/useful.h b/ell/useful.h
index b4783ce..cd7ec0f 100644
--- a/ell/useful.h
+++ b/ell/useful.h
@@ -59,17 +59,6 @@ static inline unsigned char bit_field(const unsigned char oct,
_x / _d; \
})
-#define __AUTODESTRUCT(var, func) \
- void cleanup_ ## var(void *ptr) \
- { func(*(void **) ptr); } \
- __attribute((cleanup(cleanup_ ## var)))
-
-#define _AUTODESTRUCT(var, func) \
- __AUTODESTRUCT(var, func)
-
-#define _auto_(func) \
- _AUTODESTRUCT(__COUNTER__, func)
-
/*
* Trick the compiler into thinking that var might be changed somehow by
* the asm
--
2.33.0
9 months, 2 weeks
[PATCH] signal: pass signalfd_siginfo to notify callback
by Simon Maurer
Warning: breaks API/ABI of ell signal, but signalfd_siginfo contains a
lot of useful information
---
ell/main.c | 4 ++--
ell/signal.c | 6 +++---
ell/signal.h | 3 ++-
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/ell/main.c b/ell/main.c
index 1a6cd60f..9697f019 100644
--- a/ell/main.c
+++ b/ell/main.c
@@ -604,7 +604,7 @@ struct signal_data {
void *user_data;
};
-static void sigint_handler(void *user_data)
+static void sigint_handler(const struct signalfd_siginfo *si, void
*user_data)
{
struct signal_data *data = user_data;
@@ -612,7 +612,7 @@ static void sigint_handler(void *user_data)
data->callback(SIGINT, data->user_data);
}
-static void sigterm_handler(void *user_data)
+static void sigterm_handler(const struct signalfd_siginfo *si, void
*user_data)
{
struct signal_data *data = user_data;
diff --git a/ell/signal.c b/ell/signal.c
index 2afdb45f..e756615b 100644
--- a/ell/signal.c
+++ b/ell/signal.c
@@ -66,7 +66,7 @@ static struct l_io *signalfd_io = NULL;
static struct l_queue *signal_list = NULL;
static sigset_t signal_mask;
-static void handle_callback(struct signal_desc *desc)
+static void handle_callback(struct signal_desc *desc, const struct
signalfd_siginfo *si)
{
const struct l_queue_entry *entry;
@@ -75,7 +75,7 @@ static void handle_callback(struct signal_desc *desc)
struct l_signal *signal = entry->data;
if (signal->callback)
- signal->callback(signal->user_data);
+ signal->callback(si, signal->user_data);
}
}
@@ -101,7 +101,7 @@ static bool signalfd_read_cb(struct l_io *io, void
*user_data)
desc = l_queue_find(signal_list, desc_match_signo,
L_UINT_TO_PTR(si.ssi_signo));
if (desc)
- handle_callback(desc);
+ handle_callback(desc, &si);
return true;
}
diff --git a/ell/signal.h b/ell/signal.h
index 1d98476a..a6512d9b 100644
--- a/ell/signal.h
+++ b/ell/signal.h
@@ -30,8 +30,9 @@ extern "C" {
#endif
struct l_signal;
+struct signalfd_siginfo;
-typedef void (*l_signal_notify_cb_t) (void *user_data);
+typedef void (*l_signal_notify_cb_t) (const struct signalfd_siginfo
*si, void *user_data);
typedef void (*l_signal_destroy_cb_t) (void *user_data);
struct l_signal *l_signal_create(uint32_t signo, l_signal_notify_cb_t
callback,
9 months, 2 weeks
[PATCH] cipher: Allow zero byte input for AEAD cipher
by Inga Stotland
For AEAD-based cipher, either the plaintext or the associated
data may contain zero bytes.
Add extra checks to disallow combinations of NULL input data and
nonzero data length.
---
ell/cipher.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/ell/cipher.c b/ell/cipher.c
index 866fdb5..6b8528c 100644
--- a/ell/cipher.c
+++ b/ell/cipher.c
@@ -607,7 +607,10 @@ LIB_EXPORT bool l_aead_cipher_encrypt(struct l_aead_cipher *cipher,
if (unlikely(!cipher))
return false;
- if (unlikely(!in) || unlikely(!out))
+ if (unlikely(!in && !ad) || unlikely(!out))
+ return false;
+
+ if (unlikely(!in && in_len) || unlikely(!ad && ad_len))
return false;
if (cipher->type == L_AEAD_CIPHER_AES_CCM) {
--
2.31.1
9 months, 3 weeks
Reason for Facebook’s Content Is Not Available Error Comes
by s.techmantra@gmail.com
"A few days ago, some of my friends shared a Facebook post link with me on WhatsApp with the excellent message watch this video you will die after seeing this post and some laughing emojis. This video has caught my attention and I want to see it right now.
When I clicked the link, though, I was greeted with an error message that read, ""Sorry, this content isn't available right now facebook."" I figured there was a problem with my phone or that the internet was down, so I went to my computer and accessed Facebook on the desktop, but the problem persisted.
The problem persisted when I tried to share this link with another account. We're sorry, but this content is currently unavailable. I was able to overcome the problem and watch the movie that my friend had supplied after trying a few different techniques.
Sorry, this material isn't accessible right now if you're experiencing the same problem and seeing this error message from time to time. If you're still intrigued, here are the top eight reasons why you should expect it to happen.
YOU ARE BLOCKED
YOU ARE LOGGED OUT
FACEBOOK IS DOWN
CONTENT WAS DELETED
PROFILE NO LONGER EXISTS
REMOVED BY FACEBOOK
AGE AND LOCATION RESTRICTIONS
PRIVACY SETTINGS
"
https://www.webtechmantra.com/reasons-about-facebook-error-this-content-i...
10 months