diff options
| author | Your Name <you@example.com> | 2026-05-17 16:39:31 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-17 16:39:31 +0530 |
| commit | 0c2c67b463d6a90aaa0bb69bf3c91dba1d9ec3ec (patch) | |
| tree | afd9d9bca2d184825ebf7413ec31830e14131030 /main/session.h | |
| parent | 3342c8e7b4f645c75470d3d893d09037a672cfd2 (diff) | |
feat: per-client NAT filtering via LWIP_HOOK_IP4_CANFORWARD
- Add lwip_tollgate_hooks.h defining LWIP_HOOK_IP4_CANFORWARD macro
- Inject hook into lwIP build via CMakeLists.txt ESP_IDF_LWIP_HOOK_FILENAME
- Filter forwarded packets by source IP against firewall allowed list
- Only filter packets from AP subnet (10.192.45.0/24), allow all others
- Fix byte order bug: use network byte order for firewall_is_client_allowed
- NAT always enabled, removed global NAT toggle functions
- Remove spent-secret tracking from session.c (mint is authority)
- Remove unused get_ap_netif() function
- Reduce API server stack from 32KB to 16KB (fixes ESP_ERR_HTTPD_TASK)
- Add esp_random.h stub for unit tests
- All 186 unit tests passing
- Verified on hardware: block->pay->allow->revoke->block E2E works
Diffstat (limited to 'main/session.h')
| -rw-r--r-- | main/session.h | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/main/session.h b/main/session.h index 6282f5a..ea5b476 100644 --- a/main/session.h +++ b/main/session.h | |||
| @@ -16,17 +16,13 @@ typedef struct { | |||
| 16 | uint64_t allotment_bytes; | 16 | uint64_t allotment_bytes; |
| 17 | uint64_t bytes_consumed; | 17 | uint64_t bytes_consumed; |
| 18 | bool active; | 18 | bool active; |
| 19 | char spent_secrets[5][65]; | ||
| 20 | int spent_secret_count; | ||
| 21 | } session_t; | 19 | } session_t; |
| 22 | 20 | ||
| 23 | esp_err_t session_manager_init(void); | 21 | esp_err_t session_manager_init(void); |
| 24 | 22 | ||
| 25 | session_t *session_create(uint32_t client_ip, uint64_t allotment_ms, | 23 | session_t *session_create(uint32_t client_ip, uint64_t allotment_ms); |
| 26 | const char *spent_secrets[], int secret_count); | ||
| 27 | 24 | ||
| 28 | session_t *session_create_bytes(uint32_t client_ip, uint64_t allotment_bytes, | 25 | session_t *session_create_bytes(uint32_t client_ip, uint64_t allotment_bytes); |
| 29 | const char *spent_secrets[], int secret_count); | ||
| 30 | 26 | ||
| 31 | void session_add_bytes(uint32_t client_ip, uint64_t bytes); | 27 | void session_add_bytes(uint32_t client_ip, uint64_t bytes); |
| 32 | 28 | ||
| @@ -37,8 +33,6 @@ void session_extend(session_t *session, uint64_t additional_ms); | |||
| 37 | 33 | ||
| 38 | bool session_is_expired(const session_t *session); | 34 | bool session_is_expired(const session_t *session); |
| 39 | 35 | ||
| 40 | bool session_is_secret_spent(const char *secret); | ||
| 41 | |||
| 42 | void session_check_expiry(void); | 36 | void session_check_expiry(void); |
| 43 | 37 | ||
| 44 | void session_revoke(session_t *session); | 38 | void session_revoke(session_t *session); |