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

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

Version: ~ [ linux-5.17-rc1 ] ~ [ linux-5.16.2 ] ~ [ linux-5.15.16 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.93 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.173 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.225 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.262 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.297 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.299 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ 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  *      NetBIOS name service broadcast connection tracking helper
  3  *
  4  *      (c) 2005 Patrick McHardy <kaber@trash.net>
  5  *
  6  *      This program is free software; you can redistribute it and/or
  7  *      modify it under the terms of the GNU General Public License
  8  *      as published by the Free Software Foundation; either version
  9  *      2 of the License, or (at your option) any later version.
 10  */
 11 /*
 12  *      This helper tracks locally originating NetBIOS name service
 13  *      requests by issuing permanent expectations (valid until
 14  *      timing out) matching all reply connections from the
 15  *      destination network. The only NetBIOS specific thing is
 16  *      actually the port number.
 17  */
 18 #include <linux/kernel.h>
 19 #include <linux/module.h>
 20 #include <linux/init.h>
 21 #include <linux/in.h>
 22 
 23 #include <net/netfilter/nf_conntrack.h>
 24 #include <net/netfilter/nf_conntrack_helper.h>
 25 #include <net/netfilter/nf_conntrack_expect.h>
 26 
 27 #define NMBD_PORT       137
 28 
 29 MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>");
 30 MODULE_DESCRIPTION("NetBIOS name service broadcast connection tracking helper");
 31 MODULE_LICENSE("GPL");
 32 MODULE_ALIAS("ip_conntrack_netbios_ns");
 33 MODULE_ALIAS_NFCT_HELPER("netbios_ns");
 34 
 35 static unsigned int timeout __read_mostly = 3;
 36 module_param(timeout, uint, S_IRUSR);
 37 MODULE_PARM_DESC(timeout, "timeout for master connection/replies in seconds");
 38 
 39 static struct nf_conntrack_expect_policy exp_policy = {
 40         .max_expected   = 1,
 41 };
 42 
 43 static int netbios_ns_help(struct sk_buff *skb, unsigned int protoff,
 44                    struct nf_conn *ct, enum ip_conntrack_info ctinfo)
 45 {
 46         return nf_conntrack_broadcast_help(skb, protoff, ct, ctinfo, timeout);
 47 }
 48 
 49 static struct nf_conntrack_helper helper __read_mostly = {
 50         .name                   = "netbios-ns",
 51         .tuple.src.l3num        = NFPROTO_IPV4,
 52         .tuple.src.u.udp.port   = cpu_to_be16(NMBD_PORT),
 53         .tuple.dst.protonum     = IPPROTO_UDP,
 54         .me                     = THIS_MODULE,
 55         .help                   = netbios_ns_help,
 56         .expect_policy          = &exp_policy,
 57 };
 58 
 59 static int __init nf_conntrack_netbios_ns_init(void)
 60 {
 61         exp_policy.timeout = timeout;
 62         return nf_conntrack_helper_register(&helper);
 63 }
 64 
 65 static void __exit nf_conntrack_netbios_ns_fini(void)
 66 {
 67         nf_conntrack_helper_unregister(&helper);
 68 }
 69 
 70 module_init(nf_conntrack_netbios_ns_init);
 71 module_exit(nf_conntrack_netbios_ns_fini);
 72 

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