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/firewall.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/firewall.h')
| -rw-r--r-- | main/firewall.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/main/firewall.h b/main/firewall.h index e5d492a..f177eaa 100644 --- a/main/firewall.h +++ b/main/firewall.h | |||
| @@ -6,11 +6,11 @@ | |||
| 6 | #include <stdbool.h> | 6 | #include <stdbool.h> |
| 7 | #include <stdint.h> | 7 | #include <stdint.h> |
| 8 | 8 | ||
| 9 | struct pbuf; | ||
| 10 | |||
| 9 | #define FW_MAX_MAC_LEN 18 | 11 | #define FW_MAX_MAC_LEN 18 |
| 10 | 12 | ||
| 11 | esp_err_t firewall_init(esp_ip4_addr_t ap_ip); | 13 | esp_err_t firewall_init(esp_ip4_addr_t ap_ip); |
| 12 | void firewall_enable_nat(void); | ||
| 13 | void firewall_disable_nat(void); | ||
| 14 | void firewall_grant_access(uint32_t client_ip); | 14 | void firewall_grant_access(uint32_t client_ip); |
| 15 | void firewall_revoke_access(uint32_t client_ip); | 15 | void firewall_revoke_access(uint32_t client_ip); |
| 16 | void firewall_revoke_all(void); | 16 | void firewall_revoke_all(void); |
| @@ -20,4 +20,6 @@ int firewall_client_count(void); | |||
| 20 | 20 | ||
| 21 | esp_err_t firewall_get_mac_for_ip(uint32_t client_ip, char *mac_out, size_t mac_out_size); | 21 | esp_err_t firewall_get_mac_for_ip(uint32_t client_ip, char *mac_out, size_t mac_out_size); |
| 22 | 22 | ||
| 23 | int tollgate_ip4_canforward_filter(struct pbuf *p, uint32_t dest_addr_hostorder); | ||
| 24 | |||
| 23 | #endif | 25 | #endif |