Skip to content

Commit 4e77be4

Browse files
JoePerchesdavem330
authored andcommitted
netfilter: Remove extern from function prototypes
There are a mix of function prototypes with and without extern in the kernel sources. Standardize on not using extern for function prototypes. Function prototypes don't need to be written with extern. extern is assumed by the compiler. Its use is as unnecessary as using auto to declare automatic/local variables in a block. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0e418f9 commit 4e77be4

22 files changed

Lines changed: 217 additions & 246 deletions

‎include/net/netfilter/ipv4/nf_conntrack_ipv4.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp4;
1616
extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4;
1717
extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp;
1818

19-
extern int nf_conntrack_ipv4_compat_init(void);
20-
extern void nf_conntrack_ipv4_compat_fini(void);
19+
int nf_conntrack_ipv4_compat_init(void);
20+
void nf_conntrack_ipv4_compat_fini(void);
2121

22-
extern void need_ipv4_conntrack(void);
22+
void need_ipv4_conntrack(void);
2323

2424
#endif /*_NF_CONNTRACK_IPV4_H*/
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#ifndef _NF_DEFRAG_IPV4_H
22
#define _NF_DEFRAG_IPV4_H
33

4-
extern void nf_defrag_ipv4_enable(void);
4+
void nf_defrag_ipv4_enable(void);
55

66
#endif /* _NF_DEFRAG_IPV4_H */

‎include/net/netfilter/ipv6/nf_defrag_ipv6.h‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
#ifndef _NF_DEFRAG_IPV6_H
22
#define _NF_DEFRAG_IPV6_H
33

4-
extern void nf_defrag_ipv6_enable(void);
5-
6-
extern int nf_ct_frag6_init(void);
7-
extern void nf_ct_frag6_cleanup(void);
8-
extern struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user);
9-
extern void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb,
10-
struct net_device *in,
11-
struct net_device *out,
12-
int (*okfn)(struct sk_buff *));
4+
void nf_defrag_ipv6_enable(void);
5+
6+
int nf_ct_frag6_init(void);
7+
void nf_ct_frag6_cleanup(void);
8+
struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user);
9+
void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb,
10+
struct net_device *in, struct net_device *out,
11+
int (*okfn)(struct sk_buff *));
1312

1413
struct inet_frags_ctl;
1514

‎include/net/netfilter/nf_conntrack.h‎

Lines changed: 30 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,13 @@ static inline struct net *nf_ct_net(const struct nf_conn *ct)
139139
}
140140

141141
/* Alter reply tuple (maybe alter helper). */
142-
extern void
143-
nf_conntrack_alter_reply(struct nf_conn *ct,
144-
const struct nf_conntrack_tuple *newreply);
142+
void nf_conntrack_alter_reply(struct nf_conn *ct,
143+
const struct nf_conntrack_tuple *newreply);
145144

146145
/* Is this tuple taken? (ignoring any belonging to the given
147146
conntrack). */
148-
extern int
149-
nf_conntrack_tuple_taken(const struct nf_conntrack_tuple *tuple,
150-
const struct nf_conn *ignored_conntrack);
147+
int nf_conntrack_tuple_taken(const struct nf_conntrack_tuple *tuple,
148+
const struct nf_conn *ignored_conntrack);
151149

152150
/* Return conntrack_info and tuple hash for given skb. */
153151
static inline struct nf_conn *
@@ -165,37 +163,34 @@ static inline void nf_ct_put(struct nf_conn *ct)
165163
}
166164

167165
/* Protocol module loading */
168-
extern int nf_ct_l3proto_try_module_get(unsigned short l3proto);
169-
extern void nf_ct_l3proto_module_put(unsigned short l3proto);
166+
int nf_ct_l3proto_try_module_get(unsigned short l3proto);
167+
void nf_ct_l3proto_module_put(unsigned short l3proto);
170168

