提交 1f072c96 编写于 作者: A Al Viro 提交者: David S. Miller

[EBTABLES]: translate_table(): switch direct uses of repl->hook_info to newinfo

Since newinfo->hook_table[] already has been set up, we can switch to using
it instead of repl->{hook_info,valid_hooks}.
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 e4fd77de
...@@ -792,22 +792,22 @@ static int translate_table(struct ebt_replace *repl, ...@@ -792,22 +792,22 @@ static int translate_table(struct ebt_replace *repl,
return ret; return ret;
i = 0; i = 0;
while (i < NF_BR_NUMHOOKS && !(repl->valid_hooks & (1 << i))) while (i < NF_BR_NUMHOOKS && !newinfo->hook_entry[i])
i++; i++;
if (i == NF_BR_NUMHOOKS) { if (i == NF_BR_NUMHOOKS) {
BUGPRINT("No valid hooks specified\n"); BUGPRINT("No valid hooks specified\n");
return -EINVAL; return -EINVAL;
} }
if (repl->hook_entry[i] != (struct ebt_entries *)repl->entries) { if (newinfo->hook_entry[i] != (struct ebt_entries *)newinfo->entries) {
BUGPRINT("Chains don't start at beginning\n"); BUGPRINT("Chains don't start at beginning\n");
return -EINVAL; return -EINVAL;
} }
/* make sure chains are ordered after each other in same order /* make sure chains are ordered after each other in same order
as their corresponding hooks */ as their corresponding hooks */
for (j = i + 1; j < NF_BR_NUMHOOKS; j++) { for (j = i + 1; j < NF_BR_NUMHOOKS; j++) {
if (!(repl->valid_hooks & (1 << j))) if (!newinfo->hook_entry[j])
continue; continue;
if ( repl->hook_entry[j] <= repl->hook_entry[i] ) { if (newinfo->hook_entry[j] <= newinfo->hook_entry[i]) {
BUGPRINT("Hook order must be followed\n"); BUGPRINT("Hook order must be followed\n");
return -EINVAL; return -EINVAL;
} }
...@@ -877,7 +877,7 @@ static int translate_table(struct ebt_replace *repl, ...@@ -877,7 +877,7 @@ static int translate_table(struct ebt_replace *repl,
/* Check for loops */ /* Check for loops */
for (i = 0; i < NF_BR_NUMHOOKS; i++) for (i = 0; i < NF_BR_NUMHOOKS; i++)
if (repl->valid_hooks & (1 << i)) if (newinfo->hook_entry[i])
if (check_chainloops(newinfo->hook_entry[i], if (check_chainloops(newinfo->hook_entry[i],
cl_s, udc_cnt, i, newinfo->entries)) { cl_s, udc_cnt, i, newinfo->entries)) {
vfree(cl_s); vfree(cl_s);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册