1 // SPDX-License-Identifier: GPL-2.0-only
6 * Peter Warasin <peter@endian.com>
11 * xt_NFLOG.c, (C) 2006 by Patrick McHardy <kaber@trash.net>
12 * ebt_ulog.c, (C) 2004 by Bart De Schuymer <bdschuym@pandora.be>
16 #include <linux/module.h>
17 #include <linux/spinlock.h>
18 #include <linux/netfilter/x_tables.h>
19 #include <linux/netfilter_bridge/ebtables.h>
20 #include <linux/netfilter_bridge/ebt_nflog.h>
21 #include <net/netfilter/nf_log.h>
24 ebt_nflog_tg(struct sk_buff
*skb
, const struct xt_action_param
*par
)
26 const struct ebt_nflog_info
*info
= par
->targinfo
;
27 struct net
*net
= xt_net(par
);
30 li
.type
= NF_LOG_TYPE_ULOG
;
31 li
.u
.ulog
.copy_len
= info
->len
;
32 li
.u
.ulog
.group
= info
->group
;
33 li
.u
.ulog
.qthreshold
= info
->threshold
;
36 nf_log_packet(net
, PF_BRIDGE
, xt_hooknum(par
), skb
, xt_in(par
),
37 xt_out(par
), &li
, "%s", info
->prefix
);
41 static int ebt_nflog_tg_check(const struct xt_tgchk_param
*par
)
43 struct ebt_nflog_info
*info
= par
->targinfo
;
45 if (info
->flags
& ~EBT_NFLOG_MASK
)
47 info
->prefix
[EBT_NFLOG_PREFIX_SIZE
- 1] = '\0';
51 static struct xt_target ebt_nflog_tg_reg __read_mostly
= {
54 .family
= NFPROTO_BRIDGE
,
55 .target
= ebt_nflog_tg
,
56 .checkentry
= ebt_nflog_tg_check
,
57 .targetsize
= sizeof(struct ebt_nflog_info
),
61 static int __init
ebt_nflog_init(void)
63 return xt_register_target(&ebt_nflog_tg_reg
);
66 static void __exit
ebt_nflog_fini(void)
68 xt_unregister_target(&ebt_nflog_tg_reg
);
71 module_init(ebt_nflog_init
);
72 module_exit(ebt_nflog_fini
);
73 MODULE_LICENSE("GPL");
74 MODULE_AUTHOR("Peter Warasin <peter@endian.com>");
75 MODULE_DESCRIPTION("ebtables NFLOG netfilter logging module");