171169
/*
172170
* Allocate a hashtable of hlist_head (if nulls == 0),
173171
* or hlist_nulls_head (if nulls == 1)
174172
*/
175-
extern void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls);
173+
void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls);
176174

177-
extern void nf_ct_free_hashtable(void *hash, unsigned int size);
175+
void nf_ct_free_hashtable(void *hash, unsigned int size);
178176

179-
extern struct nf_conntrack_tuple_hash *
177+
struct nf_conntrack_tuple_hash *
180178
__nf_conntrack_find(struct net *net, u16 zone,
181179
const struct nf_conntrack_tuple *tuple);
182180

183-
extern int nf_conntrack_hash_check_insert(struct nf_conn *ct);
181+
int nf_conntrack_hash_check_insert(struct nf_conn *ct);
184182
bool nf_ct_delete(struct nf_conn *ct, u32 pid, int report);
185183

186-
extern void nf_conntrack_flush_report(struct net *net, u32 portid, int report);
184+
void nf_conntrack_flush_report(struct net *net, u32 portid, int report);
187185

188-
extern bool nf_ct_get_tuplepr(const struct sk_buff *skb,
189-
unsigned int nhoff, u_int16_t l3num,
190-
struct nf_conntrack_tuple *tuple);
191-
extern bool nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse,
192-
const struct nf_conntrack_tuple *orig);
186+
bool nf_ct_get_tuplepr(const struct sk_buff *skb, unsigned int nhoff,
187+
u_int16_t l3num, struct nf_conntrack_tuple *tuple);
188+
bool nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse,
189+
const struct nf_conntrack_tuple *orig);
193190

194-
extern void __nf_ct_refresh_acct(struct nf_conn *ct,
195-
enum ip_conntrack_info ctinfo,
196-
const struct sk_buff *skb,
197-
unsigned long extra_jiffies,
198-
int do_acct);
191+
void __nf_ct_refresh_acct(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
192+
const struct sk_buff *skb,
193+
unsigned long extra_jiffies, int do_acct);
199194

200195
/* Refresh conntrack for this many jiffies and do accounting */
201196
static inline void nf_ct_refresh_acct(struct nf_conn *ct,
@@ -214,10 +209,8 @@ static inline void nf_ct_refresh(struct nf_conn *ct,
214209
__nf_ct_refresh_acct(ct, 0, skb, extra_jiffies, 0);
215210
}
216211

217-
extern bool __nf_ct_kill_acct(struct nf_conn *ct,
218-
enum ip_conntrack_info ctinfo,
219-
const struct sk_buff *skb,
220-
int do_acct);
212+
bool __nf_ct_kill_acct(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
213+
const struct sk_buff *skb, int do_acct);
221214

222215
/* kill conntrack and do accounting */
223216
static inline bool nf_ct_kill_acct(struct nf_conn *ct,
@@ -244,19 +237,17 @@ static inline struct nf_conn *nf_ct_untracked_get(void)
244237
{
245238
return &__raw_get_cpu_var(nf_conntrack_untracked);
246239
}
247-
extern void nf_ct_untracked_status_or(unsigned long bits);
240+
void nf_ct_untracked_status_or(unsigned long bits);
248241

249242
/* Iterate over all conntracks: if iter returns true, it's deleted. */
250-
extern void
251-
nf_ct_iterate_cleanup(struct net *net,
252-
int (*iter)(struct nf_conn *i, void *data),
253-
void *data, u32 portid, int report);
254-
extern void nf_conntrack_free(struct nf_conn *ct);
255-
extern struct nf_conn *
256-
nf_conntrack_alloc(struct net *net, u16 zone,
257-
const struct nf_conntrack_tuple *orig,
258-
const struct nf_conntrack_tuple *repl,
259-
gfp_t gfp);
243+
void nf_ct_iterate_cleanup(struct net *net,
244+
int (*iter)(struct nf_conn *i, void *data),
245+
void *data, u32 portid, int report);
246+
void nf_conntrack_free(struct nf_conn *ct);
247+
struct nf_conn *nf_conntrack_alloc(struct net *net, u16 zone,
248+
const struct nf_conntrack_tuple *orig,
249+
const struct nf_conntrack_tuple *repl,
250+
gfp_t gfp);
260251

261252
static inline int nf_ct_is_template(const struct nf_conn *ct)
262253
{
@@ -287,7 +278,7 @@ static inline bool nf_is_loopback_packet(const struct sk_buff *skb)
287278

288279
struct kernel_param;
289280

290-
extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp);
281+
int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp);
291282
extern unsigned int nf_conntrack_htable_size;
292283
extern unsigned int nf_conntrack_max;
293284
extern unsigned int nf_conntrack_hash_rnd;

‎include/net/netfilter/nf_conntrack_acct.h‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ struct nf_conn_counter *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp)
4242
return acct;
4343
};
4444

