This source file includes following definitions.
- xt_osf_match_packet
- xt_osf_init
- xt_osf_fini
1
2
3
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);