diff options
author | Jan Engelhardt <jengelh@medozas.de> | 2009-08-24 08:56:30 -0400 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2009-08-24 08:56:30 -0400 |
commit | 35aad0ffdf548617940ca1e78be1f2e0bafc4496 (patch) | |
tree | 1cab1705197cd247a5b5809e768e89f630c8460e /net/bridge | |
parent | dc05a564ab1b3a1957927da50912964b61f7da69 (diff) |
netfilter: xtables: mark initial tables constant
The inputted table is never modified, so should be considered const.
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net/bridge')
-rw-r--r-- | net/bridge/netfilter/ebtable_broute.c | 2 | ||||
-rw-r--r-- | net/bridge/netfilter/ebtable_filter.c | 2 | ||||
-rw-r--r-- | net/bridge/netfilter/ebtables.c | 13 |
3 files changed, 9 insertions, 8 deletions
diff --git a/net/bridge/netfilter/ebtable_broute.c b/net/bridge/netfilter/ebtable_broute.c index c751111440f8..d32ab13e728c 100644 --- a/net/bridge/netfilter/ebtable_broute.c +++ b/net/bridge/netfilter/ebtable_broute.c | |||
@@ -41,7 +41,7 @@ static int check(const struct ebt_table_info *info, unsigned int valid_hooks) | |||
41 | return 0; | 41 | return 0; |
42 | } | 42 | } |
43 | 43 | ||
44 | static struct ebt_table broute_table = | 44 | static const struct ebt_table broute_table = |
45 | { | 45 | { |
46 | .name = "broute", | 46 | .name = "broute", |
47 | .table = &initial_table, | 47 | .table = &initial_table, |
diff --git a/net/bridge/netfilter/ebtable_filter.c b/net/bridge/netfilter/ebtable_filter.c index 4b988db3cd4d..60b1a6ca7185 100644 --- a/net/bridge/netfilter/ebtable_filter.c +++ b/net/bridge/netfilter/ebtable_filter.c | |||
@@ -50,7 +50,7 @@ static int check(const struct ebt_table_info *info, unsigned int valid_hooks) | |||
50 | return 0; | 50 | return 0; |
51 | } | 51 | } |
52 | 52 | ||
53 | static struct ebt_table frame_filter = | 53 | static const struct ebt_table frame_filter = |
54 | { | 54 | { |
55 | .name = "filter", | 55 | .name = "filter", |
56 | .table = &initial_table, | 56 | .table = &initial_table, |
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index 37928d5f2840..bd1c65425d4f 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c | |||
@@ -1103,23 +1103,24 @@ free_newinfo: | |||
1103 | return ret; | 1103 | return ret; |
1104 | } | 1104 | } |
1105 | 1105 | ||
1106 | struct ebt_table *ebt_register_table(struct net *net, struct ebt_table *table) | 1106 | struct ebt_table * |
1107 | ebt_register_table(struct net *net, const struct ebt_table *input_table) | ||
1107 | { | 1108 | { |
1108 | struct ebt_table_info *newinfo; | 1109 | struct ebt_table_info *newinfo; |
1109 | struct ebt_table *t; | 1110 | struct ebt_table *t, *table; |
1110 | struct ebt_replace_kernel *repl; | 1111 | struct ebt_replace_kernel *repl; |
1111 | int ret, i, countersize; | 1112 | int ret, i, countersize; |
1112 | void *p; | 1113 | void *p; |
1113 | 1114 | ||
1114 | if (!table || !(repl = table->table) || !repl->entries || | 1115 | if (input_table == NULL || (repl = input_table->table) == NULL || |
1115 | repl->entries_size == 0 || | 1116 | repl->entries == 0 || repl->entries_size == 0 || |
1116 | repl->counters || table->private) { | 1117 | repl->counters != NULL || input_table->private != NULL) { |
1117 | BUGPRINT("Bad table data for ebt_register_table!!!\n"); | 1118 | BUGPRINT("Bad table data for ebt_register_table!!!\n"); |
1118 | return ERR_PTR(-EINVAL); | 1119 | return ERR_PTR(-EINVAL); |
1119 | } | 1120 | } |
1120 | 1121 | ||
1121 | /* Don't add one table to multiple lists. */ | 1122 | /* Don't add one table to multiple lists. */ |
1122 | table = kmemdup(table, sizeof(struct ebt_table), GFP_KERNEL); | 1123 | table = kmemdup(input_table, sizeof(struct ebt_table), GFP_KERNEL); |
1123 | if (!table) { | 1124 | if (!table) { |
1124 | ret = -ENOMEM; | 1125 | ret = -ENOMEM; |
1125 | goto out; | 1126 | goto out; |