netfilter: nfnetlink_queue: get rid of nfnetlink_queue_ct.c
Subsystems (2)
Pablo Neira Ayuso
maintainerPATCH 1/2 netfilter: nfnetlink_queue: get rid of nfnetlink_queue_ct.c
The original intention was to avoid dependencies between nfnetlink_queue and conntrack without ifdef pollution. However, we can achieve this by moving the conntrack dependent code into ctnetlink and keep some glue code to access the nfq_ct indirection from nfqueue.
After this patch, the nfq_ct indirection is always compiled in the netfilter core to avoid polluting nfqueue with ifdefs. Thus, if nf_conntrack is not compiled this results in only 8-bytes of memory waste in x86_64.
This patch also adds ctnetlink_nfqueue_seqadj() to avoid that the nf_conn structure layout if exposed to nf_queue, which creates another dependency with nf_conntrack at compilation time.
---
@Ken-ichirou: Sorry, it took me a while to follow up on this. Could you rebase your patchset on top of these two new patches, please? The original patches that you sent don't apply anymore. Thanks.
include/linux/netfilter.h | 12 ++-- include/net/netfilter/nfnetlink_queue.h | 51 -------------- net/netfilter/Makefile | 1 - net/netfilter/nf_conntrack_netlink.c | 49 +++++++++++++- net/netfilter/nfnetlink_queue_core.c | 52 +++++++++++---- net/netfilter/nfnetlink_queue_ct.c | 113 -------------------------------- 6 files changed, 96 insertions(+), 182 deletions(-) delete mode 100644 include/net/netfilter/nfnetlink_queue.h delete mode 100644 net/netfilter/nfnetlink_queue_ct.c
include/linux/netfilter.h +8 -4
@@ -369,14 +369,21 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)extern void (*ip_ct_attach)(struct sk_buff *,const struct sk_buff *)__rcu ;void nf_ct_attach (struct sk_buff *,const struct sk_buff *);extern void (*nf_ct_destroy)(struct nf_conntrack *)__rcu ; +#else +static inline void nf_ct_attach (struct sk_buff *new,struct sk_buff *skb) {} +#endif struct nf_conn ;enum ip_conntrack_info ;struct nlattr ;struct nfq_ct_hook { +struct nf_conn *(*get_ct)(struct sk_buff *skb, +enum ip_conntrack_info *ctinfo);size_t (*build_size)(const struct nf_conn *ct); -int (*build)(struct sk_buff *skb,struct nf_conn *ct); +int (*build)(struct sk_buff *skb,struct nf_conn *ct, +enum ip_conntrack_info ctinfo, +u_int16_t ct_attr,u_int16_t ct_info_attr);int (*parse)(const struct nlattr *attr,struct nf_conn *ct);int (*attach_expect)(const struct nlattr *attr,struct nf_conn *ct,u32 portid,u32 report);
@@ -384,9 +391,6 @@ struct nfq_ct_hook { enum ip_conntrack_info ctinfo, s32 off); };extern struct nfq_ct_hook __rcu *nfq_ct_hook; -#else -static inline void nf_ct_attach (struct sk_buff *new,struct sk_buff *skb) {} -#endif /** * nf_skb_duplicated - TEE target has sent a packet
include/net/netfilter/nfnetlink_queue.h deleted +0 -51
51 lines not on this page · raw message
net/netfilter/Makefile +0 -1
@@ -11,7 +11,6 @@ obj-$(CONFIG_NETFILTER) = netfilter.o obj-$(CONFIG_NETFILTER_NETLINK) += nfnetlink.o obj-$(CONFIG_NETFILTER_NETLINK_ACCT) += nfnetlink_acct.o nfnetlink_queue-y := nfnetlink_queue_core.o -nfnetlink_queue-$(CONFIG_NETFILTER_NETLINK_QUEUE_CT) += nfnetlink_queue_ct.o obj-$(CONFIG_NETFILTER_NETLINK_QUEUE) += nfnetlink_queue.o obj-$(CONFIG_NETFILTER_NETLINK_LOG) += nfnetlink_log.o
net/netfilter/nf_conntrack_netlink.c +48 -1
72 lines not on this page · raw message
net/netfilter/nfnetlink_queue_core.c +40 -12
105 lines not on this page · raw message
net/netfilter/nfnetlink_queue_ct.c deleted +0 -113
113 lines not on this page · raw message
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 2/2 netfilter: rename nfnetlink_queue_core.c to nfnetlink_queue.c
Now that we have integrated the ct glue code into nfnetlink_queue without introducing dependencies with the conntrack code.
--- net/netfilter/Makefile | 1 - net/netfilter/nfnetlink_queue.c | 1443 ++++++++++++++++++++++++++++++++++ net/netfilter/nfnetlink_queue_core.c | 1443 ---------------------------------- 3 files changed, 1443 insertions(+), 1444 deletions(-) create mode 100644 net/netfilter/nfnetlink_queue.c delete mode 100644 net/netfilter/nfnetlink_queue_core.c
net/netfilter/Makefile +0 -1
@@ -10,7 +10,6 @@ obj-$(CONFIG_NETFILTER) = netfilter.o obj-$(CONFIG_NETFILTER_NETLINK) += nfnetlink.o obj-$(CONFIG_NETFILTER_NETLINK_ACCT) += nfnetlink_acct.o -nfnetlink_queue-y := nfnetlink_queue_core.o obj-$(CONFIG_NETFILTER_NETLINK_QUEUE) += nfnetlink_queue.o obj-$(CONFIG_NETFILTER_NETLINK_LOG) += nfnetlink_log.o
net/netfilter/nfnetlink_queue.c new file +1443 -0
1,443 lines not on this page · raw message
net/netfilter/nfnetlink_queue_core.c deleted +0 -1443
1,443 lines not on this page · raw message
Signature · 1 line
2.1.4
kbuild test robot
build botconfig: m68k-sun3_defconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross…
Hi Pablo,
[auto build test results on v4.3-rc3 -- if it's inappropriate base, please ignore]
config: m68k-sun3_defconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
git checkout d383b8e3373d12fd234b15f30bdd87b4d2dfc22a
# save the attached .config to linux build tree make.cross ARCH=m68k
Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
All warnings (new ones prefixed by >>):
net/netfilter/nfnetlink_queue_core.c: In function '__nfqnl_enqueue_packet.constprop':
>> net/netfilter/nfnetlink_queue_core.c:518:18: warning: 'nfq_ct' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (ct && nfq_ct->build(skb, ct, ctinfo, NFQA_CT, NFQA_CT_INFO) < 0)
^
net/netfilter/nfnetlink_queue_core.c:316:22: note: 'nfq_ct' was declared here
struct nfq_ct_hook *nfq_ct;
^vim +/nfq_ct +518 net/netfilter/nfnetlink_queue_core.c
502 struct nfqnl_msg_packet_timestamp ts;
503 struct timeval tv = ktime_to_timeval(entskb->tstamp);
504 ts.sec = cpu_to_be64(tv.tv_sec);
505 ts.usec = cpu_to_be64(tv.tv_usec);
506
507 if (nla_put(skb, NFQA_TIMESTAMP, sizeof(ts), &ts))
508 goto nla_put_failure;
509 }
510
511 if ((queue->flags & NFQA_CFG_F_UID_GID) && entskb->sk &&
512 nfqnl_put_sk_uidgid(skb, entskb->sk) < 0)
513 goto nla_put_failure;
514
515 if (seclen && nla_put(skb, NFQA_SECCTX, seclen, secdata))
516 goto nla_put_failure;
517
> 518 if (ct && nfq_ct->build(skb, ct, ctinfo, NFQA_CT, NFQA_CT_INFO) < 0)
519 goto nla_put_failure;
520
521 if (cap_len > data_len &&
522 nla_put_be32(skb, NFQA_CAP_LEN, htonl(cap_len)))
523 goto nla_put_failure;
524
525 if (nfqnl_put_packet_info(skb, entskb, csum_verify))
526 goto nla_put_failure;
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botconfig: sh-titan_defconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross…
Hi Pablo,
[auto build test results on v4.3-rc3 -- if it's inappropriate base, please ignore]
config: sh-titan_defconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
git checkout d383b8e3373d12fd234b15f30bdd87b4d2dfc22a
# save the attached .config to linux build tree make.cross ARCH=sh
All error/warnings (new ones prefixed by >>):
>> ERROR: "nfq_ct_hook" [net/netfilter/nfnetlink_queue.ko] undefined!
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botconfig: x86_64-acpi-redef (attached as .config) reproduce: git checkout d383b8e3373d12fd234b15f30bdd87b4d2dfc22a
Hi Pablo,
[auto build test results on v4.3-rc3 -- if it's inappropriate base, please ignore]
config: x86_64-acpi-redef (attached as .config) reproduce:
git checkout d383b8e3373d12fd234b15f30bdd87b4d2dfc22a
# save the attached .config to linux build tree make ARCH=x86_64
All error/warnings (new ones prefixed by >>):
net/built-in.o: In function `nfqnl_recv_verdict':
>> nfnetlink_queue_core.c:(.text+0x37389): undefined reference to `nfq_ct_hook'
net/built-in.o: In function `nfqnl_build_packet_message.isra.6':
nfnetlink_queue_core.c:(.text+0x376ac): undefined reference to `nfq_ct_hook'
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation