diff options
author | Jan Engelhardt <jengelh@medozas.de> | 2008-10-08 05:35:00 -0400 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2008-10-08 05:35:00 -0400 |
commit | 76108cea065cda58366d16a7eb6ca90d717a1396 (patch) | |
tree | c4fc31d490c902f2c2478a6344ee988dccc6286f /include | |
parent | be713a443ee019489890e93654557916fbf72612 (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')
-rw-r--r-- | include/linux/netfilter.h | 30 | ||||
-rw-r--r-- | include/linux/netfilter/x_tables.h | 28 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack_core.h | 2 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack_expect.h | 2 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack_l4proto.h | 4 | ||||
-rw-r--r-- | include/net/netfilter/nf_log.h | 8 | ||||
-rw-r--r-- | include/net/netfilter/nf_queue.h | 6 |
7 files changed, 41 insertions, 39 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 | ||
141 | extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS]; | 141 | extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS]; |
142 | 142 | ||
143 | int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb, | 143 | int 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 | */ |
154 | static inline int nf_hook_thresh(int pf, unsigned int hook, | 154 | static 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 | ||
170 | static inline int nf_hook(int pf, unsigned int hook, struct sk_buff *skb, | 170 | static 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() */ |
215 | int nf_setsockopt(struct sock *sk, int pf, int optval, char __user *opt, | 215 | int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, |
216 | int len); | 216 | int len); |
217 | int nf_getsockopt(struct sock *sk, int pf, int optval, char __user *opt, | 217 | int nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, |
218 | int *len); | 218 | int *len); |
219 | 219 | ||
220 | int compat_nf_setsockopt(struct sock *sk, int pf, int optval, | 220 | int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, |
221 | char __user *opt, int len); | 221 | char __user *opt, int len); |
222 | int compat_nf_getsockopt(struct sock *sk, int pf, int optval, | 222 | int 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); | |||
292 | extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *); | 292 | extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *); |
293 | 293 | ||
294 | static inline void | 294 | static inline void |
295 | nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) | 295 | nf_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) |
318 | static inline int nf_hook_thresh(int pf, unsigned int hook, | 318 | static 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 | } |
327 | static inline int nf_hook(int pf, unsigned int hook, struct sk_buff *skb, | 327 | static 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 | } |
333 | struct flowi; | 333 | struct flowi; |
334 | static inline void | 334 | static inline void |
335 | nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) {} | 335 | nf_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 | ||
349 | extern struct xt_match *xt_find_match(int af, const char *name, u8 revision); | 349 | extern struct xt_match *xt_find_match(u8 af, const char *name, u8 revision); |
350 | extern struct xt_target *xt_find_target(int af, const char *name, u8 revision); | 350 | extern struct xt_target *xt_find_target(u8 af, const char *name, u8 revision); |
351 | extern struct xt_target *xt_request_find_target(int af, const char *name, | 351 | extern struct xt_target *xt_request_find_target(u8 af, const char *name, |
352 | u8 revision); | 352 | u8 revision); |
353 | extern int xt_find_revision(int af, const char *name, u8 revision, int target, | 353 | extern int xt_find_revision(u8 af, const char *name, u8 revision, |
354 | int *err); | 354 | int target, int *err); |
355 | 355 | ||
356 | extern struct xt_table *xt_find_table_lock(struct net *net, int af, | 356 | extern struct xt_table *xt_find_table_lock(struct net *net, u_int8_t af, |
357 | const char *name); | 357 | const char *name); |
358 | extern void xt_table_unlock(struct xt_table *t); | 358 | extern void xt_table_unlock(struct xt_table *t); |
359 | 359 | ||
360 | extern int xt_proto_init(struct net *net, int af); | 360 | extern int xt_proto_init(struct net *net, u_int8_t af); |
361 | extern void xt_proto_fini(struct net *net, int af); | 361 | extern void xt_proto_fini(struct net *net, u_int8_t af); |
362 | 362 | ||
363 | extern struct xt_table_info *xt_alloc_table_info(unsigned int size); | 363 | extern struct xt_table_info *xt_alloc_table_info(unsigned int size); |
364 | extern void xt_free_table_info(struct xt_table_info *info); | 364 | extern 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 | ||
426 | extern void xt_compat_lock(int af); | 426 | extern void xt_compat_lock(u_int8_t af); |
427 | extern void xt_compat_unlock(int af); | 427 | extern void xt_compat_unlock(u_int8_t af); |
428 | 428 | ||
429 | extern int xt_compat_add_offset(int af, unsigned int offset, short delta); | 429 | extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, short delta); |
430 | extern void xt_compat_flush_offsets(int af); | 430 | extern void xt_compat_flush_offsets(u_int8_t af); |
431 | extern short xt_compat_calc_jump(int af, unsigned int offset); | 431 | extern short xt_compat_calc_jump(u_int8_t af, unsigned int offset); |
432 | 432 | ||
433 | extern int xt_compat_match_offset(const struct xt_match *match); | 433 | extern int xt_compat_match_offset(const struct xt_match *match); |
434 | extern int xt_compat_match_from_user(struct xt_entry_match *m, | 434 | extern int xt_compat_match_from_user(struct xt_entry_match *m, |
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h index a81771210934..05760d6a706e 100644 --- a/include/net/netfilter/nf_conntrack_core.h +++ b/include/net/netfilter/nf_conntrack_core.h | |||
@@ -20,7 +20,7 @@ | |||
20 | /* This header is used to share core functionality between the | 20 | /* This header is used to share core functionality between the |
21 | standalone connection tracking module, and the compatibility layer's use | 21 | standalone connection tracking module, and the compatibility layer's use |
22 | of connection tracking. */ | 22 | of connection tracking. */ |
23 | extern unsigned int nf_conntrack_in(int pf, | 23 | extern unsigned int nf_conntrack_in(u_int8_t pf, |
24 | unsigned int hooknum, | 24 | unsigned int hooknum, |
25 | struct sk_buff *skb); | 25 | struct sk_buff *skb); |
26 | 26 | ||
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h index dfdf4b459475..4c4d894cb9b5 100644 --- a/include/net/netfilter/nf_conntrack_expect.h +++ b/include/net/netfilter/nf_conntrack_expect.h | |||
@@ -86,7 +86,7 @@ void nf_ct_unexpect_related(struct nf_conntrack_expect *exp); | |||
86 | /* Allocate space for an expectation: this is mandatory before calling | 86 | /* Allocate space for an expectation: this is mandatory before calling |
87 | nf_ct_expect_related. You will have to call put afterwards. */ | 87 | nf_ct_expect_related. You will have to call put afterwards. */ |
88 | struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me); | 88 | struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me); |
89 | void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, int, | 89 | void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, u_int8_t, |
90 | const union nf_inet_addr *, | 90 | const union nf_inet_addr *, |
91 | const union nf_inet_addr *, | 91 | const union nf_inet_addr *, |
92 | u_int8_t, const __be16 *, const __be16 *); | 92 | u_int8_t, const __be16 *, const __be16 *); |
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h index 723df9d1cc35..d4376e97bae8 100644 --- a/include/net/netfilter/nf_conntrack_l4proto.h +++ b/include/net/netfilter/nf_conntrack_l4proto.h | |||
@@ -39,7 +39,7 @@ struct nf_conntrack_l4proto | |||
39 | const struct sk_buff *skb, | 39 | const struct sk_buff *skb, |
40 | unsigned int dataoff, | 40 | unsigned int dataoff, |
41 | enum ip_conntrack_info ctinfo, | 41 | enum ip_conntrack_info ctinfo, |
42 | int pf, | 42 | u_int8_t pf, |
43 | unsigned int hooknum); | 43 | unsigned int hooknum); |
44 | 44 | ||
45 | /* Called when a new connection for this protocol found; | 45 | /* Called when a new connection for this protocol found; |
@@ -52,7 +52,7 @@ struct nf_conntrack_l4proto | |||
52 | 52 | ||
53 | int (*error)(struct sk_buff *skb, unsigned int dataoff, | 53 | int (*error)(struct sk_buff *skb, unsigned int dataoff, |
54 | enum ip_conntrack_info *ctinfo, | 54 | enum ip_conntrack_info *ctinfo, |
55 | int pf, unsigned int hooknum); | 55 | u_int8_t pf, unsigned int hooknum); |
56 | 56 | ||
57 | /* Print out the per-protocol part of the tuple. Return like seq_* */ | 57 | /* Print out the per-protocol part of the tuple. Return like seq_* */ |
58 | int (*print_tuple)(struct seq_file *s, | 58 | int (*print_tuple)(struct seq_file *s, |
diff --git a/include/net/netfilter/nf_log.h b/include/net/netfilter/nf_log.h index 8c6b5ae45534..7182c06974f4 100644 --- a/include/net/netfilter/nf_log.h +++ b/include/net/netfilter/nf_log.h | |||
@@ -28,7 +28,7 @@ struct nf_loginfo { | |||
28 | } u; | 28 | } u; |
29 | }; | 29 | }; |
30 | 30 | ||
31 | typedef void nf_logfn(unsigned int pf, | 31 | typedef void nf_logfn(u_int8_t pf, |
32 | unsigned int hooknum, | 32 | unsigned int hooknum, |
33 | const struct sk_buff *skb, | 33 | const struct sk_buff *skb, |
34 | const struct net_device *in, | 34 | const struct net_device *in, |
@@ -43,12 +43,12 @@ struct nf_logger { | |||
43 | }; | 43 | }; |
44 | 44 | ||
45 | /* Function to register/unregister log function. */ | 45 | /* Function to register/unregister log function. */ |
46 | int nf_log_register(int pf, const struct nf_logger *logger); | 46 | int nf_log_register(u_int8_t pf, const struct nf_logger *logger); |
47 | void nf_log_unregister(const struct nf_logger *logger); | 47 | void nf_log_unregister(const struct nf_logger *logger); |
48 | void nf_log_unregister_pf(int pf); | 48 | void nf_log_unregister_pf(u_int8_t pf); |
49 | 49 | ||
50 | /* Calls the registered backend logging function */ | 50 | /* Calls the registered backend logging function */ |
51 | void nf_log_packet(int pf, | 51 | void nf_log_packet(u_int8_t pf, |
52 | unsigned int hooknum, | 52 | unsigned int hooknum, |
53 | const struct sk_buff *skb, | 53 | const struct sk_buff *skb, |
54 | const struct net_device *in, | 54 | const struct net_device *in, |
diff --git a/include/net/netfilter/nf_queue.h b/include/net/netfilter/nf_queue.h index d030044e9235..252fd1010b77 100644 --- a/include/net/netfilter/nf_queue.h +++ b/include/net/netfilter/nf_queue.h | |||
@@ -8,7 +8,7 @@ struct nf_queue_entry { | |||
8 | unsigned int id; | 8 | unsigned int id; |
9 | 9 | ||
10 | struct nf_hook_ops *elem; | 10 | struct nf_hook_ops *elem; |
11 | int pf; | 11 | u_int8_t pf; |
12 | unsigned int hook; | 12 | unsigned int hook; |
13 | struct net_device *indev; | 13 | struct net_device *indev; |
14 | struct net_device *outdev; | 14 | struct net_device *outdev; |
@@ -24,9 +24,9 @@ struct nf_queue_handler { | |||
24 | char *name; | 24 | char *name; |
25 | }; | 25 | }; |
26 | 26 | ||
27 | extern int nf_register_queue_handler(int pf, | 27 | extern int nf_register_queue_handler(u_int8_t pf, |
28 | const struct nf_queue_handler *qh); | 28 | const struct nf_queue_handler *qh); |
29 | extern int nf_unregister_queue_handler(int pf, | 29 | extern int nf_unregister_queue_handler(u_int8_t pf, |
30 | const struct nf_queue_handler *qh); | 30 | const struct nf_queue_handler *qh); |
31 | extern void nf_unregister_queue_handlers(const struct nf_queue_handler *qh); | 31 | extern void nf_unregister_queue_handlers(const struct nf_queue_handler *qh); |
32 | extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); | 32 | extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); |