]> Git Repo - linux.git/commitdiff
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next
authorDavid S. Miller <[email protected]>
Wed, 10 Sep 2014 19:46:32 +0000 (12:46 -0700)
committerDavid S. Miller <[email protected]>
Wed, 10 Sep 2014 19:46:32 +0000 (12:46 -0700)
Pablo Neira Ayuso says:

====================
nf-next pull request

The following patchset contains Netfilter/IPVS updates for your
net-next tree. Regarding nf_tables, most updates focus on consolidating
the NAT infrastructure and adding support for masquerading. More
specifically, they are:

1) use __u8 instead of u_int8_t in arptables header, from
   Mike Frysinger.

2) Add support to match by skb->pkttype to the meta expression, from
   Ana Rey.

3) Add support to match by cpu to the meta expression, also from
   Ana Rey.

4) A smatch warning about IPSET_ATTR_MARKMASK validation, patch from
   Vytas Dauksa.

5) Fix netnet and netportnet hash types the range support for IPv4,
   from Sergey Popovich.

6) Fix missing-field-initializer warnings resolved, from Mark Rustad.

7) Dan Carperter reported possible integer overflows in ipset, from
   Jozsef Kadlecsick.

8) Filter out accounting objects in nfacct by type, so you can
   selectively reset quotas, from Alexey Perevalov.

9) Move specific NAT IPv4 functions to the core so x_tables and
   nf_tables can share the same NAT IPv4 engine.

10) Use the new NAT IPv4 functions from nft_chain_nat_ipv4.

11) Move specific NAT IPv6 functions to the core so x_tables and
    nf_tables can share the same NAT IPv4 engine.

12) Use the new NAT IPv6 functions from nft_chain_nat_ipv6.

13) Refactor code to add nft_delrule(), which can be reused in the
    enhancement of the NFT_MSG_DELTABLE to remove a table and its
    content, from Arturo Borrero.

14) Add a helper function to unregister chain hooks, from
    Arturo Borrero.

15) A cleanup to rename to nft_delrule_by_chain for consistency with
    the new nft_*() functions, also from Arturo.

16) Add support to match devgroup to the meta expression, from Ana Rey.

17) Reduce stack usage for IPVS socket option, from Julian Anastasov.

18) Remove unnecessary textsearch state initialization in xt_string,
    from Bojan Prtvar.

19) Add several helper functions to nf_tables, more work to prepare
    the enhancement of NFT_MSG_DELTABLE, again from Arturo Borrero.

20) Enhance NFT_MSG_DELTABLE to delete a table and its content, from
    Arturo Borrero.

21) Support NAT flags in the nat expression to indicate the flavour,
    eg. random fully, from Arturo.

22) Add missing audit code to ebtables when replacing tables, from
    Nicolas Dichtel.

23) Generalize the IPv4 masquerading code to allow its re-use from
    nf_tables, from Arturo.

24) Generalize the IPv6 masquerading code, also from Arturo.

25) Add the new masq expression to support IPv4/IPv6 masquerading
    from nf_tables, also from Arturo.
====================

Signed-off-by: David S. Miller <[email protected]>
1  2 
net/ipv4/netfilter/Kconfig
net/ipv4/netfilter/Makefile
net/ipv6/netfilter/Kconfig
net/ipv6/netfilter/Makefile
net/netfilter/Kconfig
net/netfilter/Makefile
net/netfilter/ipset/ip_set_hash_gen.h

index 7cbcaf4f0194f22b797f04b1fca1029a0a4e159e,8dd3d9f19d82de36f3125ce8910a09ae34772c02..d189c5262bdbd3f44d77ca8cbba149ecdb8c809d
@@@ -82,52 -82,6 +82,52 @@@ config NF_TABLES_AR
        help
          This option enables the ARP support for nf_tables.
  
 +config NF_NAT_IPV4
 +      tristate "IPv4 NAT"
 +      depends on NF_CONNTRACK_IPV4
 +      default m if NETFILTER_ADVANCED=n
 +      select NF_NAT
 +      help
 +        The IPv4 NAT option allows masquerading, port forwarding and other
 +        forms of full Network Address Port Translation. This can be
 +        controlled by iptables or nft.
 +
 +if NF_NAT_IPV4
 +
 +config NF_NAT_SNMP_BASIC
 +      tristate "Basic SNMP-ALG support"
 +      depends on NF_CONNTRACK_SNMP
 +      depends on NETFILTER_ADVANCED
 +      default NF_NAT && NF_CONNTRACK_SNMP
 +      ---help---
 +
 +        This module implements an Application Layer Gateway (ALG) for
 +        SNMP payloads.  In conjunction with NAT, it allows a network
 +        management system to access multiple private networks with
 +        conflicting addresses.  It works by modifying IP addresses
 +        inside SNMP payloads to match IP-layer NAT mapping.
 +
 +        This is the "basic" form of SNMP-ALG, as described in RFC 2962
 +
 +        To compile it as a module, choose M here.  If unsure, say N.
 +
 +config NF_NAT_PROTO_GRE
 +      tristate
 +      depends on NF_CT_PROTO_GRE
 +
 +config NF_NAT_PPTP
 +      tristate
 +      depends on NF_CONNTRACK
 +      default NF_CONNTRACK_PPTP
 +      select NF_NAT_PROTO_GRE
 +
 +config NF_NAT_H323
 +      tristate
 +      depends on NF_CONNTRACK
 +      default NF_CONNTRACK_H323
 +
 +endif # NF_NAT_IPV4
 +
  config IP_NF_IPTABLES
        tristate "IP tables support (required for filtering/masq/NAT)"
        default m if NETFILTER_ADVANCED=n
