Skip to content

Commit e4a2041

Browse files
committed
Peer review fixes
1 parent 46bceb3 commit e4a2041

5 files changed

Lines changed: 17 additions & 14 deletions

File tree

.github/workflows/stm32h563-m33mu.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ jobs:
4646
}
4747
trap cleanup EXIT
4848
49-
sudo modprobe tun
5049
sudo ip tuntap add dev tap0 mode tap
5150
sudo ip addr add 192.168.12.1/24 dev tap0
5251
sudo ip link set tap0 up
@@ -115,13 +114,13 @@ jobs:
115114
runs-on: ubuntu-latest
116115
timeout-minutes: 30
117116
container:
118-
image: ghcr.io/danielinux/m33mu-ci:1.5
117+
image: ghcr.io/danielinux/m33mu-ci:1.6
119118
options: --privileged
120119

121120
steps:
122121
- uses: actions/checkout@v4
123122

124-
- name: Clone wolfSSL, wolfSSH, wolfMQTT (pinned to stable tags)
123+
- name: Clone wolfSSL, wolfSSH, wolfMQTT
125124
run: |
126125
set -euo pipefail
127126
cd ..
@@ -162,7 +161,6 @@ jobs:
162161
}
163162
trap cleanup EXIT
164163
165-
sudo modprobe tun
166164
sudo ip tuntap add dev tap0 mode tap
167165
sudo ip addr add 192.168.12.1/24 dev tap0
168166
sudo ip link set tap0 up
@@ -271,7 +269,7 @@ jobs:
271269
echo "=== Test 4: MQTT Broker ==="
272270
sleep 5 # allow recovery from TLS echo session
273271
# Extract cert from certs.h for mosquitto
274-
sed -n '/server_cert_pem\[\]/,/^";$/p' src/port/certs.h \
272+
sed -n '/server_cert_pem\[\]/,/^"-----END CERTIFICATE-----\\n";$/p' src/port/certs.h \
275273
| sed 's/^"//; s/"$//; s/\\n$//' \
276274
| grep -v '^static\|^;' > /tmp/wolfip_cert.pem
277275
ok=0

src/port/stm32h563/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ ifeq ($(ENABLE_MQTT),1)
4545
endif
4646

4747
# Library paths - default to sibling directories (clone alongside pattern)
48-
WOLFSSL_ROOT ?= $(ROOT)/../wolfssl-alt
48+
WOLFSSL_ROOT ?= $(ROOT)/../wolfssl
4949
WOLFSSH_ROOT ?= $(ROOT)/../wolfssh
5050
WOLFMQTT_ROOT ?= $(ROOT)/../wolfmqtt
5151

src/port/stm32h563/demo.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fi
1818
BOARD_IP="${1:-192.168.12.11}"
1919

2020
# Validate BOARD_IP to block shell metacharacter injection via eval
21-
if ! [[ "$BOARD_IP" =~ ^[A-Za-z0-9._-]+$ ]]; then
21+
if [[ "$BOARD_IP" == -* ]] || ! [[ "$BOARD_IP" =~ ^[A-Za-z0-9._-]+$ ]]; then
2222
echo "Error: Invalid board IP/hostname: $BOARD_IP" >&2
2323
exit 1
2424
fi
@@ -81,7 +81,7 @@ pause() {
8181
run_cmd() {
8282
cmd_show "$1"
8383
echo ""
84-
eval "$1" 2>&1 | sed 's/^/ /'
84+
bash -c "$1" 2>&1 | sed 's/^/ /'
8585
echo ""
8686
}
8787

src/port/stm32h563/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,10 @@ void wolfmqtt_log(const char *fmt, ...)
412412
va_start(ap, fmt);
413413
n = vsnprintf(buf, sizeof(buf), fmt, ap);
414414
va_end(ap);
415+
if (n < 0) {
416+
uart_puts("<wolfmqtt_log: encoding error>\n");
417+
return;
418+
}
415419
uart_puts(buf);
416420
if (n >= (int)sizeof(buf))
417421
uart_puts("...[truncated]\n");

src/port/va416xx/main.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ extern volatile uint64_t HAL_time_ms;
4444
#define RX_BUF_SIZE 1024
4545

4646
/* DHCP timeout: total time to wait for DHCP before static IP fallback.
47-
* wolfIP's internal DHCP state machine only retries for ~4 seconds
48-
* (DHCP_DISCOVER_RETRIES=1 x 2s timeout). After that it sets state to
49-
* DHCP_OFF and the UDP socket stops accepting unicast DHCP responses
50-
* (because DHCP_IS_RUNNING becomes false). We re-init periodically to
51-
* keep trying, but must space re-inits apart to avoid socket churn
52-
* (close/reopen loses in-flight responses). */
47+
* wolfIP's internal DHCP state machine retries for a finite period based
48+
* on DHCP_DISCOVER_RETRIES and DHCP_REQUEST_RETRIES (wolfIP defaults are 3).
49+
* After the stack gives up it sets state to DHCP_OFF and the UDP socket
50+
* stops accepting unicast DHCP responses (because DHCP_IS_RUNNING becomes
51+
* false). We re-init periodically to keep trying, but must space re-inits
52+
* far enough apart to avoid socket churn (close/reopen loses in-flight
53+
* responses) and to ensure the previous DHCP attempt has fully timed out. */
5354
#define DHCP_TIMEOUT_MS 30000U /* 30s total before static fallback */
5455
#define DHCP_REINIT_MS 10000U /* 10s between DHCP re-init attempts */
5556

0 commit comments

Comments
 (0)