diff options
author | Patrick McHardy <kaber@trash.net> | 2013-04-17 02:47:09 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-04-19 14:58:36 -0400 |
commit | 3ab1f683bf8be7aa7869cc3ffb8d1db2ec8c8307 (patch) | |
tree | 06bdfb40df2905a7e6daa3dbff4cb0cc1357abb5 /net | |
parent | ec464e5dc504a164c5dbff4a06812d495e44e34d (diff) |
nfnetlink: add support for memory mapped netlink
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/nfnetlink.c | 7 | ||||
-rw-r--r-- | net/netfilter/nfnetlink_log.c | 10 | ||||
-rw-r--r-- | net/netfilter/nfnetlink_queue_core.c | 3 |
3 files changed, 15 insertions, 5 deletions
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index 1640bd7dcdf4..572d87dc116f 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c | |||
@@ -112,6 +112,13 @@ int nfnetlink_has_listeners(struct net *net, unsigned int group) | |||
112 | } | 112 | } |
113 | EXPORT_SYMBOL_GPL(nfnetlink_has_listeners); | 113 | EXPORT_SYMBOL_GPL(nfnetlink_has_listeners); |
114 | 114 | ||
115 | struct sk_buff *nfnetlink_alloc_skb(struct net *net, unsigned int size, | ||
116 | u32 dst_portid, gfp_t gfp_mask) | ||
117 | { | ||
118 | return netlink_alloc_skb(net->nfnl, size, dst_portid, gfp_mask); | ||
119 | } | ||
120 | EXPORT_SYMBOL_GPL(nfnetlink_alloc_skb); | ||
121 | |||
115 | int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 portid, | 122 | int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 portid, |
116 | unsigned int group, int echo, gfp_t flags) | 123 | unsigned int group, int echo, gfp_t flags) |
117 | { | 124 | { |
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index 50aaf716cd68..d4199eb9b338 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
@@ -318,7 +318,7 @@ nfulnl_set_flags(struct nfulnl_instance *inst, u_int16_t flags) | |||
318 | } | 318 | } |
319 | 319 | ||
320 | static struct sk_buff * | 320 | static struct sk_buff * |
321 | nfulnl_alloc_skb(unsigned int inst_size, unsigned int pkt_size) | 321 | nfulnl_alloc_skb(u32 peer_portid, unsigned int inst_size, unsigned int pkt_size) |
322 | { | 322 | { |
323 | struct sk_buff *skb; | 323 | struct sk_buff *skb; |
324 | unsigned int n; | 324 | unsigned int n; |
@@ -327,13 +327,14 @@ nfulnl_alloc_skb(unsigned int inst_size, unsigned int pkt_size) | |||
327 | * message. WARNING: has to be <= 128k due to slab restrictions */ | 327 | * message. WARNING: has to be <= 128k due to slab restrictions */ |
328 | 328 | ||
329 | n = max(inst_size, pkt_size); | 329 | n = max(inst_size, pkt_size); |
330 | skb = alloc_skb(n, GFP_ATOMIC); | 330 | skb = nfnetlink_alloc_skb(&init_net, n, peer_portid, GFP_ATOMIC); |
331 | if (!skb) { | 331 | if (!skb) { |
332 | if (n > pkt_size) { | 332 | if (n > pkt_size) { |
333 | /* try to allocate only as much as we need for current | 333 | /* try to allocate only as much as we need for current |
334 | * packet */ | 334 | * packet */ |
335 | 335 | ||
336 | skb = alloc_skb(pkt_size, GFP_ATOMIC); | 336 | skb = nfnetlink_alloc_skb(&init_net, pkt_size, |
337 | peer_portid, GFP_ATOMIC); | ||
337 | if (!skb) | 338 | if (!skb) |
338 | pr_err("nfnetlink_log: can't even alloc %u bytes\n", | 339 | pr_err("nfnetlink_log: can't even alloc %u bytes\n", |
339 | pkt_size); | 340 | pkt_size); |
@@ -696,7 +697,8 @@ nfulnl_log_packet(u_int8_t pf, | |||
696 | } | 697 | } |
697 | 698 | ||
698 | if (!inst->skb) { | 699 | if (!inst->skb) { |
699 | inst->skb = nfulnl_alloc_skb(inst->nlbufsiz, size); | 700 | inst->skb = nfulnl_alloc_skb(inst->peer_portid, inst->nlbufsiz, |
701 | size); | ||
700 | if (!inst->skb) | 702 | if (!inst->skb) |
701 | goto alloc_failure; | 703 | goto alloc_failure; |
702 | } | 704 | } |
diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c index 5e280b3e154f..ef3cdb4bfeea 100644 --- a/net/netfilter/nfnetlink_queue_core.c +++ b/net/netfilter/nfnetlink_queue_core.c | |||
@@ -339,7 +339,8 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue, | |||
339 | if (queue->flags & NFQA_CFG_F_CONNTRACK) | 339 | if (queue->flags & NFQA_CFG_F_CONNTRACK) |
340 | ct = nfqnl_ct_get(entskb, &size, &ctinfo); | 340 | ct = nfqnl_ct_get(entskb, &size, &ctinfo); |
341 | 341 | ||
342 | skb = alloc_skb(size, GFP_ATOMIC); | 342 | skb = nfnetlink_alloc_skb(&init_net, size, queue->peer_portid, |
343 | GFP_ATOMIC); | ||
343 | if (!skb) | 344 | if (!skb) |
344 | return NULL; | 345 | return NULL; |
345 | 346 | ||