From fa22291f1db158ff305d6e464bf1a7eef22f188c Mon Sep 17 00:00:00 2001 From: staylightblow8 Date: Wed, 27 Dec 2023 08:33:35 +0000 Subject: [PATCH] add temporary access to internet for client Signed-off-by: staylightblow8 --- src/fw_iptables.c | 5 +++++ src/http.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/fw_iptables.c b/src/fw_iptables.c index 8cf28e433..52dfb2a8e 100755 --- a/src/fw_iptables.c +++ b/src/fw_iptables.c @@ -727,6 +727,11 @@ iptables_fw_set_mac_temporary(const char *mac, int which) ipset_do_command("add " CHAIN_UNTRUSTED " %s timeout 60 ", mac); } #else + if(which == 0) { // trusted + nftables_do_command("add element inet fw4 set_wifidogx_trusted_macs { %s }", mac); + } else if(which == 1) { // untrusted + nftables_do_command("add element inet fw4 set_wifidogx_untrusted_macs { %s }", mac); + } #endif } diff --git a/src/http.c b/src/http.c index cf75be60f..daafad7e0 100644 --- a/src/http.c +++ b/src/http.c @@ -491,6 +491,11 @@ ev_http_callback_disconnect(struct evhttp_request *req, void *arg) void ev_http_callback_temporary_pass(struct evhttp_request *req, void *arg) { + if (evhttp_request_get_command(req) == EVHTTP_REQ_OPTIONS) { + ev_http_respond_options(req); + return; + } + const char *mac = ev_http_find_query(req, "mac"); evhttp_add_header(evhttp_request_get_output_headers(req), "Access-Control-Allow-Origin", "*");