summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--user/mosquitto/APKBUILD24
-rw-r--r--user/mosquitto/endian.patch169
2 files changed, 177 insertions, 16 deletions
diff --git a/user/mosquitto/APKBUILD b/user/mosquitto/APKBUILD
index 46460cd92..3848992b8 100644
--- a/user/mosquitto/APKBUILD
+++ b/user/mosquitto/APKBUILD
@@ -17,6 +17,7 @@ install="$pkgname.pre-install"
source="http://mosquitto.org/files/source/$pkgname-$pkgver.tar.gz
mosquitto.initd
openrc-conf.patch
+ endian.patch
"
# secfixes:
@@ -46,8 +47,12 @@ build() {
check() {
# Explicitly disable tests, instead of enabling only good ones.
+ # 08-ssl-connect-cert-auth-without-py: #687
+ # Other two: https://github.com/eclipse/mosquitto/issues/2550
sed -i test/broker/test.py \
- -e '/08-ssl-connect-cert-auth-without.py/d' `#687` \
+ -e '/08-ssl-connect-cert-auth-without.py/d' \
+ -e '/06-bridge-b2br-late-connection-retain.py/d' \
+ -e '/11-pub-props.py/d' \
;
sed -i test/lib/test.py \
-e '/02-subscribe-qos1.py/d' \
@@ -55,20 +60,6 @@ check() {
sed -i test/client/Makefile \
-e '/test.sh/d' \
;
- # These seem to ppc64 (or BE) related.
- sed -i test/unit/persist_read_test.c \
- -e '/CU_add_test.*TEST_v3_config_ok/d' \
- -e '/CU_add_test.*TEST_v3_bad_chunk/d' \
- -e '/CU_add_test.*TEST_v3_message_store/d' \
- -e '/CU_add_test.*TEST_v3_retain/d' \
- -e '/CU_add_test.*TEST_v4_config_ok/d' \
- -e '/CU_add_test.*TEST_v4_message_store/d' \
- -e '/CU_add_test.*TEST_v5_bad_chunk/d' \
- -e '/CU_add_test.*TEST_v6_config_ok/d' \
- -e '/CU_add_test.*TEST_v6_message_store/d' \
- -e '/CU_add_test.*TEST_v6_message_store_props/d' \
- -e '/CU_add_test.*TEST_v6_retain/d' \
- ;
make ptest
}
@@ -96,4 +87,5 @@ clients() {
sha512sums="a9e4f41b9af679b30318570e86a465546024651373df10e3b132f4593b89d22d0dbac01bb7371a57132ba030a2e73971c612acb5c9ac12f5ccd06aa38d9444c2 mosquitto-2.0.14.tar.gz
681fddc737b3ef3e6c052f0c854a730df290352640a18a63e23ef83d14c425558aff87805d1eb95e44de101b5df48872173af9f5414464ffa8cf727ea2c0491e mosquitto.initd
-b07f9bec2751ab32c43f53e74d8fca18dbf2d7ce7f8fab562dbcf75de19609ba6219d735ac504697404e0ed36613a14074e3a19e735297195877798f778d337a openrc-conf.patch"
+b07f9bec2751ab32c43f53e74d8fca18dbf2d7ce7f8fab562dbcf75de19609ba6219d735ac504697404e0ed36613a14074e3a19e735297195877798f778d337a openrc-conf.patch
+89f738f77732500bc2aff3086b891c1e537510e756baf0ac92c1462c2ef7e47cdc62536d90174e6b6c80637199e463609723f9915999c0b95ce878ebbed739a1 endian.patch"
diff --git a/user/mosquitto/endian.patch b/user/mosquitto/endian.patch
new file mode 100644
index 000000000..2efd1111d
--- /dev/null
+++ b/user/mosquitto/endian.patch
@@ -0,0 +1,169 @@
+From 165005742c1c6a5b0b6d037c9e83cbe4a18a3092 Mon Sep 17 00:00:00 2001
+From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
+Date: Sun, 29 May 2022 03:37:26 -0500
+Subject: [PATCH] persist: Fix ID storage on big-endian systems
+
+Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
+---
+ src/persist_read.c | 3 ++-
+ src/persist_read_v234.c | 5 ++++-
+ src/persist_read_v5.c | 4 ++++
+ src/persist_write.c | 4 ++--
+ src/persist_write_v5.c | 4 ++++
+ 5 files changed, 16 insertions(+), 4 deletions(-)
+
+diff --git a/src/persist_read.c b/src/persist_read.c
+index 5e7be454..e2b4ecb3 100644
+--- a/src/persist_read.c
++++ b/src/persist_read.c
+@@ -24,6 +24,7 @@ Contributors:
+ #include <arpa/inet.h>
+ #endif
+ #include <assert.h>
++#include <endian.h>
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <stdio.h>
+@@ -480,7 +481,7 @@ int persist__restore(void)
+ fclose(fptr);
+ return 1;
+ }
+- db.last_db_id = cfg_chunk.last_db_id;
++ db.last_db_id = le64toh(cfg_chunk.last_db_id);
+ break;
+
+ case DB_CHUNK_MSG_STORE:
+diff --git a/src/persist_read_v234.c b/src/persist_read_v234.c
+index 7460c309..701d88d9 100644
+--- a/src/persist_read_v234.c
++++ b/src/persist_read_v234.c
+@@ -24,6 +24,7 @@ Contributors:
+ #include <arpa/inet.h>
+ #endif
+ #include <assert.h>
++#include <endian.h>
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <stdio.h>
+@@ -108,6 +109,7 @@ int persist__chunk_client_msg_read_v234(FILE *db_fptr, struct P_client_msg *chun
+ }
+
+ read_e(db_fptr, &chunk->F.store_id, sizeof(dbid_t));
++ chunk->F.store_id = le64toh(chunk->F.store_id);
+
+ read_e(db_fptr, &i16temp, sizeof(uint16_t));
+ chunk->F.mid = ntohs(i16temp);
+@@ -137,6 +139,7 @@ int persist__chunk_msg_store_read_v234(FILE *db_fptr, struct P_msg_store *chunk,
+ char *err;
+
+ read_e(db_fptr, &chunk->F.store_id, sizeof(dbid_t));
++ chunk->F.store_id = le64toh(chunk->F.store_id);
+
+ rc = persist__read_string(db_fptr, &chunk->source.id);
+ if(rc){
+@@ -205,7 +208,7 @@ int persist__chunk_retain_read_v234(FILE *db_fptr, struct P_retain *chunk)
+ log__printf(NULL, MOSQ_LOG_ERR, "Error: %s.", err);
+ return 1;
+ }
+- chunk->F.store_id = i64temp;
++ chunk->F.store_id = le64toh(i64temp);
+
+ return MOSQ_ERR_SUCCESS;
+ }
+diff --git a/src/persist_read_v5.c b/src/persist_read_v5.c
+index abc9a580..12d3e801 100644
+--- a/src/persist_read_v5.c
++++ b/src/persist_read_v5.c
+@@ -24,6 +24,7 @@ Contributors:
+ #include <arpa/inet.h>
+ #endif
+ #include <assert.h>
++#include <endian.h>
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <stdio.h>
+@@ -116,6 +117,7 @@ int persist__chunk_client_msg_read_v56(FILE *db_fptr, struct P_client_msg *chunk
+ read_e(db_fptr, &chunk->F, sizeof(struct PF_client_msg));
+ chunk->F.mid = ntohs(chunk->F.mid);
+ chunk->F.id_len = ntohs(chunk->F.id_len);
++ chunk->F.store_id = le64toh(chunk->F.store_id);
+
+ length -= (uint32_t)(sizeof(struct PF_client_msg) + chunk->F.id_len);
+
+@@ -165,6 +167,7 @@ int persist__chunk_msg_store_read_v56(FILE *db_fptr, struct P_msg_store *chunk,
+ chunk->F.source_username_len = ntohs(chunk->F.source_username_len);
+ chunk->F.topic_len = ntohs(chunk->F.topic_len);
+ chunk->F.source_port = ntohs(chunk->F.source_port);
++ chunk->F.store_id = le64toh(chunk->F.store_id);
+
+ length -= (uint32_t)(sizeof(struct PF_msg_store) + chunk->F.payloadlen + chunk->F.source_id_len + chunk->F.source_username_len + chunk->F.topic_len);
+
+@@ -246,6 +249,7 @@ int persist__chunk_retain_read_v56(FILE *db_fptr, struct P_retain *chunk)
+ log__printf(NULL, MOSQ_LOG_ERR, "Error: %s.", strerror(errno));
+ return 1;
+ }
++ chunk->F.store_id = le64toh(chunk->F.store_id);
+ return MOSQ_ERR_SUCCESS;
+ }
+
+diff --git a/src/persist_write.c b/src/persist_write.c
+index ccfbc29c..93a32639 100644
+--- a/src/persist_write.c
++++ b/src/persist_write.c
+@@ -273,7 +273,7 @@ static int persist__retain_save(FILE *db_fptr, struct mosquitto__retainhier *nod
+
+ if(node->retained && strncmp(node->retained->topic, "$SYS", 4)){
+ /* Don't save $SYS messages. */
+- retain_chunk.F.store_id = node->retained->db_id;
++ retain_chunk.F.store_id = htole64(node->retained->db_id);
+ rc = persist__chunk_retain_write_v6(db_fptr, &retain_chunk);
+ if(rc){
+ return rc;
+@@ -367,7 +367,7 @@ int persist__backup(bool shutdown)
+ write_e(db_fptr, &db_version_w, sizeof(uint32_t));
+
+ memset(&cfg_chunk, 0, sizeof(struct PF_cfg));
+- cfg_chunk.last_db_id = db.last_db_id;
++ cfg_chunk.last_db_id = htole64(db.last_db_id);
+ cfg_chunk.shutdown = shutdown;
+ cfg_chunk.dbid_size = sizeof(dbid_t);
+ if(persist__chunk_cfg_write_v6(db_fptr, &cfg_chunk)){
+diff --git a/src/persist_write_v5.c b/src/persist_write_v5.c
+index 8c9f6c34..b9fb5a8e 100644
+--- a/src/persist_write_v5.c
++++ b/src/persist_write_v5.c
+@@ -24,6 +24,7 @@ Contributors:
+ #include <arpa/inet.h>
+ #endif
+ #include <assert.h>
++#include <endian.h>
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <stdio.h>
+@@ -100,6 +101,7 @@ int persist__chunk_client_msg_write_v6(FILE *db_fptr, struct P_client_msg *chunk
+
+ chunk->F.mid = htons(chunk->F.mid);
+ chunk->F.id_len = htons(chunk->F.id_len);
++ chunk->F.store_id = htole64(chunk->F.store_id);
+
+ header.chunk = htonl(DB_CHUNK_CLIENT_MSG);
+ header.length = htonl((uint32_t)sizeof(struct PF_client_msg) + id_len + proplen);
+@@ -149,6 +151,7 @@ int persist__chunk_message_store_write_v6(FILE *db_fptr, struct P_msg_store *chu
+ proplen += property__get_remaining_length(chunk->properties);
+ }
+
++ chunk->F.store_id = htole64(chunk->F.store_id);
+ chunk->F.payloadlen = htonl(chunk->F.payloadlen);
+ chunk->F.source_mid = htons(chunk->F.source_mid);
+ chunk->F.source_id_len = htons(chunk->F.source_id_len);
+@@ -206,6 +209,7 @@ int persist__chunk_retain_write_v6(FILE *db_fptr, struct P_retain *chunk)
+
+ header.chunk = htonl(DB_CHUNK_RETAIN);
+ header.length = htonl((uint32_t)sizeof(struct PF_retain));
++ chunk->F.store_id = htole64(chunk->F.store_id);
+
+ write_e(db_fptr, &header, sizeof(struct PF_header));
+ write_e(db_fptr, &chunk->F, sizeof(struct PF_retain));
+--
+2.35.1
+