@@@ -216,24 -170,35 +216,37 @@@ config IP_NF_TARGET_SYNPROX
          To compile it as a module, choose M here. If unsure, say N.
  
  # NAT + specific targets: nf_conntrack
 -config NF_NAT_IPV4
 -      tristate "IPv4 NAT"
 +config IP_NF_NAT
 +      tristate "iptables NAT support"
        depends on NF_CONNTRACK_IPV4
        default m if NETFILTER_ADVANCED=n
        select NF_NAT
 +      select NF_NAT_IPV4
 +      select NETFILTER_XT_NAT
        help
 -        The IPv4 NAT option allows masquerading, port forwarding and other
 -        forms of full Network Address Port Translation.  It is controlled by
 -        the `nat' table in iptables: see the man page for iptables(8).
 +        This enables the `nat' table in iptables. This allows masquerading,
 +        port forwarding and other forms of full Network Address Port
 +        Translation.
  
          To compile it as a module, choose M here.  If unsure, say N.
  
 -if NF_NAT_IPV4
 +if IP_NF_NAT
  
+ config NF_NAT_MASQUERADE_IPV4
+       tristate "IPv4 masquerade support"
+       help
+       This is the kernel functionality to provide NAT in the masquerade
+       flavour (automatic source address selection).
+ config NFT_MASQ_IPV4
+       tristate "IPv4 masquerading support for nf_tables"
+       depends on NF_TABLES_IPV4
+       depends on NFT_MASQ
+       select NF_NAT_MASQUERADE_IPV4
  config IP_NF_TARGET_MASQUERADE
        tristate "MASQUERADE target support"
+       select NF_NAT_MASQUERADE_IPV4
        default m if NETFILTER_ADVANCED=n
        help
          Masquerading is a special case of NAT: all outgoing connections are
@@@ -262,7 -227,47 +275,7 @@@ config IP_NF_TARGET_REDIREC
        (e.g. when running oldconfig). It selects
        CONFIG_NETFILTER_XT_TARGET_REDIRECT.
  
 -endif
 -
 -config NF_NAT_SNMP_BASIC
 -      tristate "Basic SNMP-ALG support"
 -      depends on NF_CONNTRACK_SNMP && NF_NAT_IPV4
 -      depends on NETFILTER_ADVANCED
 -      default NF_NAT && NF_CONNTRACK_SNMP
 -      ---help---
 -
 -        This module implements an Application Layer Gateway (ALG) for
 -        SNMP payloads.  In conjunction with NAT, it allows a network
 -        management system to access multiple private networks with
 -        conflicting addresses.  It works by modifying IP addresses
 -        inside SNMP payloads to match IP-layer NAT mapping.
 -
 -        This is the "basic" form of SNMP-ALG, as described in RFC 2962
 -
 -        To compile it as a module, choose M here.  If unsure, say N.
 -
 -# If they want FTP, set to $CONFIG_IP_NF_NAT (m or y),
 -# or $CONFIG_IP_NF_FTP (m or y), whichever is weaker.
 -# From kconfig-language.txt:
 -#
 -#           <expr> '&&' <expr>                   (6)
 -#
 -# (6) Returns the result of min(/expr/, /expr/).
 -
 -config NF_NAT_PROTO_GRE
 -      tristate
 -      depends on NF_NAT_IPV4 && NF_CT_PROTO_GRE
 -
 -config NF_NAT_PPTP
 -      tristate
 -      depends on NF_CONNTRACK && NF_NAT_IPV4
 -      default NF_NAT_IPV4 && NF_CONNTRACK_PPTP
 -      select NF_NAT_PROTO_GRE
 -
 -config NF_NAT_H323
 -      tristate
 -      depends on NF_CONNTRACK && NF_NAT_IPV4
 -      default NF_NAT_IPV4 && NF_CONNTRACK_H323
 +endif # IP_NF_NAT
  
  # mangle + specific targets
  config IP_NF_MANGLE