45-
extern unsigned int
46-
seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir);
45+
unsigned int seq_print_acct(struct seq_file *s, const struct nf_conn *ct,
46+
int dir);
4747

4848
/* Check if connection tracking accounting is enabled */
4949
static inline bool nf_ct_acct_enabled(struct net *net)
@@ -57,9 +57,9 @@ static inline void nf_ct_set_acct(struct net *net, bool enable)
5757
net->ct.sysctl_acct = enable;
5858
}
5959

60-
extern int nf_conntrack_acct_pernet_init(struct net *net);
61-
extern void nf_conntrack_acct_pernet_fini(struct net *net);
60+
int nf_conntrack_acct_pernet_init(struct net *net);
61+
void nf_conntrack_acct_pernet_fini(struct net *net);
6262

63-
extern int nf_conntrack_acct_init(void);
64-
extern void nf_conntrack_acct_fini(void);
63+
int nf_conntrack_acct_init(void);
64+
void nf_conntrack_acct_fini(void);
6565
#endif /* _NF_CONNTRACK_ACCT_H */

‎include/net/netfilter/nf_conntrack_core.h‎

Lines changed: 31 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -20,49 +20,42 @@
2020
/* This header is used to share core functionality between the
2121
standalone connection tracking module, and the compatibility layer's use
2222
of connection tracking. */
23-
extern unsigned int nf_conntrack_in(struct net *net,
24-
u_int8_t pf,
25-
unsigned int hooknum,
26-
struct sk_buff *skb);
27-
28-
extern int nf_conntrack_init_net(struct net *net);
29-
extern void nf_conntrack_cleanup_net(struct net *net);
30-
extern void nf_conntrack_cleanup_net_list(struct list_head *net_exit_list);
31-
32-
extern int nf_conntrack_proto_pernet_init(struct net *net);
33-
extern void nf_conntrack_proto_pernet_fini(struct net *net);
34-
35-
extern int nf_conntrack_proto_init(void);
36-
extern void nf_conntrack_proto_fini(void);
37-
38-
extern int nf_conntrack_init_start(void);
39-
extern void nf_conntrack_cleanup_start(void);
40-
41-
extern void nf_conntrack_init_end(void);
42-
extern void nf_conntrack_cleanup_end(void);
43-
44-
extern bool
45-
nf_ct_get_tuple(const struct sk_buff *skb,
46-
unsigned int nhoff,
47-
unsigned int dataoff,
48-
u_int16_t l3num,
49-
u_int8_t protonum,
50-
struct nf_conntrack_tuple *tuple,
51-
const struct nf_conntrack_l3proto *l3proto,
52-
const struct nf_conntrack_l4proto *l4proto);
53-
54-
extern bool
55-
nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
56-
const struct nf_conntrack_tuple *orig,
57-
const struct nf_conntrack_l3proto *l3proto,
58-
const struct nf_conntrack_l4proto *l4proto);
23+
unsigned int nf_conntrack_in(struct net *net, u_int8_t pf, unsigned int hooknum,
24+
struct sk_buff *skb);
25+
26+
int nf_conntrack_init_net(struct net *net);
27+
void nf_conntrack_cleanup_net(struct net *net);
28+
void nf_conntrack_cleanup_net_list(struct list_head *net_exit_list);
29+
30+
int nf_conntrack_proto_pernet_init(struct net *net);
31+
void nf_conntrack_proto_pernet_fini(struct net *net);
32+
33+
int nf_conntrack_proto_init(void);
34+
void nf_conntrack_proto_fini(void);
35+
36+
int nf_conntrack_init_start(void);
37+
void nf_conntrack_cleanup_start(void);
38+
39+
void nf_conntrack_init_end(void);
40+
void nf_conntrack_cleanup_end(void);
41+
42+
bool nf_ct_get_tuple(const struct sk_buff *skb, unsigned int nhoff,
43+
unsigned int dataoff, u_int16_t l3num, u_int8_t protonum,
44+
struct nf_conntrack_tuple *tuple,
45+
const struct nf_conntrack_l3proto *l3proto,
46+
const struct nf_conntrack_l4proto *l4proto);
47+
48+
bool nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
49+
const struct nf_conntrack_tuple *orig,
50+
const struct nf_conntrack_l3proto *l3proto,
51+
const struct nf_conntrack_l4proto *l4proto);
5952

