Skip to content

Commit

Permalink
Simplified logic in restore method
Browse files Browse the repository at this point in the history
Signed-off-by: pierantoniomerlino <[email protected]>
  • Loading branch information
pierantoniomerlino committed Oct 12, 2023
1 parent befb620 commit da6d61b
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -628,11 +628,13 @@ private void writeAdditionalRulesToMangleTable(PrintWriter writer) {
* parsing the iptables configuration file. Only Kura chains are used.
*/
public void restore() throws KuraException {
List<NatPreroutingChainRule> natPreroutingChain = new ArrayList<>();
List<NatPostroutingChainRule> natPostroutingChain = new ArrayList<>();
List<FilterForwardChainRule> filterForwardChain = new ArrayList<>();
File iptablesFile = new File(getFirewallConfigFileName());
if (iptablesFile.exists()) {
if (!iptablesFile.exists()) {
return;
} else {
List<NatPreroutingChainRule> natPreroutingChain = new ArrayList<>();
List<NatPostroutingChainRule> natPostroutingChain = new ArrayList<>();
List<FilterForwardChainRule> filterForwardChain = new ArrayList<>();
try (FileReader fr = new FileReader(getFirewallConfigFileName());
BufferedReader br = new BufferedReader(fr)) {
parseIptablesRules(natPreroutingChain, natPostroutingChain, filterForwardChain, br);
Expand Down

0 comments on commit da6d61b

Please sign in to comment.