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

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

Version: ~ [ linux-6.4-rc3 ] ~ [ linux-6.3.4 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.30 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.113 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.180 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.243 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.283 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.315 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-or-later
  2 /*
  3  * Copyright (c) 2003+ Evgeniy Polyakov <zbr@ioremap.net>
  4  */
  5 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  6 #include <linux/module.h>
  7 #include <linux/kernel.h>
  8 
  9 #include <linux/capability.h>
 10 #include <linux/if.h>
 11 #include <linux/inetdevice.h>
 12 #include <linux/ip.h>
 13 #include <linux/list.h>
 14 #include <linux/rculist.h>
 15 #include <linux/skbuff.h>
 16 #include <linux/slab.h>
 17 #include <linux/tcp.h>
 18 
 19 #include <net/ip.h>
 20 #include <net/tcp.h>
 21 
 22 #include <linux/netfilter/nfnetlink.h>
 23 #include <linux/netfilter/x_tables.h>
 24 #include <net/netfilter/nf_log.h>
 25 #include <linux/netfilter/xt_osf.h>
 26 
 27 static bool
 28 xt_osf_match_packet(const struct sk_buff *skb, struct xt_action_param *p)
 29 {
 30         return nf_osf_match(skb, xt_family(p), xt_hooknum(p), xt_in(p),
 31                             xt_out(p), p->matchinfo, xt_net(p), nf_osf_fingers);
 32 }
 33 
 34 static struct xt_match xt_osf_match = {
 35         .name           = "osf",
 36         .revision       = 0,
 37         .family         = NFPROTO_IPV4,
 38         .proto          = IPPROTO_TCP,
 39         .hooks          = (1 << NF_INET_LOCAL_IN) |
 40                                 (1 << NF_INET_PRE_ROUTING) |
 41                                 (1 << NF_INET_FORWARD),
 42         .match          = xt_osf_match_packet,
 43         .matchsize      = sizeof(struct xt_osf_info),
 44         .me             = THIS_MODULE,
 45 };
 46 
 47 static int __init xt_osf_init(void)
 48 {
 49         int err;
 50 
 51         err = xt_register_match(&xt_osf_match);
 52         if (err) {
 53                 pr_err("Failed to register OS fingerprint "
 54                        "matching module (%d)\n", err);
 55                 return err;
 56         }
 57 
 58         return 0;
 59 }
 60 
 61 static void __exit xt_osf_fini(void)
 62 {
 63         xt_unregister_match(&xt_osf_match);
 64 }
 65 
 66 module_init(xt_osf_init);
 67 module_exit(xt_osf_fini);
 68 
 69 MODULE_LICENSE("GPL");
 70 MODULE_AUTHOR("Evgeniy Polyakov <zbr@ioremap.net>");
 71 MODULE_DESCRIPTION("Passive OS fingerprint matching.");
 72 MODULE_ALIAS("ipt_osf");
 73 MODULE_ALIAS("ip6t_osf");
 74 MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_OSF);
 75 

~ [ 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