public override void AddRule(IpTablesRule rule) { if (!_inTransaction) { //Revert to using IPTables Binary if non transactional IPTablesBinaryAdapterClient binaryClient = new IPTablesBinaryAdapterClient(_ipVersion, _system, _iptablesBinary); binaryClient.AddRule(rule); return; } String command = rule.GetActionCommand("-A", false); _builder.AddCommand(rule.Chain.Table, command); }
public override void AddRule(IpTablesRule rule) { if (!_inTransaction) { //Revert to using IPTables Binary if non transactional IPTablesBinaryAdapterClient binaryClient = new IPTablesBinaryAdapterClient(_ipVersion, _system, _iptablesBinary); binaryClient.AddRule(rule); return; } String command = rule.GetActionCommand("-A"); if (GetInterface(rule.Chain.Table).ExecuteCommand("iptables " + command) != 1) { throw new IpTablesNetException(String.Format("Failed to add rule \"{0}\" due to error: \"{1}\"", command, GetInterface(rule.Chain.Table).GetErrorString())); } }
public override void AddRule(IpTablesRule rule) { if (!_inTransaction) { //Revert to using IPTables Binary if non transactional IPTablesBinaryAdapterClient binaryClient = new IPTablesBinaryAdapterClient(_ipVersion, _system, _iptablesBinary); binaryClient.AddRule(rule); return; } String command = rule.GetActionCommand("-A", false); _builder.AddCommand(rule.Chain.Table, command); }
public override void AddRule(IpTablesRule rule) { if (!_inTransaction) { //Revert to using IPTables Binary if non transactional IPTablesBinaryAdapterClient binaryClient = new IPTablesBinaryAdapterClient(_ipVersion, _system, _iptablesBinary); binaryClient.AddRule(rule); return; } String command = rule.GetActionCommand("-A"); if (GetInterface(rule.Chain.Table).ExecuteCommand(_iptablesBinary + " " + command) != 1) { throw new IpTablesNetException(String.Format("Failed to add rule \"{0}\" due to error: \"{1}\"", command, GetInterface(rule.Chain.Table).GetErrorString())); } }