cregit-Linux how code gets into the kernel

Release 4.8 net/netfilter/xt_LOG.c

Directory: net/netfilter
/*
 * 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 nf_loginfo li; struct net *net = par->net; li.type = NF_LOG_TYPE_LOG; li.u.log.level = loginfo->level; li.u.log.logflags = loginfo->logflags; nf_log_packet(net, par->family, par->hooknum, skb, par->in, par->out, &li, "%s", loginfo->prefix); return XT_CONTINUE; }

Contributors

PersonTokensPropCommitsCommitProp
harald welteharald welte5753.77%215.38%
richard weinbergerrichard weinberger2725.47%17.69%
hans schillstromhans schillstrom109.43%17.69%
jan engelhardtjan engelhardt65.66%430.77%
pablo neira ayusopablo neira ayuso32.83%215.38%
herbert xuherbert xu10.94%17.69%
patrick mchardypatrick mchardy10.94%17.69%
eric w. biedermaneric w. biederman10.94%17.69%
Total106100.00%13100.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

PersonTokensPropCommitsCommitProp
pre-gitpre-git5957.84%110.00%
richard weinbergerrichard weinberger1918.63%110.00%
jan engelhardtjan engelhardt1211.76%550.00%
pablo neira ayusopablo neira ayuso87.84%110.00%
patrick mchardypatrick mchardy43.92%220.00%
Total102100.00%10100.00%


static void log_tg_destroy(const struct xt_tgdtor_param *par) { nf_logger_put(par->family, NF_LOG_TYPE_LOG); }

Contributors

PersonTokensPropCommitsCommitProp
pablo neira ayusopablo neira ayuso21100.00%1100.00%
Total21100.00%1100.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

PersonTokensPropCommitsCommitProp
pre-gitpre-git1050.00%120.00%
richard weinbergerrichard weinberger735.00%120.00%
gao fenggao feng15.00%120.00%
pablo neira ayusopablo neira ayuso15.00%120.00%
jan engelhardtjan engelhardt15.00%120.00%
Total20100.00%5100.00%


static void __exit log_tg_exit(void) { xt_unregister_targets(log_tg_regs, ARRAY_SIZE(log_tg_regs)); }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git1052.63%133.33%
richard weinbergerrichard weinberger842.11%133.33%
jan engelhardtjan engelhardt15.26%133.33%
Total19100.00%3100.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

PersonTokensPropCommitsCommitProp
richard weinbergerrichard weinberger14832.03%13.23%
pre-gitpre-git12226.41%13.23%
harald welteharald welte6113.20%39.68%
pablo neira ayusopablo neira ayuso449.52%412.90%
jan engelhardtjan engelhardt388.23%929.03%
patrick mchardypatrick mchardy245.19%825.81%
art haasart haas122.60%13.23%
hans schillstromhans schillstrom102.16%13.23%
eric w. biedermaneric w. biederman10.22%13.23%
herbert xuherbert xu10.22%13.23%
gao fenggao feng10.22%13.23%
Total462100.00%31100.00%
Directory: net/netfilter
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.