index edf4af32e9f28fcdb3a391abbb0d651b4a16af38,7d019aefb0ed944791122d3a87d73e791ab99d86..14488cc5fd2ca21f3b3ceaa5a9f23c5cd6ed86f7
@@@ -27,6 -27,7 +27,7 @@@ obj-$(CONFIG_NF_LOG_IPV4) += nf_log_ipv
  obj-$(CONFIG_NF_NAT_H323) += nf_nat_h323.o
  obj-$(CONFIG_NF_NAT_PPTP) += nf_nat_pptp.o
  obj-$(CONFIG_NF_NAT_SNMP_BASIC) += nf_nat_snmp_basic.o
+ obj-$(CONFIG_NF_NAT_MASQUERADE_IPV4) += nf_nat_masquerade_ipv4.o
  
  # NAT protocols (nf_nat)
  obj-$(CONFIG_NF_NAT_PROTO_GRE) += nf_nat_proto_gre.o
@@@ -35,6 -36,7 +36,7 @@@ obj-$(CONFIG_NF_TABLES_IPV4) += nf_tabl
  obj-$(CONFIG_NFT_CHAIN_ROUTE_IPV4) += nft_chain_route_ipv4.o
  obj-$(CONFIG_NFT_CHAIN_NAT_IPV4) += nft_chain_nat_ipv4.o
  obj-$(CONFIG_NFT_REJECT_IPV4) += nft_reject_ipv4.o
+ obj-$(CONFIG_NFT_MASQ_IPV4) += nft_masq_ipv4.o
  obj-$(CONFIG_NF_TABLES_ARP) += nf_tables_arp.o
  
  # generic IP tables 
@@@ -43,7 -45,7 +45,7 @@@ obj-$(CONFIG_IP_NF_IPTABLES) += ip_tabl
  # the three instances of ip_tables
  obj-$(CONFIG_IP_NF_FILTER) += iptable_filter.o
  obj-$(CONFIG_IP_NF_MANGLE) += iptable_mangle.o
 -obj-$(CONFIG_NF_NAT_IPV4) += iptable_nat.o
 +obj-$(CONFIG_IP_NF_NAT) += iptable_nat.o
  obj-$(CONFIG_IP_NF_RAW) += iptable_raw.o
  obj-$(CONFIG_IP_NF_SECURITY) += iptable_security.o
  
index 2812816aabdc0a2918b183094ac4a119b4c0f1fa,24c535f66df02528a96a6db4fc2d931e82e98a37..a8f25306a46a2457d07fb9ce12a90649d9dcfec7
@@@ -57,19 -57,9 +57,19 @@@ config NFT_REJECT_IPV
  
  config NF_LOG_IPV6
        tristate "IPv6 packet logging"
 -      depends on NETFILTER_ADVANCED
 +      default m if NETFILTER_ADVANCED=n
        select NF_LOG_COMMON
  
 +config NF_NAT_IPV6
 +      tristate "IPv6 NAT"
 +      depends on NF_CONNTRACK_IPV6
 +      depends on NETFILTER_ADVANCED
 +      select NF_NAT
 +      help
 +        The IPv6 NAT option allows masquerading, port forwarding and other
 +        forms of full Network Address Port Translation. This can be
 +        controlled by iptables or nft.
 +
  config IP6_NF_IPTABLES
        tristate "IP6 tables support (required for filtering)"
        depends on INET && IPV6
@@@ -242,24 -232,35 +242,37 @@@ config IP6_NF_SECURIT
  
           If unsure, say N.
  
 -config NF_NAT_IPV6
 -      tristate "IPv6 NAT"
 +config IP6_NF_NAT
 +      tristate "ip6tables NAT support"
        depends on NF_CONNTRACK_IPV6
        depends on NETFILTER_ADVANCED
        select NF_NAT
 +      select NF_NAT_IPV6
 +      select NETFILTER_XT_NAT
        help
 -        The IPv6 NAT option allows masquerading, port forwarding and other
 -        forms of full Network Address Port Translation. It is controlled by
 -        the `nat' table in ip6tables, see the man page for ip6tables(8).
 +        This enables the `nat' table in ip6tables. This allows masquerading,
 +        port forwarding and other forms of full Network Address Port
 +        Translation.
  
          To compile it as a module, choose M here.  If unsure, say N.
  
 -if NF_NAT_IPV6
 +if IP6_NF_NAT
  
