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:
DL6ER
2023-05-24 20:47:51 +02:00
parent 3b404ff9a0
commit b5a6ae44aa
7 changed files with 67 additions and 1 deletions
+16 -1
View File
@@ -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);
}