2 * Copyright (c) 2003+ Evgeniy Polyakov <zbr@ioremap.net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, see <http://www.gnu.org/licenses/>.
18 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
19 #include <linux/module.h>
20 #include <linux/kernel.h>
22 #include <linux/capability.h>
24 #include <linux/inetdevice.h>
26 #include <linux/list.h>
27 #include <linux/rculist.h>
28 #include <linux/skbuff.h>
29 #include <linux/slab.h>
30 #include <linux/tcp.h>
35 #include <linux/netfilter/nfnetlink.h>
36 #include <linux/netfilter/x_tables.h>
37 #include <net/netfilter/nf_log.h>
38 #include <linux/netfilter/xt_osf.h>
41 xt_osf_match_packet(const struct sk_buff
*skb
, struct xt_action_param
*p
)
43 const struct xt_osf_info
*info
= p
->matchinfo
;
44 struct net
*net
= xt_net(p
);
49 return nf_osf_match(skb
, xt_family(p
), xt_hooknum(p
), xt_in(p
),
50 xt_out(p
), info
, net
, nf_osf_fingers
);
53 static struct xt_match xt_osf_match
= {
56 .family
= NFPROTO_IPV4
,
58 .hooks
= (1 << NF_INET_LOCAL_IN
) |
59 (1 << NF_INET_PRE_ROUTING
) |
60 (1 << NF_INET_FORWARD
),
61 .match
= xt_osf_match_packet
,
62 .matchsize
= sizeof(struct xt_osf_info
),
66 static int __init
xt_osf_init(void)
70 err
= xt_register_match(&xt_osf_match
);
72 pr_err("Failed to register OS fingerprint "
73 "matching module (%d)\n", err
);
80 static void __exit
xt_osf_fini(void)
82 xt_unregister_match(&xt_osf_match
);
85 module_init(xt_osf_init
);
86 module_exit(xt_osf_fini
);
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Evgeniy Polyakov <zbr@ioremap.net>");
90 MODULE_DESCRIPTION("Passive OS fingerprint matching.");
91 MODULE_ALIAS("ipt_osf");
92 MODULE_ALIAS("ip6t_osf");
93 MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_OSF
);