1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (c) 2003+ Evgeniy Polyakov <zbr@ioremap.net>
5 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
6 #include <linux/module.h>
7 #include <linux/kernel.h>
9 #include <linux/capability.h>
11 #include <linux/inetdevice.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>
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>
28 xt_osf_match_packet(const struct sk_buff
*skb
, struct xt_action_param
*p
)
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
);
34 static struct xt_match xt_osf_match
= {
37 .family
= NFPROTO_IPV4
,
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
),
47 static int __init
xt_osf_init(void)
51 err
= xt_register_match(&xt_osf_match
);
53 pr_err("Failed to register OS fingerprint "
54 "matching module (%d)\n", err
);
61 static void __exit
xt_osf_fini(void)
63 xt_unregister_match(&xt_osf_match
);
66 module_init(xt_osf_init
);
67 module_exit(xt_osf_fini
);
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
);