Permalink
Browse files

Parse iptables rules that include "--comment"

  • Loading branch information...
1 parent 67af7de commit a0b05bdaa848124f64bb3fca3bf83aa0f7324ade @justinsb justinsb committed Jun 8, 2012
@@ -24,6 +24,7 @@
String device;
boolean logPacket;
public boolean fromIpsec;
+ public String comment;
public FirewallRecord() {
}
@@ -181,6 +181,12 @@ public static FirewallRecord parseRule(String rule) {
throw new IllegalStateException();
}
record.keepState = true;
+ } else if (module.equals("comment")) {
+ if (!tokens.remove().equals("--comment")) {
+ throw new IllegalStateException("Expected --comment");
+ }
+ String comment = tokens.remove();
+ record.comment = comment;
} else {
throw new IllegalArgumentException("Cannot parse -m module in " + rule);
}

0 comments on commit a0b05bd

Please sign in to comment.