# --tcp-flags takes two values; we cheat by adding " around it
# so it behaves like --comment
+ # we do a simular thing for negated address masks (source and destination).
values = values.sub(/--tcp-flags (\S*) (\S*)/, '--tcp-flags "\1 \2"')
+ values = values.sub(/-s (!)\s?(\S*)/, '-s "\1 \2"')
+ values = values.sub(/-d (!)\s?(\S*)/,'-d "\1 \2"')
# Trick the system for booleans
@known_booleans.each do |bool|
# Normalise all rules to CIDR notation.
[:source, :destination].each do |prop|
- hash[prop] = Puppet::Util::IPCidr.new(hash[prop]).cidr unless hash[prop].nil?
+ next if hash[prop].nil?
+ m = hash[prop].match(/(!?)\s?(.*)/)
+ neg = "! " if m[1] == "!"
+ hash[prop] = "#{neg}#{Puppet::Util::IPCidr.new(m[2]).cidr}"
end
[:dport, :sport, :port, :state, :ctstate].each do |prop|