writeback: Fix performance regression in wb_over_bg_thresh()
[deliverable/linux.git] / net / netfilter / nf_dup_netdev.c
1 /*
2 * Copyright (c) 2015 Pablo Neira Ayuso <pablo@netfilter.org>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 as published by
6 * the Free Software Foundation.
7 */
8
9 #include <linux/kernel.h>
10 #include <linux/init.h>
11 #include <linux/module.h>
12 #include <linux/netlink.h>
13 #include <linux/netfilter.h>
14 #include <linux/netfilter/nf_tables.h>
15 #include <net/netfilter/nf_tables.h>
16
17 void nf_dup_netdev_egress(const struct nft_pktinfo *pkt, int oif)
18 {
19 struct net_device *dev;
20 struct sk_buff *skb;
21
22 dev = dev_get_by_index_rcu(pkt->net, oif);
23 if (dev == NULL)
24 return;
25
26 skb = skb_clone(pkt->skb, GFP_ATOMIC);
27 if (skb == NULL)
28 return;
29
30 if (skb_mac_header_was_set(skb))
31 skb_push(skb, skb->mac_len);
32
33 skb->dev = dev;
34 dev_queue_xmit(skb);
35 }
36 EXPORT_SYMBOL_GPL(nf_dup_netdev_egress);
37
38 MODULE_LICENSE("GPL");
39 MODULE_AUTHOR("Pablo Neira Ayuso <pablo@netfilter.org>");
This page took 0.030527 seconds and 5 git commands to generate.