~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/netfilter/nf_log_netdev.c

Version: ~ [ linux-5.8-rc4 ] ~ [ linux-5.7.7 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.50 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.131 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.187 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.229 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.229 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * (C) 2016 by Pablo Neira Ayuso <pablo@netfilter.org>
  3  *
  4  * This program is free software; you can redistribute it and/or modify
  5  * it under the terms of the GNU General Public License version 2 as
  6  * published by the Free Software Foundation.
  7  */
  8 
  9 #include <linux/module.h>
 10 #include <linux/spinlock.h>
 11 #include <linux/skbuff.h>
 12 #include <linux/ip.h>
 13 #include <net/route.h>
 14 
 15 #include <linux/netfilter.h>
 16 #include <net/netfilter/nf_log.h>
 17 
 18 static void nf_log_netdev_packet(struct net *net, u_int8_t pf,
 19                                  unsigned int hooknum,
 20                                  const struct sk_buff *skb,
 21                                  const struct net_device *in,
 22                                  const struct net_device *out,
 23                                  const struct nf_loginfo *loginfo,
 24                                  const char *prefix)
 25 {
 26         nf_log_l2packet(net, pf, skb->protocol, hooknum, skb, in, out,
 27                         loginfo, prefix);
 28 }
 29 
 30 static struct nf_logger nf_netdev_logger __read_mostly = {
 31         .name           = "nf_log_netdev",
 32         .type           = NF_LOG_TYPE_LOG,
 33         .logfn          = nf_log_netdev_packet,
 34         .me             = THIS_MODULE,
 35 };
 36 
 37 static int __net_init nf_log_netdev_net_init(struct net *net)
 38 {
 39         return nf_log_set(net, NFPROTO_NETDEV, &nf_netdev_logger);
 40 }
 41 
 42 static void __net_exit nf_log_netdev_net_exit(struct net *net)
 43 {
 44         nf_log_unset(net, &nf_netdev_logger);
 45 }
 46 
 47 static struct pernet_operations nf_log_netdev_net_ops = {
 48         .init = nf_log_netdev_net_init,
 49         .exit = nf_log_netdev_net_exit,
 50 };
 51 
 52 static int __init nf_log_netdev_init(void)
 53 {
 54         int ret;
 55 
 56         /* Request to load the real packet loggers. */
 57         nf_logger_request_module(NFPROTO_IPV4, NF_LOG_TYPE_LOG);
 58         nf_logger_request_module(NFPROTO_IPV6, NF_LOG_TYPE_LOG);
 59         nf_logger_request_module(NFPROTO_ARP, NF_LOG_TYPE_LOG);
 60 
 61         ret = register_pernet_subsys(&nf_log_netdev_net_ops);
 62         if (ret < 0)
 63                 return ret;
 64 
 65         nf_log_register(NFPROTO_NETDEV, &nf_netdev_logger);
 66         return 0;
 67 }
 68 
 69 static void __exit nf_log_netdev_exit(void)
 70 {
 71         unregister_pernet_subsys(&nf_log_netdev_net_ops);
 72         nf_log_unregister(&nf_netdev_logger);
 73 }
 74 
 75 module_init(nf_log_netdev_init);
 76 module_exit(nf_log_netdev_exit);
 77 
 78 MODULE_AUTHOR("Pablo Neira Ayuso <pablo@netfilter.org>");
 79 MODULE_DESCRIPTION("Netfilter netdev packet logging");
 80 MODULE_LICENSE("GPL");
 81 MODULE_ALIAS_NF_LOGGER(5, 0); /* NFPROTO_NETDEV */
 82 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp