diff options
| author | Your Name <you@example.com> | 2026-05-21 06:20:45 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-21 06:20:45 +0530 |
| commit | 716daafce3eaa5ebfd246c1ef9915a2972b4c6fd (patch) | |
| tree | 79535bd62e66a82b248d96174b57a1c0f861cc2d /main/dns_server.c | |
| parent | 60797e35dda136e08b0a6c966fa92107095e6e64 (diff) | |
fix: TLS allocation, stack overflow, DNS bind — mint now reachable
Root cause: mbedtls SSL buffers (16KB) couldn't allocate from fragmented
internal RAM (largest block 8KB). Fix by lowering SPIRAM_MALLOC_ALWAYSINTERNAL
from 16KB to 4KB, allowing SSL buffers to go to PSRAM.
Additional fixes:
- DNS server binds to AP IP only (prevents self-hijacking)
- start_services() moved from esp_timer (2KB stack) to dedicated FreeRTOS
task (16KB stack) — was causing stack overflow with dynamic buffers
- Mint health probe now logs errors and exposes last_err in API
- Debug endpoint shows internal/PSRAM heap breakdown and DNS resolve test
- Enabled CONFIG_MBEDTLS_DYNAMIC_BUFFER for better memory management
- Board C config: mint_url → testnut-nutshell.mints.orangesync.tech
Diffstat (limited to 'main/dns_server.c')
| -rw-r--r-- | main/dns_server.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/main/dns_server.c b/main/dns_server.c index 15a729f..b84a4cf 100644 --- a/main/dns_server.c +++ b/main/dns_server.c | |||
| @@ -161,7 +161,7 @@ static void dns_server_task(void *arg) | |||
| 161 | struct sockaddr_in bind_addr = { | 161 | struct sockaddr_in bind_addr = { |
| 162 | .sin_family = AF_INET, | 162 | .sin_family = AF_INET, |
| 163 | .sin_port = htons(DNS_PORT), | 163 | .sin_port = htons(DNS_PORT), |
| 164 | .sin_addr.s_addr = INADDR_ANY, | 164 | .sin_addr.s_addr = s_ap_ip.addr, |
| 165 | }; | 165 | }; |
| 166 | if (bind(sock, (struct sockaddr *)&bind_addr, sizeof(bind_addr)) < 0) { | 166 | if (bind(sock, (struct sockaddr *)&bind_addr, sizeof(bind_addr)) < 0) { |
| 167 | ESP_LOGE(TAG, "Failed to bind DNS socket"); | 167 | ESP_LOGE(TAG, "Failed to bind DNS socket"); |