/** * @internal * append all the rules in a rule set. * @arg ruleset Name of the ruleset * @arg table Table containing the chain. * @arg chain IPTables chain the rules go into */ static int _iptables_append_ruleset(char *table, char *ruleset, char *chain) { t_firewall_rule *rule; char *cmd; int ret = 0; debug(LOG_DEBUG, "Loading ruleset %s into table %s, chain %s", ruleset, table, chain); for (rule = get_ruleset_list(ruleset); rule != NULL; rule = rule->next) { cmd = _iptables_compile(table, chain, rule); debug(LOG_DEBUG, "Loading rule \"%s\" into table %s, chain %s", cmd, table, chain); ret |= iptables_do_command(cmd); free(cmd); } debug(LOG_DEBUG, "Ruleset %s loaded into table %s, chain %s", ruleset, table, chain); return ret; }
int is_empty_ruleset (const char *rulesetname) { return get_ruleset_list(rulesetname) == NULL; }