static int jump_rule_exists_chk_support(const fko_srv_options_t * const opts, const int chain_num) { int exists = 0; char rule_buf[CMD_BUFSIZE] = {0}; snprintf(rule_buf, CMD_BUFSIZE-1, IPT_CHK_JUMP_RULE_ARGS, fwc.chain[chain_num].table, fwc.chain[chain_num].to_chain ); if(rule_exists_chk_support(opts, fwc.chain[chain_num].from_chain, rule_buf) == 1) { log_msg(LOG_DEBUG, "jump_rule_exists_chk_support() jump rule found"); exists = 1; } else log_msg(LOG_DEBUG, "jump_rule_exists_chk_support() jump rule not found"); return exists; }
static int rule_exists(const fko_srv_options_t * const opts, const struct fw_chain * const fwc, const char * const rule, const unsigned int proto, const char * const ip, const unsigned int port, const unsigned int exp_ts) { int rule_exists = 0; if(have_ipt_chk_support == 1) rule_exists = rule_exists_chk_support(opts, fwc->to_chain, rule); else rule_exists = rule_exists_no_chk_support(opts, fwc, proto, ip, port, exp_ts); if(rule_exists == 1) log_msg(LOG_DEBUG, "rule_exists() Rule : '%s' in %s already exists", rule, fwc->to_chain); else log_msg(LOG_DEBUG, "rule_exists() Rule : '%s' in %s does not exist", rule, fwc->to_chain); return(rule_exists); }