Skip to content

Commit c01cd42

Browse files
kaberdavem330
authored andcommitted
[NETFILTER]: nf_queue: move queueing related functions/struct to seperate header
Signed-off-by: Patrick McHardy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f9d8928 commit c01cd42

File tree

8 files changed

+40
-30
lines changed

8 files changed

+40
-30
lines changed

include/linux/netfilter.h

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -101,19 +101,6 @@ struct nf_sockopt_ops
101101
struct module *owner;
102102
};
103103

104-
/* Each queued (to userspace) skbuff has one of these. */
105-
struct nf_info
106-
{
107-
/* The ops struct which sent us to userspace. */
108-
struct nf_hook_ops *elem;
109-
110-
/* If we're sent to userspace, this keeps housekeeping info */
111-
int pf;
112-
unsigned int hook;
113-
struct net_device *indev, *outdev;
114-
int (*okfn)(struct sk_buff *);
115-
};
116-
117104
/* Function to register/unregister hook points. */
118105
int nf_register_hook(struct nf_hook_ops *reg);
119106
void nf_unregister_hook(struct nf_hook_ops *reg);
@@ -274,21 +261,6 @@ int compat_nf_setsockopt(struct sock *sk, int pf, int optval,
274261
int compat_nf_getsockopt(struct sock *sk, int pf, int optval,
275262
char __user *opt, int *len);
276263

277-
/* Packet queuing */
278-
struct nf_queue_handler {
279-
int (*outfn)(struct sk_buff *skb, struct nf_info *info,
280-
unsigned int queuenum);
281-
char *name;
282-
};
283-
extern int nf_register_queue_handler(int pf,
284-
const struct nf_queue_handler *qh);
285-
extern int nf_unregister_queue_handler(int pf,
286-
const struct nf_queue_handler *qh);
287-
extern void nf_unregister_queue_handlers(const struct nf_queue_handler *qh);
288-
extern void nf_reinject(struct sk_buff *skb,
289-
struct nf_info *info,
290-
unsigned int verdict);
291-
292264
/* FIXME: Before cache is ever used, this must be implemented for real. */
293265
extern void nf_invalidate_cache(int pf);
294266

@@ -298,6 +270,8 @@ extern void nf_invalidate_cache(int pf);
298270
extern int skb_make_writable(struct sk_buff *skb, unsigned int writable_len);
299271

300272
struct flowi;
273+
struct nf_info;
274+
301275
struct nf_afinfo {
302276
unsigned short family;
303277
__sum16 (*checksum)(struct sk_buff *skb, unsigned int hook,
@@ -334,8 +308,6 @@ nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff,
334308
extern int nf_register_afinfo(struct nf_afinfo *afinfo);
335309
extern void nf_unregister_afinfo(struct nf_afinfo *afinfo);
336310

337-
#define nf_info_reroute(x) ((void *)x + sizeof(struct nf_info))
338-
339311
#include <net/flow.h>
340312
extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *);
341313

include/net/netfilter/nf_queue.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#ifndef _NF_QUEUE_H
2+
#define _NF_QUEUE_H
3+
4+
/* Each queued (to userspace) skbuff has one of these. */
5+
struct nf_info {
6+
struct nf_hook_ops *elem;
7+
int pf;
8+
unsigned int hook;
9+
struct net_device *indev;
10+
struct net_device *outdev;
11+
int (*okfn)(struct sk_buff *);
12+
};
13+
14+
#define nf_info_reroute(x) ((void *)x + sizeof(struct nf_info))
15+
16+
/* Packet queuing */
17+
struct nf_queue_handler {
18+
int (*outfn)(struct sk_buff *skb,
19+
struct nf_info *info,
20+
unsigned int queuenum);
21+
char *name;
22+
};
23+
24+
extern int nf_register_queue_handler(int pf,
25+
const struct nf_queue_handler *qh);
26+
extern int nf_unregister_queue_handler(int pf,
27+
const struct nf_queue_handler *qh);
28+
extern void nf_unregister_queue_handlers(const struct nf_queue_handler *qh);
29+
extern void nf_reinject(struct sk_buff *skb, struct nf_info *info,
30+
unsigned int verdict);
31+
32+
#endif /* _NF_QUEUE_H */

net/ipv4/netfilter.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <net/route.h>
88
#include <net/xfrm.h>
99
#include <net/ip.h>
10+
#include <net/netfilter/nf_queue.h>
1011

1112
/* route_me_harder function, used by iptable_nat, iptable_mangle + ip_queue */
1213
int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type)

net/ipv4/netfilter/ip_queue.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <net/net_namespace.h>
2929
#include <net/sock.h>
3030
#include <net/route.h>
31+
#include <net/netfilter/nf_queue.h>
3132

3233
#define IPQ_QMAX_DEFAULT 1024
3334
#define IPQ_PROC_FS_NAME "ip_queue"

net/ipv6/netfilter.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <net/ip6_route.h>
99
#include <net/xfrm.h>
1010
#include <net/ip6_checksum.h>
11+
#include <net/netfilter/nf_queue.h>
1112

1213
int ip6_route_me_harder(struct sk_buff *skb)
1314
{

net/ipv6/netfilter/ip6_queue.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <net/sock.h>
3030
#include <net/ipv6.h>
3131
#include <net/ip6_route.h>
32+
#include <net/netfilter/nf_queue.h>
3233
#include <linux/netfilter_ipv4/ip_queue.h>
3334
#include <linux/netfilter_ipv4/ip_tables.h>
3435
#include <linux/netfilter_ipv6/ip6_tables.h>

net/netfilter/nf_queue.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <linux/seq_file.h>
88
#include <linux/rcupdate.h>
99
#include <net/protocol.h>
10+
#include <net/netfilter/nf_queue.h>
1011

1112
#include "nf_internals.h"
1213

net/netfilter/nfnetlink_queue.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <linux/netfilter/nfnetlink_queue.h>
2828
#include <linux/list.h>
2929
#include <net/sock.h>
30+
#include <net/netfilter/nf_queue.h>
3031

3132
#include <asm/atomic.h>
3233

0 commit comments

Comments
 (0)