aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2008-10-08 05:35:00 -0400
committerPatrick McHardy <kaber@trash.net>2008-10-08 05:35:00 -0400
commit76108cea065cda58366d16a7eb6ca90d717a1396 (patch)
treec4fc31d490c902f2c2478a6344ee988dccc6286f /include/linux
parentbe713a443ee019489890e93654557916fbf72612 (diff)
netfilter: Use unsigned types for hooknum and pf vars
and (try to) consistently use u_int8_t for the L3 family. Signed-off-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/netfilter.h30
-rw-r--r--include/linux/netfilter/x_tables.h28
2 files changed, 30 insertions, 28 deletions
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 0c5eb7ed8b3f..8c83d2e23bde 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -92,8 +92,8 @@ struct nf_hook_ops
92 /* User fills in from here down. */ 92 /* User fills in from here down. */
93 nf_hookfn *hook; 93 nf_hookfn *hook;
94 struct module *owner; 94 struct module *owner;
95 int pf; 95 u_int8_t pf;
96 int hooknum; 96 unsigned int hooknum;
97 /* Hooks are ordered in ascending priority. */ 97 /* Hooks are ordered in ascending priority. */
98 int priority; 98 int priority;
99}; 99};
@@ -102,7 +102,7 @@ struct nf_sockopt_ops
102{ 102{
103 struct list_head list; 103 struct list_head list;
104 104
105 int pf; 105 u_int8_t pf;
106 106
107 /* Non-inclusive ranges: use 0/0/NULL to never get called. */ 107 /* Non-inclusive ranges: use 0/0/NULL to never get called. */
108 int set_optmin; 108 int set_optmin;
@@ -140,7 +140,7 @@ extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[];
140 140
141extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS]; 141extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS];
142 142
143int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb, 143int nf_hook_slow(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
144 struct net_device *indev, struct net_device *outdev, 144 struct net_device *indev, struct net_device *outdev,
145 int (*okfn)(struct sk_buff *), int thresh); 145 int (*okfn)(struct sk_buff *), int thresh);
146 146
@@ -151,7 +151,7 @@ int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb,
151 * okfn must be invoked by the caller in this case. Any other return 151 * okfn must be invoked by the caller in this case. Any other return
152 * value indicates the packet has been consumed by the hook. 152 * value indicates the packet has been consumed by the hook.
153 */ 153 */
154static inline int nf_hook_thresh(int pf, unsigned int hook, 154static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
155 struct sk_buff *skb, 155 struct sk_buff *skb,
156 struct net_device *indev, 156 struct net_device *indev,
157 struct net_device *outdev, 157 struct net_device *outdev,
@@ -167,7 +167,7 @@ static inline int nf_hook_thresh(int pf, unsigned int hook,
167 return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh); 167 return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh);
168} 168}
169 169
170static inline int nf_hook(int pf, unsigned int hook, struct sk_buff *skb, 170static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
171 struct net_device *indev, struct net_device *outdev, 171 struct net_device *indev, struct net_device *outdev,
172 int (*okfn)(struct sk_buff *)) 172 int (*okfn)(struct sk_buff *))
173{ 173{
@@ -212,14 +212,14 @@ __ret;})
212 NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, INT_MIN) 212 NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, INT_MIN)
213 213
214/* Call setsockopt() */ 214/* Call setsockopt() */
215int nf_setsockopt(struct sock *sk, int pf, int optval, char __user *opt, 215int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt,
216 int len); 216 int len);
217int nf_getsockopt(struct sock *sk, int pf, int optval, char __user *opt, 217int nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt,
218 int *len); 218 int *len);
219 219
220int compat_nf_setsockopt(struct sock *sk, int pf, int optval, 220int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, int optval,
221 char __user *opt, int len); 221 char __user *opt, int len);
222int compat_nf_getsockopt(struct sock *sk, int pf, int optval, 222int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval,
223 char __user *opt, int *len); 223 char __user *opt, int *len);
224 224
225/* Call this before modifying an existing packet: ensures it is 225/* Call this before modifying an existing packet: ensures it is
@@ -292,7 +292,7 @@ extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo);
292extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *); 292extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *);
293 293
294static inline void 294static inline void
295nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) 295nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
296{ 296{
297#ifdef CONFIG_NF_NAT_NEEDED 297#ifdef CONFIG_NF_NAT_NEEDED
298 void (*decodefn)(struct sk_buff *, struct flowi *); 298 void (*decodefn)(struct sk_buff *, struct flowi *);
@@ -315,7 +315,7 @@ extern struct proc_dir_entry *proc_net_netfilter;
315#else /* !CONFIG_NETFILTER */ 315#else /* !CONFIG_NETFILTER */
316#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) 316#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb)
317#define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb) 317#define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb)
318static inline int nf_hook_thresh(int pf, unsigned int hook, 318static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
319 struct sk_buff *skb, 319 struct sk_buff *skb,
320 struct net_device *indev, 320 struct net_device *indev,
321 struct net_device *outdev, 321 struct net_device *outdev,
@@ -324,7 +324,7 @@ static inline int nf_hook_thresh(int pf, unsigned int hook,
324{ 324{
325 return okfn(skb); 325 return okfn(skb);
326} 326}
327static inline int nf_hook(int pf, unsigned int hook, struct sk_buff *skb, 327static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
328 struct net_device *indev, struct net_device *outdev, 328 struct net_device *indev, struct net_device *outdev,
329 int (*okfn)(struct sk_buff *)) 329 int (*okfn)(struct sk_buff *))
330{ 330{
@@ -332,7 +332,9 @@ static inline int nf_hook(int pf, unsigned int hook, struct sk_buff *skb,
332} 332}
333struct flowi; 333struct flowi;
334static inline void 334static inline void
335nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) {} 335nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
336{
337}
336#endif /*CONFIG_NETFILTER*/ 338#endif /*CONFIG_NETFILTER*/
337 339
338#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 340#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 2326296b6f25..6989b22716e6 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -292,7 +292,7 @@ struct xt_table
292 /* Set this to THIS_MODULE if you are a module, otherwise NULL */ 292 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
293 struct module *me; 293 struct module *me;
294 294
295 int af; /* address/protocol family */ 295 u_int8_t af; /* address/protocol family */
296}; 296};
297 297
298#include <linux/netfilter_ipv4.h> 298#include <linux/netfilter_ipv4.h>
@@ -346,19 +346,19 @@ extern struct xt_table_info *xt_replace_table(struct xt_table *table,
346 struct xt_table_info *newinfo, 346 struct xt_table_info *newinfo,
347 int *error); 347 int *error);
348 348
349extern struct xt_match *xt_find_match(int af, const char *name, u8 revision); 349extern struct xt_match *xt_find_match(u8 af, const char *name, u8 revision);
350extern struct xt_target *xt_find_target(int af, const char *name, u8 revision); 350extern struct xt_target *xt_find_target(u8 af, const char *name, u8 revision);
351extern struct xt_target *xt_request_find_target(int af, const char *name, 351extern struct xt_target *xt_request_find_target(u8 af, const char *name,
352 u8 revision); 352 u8 revision);
353extern int xt_find_revision(int af, const char *name, u8 revision, int target, 353extern int xt_find_revision(u8 af, const char *name, u8 revision,
354 int *err); 354 int target, int *err);
355 355
356extern struct xt_table *xt_find_table_lock(struct net *net, int af, 356extern struct xt_table *xt_find_table_lock(struct net *net, u_int8_t af,
357 const char *name); 357 const char *name);
358extern void xt_table_unlock(struct xt_table *t); 358extern void xt_table_unlock(struct xt_table *t);
359 359
360extern int xt_proto_init(struct net *net, int af); 360extern int xt_proto_init(struct net *net, u_int8_t af);
361extern void xt_proto_fini(struct net *net, int af); 361extern void xt_proto_fini(struct net *net, u_int8_t af);
362 362
363extern struct xt_table_info *xt_alloc_table_info(unsigned int size); 363extern struct xt_table_info *xt_alloc_table_info(unsigned int size);
364extern void xt_free_table_info(struct xt_table_info *info); 364extern void xt_free_table_info(struct xt_table_info *info);
@@ -423,12 +423,12 @@ struct compat_xt_counters_info
423#define COMPAT_XT_ALIGN(s) (((s) + (__alignof__(struct compat_xt_counters)-1)) \ 423#define COMPAT_XT_ALIGN(s) (((s) + (__alignof__(struct compat_xt_counters)-1)) \
424 & ~(__alignof__(struct compat_xt_counters)-1)) 424 & ~(__alignof__(struct compat_xt_counters)-1))
425 425
426extern void xt_compat_lock(int af); 426extern void xt_compat_lock(u_int8_t af);
427extern void xt_compat_unlock(int af); 427extern void xt_compat_unlock(u_int8_t af);
428 428
429extern int xt_compat_add_offset(int af, unsigned int offset, short delta); 429extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, short delta);
430extern void xt_compat_flush_offsets(int af); 430extern void xt_compat_flush_offsets(u_int8_t af);
431extern short xt_compat_calc_jump(int af, unsigned int offset); 431extern short xt_compat_calc_jump(u_int8_t af, unsigned int offset);
432 432
433extern int xt_compat_match_offset(const struct xt_match *match); 433extern int xt_compat_match_offset(const struct xt_match *match);
434extern int xt_compat_match_from_user(struct xt_entry_match *m, 434extern int xt_compat_match_from_user(struct xt_entry_match *m,