Release 4.11 net/netfilter/xt_LOG.c
/*
* This is a module which is used for logging packets.
*/
/* (C) 1999-2001 Paul `Rusty' Russell
* (C) 2002-2004 Netfilter Core Team <coreteam@netfilter.org>
*
* 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.
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/skbuff.h>
#include <linux/if_arp.h>
#include <linux/ip.h>
#include <net/ipv6.h>
#include <net/icmp.h>
#include <net/udp.h>
#include <net/tcp.h>
#include <net/route.h>
#include <linux/netfilter.h>
#include <linux/netfilter/x_tables.h>
#include <linux/netfilter/xt_LOG.h>
#include <linux/netfilter_ipv6/ip6_tables.h>
#include <net/netfilter/nf_log.h>
static unsigned int
log_tg(struct sk_buff *skb, const struct xt_action_param *par)
{
const struct xt_log_info *loginfo = par->targinfo;
struct net *net = xt_net(par);
struct nf_loginfo li;
li.type = NF_LOG_TYPE_LOG;
li.u.log.level = loginfo->level;
li.u.log.logflags = loginfo->logflags;
nf_log_packet(net, xt_family(par), xt_hooknum(par), skb, xt_in(par),
xt_out(par), &li, "%s", loginfo->prefix);
return XT_CONTINUE;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Harald Welte | 54 | 48.65% | 2 | 15.38% |
Pablo Neira Ayuso | 22 | 19.82% | 3 | 23.08% |
Richard Weinberger | 19 | 17.12% | 1 | 7.69% |
Hans Schillstrom | 8 | 7.21% | 1 | 7.69% |
Jan Engelhardt | 6 | 5.41% | 4 | 30.77% |
Herbert Xu | 1 | 0.90% | 1 | 7.69% |
Patrick McHardy | 1 | 0.90% | 1 | 7.69% |
Total | 111 | 100.00% | 13 | 100.00% |
static int log_tg_check(const struct xt_tgchk_param *par)
{
const struct xt_log_info *loginfo = par->targinfo;
if (par->family != NFPROTO_IPV4 && par->family != NFPROTO_IPV6)
return -EINVAL;
if (loginfo->level >= 8) {
pr_debug("level %u >= 8\n", loginfo->level);
return -EINVAL;
}
if (loginfo->prefix[sizeof(loginfo->prefix)-1] != '\0') {
pr_debug("prefix is not null-terminated\n");
return -EINVAL;
}
return nf_logger_find_get(par->family, NF_LOG_TYPE_LOG);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 59 | 57.84% | 1 | 10.00% |
Richard Weinberger | 19 | 18.63% | 1 | 10.00% |
Jan Engelhardt | 12 | 11.76% | 5 | 50.00% |
Pablo Neira Ayuso | 8 | 7.84% | 1 | 10.00% |
Patrick McHardy | 4 | 3.92% | 2 | 20.00% |
Total | 102 | 100.00% | 10 | 100.00% |
static void log_tg_destroy(const struct xt_tgdtor_param *par)
{
nf_logger_put(par->family, NF_LOG_TYPE_LOG);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Pablo Neira Ayuso | 21 | 100.00% | 1 | 100.00% |
Total | 21 | 100.00% | 1 | 100.00% |
static struct xt_target log_tg_regs[] __read_mostly = {
{
.name = "LOG",
.family = NFPROTO_IPV4,
.target = log_tg,
.targetsize = sizeof(struct xt_log_info),
.checkentry = log_tg_check,
.destroy = log_tg_destroy,
.me = THIS_MODULE,
},
#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES)
{
.name = "LOG",
.family = NFPROTO_IPV6,
.target = log_tg,
.targetsize = sizeof(struct xt_log_info),
.checkentry = log_tg_check,
.destroy = log_tg_destroy,
.me = THIS_MODULE,
},
#endif
};
static int __init log_tg_init(void)
{
return xt_register_targets(log_tg_regs, ARRAY_SIZE(log_tg_regs));
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 10 | 50.00% | 1 | 20.00% |
Richard Weinberger | 7 | 35.00% | 1 | 20.00% |
Gao Feng | 1 | 5.00% | 1 | 20.00% |
Jan Engelhardt | 1 | 5.00% | 1 | 20.00% |
Pablo Neira Ayuso | 1 | 5.00% | 1 | 20.00% |
Total | 20 | 100.00% | 5 | 100.00% |
static void __exit log_tg_exit(void)
{
xt_unregister_targets(log_tg_regs, ARRAY_SIZE(log_tg_regs));
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 10 | 52.63% | 1 | 33.33% |
Richard Weinberger | 8 | 42.11% | 1 | 33.33% |
Jan Engelhardt | 1 | 5.26% | 1 | 33.33% |
Total | 19 | 100.00% | 3 | 100.00% |
module_init(log_tg_init);
module_exit(log_tg_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
MODULE_AUTHOR("Jan Rekorajski <baggins@pld.org.pl>");
MODULE_DESCRIPTION("Xtables: IPv4/IPv6 packet logging");
MODULE_ALIAS("ipt_LOG");
MODULE_ALIAS("ip6t_LOG");
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Richard Weinberger | 140 | 29.98% | 1 | 3.23% |
Linus Torvalds (pre-git) | 122 | 26.12% | 1 | 3.23% |
Pablo Neira Ayuso | 63 | 13.49% | 5 | 16.13% |
Harald Welte | 58 | 12.42% | 3 | 9.68% |
Jan Engelhardt | 38 | 8.14% | 9 | 29.03% |
Patrick McHardy | 24 | 5.14% | 8 | 25.81% |
Art Haas | 12 | 2.57% | 1 | 3.23% |
Hans Schillstrom | 8 | 1.71% | 1 | 3.23% |
Gao Feng | 1 | 0.21% | 1 | 3.23% |
Herbert Xu | 1 | 0.21% | 1 | 3.23% |
Total | 467 | 100.00% | 31 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.