aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2009-06-26 01:51:59 -0400
committerJan Engelhardt <jengelh@medozas.de>2010-02-15 10:59:29 -0500
commitd5d1baa15f5b05e9110403724d5dc72d6d541e04 (patch)
treebdd4858e8a63c7aae1b65f44320dae2aa519b48e /net/bridge
parent739674fb7febf116e7d647031fab16989a08a965 (diff)
netfilter: xtables: add const qualifiers
This should make it easier to remove redundant arguments later. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'net/bridge')
-rw-r--r--net/bridge/netfilter/ebtables.c59
1 files changed, 32 insertions, 27 deletions
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index 208f4e32e732..bcdf02d866b8 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -82,7 +82,8 @@ static inline int ebt_do_match (struct ebt_entry_match *m,
82 return m->u.match->match(skb, par) ? EBT_MATCH : EBT_NOMATCH; 82 return m->u.match->match(skb, par) ? EBT_MATCH : EBT_NOMATCH;
83} 83}
84 84
85static inline int ebt_dev_check(char *entry, const struct net_device *device) 85static inline int
86ebt_dev_check(const char *entry, const struct net_device *device)
86{ 87{
87 int i = 0; 88 int i = 0;
88 const char *devname; 89 const char *devname;
@@ -100,8 +101,9 @@ static inline int ebt_dev_check(char *entry, const struct net_device *device)
100 101
101#define FWINV2(bool,invflg) ((bool) ^ !!(e->invflags & invflg)) 102#define FWINV2(bool,invflg) ((bool) ^ !!(e->invflags & invflg))
102/* process standard matches */ 103/* process standard matches */
103static inline int ebt_basic_match(struct ebt_entry *e, struct ethhdr *h, 104static inline int
104 const struct net_device *in, const struct net_device *out) 105ebt_basic_match(const struct ebt_entry *e, const struct ethhdr *h,
106 const struct net_device *in, const struct net_device *out)
105{ 107{
106 int verdict, i; 108 int verdict, i;
107 109
@@ -156,12 +158,12 @@ unsigned int ebt_do_table (unsigned int hook, struct sk_buff *skb,
156 int i, nentries; 158 int i, nentries;
157 struct ebt_entry *point; 159 struct ebt_entry *point;
158 struct ebt_counter *counter_base, *cb_base; 160 struct ebt_counter *counter_base, *cb_base;
159 struct ebt_entry_target *t; 161 const struct ebt_entry_target *t;
160 int verdict, sp = 0; 162 int verdict, sp = 0;
161 struct ebt_chainstack *cs; 163 struct ebt_chainstack *cs;
162 struct ebt_entries *chaininfo; 164 struct ebt_entries *chaininfo;
163 char *base; 165 const char *base;
164 struct ebt_table_info *private; 166 const struct ebt_table_info *private;
165 bool hotdrop = false; 167 bool hotdrop = false;
166 struct xt_match_param mtpar; 168 struct xt_match_param mtpar;
167 struct xt_target_param tgpar; 169 struct xt_target_param tgpar;
@@ -395,7 +397,7 @@ ebt_check_watcher(struct ebt_entry_watcher *w, struct xt_tgchk_param *par,
395 return 0; 397 return 0;
396} 398}
397 399
398static int ebt_verify_pointers(struct ebt_replace *repl, 400static int ebt_verify_pointers(const struct ebt_replace *repl,
399 struct ebt_table_info *newinfo) 401 struct ebt_table_info *newinfo)
400{ 402{
401 unsigned int limit = repl->entries_size; 403 unsigned int limit = repl->entries_size;
@@ -466,8 +468,8 @@ static int ebt_verify_pointers(struct ebt_replace *repl,
466 * to parse the userspace data 468 * to parse the userspace data
467 */ 469 */
468static inline int 470static inline int
469ebt_check_entry_size_and_hooks(struct ebt_entry *e, 471ebt_check_entry_size_and_hooks(const struct ebt_entry *e,
470 struct ebt_table_info *newinfo, 472 const struct ebt_table_info *newinfo,
471 unsigned int *n, unsigned int *cnt, 473 unsigned int *n, unsigned int *cnt,
472 unsigned int *totalcnt, unsigned int *udc_cnt) 474 unsigned int *totalcnt, unsigned int *udc_cnt)
473{ 475{
@@ -622,9 +624,8 @@ ebt_cleanup_entry(struct ebt_entry *e, struct net *net, unsigned int *cnt)
622} 624}
623 625
624static inline int 626static inline int
625ebt_check_entry(struct ebt_entry *e, 627ebt_check_entry(struct ebt_entry *e, struct net *net,
626 struct net *net, 628 const struct ebt_table_info *newinfo,
627 struct ebt_table_info *newinfo,
628 const char *name, unsigned int *cnt, 629 const char *name, unsigned int *cnt,
629 struct ebt_cl_stack *cl_s, unsigned int udc_cnt) 630 struct ebt_cl_stack *cl_s, unsigned int udc_cnt)
630{ 631{
@@ -743,12 +744,12 @@ cleanup_matches:
743 * the hook mask for udc tells us from which base chains the udc can be 744 * the hook mask for udc tells us from which base chains the udc can be
744 * accessed. This mask is a parameter to the check() functions of the extensions 745 * accessed. This mask is a parameter to the check() functions of the extensions
745 */ 746 */
746static int check_chainloops(struct ebt_entries *chain, struct ebt_cl_stack *cl_s, 747static int check_chainloops(const struct ebt_entries *chain, struct ebt_cl_stack *cl_s,
747 unsigned int udc_cnt, unsigned int hooknr, char *base) 748 unsigned int udc_cnt, unsigned int hooknr, char *base)
748{ 749{
749 int i, chain_nr = -1, pos = 0, nentries = chain->nentries, verdict; 750 int i, chain_nr = -1, pos = 0, nentries = chain->nentries, verdict;
750 struct ebt_entry *e = (struct ebt_entry *)chain->data; 751 const struct ebt_entry *e = (struct ebt_entry *)chain->data;
751 struct ebt_entry_target *t; 752 const struct ebt_entry_target *t;
752 753
753 while (pos < nentries || chain_nr != -1) { 754 while (pos < nentries || chain_nr != -1) {
754 /* end of udc, go back one 'recursion' step */ 755 /* end of udc, go back one 'recursion' step */
@@ -814,7 +815,7 @@ letscontinue:
814} 815}
815 816
816/* do the parsing of the table/chains/entries/matches/watchers/targets, heh */ 817/* do the parsing of the table/chains/entries/matches/watchers/targets, heh */
817static int translate_table(struct net *net, char *name, 818static int translate_table(struct net *net, const char *name,
818 struct ebt_table_info *newinfo) 819 struct ebt_table_info *newinfo)
819{ 820{
820 unsigned int i, j, k, udc_cnt; 821 unsigned int i, j, k, udc_cnt;
@@ -934,7 +935,7 @@ static int translate_table(struct net *net, char *name,
934} 935}
935 936
936/* called under write_lock */ 937/* called under write_lock */
937static void get_counters(struct ebt_counter *oldcounters, 938static void get_counters(const struct ebt_counter *oldcounters,
938 struct ebt_counter *counters, unsigned int nentries) 939 struct ebt_counter *counters, unsigned int nentries)
939{ 940{
940 int i, cpu; 941 int i, cpu;
@@ -957,7 +958,8 @@ static void get_counters(struct ebt_counter *oldcounters,
957} 958}
958 959
959/* replace the table */ 960/* replace the table */
960static int do_replace(struct net *net, void __user *user, unsigned int len) 961static int do_replace(struct net *net, const void __user *user,
962 unsigned int len)
961{ 963{
962 int ret, i, countersize; 964 int ret, i, countersize;
963 struct ebt_table_info *newinfo; 965 struct ebt_table_info *newinfo;
@@ -1237,7 +1239,8 @@ void ebt_unregister_table(struct net *net, struct ebt_table *table)
1237} 1239}
1238 1240
1239/* userspace just supplied us with counters */ 1241/* userspace just supplied us with counters */
1240static int update_counters(struct net *net, void __user *user, unsigned int len) 1242static int update_counters(struct net *net, const void __user *user,
1243 unsigned int len)
1241{ 1244{
1242 int i, ret; 1245 int i, ret;
1243 struct ebt_counter *tmp; 1246 struct ebt_counter *tmp;
@@ -1292,8 +1295,8 @@ free_tmp:
1292 return ret; 1295 return ret;
1293} 1296}
1294 1297
1295static inline int ebt_make_matchname(struct ebt_entry_match *m, 1298static inline int ebt_make_matchname(const struct ebt_entry_match *m,
1296 char *base, char __user *ubase) 1299 const char *base, char __user *ubase)
1297{ 1300{
1298 char __user *hlp = ubase + ((char *)m - base); 1301 char __user *hlp = ubase + ((char *)m - base);
1299 if (copy_to_user(hlp, m->u.match->name, EBT_FUNCTION_MAXNAMELEN)) 1302 if (copy_to_user(hlp, m->u.match->name, EBT_FUNCTION_MAXNAMELEN))
@@ -1301,8 +1304,8 @@ static inline int ebt_make_matchname(struct ebt_entry_match *m,
1301 return 0; 1304 return 0;
1302} 1305}
1303 1306
1304static inline int ebt_make_watchername(struct ebt_entry_watcher *w, 1307static inline int ebt_make_watchername(const struct ebt_entry_watcher *w,
1305 char *base, char __user *ubase) 1308 const char *base, char __user *ubase)
1306{ 1309{
1307 char __user *hlp = ubase + ((char *)w - base); 1310 char __user *hlp = ubase + ((char *)w - base);
1308 if (copy_to_user(hlp , w->u.watcher->name, EBT_FUNCTION_MAXNAMELEN)) 1311 if (copy_to_user(hlp , w->u.watcher->name, EBT_FUNCTION_MAXNAMELEN))
@@ -1310,11 +1313,12 @@ static inline int ebt_make_watchername(struct ebt_entry_watcher *w,
1310 return 0; 1313 return 0;
1311} 1314}
1312 1315
1313static inline int ebt_make_names(struct ebt_entry *e, char *base, char __user *ubase) 1316static inline int
1317ebt_make_names(struct ebt_entry *e, const char *base, char __user *ubase)
1314{ 1318{
1315 int ret; 1319 int ret;
1316 char __user *hlp; 1320 char __user *hlp;
1317 struct ebt_entry_target *t; 1321 const struct ebt_entry_target *t;
1318 1322
1319 if (e->bitmask == 0) 1323 if (e->bitmask == 0)
1320 return 0; 1324 return 0;
@@ -1335,10 +1339,11 @@ static inline int ebt_make_names(struct ebt_entry *e, char *base, char __user *u
1335 1339
1336/* called with ebt_mutex locked */ 1340/* called with ebt_mutex locked */
1337static int copy_everything_to_user(struct ebt_table *t, void __user *user, 1341static int copy_everything_to_user(struct ebt_table *t, void __user *user,
1338 int *len, int cmd) 1342 const int *len, int cmd)
1339{ 1343{
1340 struct ebt_replace tmp; 1344 struct ebt_replace tmp;
1341 struct ebt_counter *counterstmp, *oldcounters; 1345 struct ebt_counter *counterstmp;
1346 const struct ebt_counter *oldcounters;
1342 unsigned int entries_size, nentries; 1347 unsigned int entries_size, nentries;
1343 char *entries; 1348 char *entries;
1344 1349