6053
/* Find a connection corresponding to a tuple. */
61-
extern struct nf_conntrack_tuple_hash *
54+
struct nf_conntrack_tuple_hash *
6255
nf_conntrack_find_get(struct net *net, u16 zone,
6356
const struct nf_conntrack_tuple *tuple);
6457

65-
extern int __nf_conntrack_confirm(struct sk_buff *skb);
58+
int __nf_conntrack_confirm(struct sk_buff *skb);
6659

6760
/* Confirm a connection: returns NF_DROP if packet must be dropped. */
6861
static inline int nf_conntrack_confirm(struct sk_buff *skb)

‎include/net/netfilter/nf_conntrack_ecache.h‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,12 @@ struct nf_ct_event_notifier {
6868
int (*fcn)(unsigned int events, struct nf_ct_event *item);
6969
};
7070

71-
extern int nf_conntrack_register_notifier(struct net *net, struct nf_ct_event_notifier *nb);
72-
extern void nf_conntrack_unregister_notifier(struct net *net, struct nf_ct_event_notifier *nb);
71+
int nf_conntrack_register_notifier(struct net *net,
72+
struct nf_ct_event_notifier *nb);
73+
void nf_conntrack_unregister_notifier(struct net *net,
74+
struct nf_ct_event_notifier *nb);
7375

74-
extern void nf_ct_deliver_cached_events(struct nf_conn *ct);
76+
void nf_ct_deliver_cached_events(struct nf_conn *ct);
7577

7678
static inline void
7779
nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
@@ -166,8 +168,10 @@ struct nf_exp_event_notifier {
166168
int (*fcn)(unsigned int events, struct nf_exp_event *item);
167169
};
168170

169-
extern int nf_ct_expect_register_notifier(struct net *net, struct nf_exp_event_notifier *nb);
170-
extern void nf_ct_expect_unregister_notifier(struct net *net, struct nf_exp_event_notifier *nb);
171+
int nf_ct_expect_register_notifier(struct net *net,
172+
struct nf_exp_event_notifier *nb);
173+
void nf_ct_expect_unregister_notifier(struct net *net,
174+
struct nf_exp_event_notifier *nb);
171175

172176
static inline void
173177
nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
@@ -207,11 +211,11 @@ nf_ct_expect_event(enum ip_conntrack_expect_events event,
207211
nf_ct_expect_event_report(event, exp, 0, 0);
208212
}
209213