+ config NF_NAT_MASQUERADE_IPV6
+       tristate "IPv6 masquerade support"
+       help
+        This is the kernel functionality to provide NAT in the masquerade
+        flavour (automatic source address selection) for IPv6.
+ config NFT_MASQ_IPV6
+       tristate "IPv6 masquerade support for nf_tables"
+       depends on NF_TABLES_IPV6
+       depends on NFT_MASQ
+       select NF_NAT_MASQUERADE_IPV6
  config IP6_NF_TARGET_MASQUERADE
        tristate "MASQUERADE target support"
+       select NF_NAT_MASQUERADE_IPV6
        help
          Masquerading is a special case of NAT: all outgoing connections are
          changed to seem to come from a particular interface's address, and
@@@ -277,7 -278,7 +290,7 @@@ config IP6_NF_TARGET_NP
  
          To compile it as a module, choose M here.  If unsure, say N.
  
 -endif # NF_NAT_IPV6
 +endif # IP6_NF_NAT
  
  endif # IP6_NF_IPTABLES
  
index c3d3286db4bb804546ee8b0488ecdad1441bb06b,482c4dff273f5f54d87edd2726957fce973b5ad1..0f7e5b3f328dd8da268d3c200e9edb53a490cf45
@@@ -8,7 -8,7 +8,7 @@@ obj-$(CONFIG_IP6_NF_FILTER) += ip6table
  obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o
  obj-$(CONFIG_IP6_NF_RAW) += ip6table_raw.o
  obj-$(CONFIG_IP6_NF_SECURITY) += ip6table_security.o
 -obj-$(CONFIG_NF_NAT_IPV6) += ip6table_nat.o
 +obj-$(CONFIG_IP6_NF_NAT) += ip6table_nat.o
  
  # objects for l3 independent conntrack
  nf_conntrack_ipv6-y  :=  nf_conntrack_l3proto_ipv6.o nf_conntrack_proto_icmpv6.o
@@@ -18,6 -18,7 +18,7 @@@ obj-$(CONFIG_NF_CONNTRACK_IPV6) += nf_c
  
  nf_nat_ipv6-y         := nf_nat_l3proto_ipv6.o nf_nat_proto_icmpv6.o
  obj-$(CONFIG_NF_NAT_IPV6) += nf_nat_ipv6.o
+ obj-$(CONFIG_NF_NAT_MASQUERADE_IPV6) += nf_nat_masquerade_ipv6.o
  
  # defrag
  nf_defrag_ipv6-y := nf_defrag_ipv6_hooks.o nf_conntrack_reasm.o
@@@ -31,6 -32,7 +32,7 @@@ obj-$(CONFIG_NF_TABLES_IPV6) += nf_tabl
  obj-$(CONFIG_NFT_CHAIN_ROUTE_IPV6) += nft_chain_route_ipv6.o
  obj-$(CONFIG_NFT_CHAIN_NAT_IPV6) += nft_chain_nat_ipv6.o
  obj-$(CONFIG_NFT_REJECT_IPV6) += nft_reject_ipv6.o
+ obj-$(CONFIG_NFT_MASQ_IPV6) += nft_masq_ipv6.o
  
  # matches
  obj-$(CONFIG_IP6_NF_MATCH_AH) += ip6t_ah.o
diff --combined net/netfilter/Kconfig
index b5c1d3aadb41569d95728d9eca5faf6831caa9dc,37428723394f65287b2668f03d7c5a3aa13023f2..608d189869236c8f22aeeb229c246de478a157d9
@@@ -496,10 -496,19 +496,19 @@@ config NFT_LIMI
          This option adds the "limit" expression that you can use to
          ratelimit rule matchings.
  
+ config NFT_MASQ
+       depends on NF_TABLES
+       depends on NF_CONNTRACK
+       depends on NF_NAT
+       tristate "Netfilter nf_tables masquerade support"
+       help
+         This option adds the "masquerade" expression that you can use
+         to perform NAT in the masquerade flavour.
  config NFT_NAT
        depends on NF_TABLES
        depends on NF_CONNTRACK
 -      depends on NF_NAT
 +      select NF_NAT
        tristate "Netfilter nf_tables nat module"
        help
          This option adds the "nat" expression that you can use to perform
