netfilter: merge udp and udplite helpers
Subsystems (2)
Florian Westphal
maintainercover netfilter: merge udp and udplite helpers
Most of the code is copy&paste from the udp one; most of the udp functions can be re-used for udplite.
After merge, udplite is another builtin available in the core.
before:
164288 nf_conntrack.ko
31472 nf_nat.ko
after:
165848 nf_conntrack.ko
32520 nf_nat.ko
removed:
11328 nf_conntrack_proto_udplite.ko
5480 nf_nat_proto_udplite.ko
include/net/netfilter/ipv4/nf_conntrack_ipv4.h | 1 include/net/netfilter/ipv6/nf_conntrack_ipv6.h | 1 include/net/netfilter/nf_nat_l4proto.h | 1 net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 1 net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | 1 net/netfilter/Kconfig | 15 net/netfilter/Makefile | 2 net/netfilter/nf_conntrack_proto_udp.c | 119 +++++++ net/netfilter/nf_nat_core.c | 2 net/netfilter/nf_nat_proto_udp.c | 76 +++- net/netfilter/nf_conntrack_proto_udplite.c | 385 ----------------------- net/netfilter/nf_nat_proto_udplite.c | 106 ------ 12 files changed, 191 insertions(+), 519 deletions(-)
Florian Westphal
maintainerPATCH 1/2 netfilter: conntrack: merge udp and udplite helpers
udplite was copied from udp, they are virtually 100% identical, which isn't suprising given udplite is just udp with partial checksum coverage.
This adds udplite tracker to udp instead, removes udplite module, and then makes the udplite tracker builtin.
udplite will then simply re-use udp timeout settings. It makes little sense to add separate sysctls, nowadays we have fine-grained timeout policy support via the CT target.
--- include/net/netfilter/ipv4/nf_conntrack_ipv4.h | 1 + include/net/netfilter/ipv6/nf_conntrack_ipv6.h | 1 + net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 1 + net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | 1 + net/netfilter/Kconfig | 10 - net/netfilter/Makefile | 1 - net/netfilter/nf_conntrack_proto_udp.c | 119 ++++++++ net/netfilter/nf_conntrack_proto_udplite.c | 385 ------------------------- 8 files changed, 123 insertions(+), 396 deletions(-) delete mode 100644 net/netfilter/nf_conntrack_proto_udplite.c
include/net/netfilter/ipv4/nf_conntrack_ipv4.h +1 -0
@@ -14,6 +14,7 @@ extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4;extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp4;extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4; +extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udplite4;extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp;int nf_conntrack_ipv4_compat_init (void );
include/net/netfilter/ipv6/nf_conntrack_ipv6.h +1 -0
@@ -5,6 +5,7 @@ extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6;extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp6;extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6; +extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udplite6;extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6;#include <linux/sysctl.h>
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +1 -0
@@ -339,6 +339,7 @@ MODULE_LICENSE("GPL");static struct nf_conntrack_l4proto *builtin_l4proto4[] = { &nf_conntrack_l4proto_tcp4, &nf_conntrack_l4proto_udp4, + &nf_conntrack_l4proto_udplite4, &nf_conntrack_l4proto_icmp, };
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c +1 -0
@@ -339,6 +339,7 @@ static struct nf_sockopt_ops so_getorigdst6 = {static struct nf_conntrack_l4proto *builtin_l4proto6[] = { &nf_conntrack_l4proto_tcp6, &nf_conntrack_l4proto_udp6, + &nf_conntrack_l4proto_udplite6, &nf_conntrack_l4proto_icmpv6, };
net/netfilter/Kconfig +0 -10
@@ -169,16 +169,6 @@ config NF_CT_PROTO_SCTP If you want to compile it as a module, say M here and read <file:Documentation/kbuild/modules.txt>. If unsure, say `N'. -config NF_CT_PROTO_UDPLITE - tristate 'UDP-Lite protocol connection tracking support' - depends on NETFILTER_ADVANCED - help - With this option enabled, the layer 3 independent connection - tracking code will be able to do state tracking on UDP-Lite - connections. - - To compile it as a module, choose M here. If unsure, say N. - config NF_CONNTRACK_AMANDA tristate "Amanda backup protocol support" depends on NETFILTER_ADVANCED
net/netfilter/Makefile +0 -1
@@ -20,7 +20,6 @@ obj-$(CONFIG_NF_CONNTRACK) += nf_conntrack.o obj-$(CONFIG_NF_CT_PROTO_DCCP) += nf_conntrack_proto_dccp.o obj-$(CONFIG_NF_CT_PROTO_GRE) += nf_conntrack_proto_gre.o obj-$(CONFIG_NF_CT_PROTO_SCTP) += nf_conntrack_proto_sctp.o -obj-$(CONFIG_NF_CT_PROTO_UDPLITE) += nf_conntrack_proto_udplite.o # netlink interface for nf_conntrack obj-$(CONFIG_NF_CT_NETLINK) += nf_conntrack_netlink.o
net/netfilter/nf_conntrack_proto_udp.c +119 -0
140 lines not on this page · raw message
net/netfilter/nf_conntrack_proto_udplite.c deleted +0 -385
385 lines not on this page · raw message
Signature · 1 line
2.7.3
kbuild test robot
build botRe: [PATCH nf-next 1/2] netfilter: conntrack: merge udp and udplite helpers
reproduce:
Hi Florian,
[auto build test ERROR on nf-next/master]
url: https://github.com/0day-ci/linux/commits/Florian-Westphal/netfilter-conntrack-merge-udp-and-udplite-helpers/20161203-195618 base: https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master config: x86_64-eywa-module (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=x86_64
All error/warnings (new ones prefixed by >>):
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4, from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from net/netfilter/nf_conntrack_proto_udp.c:10:
net/netfilter/nf_conntrack_proto_udp.c: In function 'udp_get_net_proto':
>> net/netfilter/nf_conntrack_proto_udp.c:308:15: error: 'CTA_TIMEOUT_UDP_MAX' undeclared (first use in this function)
BUILD_BUG_ON(CTA_TIMEOUT_UDP_MAX != CTA_TIMEOUT_UDPLITE_MAX);
^
include/linux/compiler.h:498:19: note: in definition of macro '__compiletime_assert'
bool __cond = !(condition); \
^~~~~~~~~
include/linux/compiler.h:518:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
include/linux/bug.h:54:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
include/linux/bug.h:78:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^~~~~~~~~~~~~~~~
>> net/netfilter/nf_conntrack_proto_udp.c:308:2: note: in expansion of macro 'BUILD_BUG_ON'
BUILD_BUG_ON(CTA_TIMEOUT_UDP_MAX != CTA_TIMEOUT_UDPLITE_MAX);
^~~~~~~~~~~~
net/netfilter/nf_conntrack_proto_udp.c:308:15: note: each undeclared identifier is reported only once for each function it appears in
BUILD_BUG_ON(CTA_TIMEOUT_UDP_MAX != CTA_TIMEOUT_UDPLITE_MAX);
^
include/linux/compiler.h:498:19: note: in definition of macro '__compiletime_assert'
bool __cond = !(condition); \
^~~~~~~~~
include/linux/compiler.h:518:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
include/linux/bug.h:54:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
include/linux/bug.h:78:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^~~~~~~~~~~~~~~~
>> net/netfilter/nf_conntrack_proto_udp.c:308:2: note: in expansion of macro 'BUILD_BUG_ON'
BUILD_BUG_ON(CTA_TIMEOUT_UDP_MAX != CTA_TIMEOUT_UDPLITE_MAX);
^~~~~~~~~~~~
>> net/netfilter/nf_conntrack_proto_udp.c:308:38: error: 'CTA_TIMEOUT_UDPLITE_MAX' undeclared (first use in this function)
BUILD_BUG_ON(CTA_TIMEOUT_UDP_MAX != CTA_TIMEOUT_UDPLITE_MAX);
^
include/linux/compiler.h:498:19: note: in definition of macro '__compiletime_assert'
bool __cond = !(condition); \
^~~~~~~~~
include/linux/compiler.h:518:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
include/linux/bug.h:54:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
include/linux/bug.h:78:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^~~~~~~~~~~~~~~~
>> net/netfilter/nf_conntrack_proto_udp.c:308:2: note: in expansion of macro 'BUILD_BUG_ON'
BUILD_BUG_ON(CTA_TIMEOUT_UDP_MAX != CTA_TIMEOUT_UDPLITE_MAX);
^~~~~~~~~~~~vim +/CTA_TIMEOUT_UDP_MAX +308 net/netfilter/nf_conntrack_proto_udp.c
302
303 return udp_kmemdup_sysctl_table(pn, un);
304 }
305
306 static struct nf_proto_net *udp_get_net_proto(struct net *net)
307 {
> 308 BUILD_BUG_ON(CTA_TIMEOUT_UDP_MAX != CTA_TIMEOUT_UDPLITE_MAX);
309
310 return &net->ct.nf_ct_proto.udp.pn;
311 }
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Florian Westphal
maintainerRe: [PATCH nf-next 1/2] netfilter: conntrack: merge udp and udplite helpers
Quoted 11 lines · kbuild test robot
All error/warnings (new ones prefixed by >>):
In file included from
include/uapi/linux/stddef.h:1:0,
frominclude/linux/stddef.h:4,
frominclude/uapi/linux/posix_types.h:4, frominclude/uapi/linux/types.h:13,
frominclude/linux/types.h:5,
fromnet/netfilter/nf_conntrack_proto_udp.c:10:
net/netfilter/nf_conntrack_proto_udp.c: In function 'udp_get_net_proto':Quoted 1 line
Quoted 1 line
net/netfilter/nf_conntrack_proto_udp.c:308:15: error: 'CTA_TIMEOUT_UDP_MAX' undeclared (first use in this function)BUILD_BUG_ON(CTA_TIMEOUT_UDP_MAX != CTA_TIMEOUT_UDPLITE_MAX);
Yay for conditional includes :-/
Pablo, I just saw there are still patches from Davide in your queue so I will not resend this (it will surely conflict).
Pablo Neira Ayuso
maintainerRe: [PATCH nf-next 1/2] netfilter: conntrack: merge udp and udplite helpers
Quoted 10 lines · Florian Westphal
Quoted 9 lines · kbuild test robot
All error/warnings (new ones prefixed by >>):
In file included from
include/uapi/linux/stddef.h:1:0,
frominclude/linux/stddef.h:4,
frominclude/uapi/linux/posix_types.h:4, frominclude/uapi/linux/types.h:13,
frominclude/linux/types.h:5,
fromnet/netfilter/nf_conntrack_proto_udp.c:10:
net/netfilter/nf_conntrack_proto_udp.c: In function 'udp_get_net_proto':
Quoted 7 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
net/netfilter/nf_conntrack_proto_udp.c:308:15: error: 'CTA_TIMEOUT_UDP_MAX' undeclared (first use in this function)BUILD_BUG_ON(CTA_TIMEOUT_UDP_MAX != CTA_TIMEOUT_UDPLITE_MAX);Yay for conditional includes :-/
Pablo, I just saw there are still patches from Davide in your queue so I will not resend this (it will surely conflict).
They are now there. Please rebase and resubmit. Thanks for working on this merging.
Pablo Neira Ayuso
maintainerRe: [PATCH nf-next 1/2] netfilter: conntrack: merge udp and udplite helpers
In reply to Florian WestphalOn Fri, Dec 02, 2016 at 07:50:36PM +0100, Florian Westphal wrote:
[...]
Quoted 8 lines
net/netfilter/Kconfig +0
-0@@ -169,16 +169,6 @@ config NF_CT_PROTO_SCTP If you want to compile it as a module, say M here and read <file:Documentation/kbuild/modules.txt>. If unsure, say `N'.
net/netfilter/Kconfig config NF_CT_PROTO_SCTP · line 181
Quoted 10 lines
net/netfilter/Kconfig +0
-10-config NF_CT_PROTO_UDPLITE - tristate 'UDP-Lite protocol connection tracking support' - depends on NETFILTER_ADVANCED - help - With this option enabled, the layer 3 independent connection - tracking code will be able to do state tracking on UDP-Lite - connections. - - To compile it as a module, choose M here. If unsure, say N. -
Better keep this so someone explicitly willing to keep this out for some reason can still do it, and we keep this inlined with other protocols.
Florian Westphal
maintainerPATCH 2/2 netfilter: nat: merge udp and udplite helpers
In reply to Florian Westphaludplite nat was copied from udp, they are virtually 100% identical, which isn't suprising given udplite is just udp with partial checksum coverage.
--- include/net/netfilter/nf_nat_l4proto.h | 1 + net/netfilter/Kconfig | 5 -- net/netfilter/Makefile | 1 - net/netfilter/nf_nat_core.c | 2 + net/netfilter/nf_nat_proto_udp.c | 76 +++++++++++++++++++---- net/netfilter/nf_nat_proto_udplite.c | 106 --------------------------------- 6 files changed, 68 insertions(+), 123 deletions(-) delete mode 100644 net/netfilter/nf_nat_proto_udplite.c
include/net/netfilter/nf_nat_l4proto.h +1 -0
@@ -51,6 +51,7 @@ const struct nf_nat_l4proto *__nf_nat_l4proto_find(u8 l3proto, u8 l4proto);/* Built-in protocols. */ extern const struct nf_nat_l4proto nf_nat_l4proto_tcp;extern const struct nf_nat_l4proto nf_nat_l4proto_udp; +extern const struct nf_nat_l4proto nf_nat_l4proto_udplite;extern const struct nf_nat_l4proto nf_nat_l4proto_icmp;extern const struct nf_nat_l4proto nf_nat_l4proto_icmpv6;extern const struct nf_nat_l4proto nf_nat_l4proto_unknown;
net/netfilter/Kconfig +0 -5
@@ -378,11 +378,6 @@ config NF_NAT_PROTO_DCCP depends on NF_NAT && NF_CT_PROTO_DCCP default NF_NAT && NF_CT_PROTO_DCCP -config NF_NAT_PROTO_UDPLITE - tristate - depends on NF_NAT && NF_CT_PROTO_UDPLITE - default NF_NAT && NF_CT_PROTO_UDPLITE - config NF_NAT_PROTO_SCTP tristate default NF_NAT && NF_CT_PROTO_SCTP
net/netfilter/Makefile +0 -1
@@ -55,7 +55,6 @@ obj-$(CONFIG_NF_NAT_REDIRECT) += nf_nat_redirect.o # NAT protocols (nf_nat) obj-$(CONFIG_NF_NAT_PROTO_DCCP) += nf_nat_proto_dccp.o -obj-$(CONFIG_NF_NAT_PROTO_UDPLITE) += nf_nat_proto_udplite.o obj-$(CONFIG_NF_NAT_PROTO_SCTP) += nf_nat_proto_sctp.o # NAT helpers
net/netfilter/nf_nat_core.c +2 -0
@@ -671,6 +671,8 @@ int nf_nat_l3proto_register(const struct nf_nat_l3proto *l3proto) &nf_nat_l4proto_tcp);RCU_INIT_POINTER (nf_nat_l4protos[l3proto->l3proto][IPPROTO_UDP ], &nf_nat_l4proto_udp); +RCU_INIT_POINTER (nf_nat_l4protos[l3proto->l3proto][IPPROTO_UDPLITE ], + &nf_nat_l4proto_udplite);mutex_unlock (&nf_nat_proto_mutex);RCU_INIT_POINTER (nf_nat_l3protos[l3proto->l3proto], l3proto);
net/netfilter/nf_nat_proto_udp.c +65 -11
104 lines not on this page · raw message
net/netfilter/nf_nat_proto_udplite.c deleted +0 -106
106 lines not on this page · raw message
Signature · 1 line
2.7.3