aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHarald Welte <laforge@netfilter.org>2005-08-09 22:43:44 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2005-08-29 18:36:49 -0400
commit0ab43f84995f2c2fcc5cc58a9accaa1095e1317f (patch)
treef58711648f91bbd880fcada7718a2462f0249a78 /include
parent2cc7d5730957c4a3f3659d17d2ba5e06d5581c1f (diff)
[NETFILTER]: Core changes required by upcoming nfnetlink_queue code
- split netfiler verdict in 16bit verdict and 16bit queue number - add 'queuenum' argument to nf_queue_outfn_t and its users ip[6]_queue - move NFNL_SUBSYS_ definitions from enum to #define - introduce autoloading for nfnetlink subsystem modules - add MODULE_ALIAS_NFNL_SUBSYS macro - add nf_unregister_queue_handlers() to register all handlers for a given nf_queue_outfn_t - add more verbose DEBUGP macro definition to nfnetlink.c - make nfnetlink_subsys_register fail if subsys already exists - add some more comments and debug statements to nfnetlink.c Signed-off-by: Harald Welte <laforge@netfilter.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/netfilter.h14
-rw-r--r--include/linux/netfilter/nfnetlink.h20
2 files changed, 24 insertions, 10 deletions
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index d163e20ca8d9..711e05f33d68 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -21,6 +21,16 @@
21#define NF_STOP 5 21#define NF_STOP 5
22#define NF_MAX_VERDICT NF_STOP 22#define NF_MAX_VERDICT NF_STOP
23 23
24/* we overload the higher bits for encoding auxiliary data such as the queue
25 * number. Not nice, but better than additional function arguments. */
26#define NF_VERDICT_MASK 0x0000ffff
27#define NF_VERDICT_BITS 16
28
29#define NF_VERDICT_QMASK 0xffff0000
30#define NF_VERDICT_QBITS 16
31
32#define NF_QUEUE_NR(x) ((x << NF_VERDICT_QBITS) & NF_VERDICT_QMASK || NF_QUEUE)
33
24/* only for userspace compatibility */ 34/* only for userspace compatibility */
25#ifndef __KERNEL__ 35#ifndef __KERNEL__
26/* Generic cache responses from hook functions. 36/* Generic cache responses from hook functions.
@@ -179,10 +189,12 @@ int nf_getsockopt(struct sock *sk, int pf, int optval, char __user *opt,
179 189
180/* Packet queuing */ 190/* Packet queuing */
181typedef int (*nf_queue_outfn_t)(struct sk_buff *skb, 191typedef int (*nf_queue_outfn_t)(struct sk_buff *skb,
182 struct nf_info *info, void *data); 192 struct nf_info *info,
193 unsigned int queuenum, void *data);
183extern int nf_register_queue_handler(int pf, 194extern int nf_register_queue_handler(int pf,
184 nf_queue_outfn_t outfn, void *data); 195 nf_queue_outfn_t outfn, void *data);
185extern int nf_unregister_queue_handler(int pf); 196extern int nf_unregister_queue_handler(int pf);
197extern void nf_unregister_queue_handlers(nf_queue_outfn_t outfn);
186extern void nf_reinject(struct sk_buff *skb, 198extern void nf_reinject(struct sk_buff *skb,
187 struct nf_info *info, 199 struct nf_info *info,
188 unsigned int verdict); 200 unsigned int verdict);
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index ace7a7be0742..561f9df28808 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -69,15 +69,14 @@ struct nfgenmsg {
69#define NFNL_SUBSYS_ID(x) ((x & 0xff00) >> 8) 69#define NFNL_SUBSYS_ID(x) ((x & 0xff00) >> 8)
70#define NFNL_MSG_TYPE(x) (x & 0x00ff) 70#define NFNL_MSG_TYPE(x) (x & 0x00ff)
71 71
72enum nfnl_subsys_id { 72/* No enum here, otherwise __stringify() trick of MODULE_ALIAS_NFNL_SUBSYS()
73 NFNL_SUBSYS_NONE = 0, 73 * won't work anymore */
74 NFNL_SUBSYS_CTNETLINK, 74#define NFNL_SUBSYS_NONE 0
75 NFNL_SUBSYS_CTNETLINK_EXP, 75#define NFNL_SUBSYS_CTNETLINK 1
76 NFNL_SUBSYS_IPTNETLINK, 76#define NFNL_SUBSYS_CTNETLINK_EXP 2
77 NFNL_SUBSYS_QUEUE, 77#define NFNL_SUBSYS_QUEUE 3
78 NFNL_SUBSYS_ULOG, 78#define NFNL_SUBSYS_ULOG 4
79 NFNL_SUBSYS_COUNT, 79#define NFNL_SUBSYS_COUNT 5
80};
81 80
82#ifdef __KERNEL__ 81#ifdef __KERNEL__
83 82
@@ -142,5 +141,8 @@ extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group,
142 int echo); 141 int echo);
143extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags); 142extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags);
144 143
144#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \
145 MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys))
146
145#endif /* __KERNEL__ */ 147#endif /* __KERNEL__ */
146#endif /* _NFNETLINK_H */ 148#endif /* _NFNETLINK_H */