Skip to content

Commit

Permalink
add temporary access to internet for client
Browse files Browse the repository at this point in the history
Signed-off-by: staylightblow8 <[email protected]>
  • Loading branch information
liudf0716 committed Dec 27, 2023
1 parent b35afd0 commit fa22291
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/fw_iptables.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
5 changes: 5 additions & 0 deletions src/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -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", "*");
Expand Down

0 comments on commit fa22291

Please sign in to comment.