mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
Add /api/action/flush/arp flushing both the network and network_addresses tables in pihole-FTL.db
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
+16
-1
@@ -17,9 +17,10 @@
|
||||
// reboot()
|
||||
#include <sys/reboot.h>
|
||||
#include <unistd.h>
|
||||
|
||||
// exit_code
|
||||
#include "signals.h"
|
||||
// flush_network_table()
|
||||
#include "database/network-table.h"
|
||||
|
||||
static int run_and_stream_command(struct ftl_conn *api, const char *path, const char *const args[])
|
||||
{
|
||||
@@ -172,3 +173,17 @@ int api_action_flush_logs(struct ftl_conn *api)
|
||||
"Cannot flush the logs",
|
||||
NULL);
|
||||
}
|
||||
|
||||
int api_action_flush_arp(struct ftl_conn *api)
|
||||
{
|
||||
log_info("Received API request to flush the ARP cache");
|
||||
|
||||
// Flush the ARP cache
|
||||
if(flush_network_table())
|
||||
return send_json_success(api);
|
||||
else
|
||||
return send_json_error(api, 500,
|
||||
"server_error",
|
||||
"Cannot flush the ARP cache",
|
||||
NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user