210-
extern int nf_conntrack_ecache_pernet_init(struct net *net);
211-
extern void nf_conntrack_ecache_pernet_fini(struct net *net);
214+
int nf_conntrack_ecache_pernet_init(struct net *net);
215+
void nf_conntrack_ecache_pernet_fini(struct net *net);
212216

213-
extern int nf_conntrack_ecache_init(void);
214-
extern void nf_conntrack_ecache_fini(void);
217+
int nf_conntrack_ecache_init(void);
218+
void nf_conntrack_ecache_fini(void);
215219
#else /* CONFIG_NF_CONNTRACK_EVENTS */
216220

217221
static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,

‎include/net/netfilter/nf_conntrack_extend.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static inline void *__nf_ct_ext_find(const struct nf_conn *ct, u8 id)
7373
((id##_TYPE *)__nf_ct_ext_find((ext), (id)))
7474

7575
/* Destroy all relationships */
76-
extern void __nf_ct_ext_destroy(struct nf_conn *ct);
76+
void __nf_ct_ext_destroy(struct nf_conn *ct);
7777
static inline void nf_ct_ext_destroy(struct nf_conn *ct)
7878
{
7979
if (ct->ext)

‎include/net/netfilter/nf_conntrack_helper.h‎

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,24 @@ struct nf_conntrack_helper {
5252
unsigned int queue_num; /* For user-space helpers. */
5353
};
5454

55-
extern struct nf_conntrack_helper *
56-
__nf_conntrack_helper_find(const char *name, u16 l3num, u8 protonum);
55+
struct nf_conntrack_helper *__nf_conntrack_helper_find(const char *name,
56+
u16 l3num, u8 protonum);
5757

58-
extern struct nf_conntrack_helper *
59-
nf_conntrack_helper_try_module_get(const char *name, u16 l3num, u8 protonum);
58+
struct nf_conntrack_helper *nf_conntrack_helper_try_module_get(const char *name,
59+
u16 l3num,
60+
u8 protonum);
6061

61-
extern int nf_conntrack_helper_register(struct nf_conntrack_helper *);
62-
extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *);
62+
int nf_conntrack_helper_register(struct nf_conntrack_helper *);
63+
void nf_conntrack_helper_unregister(struct nf_conntrack_helper *);
6364

64-
extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, struct nf_conntrack_helper *helper, gfp_t gfp);
65+
struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct,
66+
struct nf_conntrack_helper *helper,
67+
gfp_t gfp);
6568

66-
extern int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl,
67-
gfp_t flags);
69+
int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl,
70+
gfp_t flags);
6871

69-
extern void nf_ct_helper_destroy(struct nf_conn *ct);
72+
void nf_ct_helper_destroy(struct nf_conn *ct);
7073

7174
static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
7275
{
@@ -82,17 +85,16 @@ static inline void *nfct_help_data(const struct nf_conn *ct)
8285
return (void *)help->data;
8386
}
8487

85-
extern int nf_conntrack_helper_pernet_init(struct net *net);
86-
extern void nf_conntrack_helper_pernet_fini(struct net *net);
88+
int nf_conntrack_helper_pernet_init(struct net *net);
89+
void nf_conntrack_helper_pernet_fini(struct net *net);
8790

88-
extern int nf_conntrack_helper_init(void);
89-
extern void nf_conntrack_helper_fini(void);
91+
int nf_conntrack_helper_init(void);
92+
void nf_conntrack_helper_fini(void);
9093

91-
extern int nf_conntrack_broadcast_help(struct sk_buff *skb,
92-
unsigned int protoff,
93-
struct nf_conn *ct,
94-
enum ip_conntrack_info ctinfo,
95-
unsigned int timeout);
94+
int nf_conntrack_broadcast_help(struct sk_buff *skb, unsigned int protoff,
95+
struct nf_conn *ct,
96+
enum ip_conntrack_info ctinfo,
97+
unsigned int timeout);
9698

9799
struct nf_ct_helper_expectfn {
98100
struct list_head head;

0 commit comments

Comments
 (0)