2005-04-17 00:20:36 +02:00
|
|
|
/*
|
|
|
|
* This is a module which is used for queueing IPv6 packets and
|
|
|
|
* communicating with userspace via netlink.
|
|
|
|
*
|
|
|
|
* (C) 2001 Fernando Anton, this code is GPL.
|
|
|
|
* IPv64 Project - Work based in IPv64 draft by Arturo Azcorra.
|
|
|
|
* Universidad Carlos III de Madrid - Leganes (Madrid) - Spain
|
|
|
|
* Universidad Politecnica de Alcala de Henares - Alcala de H. (Madrid) - Spain
|
|
|
|
* email: fanton@it.uc3m.es
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/skbuff.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/ipv6.h>
|
|
|
|
#include <linux/notifier.h>
|
|
|
|
#include <linux/netdevice.h>
|
|
|
|
#include <linux/netfilter.h>
|
|
|
|
#include <linux/netlink.h>
|
|
|
|
#include <linux/spinlock.h>
|
|
|
|
#include <linux/sysctl.h>
|
|
|
|
#include <linux/proc_fs.h>
|
2007-11-06 05:33:46 +01:00
|
|
|
#include <linux/seq_file.h>
|
2006-03-21 07:33:17 +01:00
|
|
|
#include <linux/mutex.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 09:04:11 +01:00
|
|
|
#include <linux/slab.h>
|
2007-09-12 12:01:34 +02:00
|
|
|
#include <net/net_namespace.h>
|
2005-04-17 00:20:36 +02:00
|
|
|
#include <net/sock.h>
|
|
|
|
#include <net/ipv6.h>
|
|
|
|
#include <net/ip6_route.h>
|
2007-12-05 10:24:48 +01:00
|
|
|
#include <net/netfilter/nf_queue.h>
|
2005-04-17 00:20:36 +02:00
|
|
|
#include <linux/netfilter_ipv4/ip_queue.h>
|
|
|
|
#include <linux/netfilter_ipv4/ip_tables.h>
|
|
|
|
#include <linux/netfilter_ipv6/ip6_tables.h>
|
|
|
|
|
|
|
|
#define IPQ_QMAX_DEFAULT 1024
|
|
|
|
#define IPQ_PROC_FS_NAME "ip6_queue"
|
|
|
|
#define NET_IPQ_QMAX_NAME "ip6_queue_maxlen"
|
|
|
|
|
2007-12-05 10:26:33 +01:00
|
|
|
typedef int (*ipq_cmpfn)(struct nf_queue_entry *, unsigned long);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2006-09-20 21:03:46 +02:00
|
|
|
static unsigned char copy_mode __read_mostly = IPQ_COPY_NONE;
|
2006-09-18 09:05:22 +02:00
|
|
|
static unsigned int queue_maxlen __read_mostly = IPQ_QMAX_DEFAULT;
|
2010-06-09 16:25:08 +02:00
|
|
|
static DEFINE_SPINLOCK(queue_lock);
|
2006-09-20 21:03:46 +02:00
|
|
|
static int peer_pid __read_mostly;
|
|
|
|
static unsigned int copy_range __read_mostly;
|
2005-04-17 00:20:36 +02:00
|
|
|
static unsigned int queue_total;
|
|
|
|
static unsigned int queue_dropped = 0;
|
|
|
|
static unsigned int queue_user_dropped = 0;
|
2006-09-20 21:03:46 +02:00
|
|
|
static struct sock *ipqnl __read_mostly;
|
2005-04-17 00:20:36 +02:00
|
|
|
static LIST_HEAD(queue_list);
|
2006-03-21 07:33:17 +01:00
|
|
|
static DEFINE_MUTEX(ipqnl_mutex);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
static inline void
|
2007-12-05 10:26:33 +01:00
|
|
|
__ipq_enqueue_entry(struct nf_queue_entry *entry)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2007-12-05 10:25:03 +01:00
|
|
|
list_add_tail(&entry->list, &queue_list);
|
2005-04-17 00:20:36 +02:00
|
|
|
queue_total++;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
__ipq_set_mode(unsigned char mode, unsigned int range)
|
|
|
|
{
|
|
|
|
int status = 0;
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
switch(mode) {
|
|
|
|
case IPQ_COPY_NONE:
|
|
|
|
case IPQ_COPY_META:
|
|
|
|
copy_mode = mode;
|
|
|
|
copy_range = 0;
|
|
|
|
break;
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
case IPQ_COPY_PACKET:
|
2010-06-09 16:25:08 +02:00
|
|
|
if (range > 0xFFFF)
|
|
|
|
range = 0xFFFF;
|
2005-04-17 00:20:36 +02:00
|
|
|
copy_range = range;
|
2010-06-09 16:25:08 +02:00
|
|
|
copy_mode = mode;
|
2005-04-17 00:20:36 +02:00
|
|
|
break;
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
default:
|
|
|
|
status = -EINVAL;
|
|
|
|
|
|
|
|
}
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2007-12-05 10:26:02 +01:00
|
|
|
static void __ipq_flush(ipq_cmpfn cmpfn, unsigned long data);
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
static inline void
|
|
|
|
__ipq_reset(void)
|
|
|
|
{
|
|
|
|
peer_pid = 0;
|
|
|
|
net_disable_timestamp();
|
|
|
|
__ipq_set_mode(IPQ_COPY_NONE, 0);
|
2007-12-05 10:26:02 +01:00
|
|
|
__ipq_flush(NULL, 0);
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
2007-12-05 10:26:33 +01:00
|
|
|
static struct nf_queue_entry *
|
2007-12-05 10:26:02 +01:00
|
|
|
ipq_find_dequeue_entry(unsigned long id)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2007-12-05 10:26:33 +01:00
|
|
|
struct nf_queue_entry *entry = NULL, *i;
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2010-06-09 16:25:08 +02:00
|
|
|
spin_lock_bh(&queue_lock);
|
2007-12-05 10:26:02 +01:00
|
|
|
|
|
|
|
list_for_each_entry(i, &queue_list, list) {
|
|
|
|
if ((unsigned long)i == id) {
|
|
|
|
entry = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (entry) {
|
|
|
|
list_del(&entry->list);
|
|
|
|
queue_total--;
|
|
|
|
}
|
|
|
|
|
2010-06-09 16:25:08 +02:00
|
|
|
spin_unlock_bh(&queue_lock);
|
2005-04-17 00:20:36 +02:00
|
|
|
return entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-12-05 10:26:02 +01:00
|
|
|
__ipq_flush(ipq_cmpfn cmpfn, unsigned long data)
|
|
|
|
{
|
2007-12-05 10:26:33 +01:00
|
|
|
struct nf_queue_entry *entry, *next;
|
2007-12-05 10:26:02 +01:00
|
|
|
|
|
|
|
list_for_each_entry_safe(entry, next, &queue_list, list) {
|
|
|
|
if (!cmpfn || cmpfn(entry, data)) {
|
|
|
|
list_del(&entry->list);
|
|
|
|
queue_total--;
|
2007-12-05 10:27:02 +01:00
|
|
|
nf_reinject(entry, NF_DROP);
|
2007-12-05 10:26:02 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ipq_flush(ipq_cmpfn cmpfn, unsigned long data)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2010-06-09 16:25:08 +02:00
|
|
|
spin_lock_bh(&queue_lock);
|
2007-12-05 10:26:02 +01:00
|
|
|
__ipq_flush(cmpfn, data);
|
2010-06-09 16:25:08 +02:00
|
|
|
spin_unlock_bh(&queue_lock);
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct sk_buff *
|
2007-12-05 10:26:33 +01:00
|
|
|
ipq_build_packet_message(struct nf_queue_entry *entry, int *errp)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2007-04-20 05:29:13 +02:00
|
|
|
sk_buff_data_t old_tail;
|
2005-04-17 00:20:36 +02:00
|
|
|
size_t size = 0;
|
|
|
|
size_t data_len = 0;
|
|
|
|
struct sk_buff *skb;
|
|
|
|
struct ipq_packet_msg *pmsg;
|
|
|
|
struct nlmsghdr *nlh;
|
2007-04-20 01:16:32 +02:00
|
|
|
struct timeval tv;
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2010-06-09 16:25:08 +02:00
|
|
|
switch (ACCESS_ONCE(copy_mode)) {
|
2005-04-17 00:20:36 +02:00
|
|
|
case IPQ_COPY_META:
|
|
|
|
case IPQ_COPY_NONE:
|
|
|
|
size = NLMSG_SPACE(sizeof(*pmsg));
|
|
|
|
break;
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
case IPQ_COPY_PACKET:
|
2010-04-08 14:53:40 +02:00
|
|
|
if (entry->skb->ip_summed == CHECKSUM_PARTIAL &&
|
2010-06-09 16:25:08 +02:00
|
|
|
(*errp = skb_checksum_help(entry->skb)))
|
2005-08-23 19:10:35 +02:00
|
|
|
return NULL;
|
2010-06-09 16:25:08 +02:00
|
|
|
|
|
|
|
data_len = ACCESS_ONCE(copy_range);
|
|
|
|
if (data_len == 0 || data_len > entry->skb->len)
|
2005-04-17 00:20:36 +02:00
|
|
|
data_len = entry->skb->len;
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
size = NLMSG_SPACE(sizeof(*pmsg) + data_len);
|
|
|
|
break;
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
default:
|
|
|
|
*errp = -EINVAL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
skb = alloc_skb(size, GFP_ATOMIC);
|
|
|
|
if (!skb)
|
|
|
|
goto nlmsg_failure;
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2007-04-20 05:29:13 +02:00
|
|
|
old_tail = skb->tail;
|
2005-04-17 00:20:36 +02:00
|
|
|
nlh = NLMSG_PUT(skb, 0, 0, IPQM_PACKET, size - sizeof(*nlh));
|
|
|
|
pmsg = NLMSG_DATA(nlh);
|
|
|
|
memset(pmsg, 0, sizeof(*pmsg));
|
|
|
|
|
|
|
|
pmsg->packet_id = (unsigned long )entry;
|
|
|
|
pmsg->data_len = data_len;
|
2007-04-20 01:16:32 +02:00
|
|
|
tv = ktime_to_timeval(entry->skb->tstamp);
|
|
|
|
pmsg->timestamp_sec = tv.tv_sec;
|
|
|
|
pmsg->timestamp_usec = tv.tv_usec;
|
2006-11-10 00:19:14 +01:00
|
|
|
pmsg->mark = entry->skb->mark;
|
2007-12-05 10:26:33 +01:00
|
|
|
pmsg->hook = entry->hook;
|
2005-04-17 00:20:36 +02:00
|
|
|
pmsg->hw_protocol = entry->skb->protocol;
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2007-12-05 10:26:33 +01:00
|
|
|
if (entry->indev)
|
|
|
|
strcpy(pmsg->indev_name, entry->indev->name);
|
2005-04-17 00:20:36 +02:00
|
|
|
else
|
|
|
|
pmsg->indev_name[0] = '\0';
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2007-12-05 10:26:33 +01:00
|
|
|
if (entry->outdev)
|
|
|
|
strcpy(pmsg->outdev_name, entry->outdev->name);
|
2005-04-17 00:20:36 +02:00
|
|
|
else
|
|
|
|
pmsg->outdev_name[0] = '\0';
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2007-12-05 10:26:33 +01:00
|
|
|
if (entry->indev && entry->skb->dev) {
|
2005-04-17 00:20:36 +02:00
|
|
|
pmsg->hw_type = entry->skb->dev->type;
|
2007-09-27 07:13:38 +02:00
|
|
|
pmsg->hw_addrlen = dev_parse_header(entry->skb, pmsg->hw_addr);
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
if (data_len)
|
|
|
|
if (skb_copy_bits(entry->skb, 0, pmsg->payload, data_len))
|
|
|
|
BUG();
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
nlh->nlmsg_len = skb->tail - old_tail;
|
|
|
|
return skb;
|
|
|
|
|
|
|
|
nlmsg_failure:
|
|
|
|
*errp = -EINVAL;
|
|
|
|
printk(KERN_ERR "ip6_queue: error creating packet message\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2007-12-05 10:26:33 +01:00
|
|
|
ipq_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
|
|
|
int status = -EINVAL;
|
|
|
|
struct sk_buff *nskb;
|
|
|
|
|
|
|
|
if (copy_mode == IPQ_COPY_NONE)
|
|
|
|
return -EAGAIN;
|
|
|
|
|
|
|
|
nskb = ipq_build_packet_message(entry, &status);
|
|
|
|
if (nskb == NULL)
|
2007-12-05 10:26:33 +01:00
|
|
|
return status;
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2010-06-09 16:25:08 +02:00
|
|
|
spin_lock_bh(&queue_lock);
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
if (!peer_pid)
|
2007-02-09 15:24:49 +01:00
|
|
|
goto err_out_free_nskb;
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
if (queue_total >= queue_maxlen) {
|
2007-02-09 15:24:49 +01:00
|
|
|
queue_dropped++;
|
2005-04-17 00:20:36 +02:00
|
|
|
status = -ENOSPC;
|
|
|
|
if (net_ratelimit())
|
2007-02-09 15:24:49 +01:00
|
|
|
printk (KERN_WARNING "ip6_queue: fill at %d entries, "
|
2005-04-17 00:20:36 +02:00
|
|
|
"dropping packet(s). Dropped: %d\n", queue_total,
|
|
|
|
queue_dropped);
|
|
|
|
goto err_out_free_nskb;
|
|
|
|
}
|
|
|
|
|
2007-02-09 15:24:49 +01:00
|
|
|
/* netlink_unicast will either free the nskb or attach it to a socket */
|
2005-04-17 00:20:36 +02:00
|
|
|
status = netlink_unicast(ipqnl, nskb, peer_pid, MSG_DONTWAIT);
|
|
|
|
if (status < 0) {
|
2007-02-09 15:24:49 +01:00
|
|
|
queue_user_dropped++;
|
2005-04-17 00:20:36 +02:00
|
|
|
goto err_out_unlock;
|
|
|
|
}
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
__ipq_enqueue_entry(entry);
|
|
|
|
|
2010-06-09 16:25:08 +02:00
|
|
|
spin_unlock_bh(&queue_lock);
|
2005-04-17 00:20:36 +02:00
|
|
|
return status;
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
err_out_free_nskb:
|
2007-02-09 15:24:49 +01:00
|
|
|
kfree_skb(nskb);
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
err_out_unlock:
|
2010-06-09 16:25:08 +02:00
|
|
|
spin_unlock_bh(&queue_lock);
|
2005-04-17 00:20:36 +02:00
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2007-12-05 10:26:33 +01:00
|
|
|
ipq_mangle_ipv6(ipq_verdict_msg_t *v, struct nf_queue_entry *e)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
|
|
|
int diff;
|
|
|
|
struct ipv6hdr *user_iph = (struct ipv6hdr *)v->payload;
|
2008-02-20 02:17:52 +01:00
|
|
|
struct sk_buff *nskb;
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
if (v->data_len < sizeof(*user_iph))
|
|
|
|
return 0;
|
|
|
|
diff = v->data_len - e->skb->len;
|
2006-11-15 04:48:09 +01:00
|
|
|
if (diff < 0) {
|
|
|
|
if (pskb_trim(e->skb, v->data_len))
|
|
|
|
return -ENOMEM;
|
|
|
|
} else if (diff > 0) {
|
2005-04-17 00:20:36 +02:00
|
|
|
if (v->data_len > 0xFFFF)
|
|
|
|
return -EINVAL;
|
|
|
|
if (diff > skb_tailroom(e->skb)) {
|
netfilter: {nfnetlink,ip,ip6}_queue: fix skb_over_panic when enlarging packets
While reinjecting *bigger* modified versions of IPv6 packets using
libnetfilter_queue, things work fine on a 2.6.24 kernel (2.6.22 too)
but I get the following on recents kernels (2.6.25, trace below is
against today's net-2.6 git tree):
skb_over_panic: text:c04fddb0 len:696 put:632 head:f7592c00 data:f7592c00 tail:0xf7592eb8 end:0xf7592e80 dev:eth0
------------[ cut here ]------------
invalid opcode: 0000 [#1] PREEMPT
Process sendd (pid: 3657, ti=f6014000 task=f77c31d0 task.ti=f6014000)
Stack: c071e638 c04fddb0 000002b8 00000278 f7592c00 f7592c00 f7592eb8 f7592e80
f763c000 f6bc5200 f7592c40 f6015c34 c04cdbfc f6bc5200 00000278 f6015c60
c04fddb0 00000020 f72a10c0 f751b420 00000001 0000000a 000002b8 c065582c
Call Trace:
[<c04fddb0>] ? nfqnl_recv_verdict+0x1c0/0x2e0
[<c04cdbfc>] ? skb_put+0x3c/0x40
[<c04fddb0>] ? nfqnl_recv_verdict+0x1c0/0x2e0
[<c04fd115>] ? nfnetlink_rcv_msg+0xf5/0x160
[<c04fd03e>] ? nfnetlink_rcv_msg+0x1e/0x160
[<c04fd020>] ? nfnetlink_rcv_msg+0x0/0x160
[<c04f8ed7>] ? netlink_rcv_skb+0x77/0xa0
[<c04fcefc>] ? nfnetlink_rcv+0x1c/0x30
[<c04f8c73>] ? netlink_unicast+0x243/0x2b0
[<c04cfaba>] ? memcpy_fromiovec+0x4a/0x70
[<c04f9406>] ? netlink_sendmsg+0x1c6/0x270
[<c04c8244>] ? sock_sendmsg+0xc4/0xf0
[<c011970d>] ? set_next_entity+0x1d/0x50
[<c0133a80>] ? autoremove_wake_function+0x0/0x40
[<c0118f9e>] ? __wake_up_common+0x3e/0x70
[<c0342fbf>] ? n_tty_receive_buf+0x34f/0x1280
[<c011d308>] ? __wake_up+0x68/0x70
[<c02cea47>] ? copy_from_user+0x37/0x70
[<c04cfd7c>] ? verify_iovec+0x2c/0x90
[<c04c837a>] ? sys_sendmsg+0x10a/0x230
[<c011967a>] ? __dequeue_entity+0x2a/0xa0
[<c011970d>] ? set_next_entity+0x1d/0x50
[<c0345397>] ? pty_write+0x47/0x60
[<c033d59b>] ? tty_default_put_char+0x1b/0x20
[<c011d2e9>] ? __wake_up+0x49/0x70
[<c033df99>] ? tty_ldisc_deref+0x39/0x90
[<c033ff20>] ? tty_write+0x1a0/0x1b0
[<c04c93af>] ? sys_socketcall+0x7f/0x260
[<c0102ff9>] ? sysenter_past_esp+0x6a/0x91
[<c05f0000>] ? snd_intel8x0m_probe+0x270/0x6e0
=======================
Code: 00 00 89 5c 24 14 8b 98 9c 00 00 00 89 54 24 0c 89 5c 24 10 8b 40 50 89 4c 24 04 c7 04 24 38 e6 71 c0 89 44 24 08 e8 c4 46 c5 ff <0f> 0b eb fe 55 89 e5 56 89 d6 53 89 c3 83 ec 0c 8b 40 50 39 d0
EIP: [<c04ccdfc>] skb_over_panic+0x5c/0x60 SS:ESP 0068:f6015bf8
Looking at the code, I ended up in nfq_mangle() function (called by
nfqnl_recv_verdict()) which performs a call to skb_copy_expand() due to
the increased size of data passed to the function. AFAICT, it should ask
for 'diff' instead of 'diff - skb_tailroom(e->skb)'. Because the
resulting sk_buff has not enough space to support the skb_put(skb, diff)
call a few lines later, this results in the call to skb_over_panic().
The patch below asks for allocation of a copy with enough space for
mangled packet and the same amount of headroom as old sk_buff. While
looking at how the regression appeared (e2b58a67), I noticed the same
pattern in ipq_mangle_ipv6() and ipq_mangle_ipv4(). The patch corrects
those locations too.
Tested with bigger reinjected IPv6 packets (nfqnl_mangle() path), things
are ok (2.6.25 and today's net-2.6 git tree).
Signed-off-by: Arnaud Ebalard <arno@natisbad.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-04-29 12:16:34 +02:00
|
|
|
nskb = skb_copy_expand(e->skb, skb_headroom(e->skb),
|
|
|
|
diff, GFP_ATOMIC);
|
2008-02-20 02:17:52 +01:00
|
|
|
if (!nskb) {
|
2005-04-17 00:20:36 +02:00
|
|
|
printk(KERN_WARNING "ip6_queue: OOM "
|
|
|
|
"in mangle, dropping packet\n");
|
2008-02-20 02:17:52 +01:00
|
|
|
return -ENOMEM;
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
2008-02-20 02:17:52 +01:00
|
|
|
kfree_skb(e->skb);
|
|
|
|
e->skb = nskb;
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
skb_put(e->skb, diff);
|
|
|
|
}
|
2007-10-14 09:39:18 +02:00
|
|
|
if (!skb_make_writable(e->skb, v->data_len))
|
2005-04-17 00:20:36 +02:00
|
|
|
return -ENOMEM;
|
2007-03-31 16:55:19 +02:00
|
|
|
skb_copy_to_linear_data(e->skb, v->payload, v->data_len);
|
2005-08-23 19:10:35 +02:00
|
|
|
e->skb->ip_summed = CHECKSUM_NONE;
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ipq_set_verdict(struct ipq_verdict_msg *vmsg, unsigned int len)
|
|
|
|
{
|
2007-12-05 10:26:33 +01:00
|
|
|
struct nf_queue_entry *entry;
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
if (vmsg->value > NF_MAX_VERDICT)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2007-12-05 10:26:02 +01:00
|
|
|
entry = ipq_find_dequeue_entry(vmsg->id);
|
2005-04-17 00:20:36 +02:00
|
|
|
if (entry == NULL)
|
|
|
|
return -ENOENT;
|
|
|
|
else {
|
|
|
|
int verdict = vmsg->value;
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
if (vmsg->data_len && vmsg->data_len == len)
|
|
|
|
if (ipq_mangle_ipv6(vmsg, entry) < 0)
|
|
|
|
verdict = NF_DROP;
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2007-12-05 10:27:02 +01:00
|
|
|
nf_reinject(entry, verdict);
|
2005-04-17 00:20:36 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ipq_set_mode(unsigned char mode, unsigned int range)
|
|
|
|
{
|
|
|
|
int status;
|
|
|
|
|
2010-06-09 16:25:08 +02:00
|
|
|
spin_lock_bh(&queue_lock);
|
2005-04-17 00:20:36 +02:00
|
|
|
status = __ipq_set_mode(mode, range);
|
2010-06-09 16:25:08 +02:00
|
|
|
spin_unlock_bh(&queue_lock);
|
2005-04-17 00:20:36 +02:00
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ipq_receive_peer(struct ipq_peer_msg *pmsg,
|
2007-02-09 15:24:49 +01:00
|
|
|
unsigned char type, unsigned int len)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
|
|
|
int status = 0;
|
|
|
|
|
|
|
|
if (len < sizeof(*pmsg))
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case IPQM_MODE:
|
|
|
|
status = ipq_set_mode(pmsg->msg.mode.value,
|
2007-02-09 15:24:49 +01:00
|
|
|
pmsg->msg.mode.range);
|
2005-04-17 00:20:36 +02:00
|
|
|
break;
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
case IPQM_VERDICT:
|
|
|
|
if (pmsg->msg.verdict.value > NF_MAX_VERDICT)
|
|
|
|
status = -EINVAL;
|
|
|
|
else
|
|
|
|
status = ipq_set_verdict(&pmsg->msg.verdict,
|
2007-02-09 15:24:49 +01:00
|
|
|
len - sizeof(*pmsg));
|
2005-04-17 00:20:36 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
status = -EINVAL;
|
|
|
|
}
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2007-12-05 10:26:33 +01:00
|
|
|
dev_cmp(struct nf_queue_entry *entry, unsigned long ifindex)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2007-12-05 10:26:33 +01:00
|
|
|
if (entry->indev)
|
|
|
|
if (entry->indev->ifindex == ifindex)
|
2005-04-17 00:20:36 +02:00
|
|
|
return 1;
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2007-12-05 10:26:33 +01:00
|
|
|
if (entry->outdev)
|
|
|
|
if (entry->outdev->ifindex == ifindex)
|
2005-04-17 00:20:36 +02:00
|
|
|
return 1;
|
2007-12-05 10:26:18 +01:00
|
|
|
#ifdef CONFIG_BRIDGE_NETFILTER
|
|
|
|
if (entry->skb->nf_bridge) {
|
|
|
|
if (entry->skb->nf_bridge->physindev &&
|
|
|
|
entry->skb->nf_bridge->physindev->ifindex == ifindex)
|
|
|
|
return 1;
|
|
|
|
if (entry->skb->nf_bridge->physoutdev &&
|
|
|
|
entry->skb->nf_bridge->physoutdev->ifindex == ifindex)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
#endif
|
2005-04-17 00:20:36 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ipq_dev_drop(int ifindex)
|
|
|
|
{
|
2007-12-05 10:26:02 +01:00
|
|
|
ipq_flush(dev_cmp, ifindex);
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#define RCV_SKB_FAIL(err) do { netlink_ack(skb, nlh, (err)); return; } while (0)
|
|
|
|
|
|
|
|
static inline void
|
2007-10-11 06:15:29 +02:00
|
|
|
__ipq_rcv_skb(struct sk_buff *skb)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
|
|
|
int status, type, pid, flags, nlmsglen, skblen;
|
|
|
|
struct nlmsghdr *nlh;
|
|
|
|
|
|
|
|
skblen = skb->len;
|
|
|
|
if (skblen < sizeof(*nlh))
|
|
|
|
return;
|
|
|
|
|
2007-04-26 04:08:35 +02:00
|
|
|
nlh = nlmsg_hdr(skb);
|
2005-04-17 00:20:36 +02:00
|
|
|
nlmsglen = nlh->nlmsg_len;
|
|
|
|
if (nlmsglen < sizeof(*nlh) || skblen < nlmsglen)
|
|
|
|
return;
|
|
|
|
|
|
|
|
pid = nlh->nlmsg_pid;
|
|
|
|
flags = nlh->nlmsg_flags;
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
if(pid <= 0 || !(flags & NLM_F_REQUEST) || flags & NLM_F_MULTI)
|
|
|
|
RCV_SKB_FAIL(-EINVAL);
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
if (flags & MSG_TRUNC)
|
|
|
|
RCV_SKB_FAIL(-ECOMM);
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
type = nlh->nlmsg_type;
|
|
|
|
if (type < NLMSG_NOOP || type >= IPQM_MAX)
|
|
|
|
RCV_SKB_FAIL(-EINVAL);
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
if (type <= IPQM_BASE)
|
|
|
|
return;
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2006-06-27 22:26:11 +02:00
|
|
|
if (security_netlink_recv(skb, CAP_NET_ADMIN))
|
2007-02-09 15:24:49 +01:00
|
|
|
RCV_SKB_FAIL(-EPERM);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2010-06-09 16:25:08 +02:00
|
|
|
spin_lock_bh(&queue_lock);
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
if (peer_pid) {
|
|
|
|
if (peer_pid != pid) {
|
2010-06-09 16:25:08 +02:00
|
|
|
spin_unlock_bh(&queue_lock);
|
2005-04-17 00:20:36 +02:00
|
|
|
RCV_SKB_FAIL(-EBUSY);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
net_enable_timestamp();
|
|
|
|
peer_pid = pid;
|
|
|
|
}
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2010-06-09 16:25:08 +02:00
|
|
|
spin_unlock_bh(&queue_lock);
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
status = ipq_receive_peer(NLMSG_DATA(nlh), type,
|
2007-02-09 15:24:49 +01:00
|
|
|
nlmsglen - NLMSG_LENGTH(0));
|
2005-04-17 00:20:36 +02:00
|
|
|
if (status < 0)
|
|
|
|
RCV_SKB_FAIL(status);
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
if (flags & NLM_F_ACK)
|
|
|
|
netlink_ack(skb, nlh, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-10-11 06:15:29 +02:00
|
|
|
ipq_rcv_skb(struct sk_buff *skb)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2006-03-21 07:33:17 +01:00
|
|
|
mutex_lock(&ipqnl_mutex);
|
2007-10-11 06:15:29 +02:00
|
|
|
__ipq_rcv_skb(skb);
|
2006-03-21 07:33:17 +01:00
|
|
|
mutex_unlock(&ipqnl_mutex);
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ipq_rcv_dev_event(struct notifier_block *this,
|
2007-02-09 15:24:49 +01:00
|
|
|
unsigned long event, void *ptr)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
|
|
|
struct net_device *dev = ptr;
|
|
|
|
|
2008-07-20 07:34:43 +02:00
|
|
|
if (!net_eq(dev_net(dev), &init_net))
|
2007-09-12 13:02:17 +02:00
|
|
|
return NOTIFY_DONE;
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
/* Drop any packets associated with the downed device */
|
|
|
|
if (event == NETDEV_DOWN)
|
|
|
|
ipq_dev_drop(dev->ifindex);
|
|
|
|
return NOTIFY_DONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct notifier_block ipq_dev_notifier = {
|
|
|
|
.notifier_call = ipq_rcv_dev_event,
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
|
|
|
ipq_rcv_nl_event(struct notifier_block *this,
|
2007-02-09 15:24:49 +01:00
|
|
|
unsigned long event, void *ptr)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
|
|
|
struct netlink_notify *n = ptr;
|
|
|
|
|
2009-11-06 17:04:00 +01:00
|
|
|
if (event == NETLINK_URELEASE && n->protocol == NETLINK_IP6_FW) {
|
2010-06-09 16:25:08 +02:00
|
|
|
spin_lock_bh(&queue_lock);
|
2009-11-26 00:14:13 +01:00
|
|
|
if ((net_eq(n->net, &init_net)) && (n->pid == peer_pid))
|
2005-04-17 00:20:36 +02:00
|
|
|
__ipq_reset();
|
2010-06-09 16:25:08 +02:00
|
|
|
spin_unlock_bh(&queue_lock);
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
return NOTIFY_DONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct notifier_block ipq_nl_notifier = {
|
|
|
|
.notifier_call = ipq_rcv_nl_event,
|
|
|
|
};
|
|
|
|
|
2008-01-31 13:54:18 +01:00
|
|
|
#ifdef CONFIG_SYSCTL
|
2005-04-17 00:20:36 +02:00
|
|
|
static struct ctl_table_header *ipq_sysctl_header;
|
|
|
|
|
|
|
|
static ctl_table ipq_table[] = {
|
|
|
|
{
|
|
|
|
.procname = NET_IPQ_QMAX_NAME,
|
|
|
|
.data = &queue_maxlen,
|
|
|
|
.maxlen = sizeof(queue_maxlen),
|
|
|
|
.mode = 0644,
|
|
|
|
.proc_handler = proc_dointvec
|
|
|
|
},
|
2009-11-05 22:32:03 +01:00
|
|
|
{ }
|
2005-04-17 00:20:36 +02:00
|
|
|
};
|
2008-01-31 13:54:18 +01:00
|
|
|
#endif
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2008-01-31 13:54:18 +01:00
|
|
|
#ifdef CONFIG_PROC_FS
|
2007-11-06 05:33:46 +01:00
|
|
|
static int ip6_queue_show(struct seq_file *m, void *v)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2010-06-09 16:25:08 +02:00
|
|
|
spin_lock_bh(&queue_lock);
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2007-11-06 05:33:46 +01:00
|
|
|
seq_printf(m,
|
2007-02-09 15:24:49 +01:00
|
|
|
"Peer PID : %d\n"
|
|
|
|
"Copy mode : %hu\n"
|
|
|
|
"Copy range : %u\n"
|
|
|
|
"Queue length : %u\n"
|
|
|
|
"Queue max. length : %u\n"
|
2005-04-17 00:20:36 +02:00
|
|
|
"Queue dropped : %u\n"
|
|
|
|
"Netfilter dropped : %u\n",
|
2007-02-09 15:24:49 +01:00
|
|
|
peer_pid,
|
|
|
|
copy_mode,
|
|
|
|
copy_range,
|
|
|
|
queue_total,
|
|
|
|
queue_maxlen,
|
2005-04-17 00:20:36 +02:00
|
|
|
queue_dropped,
|
|
|
|
queue_user_dropped);
|
|
|
|
|
2010-06-09 16:25:08 +02:00
|
|
|
spin_unlock_bh(&queue_lock);
|
2007-11-06 05:33:46 +01:00
|
|
|
return 0;
|
|
|
|
}
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2007-11-06 05:33:46 +01:00
|
|
|
static int ip6_queue_open(struct inode *inode, struct file *file)
|
|
|
|
{
|
|
|
|
return single_open(file, ip6_queue_show, NULL);
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
2007-11-06 05:33:46 +01:00
|
|
|
|
|
|
|
static const struct file_operations ip6_queue_proc_fops = {
|
|
|
|
.open = ip6_queue_open,
|
|
|
|
.read = seq_read,
|
|
|
|
.llseek = seq_lseek,
|
|
|
|
.release = single_release,
|
|
|
|
.owner = THIS_MODULE,
|
|
|
|
};
|
2008-01-31 13:54:18 +01:00
|
|
|
#endif
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2007-12-05 10:23:57 +01:00
|
|
|
static const struct nf_queue_handler nfqh = {
|
2005-08-10 05:23:11 +02:00
|
|
|
.name = "ip6_queue",
|
|
|
|
.outfn = &ipq_enqueue_packet,
|
|
|
|
};
|
|
|
|
|
2006-04-06 23:11:30 +02:00
|
|
|
static int __init ip6_queue_init(void)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
|
|
|
int status = -ENOMEM;
|
2008-01-31 13:54:18 +01:00
|
|
|
struct proc_dir_entry *proc __maybe_unused;
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
netlink_register_notifier(&ipq_nl_notifier);
|
2007-10-11 06:15:29 +02:00
|
|
|
ipqnl = netlink_kernel_create(&init_net, NETLINK_IP6_FW, 0,
|
|
|
|
ipq_rcv_skb, NULL, THIS_MODULE);
|
2005-04-17 00:20:36 +02:00
|
|
|
if (ipqnl == NULL) {
|
|
|
|
printk(KERN_ERR "ip6_queue: failed to create netlink socket\n");
|
|
|
|
goto cleanup_netlink_notifier;
|
|
|
|
}
|
|
|
|
|
2008-01-31 13:54:18 +01:00
|
|
|
#ifdef CONFIG_PROC_FS
|
2008-03-28 00:55:53 +01:00
|
|
|
proc = proc_create(IPQ_PROC_FS_NAME, 0, init_net.proc_net,
|
|
|
|
&ip6_queue_proc_fops);
|
|
|
|
if (!proc) {
|
2005-04-17 00:20:36 +02:00
|
|
|
printk(KERN_ERR "ip6_queue: failed to create proc entry\n");
|
|
|
|
goto cleanup_ipqnl;
|
|
|
|
}
|
2008-01-31 13:54:18 +01:00
|
|
|
#endif
|
2005-04-17 00:20:36 +02:00
|
|
|
register_netdevice_notifier(&ipq_dev_notifier);
|
2008-01-31 13:54:18 +01:00
|
|
|
#ifdef CONFIG_SYSCTL
|
2008-01-09 09:33:11 +01:00
|
|
|
ipq_sysctl_header = register_sysctl_paths(net_ipv6_ctl_path, ipq_table);
|
2008-01-31 13:54:18 +01:00
|
|
|
#endif
|
2009-04-14 14:26:49 +02:00
|
|
|
status = nf_register_queue_handler(NFPROTO_IPV6, &nfqh);
|
2005-04-17 00:20:36 +02:00
|
|
|
if (status < 0) {
|
|
|
|
printk(KERN_ERR "ip6_queue: failed to register queue handler\n");
|
|
|
|
goto cleanup_sysctl;
|
|
|
|
}
|
|
|
|
return status;
|
|
|
|
|
|
|
|
cleanup_sysctl:
|
2008-01-31 13:54:18 +01:00
|
|
|
#ifdef CONFIG_SYSCTL
|
2005-04-17 00:20:36 +02:00
|
|
|
unregister_sysctl_table(ipq_sysctl_header);
|
2008-01-31 13:54:18 +01:00
|
|
|
#endif
|
2005-04-17 00:20:36 +02:00
|
|
|
unregister_netdevice_notifier(&ipq_dev_notifier);
|
2007-09-12 12:01:34 +02:00
|
|
|
proc_net_remove(&init_net, IPQ_PROC_FS_NAME);
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2008-01-31 13:54:18 +01:00
|
|
|
cleanup_ipqnl: __maybe_unused
|
2008-01-28 23:41:19 +01:00
|
|
|
netlink_kernel_release(ipqnl);
|
2006-03-21 07:33:17 +01:00
|
|
|
mutex_lock(&ipqnl_mutex);
|
|
|
|
mutex_unlock(&ipqnl_mutex);
|
2007-02-09 15:24:49 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
cleanup_netlink_notifier:
|
|
|
|
netlink_unregister_notifier(&ipq_nl_notifier);
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2006-03-29 02:37:06 +02:00
|
|
|
static void __exit ip6_queue_fini(void)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2006-04-06 23:11:30 +02:00
|
|
|
nf_unregister_queue_handlers(&nfqh);
|
2009-11-04 21:14:31 +01:00
|
|
|
|
2007-12-05 10:26:02 +01:00
|
|
|
ipq_flush(NULL, 0);
|
2006-04-06 23:11:30 +02:00
|
|
|
|
2008-01-31 13:54:18 +01:00
|
|
|
#ifdef CONFIG_SYSCTL
|
2006-04-06 23:11:30 +02:00
|
|
|
unregister_sysctl_table(ipq_sysctl_header);
|
2008-01-31 13:54:18 +01:00
|
|
|
#endif
|
2006-04-06 23:11:30 +02:00
|
|
|
unregister_netdevice_notifier(&ipq_dev_notifier);
|
2007-09-12 12:01:34 +02:00
|
|
|
proc_net_remove(&init_net, IPQ_PROC_FS_NAME);
|
2006-04-06 23:11:30 +02:00
|
|
|
|
2008-01-28 23:41:19 +01:00
|
|
|
netlink_kernel_release(ipqnl);
|
2006-04-06 23:11:30 +02:00
|
|
|
mutex_lock(&ipqnl_mutex);
|
|
|
|
mutex_unlock(&ipqnl_mutex);
|
|
|
|
|
|
|
|
netlink_unregister_notifier(&ipq_nl_notifier);
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
MODULE_DESCRIPTION("IPv6 packet queue handler");
|
|
|
|
MODULE_LICENSE("GPL");
|
2009-03-16 15:30:14 +01:00
|
|
|
MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_IP6_FW);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2006-03-29 02:37:06 +02:00
|
|
|
module_init(ip6_queue_init);
|
|
|
|
module_exit(ip6_queue_fini);
|