Skip to content

Commit

Permalink
improve: flush all conntrack when start
Browse files Browse the repository at this point in the history
Signed-off-by: Dengfeng Liu <[email protected]>
  • Loading branch information
liudf0716 committed Sep 27, 2024
1 parent b24bff0 commit 563ecbf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/firewall.c
Original file line number Diff line number Diff line change
Expand Up @@ -686,3 +686,9 @@ ev_fw_sync_with_authserver(struct wd_request_context *context)
}
}

void
conntrack_flush()
{
debug(LOG_DEBUG, "Flush conntrack");
execute("conntrack -F", 0);
}
2 changes: 2 additions & 0 deletions src/firewall.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,6 @@ void ev_fw_sync_with_authserver(struct wd_request_context *);
/** @brief */
void ev_fw_sync_with_authserver_v2(struct wd_request_context *);

void conntrack_flush();

#endif /* _FIREWALL_H_ */
1 change: 1 addition & 0 deletions src/gateway.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ wd_init(s_config *config)
}

#if 1
conntrack_flush();
/* Reset the firewall (if WiFiDog crashed) */
fw_destroy();
/* Then initialize it */
Expand Down

0 comments on commit 563ecbf

Please sign in to comment.