diff options
| author | Your Name <you@example.com> | 2026-05-15 17:03:40 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-15 17:03:40 +0530 |
| commit | a7d0a672d59bf8985a6fc0e61b49015fabd96513 (patch) | |
| tree | 46814d1757649a640f53805a8d9dfc1b0f354289 /main/dns_server.c | |
| parent | 8a2307a5ced6da94cc674602219d5a68a1246264 (diff) | |
Phase 1 working: captive portal, DNS hijack, NAT-based access control
- Fix WiFi init order: netif creation before esp_wifi_init, set mode before set_config
- Replace broken netif input filter with NAPT on/off per authentication state
- NAPT disabled by default, enabled when client granted, disabled on revoke
- Fix test helpers: use -I wlp59s0 for ping, handle nslookup exit code 1
- All 20 API tests pass, all 6 smoke tests pass
Diffstat (limited to 'main/dns_server.c')
| -rw-r--r-- | main/dns_server.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/main/dns_server.c b/main/dns_server.c index f7977c6..733e771 100644 --- a/main/dns_server.c +++ b/main/dns_server.c | |||
| @@ -85,7 +85,6 @@ static void parse_dns_name(const uint8_t *buf, int buf_len, int offset, char *ou | |||
| 85 | 85 | ||
| 86 | static int build_nxdomain(uint8_t *response, int req_len) | 86 | static int build_nxdomain(uint8_t *response, int req_len) |
| 87 | { | 87 | { |
| 88 | memcpy(response, response, req_len); | ||
| 89 | dns_header_t *hdr = (dns_header_t *)response; | 88 | dns_header_t *hdr = (dns_header_t *)response; |
| 90 | hdr->flags = htons(0x8403); | 89 | hdr->flags = htons(0x8403); |
| 91 | hdr->ancount = 0; | 90 | hdr->ancount = 0; |
| @@ -96,7 +95,7 @@ static int build_nxdomain(uint8_t *response, int req_len) | |||
| 96 | 95 | ||
| 97 | static int build_redirect_response(uint8_t *response, int req_len) | 96 | static int build_redirect_response(uint8_t *response, int req_len) |
| 98 | { | 97 | { |
| 99 | memcpy(response, response, req_len); | 98 | memmove(response, response, req_len); |
| 100 | dns_header_t *hdr = (dns_header_t *)response; | 99 | dns_header_t *hdr = (dns_header_t *)response; |
| 101 | hdr->flags = htons(0x8180); | 100 | hdr->flags = htons(0x8180); |
| 102 | hdr->ancount = htons(1); | 101 | hdr->ancount = htons(1); |