Skip to content

Commit

Permalink
feat: add fw_counters_update function to streamline firewall counter …
Browse files Browse the repository at this point in the history
…updates

Signed-off-by: Dengfeng Liu <[email protected]>
  • Loading branch information
liudf0716 committed Feb 1, 2025
1 parent 56206ef commit 200484e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
11 changes: 11 additions & 0 deletions src/firewall.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,4 +852,15 @@ fw_del_anti_nat_permit_device(const char *mac)
#else
nft_fw_del_anti_nat_permit(mac);
#endif
}

int
fw_counters_update()
{
debug(LOG_DEBUG, "Update firewall counters");
#ifdef AW_FW3
return iptables_fw_counters_update();
#else
return nft_fw_counters_update();
#endif
}
2 changes: 2 additions & 0 deletions src/firewall.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,6 @@ void conntrack_flush(const char *);
void fw_add_anti_nat_permit_device(const char *);
void fw_del_anti_nat_permit_device(const char *);

int fw_counters_update();

#endif /* _FIREWALL_H_ */
6 changes: 1 addition & 5 deletions src/wdctl_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,7 @@ wdctl_status(struct bufferevent *fd, const char *arg)
const char *type = arg;
char *status = NULL;

#ifdef AW_FW3
if (-1 == iptables_fw_counters_update())
#else
if (-1 == nft_fw_counters_update())
#endif
if (fw_counters_update())
{
debug(LOG_ERR, "Could not get counters from firewall!");
}
Expand Down

0 comments on commit 200484e

Please sign in to comment.