Blame view
net/netfilter/xt_NFLOG.c
1.81 KB
baf7b1e11 [NETFILTER]: x_ta... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
/* * Copyright (c) 2006 Patrick McHardy <kaber@trash.net> * * 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/init.h> #include <linux/skbuff.h> #include <linux/netfilter/x_tables.h> #include <linux/netfilter/xt_NFLOG.h> |
f01ffbd6e [NETFILTER]: nf_l... |
15 |
#include <net/netfilter/nf_log.h> |
5f7340eff netfilter: xt_NFL... |
16 |
#include <net/netfilter/nfnetlink_log.h> |
baf7b1e11 [NETFILTER]: x_ta... |
17 18 |
MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>"); |
2ae15b64e [NETFILTER]: Upda... |
19 |
MODULE_DESCRIPTION("Xtables: packet logging to netlink using NFLOG"); |
baf7b1e11 [NETFILTER]: x_ta... |
20 21 22 23 24 |
MODULE_LICENSE("GPL"); MODULE_ALIAS("ipt_NFLOG"); MODULE_ALIAS("ip6t_NFLOG"); static unsigned int |
4b560b447 netfilter: xtable... |
25 |
nflog_tg(struct sk_buff *skb, const struct xt_action_param *par) |
baf7b1e11 [NETFILTER]: x_ta... |
26 |
{ |
7eb355865 netfilter: xtable... |
27 |
const struct xt_nflog_info *info = par->targinfo; |
baf7b1e11 [NETFILTER]: x_ta... |
28 29 30 31 32 33 |
struct nf_loginfo li; li.type = NF_LOG_TYPE_ULOG; li.u.ulog.copy_len = info->len; li.u.ulog.group = info->group; li.u.ulog.qthreshold = info->threshold; |
5f7340eff netfilter: xt_NFL... |
34 35 |
nfulnl_log_packet(par->family, par->hooknum, skb, par->in, par->out, &li, info->prefix); |
baf7b1e11 [NETFILTER]: x_ta... |
36 37 |
return XT_CONTINUE; } |
135367b8f netfilter: xtable... |
38 |
static int nflog_tg_check(const struct xt_tgchk_param *par) |
baf7b1e11 [NETFILTER]: x_ta... |
39 |
{ |
af5d6dc20 netfilter: xtable... |
40 |
const struct xt_nflog_info *info = par->targinfo; |
baf7b1e11 [NETFILTER]: x_ta... |
41 42 |
if (info->flags & ~XT_NFLOG_MASK) |
d6b00a534 netfilter: xtable... |
43 |
return -EINVAL; |
baf7b1e11 [NETFILTER]: x_ta... |
44 |
if (info->prefix[sizeof(info->prefix) - 1] != '\0') |
d6b00a534 netfilter: xtable... |
45 46 |
return -EINVAL; return 0; |
baf7b1e11 [NETFILTER]: x_ta... |
47 |
} |
92f3b2b1b netfilter: xtable... |
48 49 50 51 52 53 54 55 |
static struct xt_target nflog_tg_reg __read_mostly = { .name = "NFLOG", .revision = 0, .family = NFPROTO_UNSPEC, .checkentry = nflog_tg_check, .target = nflog_tg, .targetsize = sizeof(struct xt_nflog_info), .me = THIS_MODULE, |
baf7b1e11 [NETFILTER]: x_ta... |
56 |
}; |
d3c5ee6d5 [NETFILTER]: x_ta... |
57 |
static int __init nflog_tg_init(void) |
baf7b1e11 [NETFILTER]: x_ta... |
58 |
{ |
92f3b2b1b netfilter: xtable... |
59 |
return xt_register_target(&nflog_tg_reg); |
baf7b1e11 [NETFILTER]: x_ta... |
60 |
} |
d3c5ee6d5 [NETFILTER]: x_ta... |
61 |
static void __exit nflog_tg_exit(void) |
baf7b1e11 [NETFILTER]: x_ta... |
62 |
{ |
92f3b2b1b netfilter: xtable... |
63 |
xt_unregister_target(&nflog_tg_reg); |
baf7b1e11 [NETFILTER]: x_ta... |
64 |
} |
d3c5ee6d5 [NETFILTER]: x_ta... |
65 66 |
module_init(nflog_tg_init); module_exit(nflog_tg_exit); |