From e5eec6dd21352a4ac6e2e71e09323a7035b49fc6 Mon Sep 17 00:00:00 2001 From: "Alexander V. Chernikov" Date: Tue, 12 Aug 2014 16:08:13 +0000 Subject: [PATCH] * Rename ipfw_[un]bind_table_rule to ipfw_[un]ref_rule_tables * Update their descriptions. --- sys/netpfil/ipfw/ip_fw_sockopt.c | 2 +- sys/netpfil/ipfw/ip_fw_table.c | 13 +++++-------- sys/netpfil/ipfw/ip_fw_table.h | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/sys/netpfil/ipfw/ip_fw_sockopt.c b/sys/netpfil/ipfw/ip_fw_sockopt.c index 7f05ed1c57eb..ac733d9f1e6d 100644 --- a/sys/netpfil/ipfw/ip_fw_sockopt.c +++ b/sys/netpfil/ipfw/ip_fw_sockopt.c @@ -658,7 +658,7 @@ commit_rules(struct ip_fw_chain *chain, struct rule_check_info *rci, int count) ci--; if (ci->table_opcodes == 0) continue; - ipfw_unbind_table_rule(chain,ci->krule); + ipfw_unref_rule_tables(chain,ci->krule); } IPFW_UH_WUNLOCK(chain); diff --git a/sys/netpfil/ipfw/ip_fw_table.c b/sys/netpfil/ipfw/ip_fw_table.c index c67073598a97..7819405979ed 100644 --- a/sys/netpfil/ipfw/ip_fw_table.c +++ b/sys/netpfil/ipfw/ip_fw_table.c @@ -2940,14 +2940,14 @@ ipfw_move_tables_sets(struct ip_fw_chain *ch, ipfw_range_tlv *rt, /* * Finds and bumps refcount for tables referenced by given @rule. - * Allocates new indexes for non-existing tables. + * Auto-creates non-existing tables. * Fills in @oib array with userland/kernel indexes. * First free oidx pointer is saved back in @oib. * * Returns 0 on success. */ static int -bind_table_rule(struct ip_fw_chain *ch, struct ip_fw *rule, +find_ref_rule_tables(struct ip_fw_chain *ch, struct ip_fw *rule, struct rule_check_info *ci, struct obj_idx **oib, struct tid_info *ti) { struct table_config *tc; @@ -2969,10 +2969,7 @@ bind_table_rule(struct ip_fw_chain *ch, struct ip_fw *rule, IPFW_UH_WLOCK(ch); ni = CHAIN_TO_NI(ch); - /* - * Increase refcount on each referenced table. - * Allocate table indexes for non-existing tables. - */ + /* Increase refcount on each existing referenced table. */ for ( ; l > 0 ; l -= cmdlen, cmd += cmdlen) { cmdlen = F_LEN(cmd); @@ -3071,7 +3068,7 @@ bind_table_rule(struct ip_fw_chain *ch, struct ip_fw *rule, * Remove references from every table used in @rule. */ void -ipfw_unbind_table_rule(struct ip_fw_chain *chain, struct ip_fw *rule) +ipfw_unref_rule_tables(struct ip_fw_chain *chain, struct ip_fw *rule) { int cmdlen, l; ipfw_insn *cmd; @@ -3203,7 +3200,7 @@ ipfw_rewrite_table_uidx(struct ip_fw_chain *chain, } /* Reference all used tables */ - error = bind_table_rule(chain, ci->krule, ci, &pidx_last, &ti); + error = find_ref_rule_tables(chain, ci->krule, ci, &pidx_last, &ti); if (error != 0) goto free; diff --git a/sys/netpfil/ipfw/ip_fw_table.h b/sys/netpfil/ipfw/ip_fw_table.h index cf89f65e07b5..bcbffa838d85 100644 --- a/sys/netpfil/ipfw/ip_fw_table.h +++ b/sys/netpfil/ipfw/ip_fw_table.h @@ -176,7 +176,7 @@ int ipfw_mark_table_kidx(struct ip_fw_chain *chain, struct ip_fw *rule, uint32_t *bmask); int ipfw_export_table_ntlv(struct ip_fw_chain *ch, uint16_t kidx, struct sockopt_data *sd); -void ipfw_unbind_table_rule(struct ip_fw_chain *chain, struct ip_fw *rule); +void ipfw_unref_rule_tables(struct ip_fw_chain *chain, struct ip_fw *rule); /* utility functions */ int ipfw_check_table_name(char *name);