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

TOMOYO Linux Cross Reference
Linux/net/ipv6/netfilter/ip6t_MASQUERADE.c

Version: ~ [ linux-5.13-rc5 ] ~ [ linux-5.12.9 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.42 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.124 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.193 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.235 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.271 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.271 ] ~ [ 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  * Copyright (c) 2011 Patrick McHardy <kaber@trash.net>
  3  *
  4  * This program is free software; you can redistribute it and/or modify
  5  * it under the terms of the GNU General Public License version 2 as
  6  * published by the Free Software Foundation.
  7  *
  8  * Based on Rusty Russell's IPv6 MASQUERADE target. Development of IPv6
  9  * NAT funded by Astaro.
 10  */
 11 
 12 #include <linux/kernel.h>
 13 #include <linux/module.h>
 14 #include <linux/netdevice.h>
 15 #include <linux/ipv6.h>
 16 #include <linux/netfilter.h>
 17 #include <linux/netfilter_ipv6.h>
 18 #include <linux/netfilter/x_tables.h>
 19 #include <net/netfilter/nf_nat.h>
 20 #include <net/addrconf.h>
 21 #include <net/ipv6.h>
 22 #include <net/netfilter/ipv6/nf_nat_masquerade.h>
 23 
 24 static unsigned int
 25 masquerade_tg6(struct sk_buff *skb, const struct xt_action_param *par)
 26 {
 27         return nf_nat_masquerade_ipv6(skb, par->targinfo, par->out);
 28 }
 29 
 30 static int masquerade_tg6_checkentry(const struct xt_tgchk_param *par)
 31 {
 32         const struct nf_nat_range *range = par->targinfo;
 33 
 34         if (range->flags & NF_NAT_RANGE_MAP_IPS)
 35                 return -EINVAL;
 36         return 0;
 37 }
 38 
 39 static struct xt_target masquerade_tg6_reg __read_mostly = {
 40         .name           = "MASQUERADE",
 41         .family         = NFPROTO_IPV6,
 42         .checkentry     = masquerade_tg6_checkentry,
 43         .target         = masquerade_tg6,
 44         .targetsize     = sizeof(struct nf_nat_range),
 45         .table          = "nat",
 46         .hooks          = 1 << NF_INET_POST_ROUTING,
 47         .me             = THIS_MODULE,
 48 };
 49 
 50 static int __init masquerade_tg6_init(void)
 51 {
 52         int err;
 53 
 54         err = xt_register_target(&masquerade_tg6_reg);
 55         if (err == 0)
 56                 nf_nat_masquerade_ipv6_register_notifier();
 57 
 58         return err;
 59 }
 60 static void __exit masquerade_tg6_exit(void)
 61 {
 62         nf_nat_masquerade_ipv6_unregister_notifier();
 63         xt_unregister_target(&masquerade_tg6_reg);
 64 }
 65 
 66 module_init(masquerade_tg6_init);
 67 module_exit(masquerade_tg6_exit);
 68 
 69 MODULE_LICENSE("GPL");
 70 MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>");
 71 MODULE_DESCRIPTION("Xtables: automatic address SNAT");
 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