[PATCH] dhcp.c: include net/ethernet.h before linux headers
by John
to fix compilation on systems with MUSL libc since MUSL a few argp
structs exists in MUSL libc headers and kernel headers. Including libc
headers before lets libc_compat.h take care of that.
---
ell/dhcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ell/dhcp.c b/ell/dhcp.c
index ad95850..6c90370 100644
--- a/ell/dhcp.c
+++ b/ell/dhcp.c
@@ -25,9 +25,9 @@
#endif
#include <netinet/ip.h>
+#include <net/ethernet.h>
#include <linux/types.h>
#include <linux/if_arp.h>
-#include <net/ethernet.h>
#include <errno.h>
#include <time.h>
--
2.17.0
2 years, 8 months
[PATCH 1/2] dhcp-transport: define _GNU_SOURCE
by John
the source, dest, len, check naming for the udphdr struct is not avaible
on non GLIBC libc's like MUSL without defining _GNU_SOURCE
---
ell/dhcp-transport.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/ell/dhcp-transport.c b/ell/dhcp-transport.c
index a317431..1de190a 100644
--- a/ell/dhcp-transport.c
+++ b/ell/dhcp-transport.c
@@ -24,6 +24,7 @@
#include <config.h>
#endif
+#define _GNU_SOURCE
#include <linux/types.h>
#include <sys/uio.h>
#include <sys/socket.h>
--
2.17.0
2 years, 8 months
[PATCH] checksum: Fix undefined references
by Claudio Takahasi
---
ell/checksum.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ell/checksum.c b/ell/checksum.c
index 1e6a4b5..56b337c 100644
--- a/ell/checksum.c
+++ b/ell/checksum.c
@@ -223,8 +223,8 @@ LIB_EXPORT struct l_checksum *l_checksum_new_cmac_aes(const void *key,
return checksum;
}
-struct l_checksum *l_checksum_new_hmac(enum l_checksum_type type,
- const void *key, size_t key_len)
+LIB_EXPORT struct l_checksum *l_checksum_new_hmac(enum l_checksum_type type,
+ const void *key, size_t key_len)
{
struct l_checksum *checksum;
int fd;
@@ -309,7 +309,7 @@ LIB_EXPORT void l_checksum_free(struct l_checksum *checksum)
*
* Resets the internal state of @checksum.
**/
-void l_checksum_reset(struct l_checksum *checksum)
+LIB_EXPORT void l_checksum_reset(struct l_checksum *checksum)
{
if (unlikely(!checksum))
return;
@@ -353,7 +353,7 @@ LIB_EXPORT bool l_checksum_update(struct l_checksum *checksum,
*
* Returns: true if the operation succeeded, false otherwise.
**/
-bool l_checksum_updatev(struct l_checksum *checksum,
+LIB_EXPORT bool l_checksum_updatev(struct l_checksum *checksum,
const struct iovec *iov, size_t iov_len)
{
struct msghdr msg;
--
2.17.0
2 years, 8 months
[PATCH] tls: Flush rx buffer on failure
by Andrew Zaborowski
When we send an Alert message to the peer (and our alerts are always
fatal) ignore any buffered messages we've received. When the
certificate chain verification fails on a client we are usually
processing the third message in a sequence of five received from the
server. We would then send an Alert and forget the negotiated state,
then process the two remaining messages which would result in two more
Alerts being sent, with the default TLS 1.0 version header. There is
no need to process those remaining messages.
---
ell/tls-private.h | 1 +
ell/tls-record.c | 10 ++++++++++
2 files changed, 11 insertions(+)
diff --git a/ell/tls-private.h b/ell/tls-private.h
index d501651..8c068c6 100644
--- a/ell/tls-private.h
+++ b/ell/tls-private.h
@@ -147,6 +147,7 @@ struct l_tls {
uint8_t *record_buf;
int record_buf_len;
int record_buf_max_len;
+ bool record_flush;
uint8_t *message_buf;
int message_buf_len;
diff --git a/ell/tls-record.c b/ell/tls-record.c
index c0e5834..0ad03ed 100644
--- a/ell/tls-record.c
+++ b/ell/tls-record.c
@@ -181,6 +181,9 @@ void tls_tx_record(struct l_tls *tls, enum tls_content_type type,
uint16_t fragment_len;
uint16_t version = tls->negotiated_version ?: TLS_MIN_VERSION;
+ if (type == TLS_CT_ALERT)
+ tls->record_flush = true;
+
while (len) {
fragment = buf + TX_RECORD_HEADROOM;
fragment_len = len < TX_RECORD_MAX_LEN ?
@@ -492,6 +495,8 @@ LIB_EXPORT void l_tls_handle_rx(struct l_tls *tls, const uint8_t *data,
int need_len;
int chunk_len;
+ tls->record_flush = false;
+
/* Reassemble TLSCiphertext structures from the received chunks */
while (1) {
@@ -506,6 +511,11 @@ LIB_EXPORT void l_tls_handle_rx(struct l_tls *tls, const uint8_t *data,
tls->record_buf_len = 0;
need_len = 5;
+
+ if (tls->record_flush) {
+ tls->record_flush = false;
+ break;
+ }
}
if (!len)
--
2.14.1
2 years, 8 months