Skip to content

Commit f8eb24a

Browse files
kaberDavid S. Miller
authored andcommitted
[NETFILTER]: nf_conntrack: move extern declaration to header files
Using extern in a C file is a bad idea because the compiler can't catch type errors. Signed-off-by: Patrick McHardy <kaber@trash.net>
1 parent d734685 commit f8eb24a

9 files changed

Lines changed: 34 additions & 37 deletions

File tree

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,8 @@ struct nf_conntrack_ipv4 {
3737
struct sk_buff *
3838
nf_ct_ipv4_ct_gather_frags(struct sk_buff *skb);
3939

40+
extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp4;
41+
extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4;
42+
extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp;
43+
4044
#endif /*_NF_CONNTRACK_IPV4_H*/
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#ifndef _NF_CONNTRACK_IPV6_H
2+
#define _NF_CONNTRACK_IPV6_H
3+
4+
extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6;
5+
6+
extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp6;
7+
extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6;
8+
extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6;
9+
10+
extern int nf_ct_ipv6_skip_exthdr(struct sk_buff *skb, int start,
11+
u8 *nexthdrp, int len);
12+
13+
extern int nf_ct_frag6_init(void);
14+
extern void nf_ct_frag6_cleanup(void);
15+
extern struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb);
16+
extern void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb,
17+
struct net_device *in,
18+
struct net_device *out,
19+
int (*okfn)(struct sk_buff *));
20+
21+
extern unsigned int nf_ct_frag6_timeout;
22+
extern unsigned int nf_ct_frag6_low_thresh;
23+
extern unsigned int nf_ct_frag6_high_thresh;
24+
25+
#endif /* _NF_CONNTRACK_IPV6_H*/

‎include/net/netfilter/nf_conntrack.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ struct nf_conn_help {
7979

8080

8181
#include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
82+
#include <net/netfilter/ipv6/nf_conntrack_ipv6.h>
83+
8284
struct nf_conn
8385
{
8486
/* Usage count in here is 1 for hash table/destruct timer, 1 per skb,
@@ -241,7 +243,10 @@ static inline int nf_ct_is_dying(struct nf_conn *ct)
241243

242244
extern unsigned int nf_conntrack_htable_size;
243245
extern int nf_conntrack_checksum;
246+
extern atomic_t nf_conntrack_count;
247+
extern int nf_conntrack_max;
244248

249+
DECLARE_PER_CPU(struct ip_conntrack_stat, nf_conntrack_stat);
245250
#define NF_CT_STAT_INC(count) (__get_cpu_var(nf_conntrack_stat).count++)
246251

247252
/* no helper, no nat */

‎net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@
3838
#define DEBUGP(format, args...)
3939
#endif
4040

41-
DECLARE_PER_CPU(struct nf_conntrack_stat, nf_conntrack_stat);
42-
4341
static int ipv4_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff,
4442
struct nf_conntrack_tuple *tuple)
4543
{
@@ -429,10 +427,6 @@ struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4 = {
429427
.me = THIS_MODULE,
430428
};
431429

432-
extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp4;
433-
extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4;
434-
extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp;
435-
436430
MODULE_ALIAS("nf_conntrack-" __stringify(AF_INET));
437431
MODULE_LICENSE("GPL");
438432

‎net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@
4343
#define DEBUGP(format, args...)
4444
#endif
4545

46-
DECLARE_PER_CPU(struct ip_conntrack_stat, nf_conntrack_stat);
47-
4846
static int ipv6_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff,
4947
struct nf_conntrack_tuple *tuple)
5048
{
@@ -211,11 +209,6 @@ static unsigned int ipv6_confirm(unsigned int hooknum,
211209
return nf_conntrack_confirm(pskb);
212210
}
213211

214-
extern struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb);
215-
extern void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb,
216-
struct net_device *in,
217-
struct net_device *out,
218-
int (*okfn)(struct sk_buff *));
219212
static unsigned int ipv6_defrag(unsigned int hooknum,
220213
struct sk_buff **pskb,
221214
const struct net_device *in,
@@ -335,11 +328,6 @@ static struct nf_hook_ops ipv6_conntrack_ops[] = {
335328
/* From nf_conntrack_proto_icmpv6.c */
336329
extern unsigned int nf_ct_icmpv6_timeout;
337330

338-
/* From nf_conntrack_reasm.c */
339-
extern unsigned int nf_ct_frag6_timeout;
340-
extern unsigned int nf_ct_frag6_low_thresh;
341-
extern unsigned int nf_ct_frag6_high_thresh;
342-
343331
static struct ctl_table_header *nf_ct_ipv6_sysctl_header;
344332

345333
static ctl_table nf_ct_sysctl_table[] = {
@@ -458,12 +446,6 @@ struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6 = {
458446
.me = THIS_MODULE,
459447
};
460448

461-
extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp6;
462-
extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6;
463-
extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6;
464-
extern int nf_ct_frag6_init(void);
465-
extern void nf_ct_frag6_cleanup(void);
466-
467449
MODULE_ALIAS("nf_conntrack-" __stringify(AF_INET6));
468450
MODULE_LICENSE("GPL");
469451
MODULE_AUTHOR("Yasuyuki KOZAKAI @USAGI <yasuyuki.kozakai@toshiba.co.jp>");

‎net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,6 @@ static int icmpv6_new(struct nf_conn *conntrack,
142142
return 1;
143143
}
144144

145-
extern int
146-
nf_ct_ipv6_skip_exthdr(struct sk_buff *skb, int start, u8 *nexthdrp, int len);
147-
extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6;
148145
static int
149146
icmpv6_error_message(struct sk_buff *skb,
150147
unsigned int icmp6off,

‎net/netfilter/nf_conntrack_expect.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828

2929
LIST_HEAD(nf_conntrack_expect_list);
3030
kmem_cache_t *nf_conntrack_expect_cachep __read_mostly;
31-
DECLARE_PER_CPU(struct ip_conntrack_stat, nf_conntrack_stat);
3231
static unsigned int nf_conntrack_expect_next_id;
3332

3433
/* nf_conntrack_expect helper functions */

‎net/netfilter/nf_conntrack_l3proto_generic.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@
3737
#define DEBUGP(format, args...)
3838
#endif
3939

40-
DECLARE_PER_CPU(struct nf_conntrack_stat, nf_conntrack_stat);
41-
4240
static int generic_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff,
4341
struct nf_conntrack_tuple *tuple)
4442
{

‎net/netfilter/nf_conntrack_standalone.c‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@
4444

4545
MODULE_LICENSE("GPL");
4646

47-
extern atomic_t nf_conntrack_count;
48-
DECLARE_PER_CPU(struct ip_conntrack_stat, nf_conntrack_stat);
49-
5047
#ifdef CONFIG_PROC_FS
5148
int
5249
print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
@@ -334,10 +331,6 @@ int nf_conntrack_checksum __read_mostly = 1;
334331

335332
#ifdef CONFIG_SYSCTL
336333

337-
/* From nf_conntrack_core.c */
338-
extern int nf_conntrack_max;
339-
extern unsigned int nf_conntrack_htable_size;
340-
341334
/* From nf_conntrack_proto_tcp.c */
342335
extern unsigned int nf_ct_tcp_timeout_syn_sent;
343336
extern unsigned int nf_ct_tcp_timeout_syn_recv;

0 commit comments

Comments
 (0)