@@@ -747,9 -756,7 +756,9 @@@ config NETFILTER_XT_TARGET_LE
  
  config NETFILTER_XT_TARGET_LOG
        tristate "LOG target support"
 -      depends on NF_LOG_IPV4 && NF_LOG_IPV6
 +      select NF_LOG_COMMON
 +      select NF_LOG_IPV4
 +      select NF_LOG_IPV6 if IPV6
        default m if NETFILTER_ADVANCED=n
        help
          This option adds a `LOG' target, which allows you to create rules in
@@@ -766,14 -773,6 +775,14 @@@ config NETFILTER_XT_TARGET_MAR
        (e.g. when running oldconfig). It selects
        CONFIG_NETFILTER_XT_MARK (combined mark/MARK module).
  
 +config NETFILTER_XT_NAT
 +      tristate '"SNAT and DNAT" targets support'
 +      depends on NF_NAT
 +      ---help---
 +      This option enables the SNAT and DNAT targets.
 +
 +      To compile it as a module, choose M here. If unsure, say N.
 +
  config NETFILTER_XT_TARGET_NETMAP
        tristate '"NETMAP" target support'
        depends on NF_NAT
diff --combined net/netfilter/Makefile
index fad5fdba34e5873c0535037bf709c343ebfd55e3,0637792f6faf5622e988d53f8b167d3e86c45715..a9571be3f7914cff0619cb5c7d5829f56feab35f
@@@ -87,6 -87,7 +87,7 @@@ obj-$(CONFIG_NFT_RBTREE)      += nft_rbtree.
  obj-$(CONFIG_NFT_HASH)                += nft_hash.o
  obj-$(CONFIG_NFT_COUNTER)     += nft_counter.o
  obj-$(CONFIG_NFT_LOG)         += nft_log.o
+ obj-$(CONFIG_NFT_MASQ)                += nft_masq.o
  
  # generic X tables 
  obj-$(CONFIG_NETFILTER_XTABLES) += x_tables.o xt_tcpudp.o
@@@ -95,7 -96,7 +96,7 @@@
  obj-$(CONFIG_NETFILTER_XT_MARK) += xt_mark.o
  obj-$(CONFIG_NETFILTER_XT_CONNMARK) += xt_connmark.o
  obj-$(CONFIG_NETFILTER_XT_SET) += xt_set.o
 -obj-$(CONFIG_NF_NAT) += xt_nat.o
 +obj-$(CONFIG_NETFILTER_XT_NAT) += xt_nat.o
  
  # targets
  obj-$(CONFIG_NETFILTER_XT_TARGET_AUDIT) += xt_AUDIT.o
index 80f49dfba5556a0c572035688b8cebeed1752c13,0398a92da6cca8bbece002e62293ce718841f161..8a38890cbe5eb283794b29ec629b4d94f919052e
@@@ -565,8 -565,8 +565,8 @@@ retry
                 set->name, orig->htable_bits, htable_bits, orig);
        if (!htable_bits) {
                /* In case we have plenty of memory :-) */
 -              pr_warning("Cannot increase the hashsize of set %s further\n",
 -                         set->name);
 +              pr_warn("Cannot increase the hashsize of set %s further\n",
 +                      set->name);
                return -IPSET_ERR_HASH_FULL;
        }
        t = ip_set_alloc(sizeof(*t)
@@@ -651,8 -651,8 +651,8 @@@ mtype_add(struct ip_set *set, void *val
  
        if (h->elements >= h->maxelem) {
                if (net_ratelimit())
 -                      pr_warning("Set %s is full, maxelem %u reached\n",
 -                                 set->name, h->maxelem);
 +                      pr_warn("Set %s is full, maxelem %u reached\n",
 +                              set->name, h->maxelem);
                return -IPSET_ERR_HASH_FULL;
        }
  
@@@ -998,8 -998,8 +998,8 @@@ mtype_list(const struct ip_set *set
  nla_put_failure:
        nlmsg_trim(skb, incomplete);
        if (unlikely(first == cb->args[IPSET_CB_ARG0])) {
 -              pr_warning("Can't list set %s: one bucket does not fit into "
 -                         "a message. Please report it!\n", set->name);
 +              pr_warn("Can't list set %s: one bucket does not fit into a message. Please report it!\n",
 +                      set->name);
                cb->args[IPSET_CB_ARG0] = 0;
                return -EMSGSIZE;
        }
@@@ -1093,7 -1093,7 +1093,7 @@@ IPSET_TOKEN(HTYPE, _create)(struct net 
        if (tb[IPSET_ATTR_MARKMASK]) {
                markmask = ntohl(nla_get_u32(tb[IPSET_ATTR_MARKMASK]));
  
-               if ((markmask > 4294967295u) || markmask == 0)
+               if (markmask == 0)
                        return -IPSET_ERR_INVALID_MARKMASK;
        }
  #endif
This page took 0.142917 seconds and 4 git commands to generate.