Netfilter/IPVS updates for net-next
Subsystems (8)
Pablo Neira Ayuso
maintainercover Netfilter/IPVS updates for net-next
Hi David,
The following patchset contains Netfilter/IPVS updates for your net-next tree. Most relevantly, updates for the nfnetlink_log to integrate with conntrack, fixes for cttimeout and improvements for nf_queue core, they are:
1) Remove useless ifdef around static inline function in IPVS, from Eric W. Biederman.
2) Simplify the conntrack support for nfnetlink_queue: Merge nfnetlink_queue_ct.c file into nfnetlink_queue_core.c, then rename it back to nfnetlink_queue.c
3) Use y2038 safe timestamp from nfnetlink_queue.
4) Get rid of dead function definition in nf_conntrack, from Flavio Leitner.
5) Attach conntrack support for nfnetlink_log.c, from Ken-ichirou MATSUZAWA. This adds a new NETFILTER_NETLINK_GLUE_CT Kconfig switch that controls enabling both nfqueue and nflog integration with conntrack. The userspace application can request this via NFULNL_CFG_F_CONNTRACK configuration flag.
6) Remove unused netns variables in IPVS, from Eric W. Biederman and Simon Horman.
7) Put back the refcount on the cttimeout object from xt_CT.
8) Fix crash on cttimeout policy object removal. We have to flush out the cttimeout extension area of the conntrack not to refer to an unexisting object that was just removed.
9) Make sure rcu_callback completion before removing nfnetlink_cttimeout module removal.
10) Fix compilation warning in br_netfilter when no nf_defrag_ipv4 and nf_defrag_ipv6 are enabled. Patch from Arnd Bergmann.
11) Autoload ctnetlink dependencies when NFULNL_CFG_F_CONNTRACK is requested. Again from Ken-ichirou MATSUZAWA.
12) Don't use pointer to previous hook when reinjecting traffic via nf_queue with NF_REPEAT verdict since it may be already gone. This also avoids a deadloop if the userspace application keeps returning NF_REPEAT.
13) A bunch of cleanups for netfilter IPv4 and IPv6 code from Ian Morris.
14) Consolidate logger instance existence check in nfulnl_recv_config().
15) Fix broken atomicity when applying configuration updates to logger instances in nfnetlink_log.
16) Get rid of the .owner attribute in our hook object. We don't need this anymore since we're dropping pending packets that have escaped from the kernel when unremoving the hook. Patch from Florian Westphal.
17) Remove unnecessary rcu_read_lock() from nf_reinject code, we always assume RCU read side lock from .call_rcu in nfnetlink. Also from Florian.
18) Use static inline function instead of macros to define NF_HOOK() and NF_HOOK_COND() when no netfilter support in on, from Arnd Bergmann.
You can pull these changes from:
git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git
Thanks!
----------------------------------------------------------------
The following changes since commit e96f78ab2703f3b0d512f6b469bc685d2ef20475:
tcp/dccp: add SLAB_DESTROY_BY_RCU flag for request sockets (2015-10-03 13:25:20 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git HEAD
for you to fetch changes up to c8d71d08aa23679f56e7072358383442c6ede352:
netfilter: ipv4: whitespace around operators (2015-10-16 19:19:23 +0200)
----------------------------------------------------------------
Arnd Bergmann (2):
netfilter: bridge: avoid unused label warning
netfilter: turn NF_HOOK into an inline function
David Ahern (1):
ipvs: Remove possibly unused variable from ip_vs_out
Eric W. Biederman (1):
ipvs: Don't protect ip_vs_addr_is_unicast with CONFIG_SYSCTL
Flavio Leitner (1):
netfilter: remove dead code
Florian Westphal (4):
netfilter: nfqueue: don't use prev pointer
netfilter: remove hook owner refcounting
netfilter: make nf_queue_entry_get_refs return void
netfilter: nf_queue: remove rcu_read_lock calls
Ian Morris (12):
netfilter: ip6_tables: label placement
netfilter: ip6_tables: function definition layout
netfilter: ipv6: code indentation
netfilter: ipv6: whitespace around operators
netfilter: ip6_tables: ternary operator layout
netfilter: ip6_tables: improve if statements
netfilter: ipv6: pointer cast layout
netfilter: ipv4: label placement
netfilter: ipv4: ternary operator layout
netfilter: ipv4: function definition layout
netfilter: ipv4: code indentation
netfilter: ipv4: whitespace around operators
Ken-ichirou MATSUZAWA (5):
netfilter: nfnetlink_queue: rename related to nfqueue attaching conntrack info
netfilter: Kconfig rename QUEUE_CT to GLUE_CT
netfilter: ctnetlink: add const qualifier to nfnl_hook.get_ct
netfilter: nfnetlink_log: allow to attach conntrack
netfilter: nfnetlink_log: autoload nf_conntrack_netlink module NFQA_CFG_F_CONNTRACK config flag
Pablo Neira (1):
netfilter: nfnetlink_log: validate dependencies to avoid breaking atomicity
Pablo Neira Ayuso (9):
netfilter: nfnetlink_queue: get rid of nfnetlink_queue_ct.c
netfilter: rename nfnetlink_queue_core.c to nfnetlink_queue.c Merge tag 'ipvs3-for-v4.4' of https://git.kernel.org/.../horms/ipvs-next
netfilter: nfnetlink_queue: use y2038 safe timestamp
netfilter: xt_CT: don't put back reference to timeout policy object
netfilter: conntrack: fix crash on timeout object removal
nfnetlink_cttimeout: add rcu_barrier() on module removal
Merge tag 'ipvs4-for-v4.4' of https://git.kernel.org/.../horms/ipvs-next
netfilter: nfnetlink_log: consolidate check for instance in nfulnl_recv_config()
Simon Horman (1):
ipvs: Remove possibly unused variables from ip_vs_conn_net_{init,cleanup} include/linux/netfilter.h | 36 +++++--
include/net/netfilter/nf_conntrack.h | 4 -
include/net/netfilter/nf_conntrack_timeout.h | 25 +++--
include/net/netfilter/nf_queue.h | 2 +-
include/net/netfilter/nfnetlink_queue.h | 51 ----------
include/uapi/linux/netfilter/nfnetlink_log.h | 3 +
net/bridge/br_netfilter_hooks.c | 23 +----
net/bridge/netfilter/ebtable_filter.c | 3 -
net/bridge/netfilter/ebtable_nat.c | 3 -
net/decnet/dn_route.c | 2 -
net/ipv4/netfilter/arp_tables.c | 12 +--
net/ipv4/netfilter/ip_tables.c | 20 ++--
net/ipv4/netfilter/ipt_CLUSTERIP.c | 8 +-
net/ipv4/netfilter/ipt_SYNPROXY.c | 4 +-
net/ipv4/netfilter/ipt_ah.c | 2 +-
net/ipv4/netfilter/iptable_nat.c | 4 -
net/ipv4/netfilter/iptable_security.c | 2 +-
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 6 --
net/ipv4/netfilter/nf_defrag_ipv4.c | 2 -
net/ipv4/netfilter/nf_nat_snmp_basic.c | 2 +-
net/ipv6/netfilter/ip6_tables.c | 22 ++--
net/ipv6/netfilter/ip6t_SYNPROXY.c | 4 +-
net/ipv6/netfilter/ip6table_nat.c | 4 -
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | 6 --
net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 4 +-
net/ipv6/netfilter/nf_conntrack_reasm.c | 4 +-
net/ipv6/netfilter/nf_defrag_ipv6_hooks.c | 2 -
net/ipv6/netfilter/nf_reject_ipv6.c | 4 +-
net/ipv6/netfilter/nft_chain_route_ipv6.c | 6 +-
net/netfilter/Kconfig | 15 +--
net/netfilter/Makefile | 2 -
net/netfilter/core.c | 11 +-
net/netfilter/ipvs/ip_vs_conn.c | 13 +--
net/netfilter/ipvs/ip_vs_core.c | 17 +---
net/netfilter/nf_conntrack_core.c | 12 ++-
net/netfilter/nf_conntrack_netlink.c | 98 +++++++++++++-----
net/netfilter/nf_queue.c | 38 ++-----
net/netfilter/nf_tables_api.c | 1 -
net/netfilter/nfnetlink_cttimeout.c | 34 +++++++
net/netfilter/nfnetlink_log.c | 83 +++++++++------
.../{nfnetlink_queue_core.c => nfnetlink_queue.c} | 70 +++++++++----
net/netfilter/nfnetlink_queue_ct.c | 113 ---------------------
net/netfilter/x_tables.c | 1 -
net/netfilter/xt_CT.c | 7 +-
security/selinux/hooks.c | 5 -
security/smack/smack_netfilter.c | 2 -
46 files changed, 348 insertions(+), 444 deletions(-)
delete mode 100644 include/net/netfilter/nfnetlink_queue.h
rename net/netfilter/{nfnetlink_queue_core.c => nfnetlink_queue.c} (95%)
delete mode 100644 net/netfilter/nfnetlink_queue_ct.cPablo Neira Ayuso
maintainerPATCH 1/35 ipvs: Don't protect ip_vs_addr_is_unicast with CONFIG_SYSCTL
From: "Eric W. Biederman" <[email protected]>
I arranged the code so that the compiler can remove the unecessary bits in ip_vs_leave when CONFIG_SYSCTL is unset, and removed an explicit CONFIG_SYSCTL.
Unfortunately when rebasing my work on top of that of Alex Gartrell I missed the fact that the newly added function ip_vs_addr_is_unicast was surrounded by CONFIG_SYSCTL.
So remove the now unnecessary CONFIG_SYSCTL guards around ip_vs_addr_is_unicast. It is causing build failures today when CONFIG_SYSCTL is not selected and any self respecting compiler will notice that sysctl_cache_bypass is always false without CONFIG_SYSCTL and not include the logic from the function ip_vs_addr_is_unicast in the compiled code.
--- net/netfilter/ipvs/ip_vs_core.c | 2 -- 1 file changed, 2 deletions(-)
net/netfilter/ipvs/ip_vs_core.c +0 -2
@@ -547,7 +547,6 @@ ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb,return cp; } -#ifdef CONFIG_SYSCTL static inline int ip_vs_addr_is_unicast (struct net *net,int af,union nf_inet_addr *addr) {
@@ -557,7 +556,6 @@ static inline int ip_vs_addr_is_unicast(struct net *net, int af,#endif return (inet_addr_type (net, addr->ip) ==RTN_UNICAST ); } -#endif /* * Pass or drop the packet.
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 2/35 netfilter: nfnetlink_queue: get rid of nfnetlink_queue_ct.c
In reply to Pablo Neira AyusoThe 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.
--- include/linux/netfilter.h | 12 ++-- include/net/netfilter/nfnetlink_queue.h | 51 -------------- net/netfilter/Makefile | 1 - net/netfilter/core.c | 9 ++- net/netfilter/nf_conntrack_netlink.c | 52 ++++++++++++++- net/netfilter/nfnetlink_queue_core.c | 52 +++++++++++---- net/netfilter/nfnetlink_queue_ct.c | 113 -------------------------------- 7 files changed, 103 insertions(+), 187 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/core.c +6 -3
@@ -348,6 +348,12 @@ int skb_make_writable(struct sk_buff *skb, unsigned int writable_len) }EXPORT_SYMBOL (skb_make_writable); +/* This needs to be compiled in any case to avoid dependencies between the +* nfnetlink_queue code and nf_conntrack. +*/ +struct nfq_ct_hook __rcu *nfq_ct_hook__read_mostly ; +EXPORT_SYMBOL_GPL (nfq_ct_hook); +#if IS_ENABLED (CONFIG_NF_CONNTRACK )/* This does not belong here, but locally generated errors need it if connection tracking in use: without this, connection may not be in hash table, and hence
@@ -385,9 +391,6 @@ void nf_conntrack_destroy(struct nf_conntrack *nfct) }EXPORT_SYMBOL (nf_conntrack_destroy); -struct nfq_ct_hook __rcu *nfq_ct_hook__read_mostly ; -EXPORT_SYMBOL_GPL (nfq_ct_hook); -/* Built-in default zone used e.g. by modules. */ const struct nf_conntrack_zone nf_ct_zone_dflt = { .id =NF_CT_DEFAULT_ZONE_ID ,
net/netfilter/nf_conntrack_netlink.c +49 -3
75 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 3/35 netfilter: rename nfnetlink_queue_core.c to nfnetlink_queue.c
In reply to Pablo Neira AyusoNow 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_core.c => nfnetlink_queue.c} | 0
2 files changed, 1 deletion(-)
rename net/netfilter/{nfnetlink_queue_core.c => nfnetlink_queue.c} (100%)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 renamed from net/netfilter/nfnetlink_queue_core.c +0 -0
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 4/35 netfilter: nfnetlink_queue: use y2038 safe timestamp
In reply to Pablo Neira AyusoThe __build_packet_message function fills a nfulnl_msg_packet_timestamp structure that uses 64-bit seconds and is therefore y2038 safe, but it uses an intermediate 'struct timespec' which is not.
This trivially changes the code to use 'struct timespec64' instead, to correct the result on 32-bit architectures.
This is a copy and paste of Arnd's original patch for nfnetlink_log.
--- net/netfilter/nfnetlink_queue.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/netfilter/nfnetlink_queue.c +4 -3
@@ -500,9 +500,10 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,if (entskb->tstamp.tv64) {struct nfqnl_msg_packet_timestamp ts; -struct timeval tv =ktime_to_timeval (entskb->tstamp); - ts.sec =cpu_to_be64 (tv.tv_sec); - ts.usec =cpu_to_be64 (tv.tv_usec); +struct timespec64 kts =ktime_to_timespec64 (skb->tstamp); + + ts.sec =cpu_to_be64 (kts.tv_sec); + ts.usec =cpu_to_be64 (kts.tv_nsec /NSEC_PER_USEC );if (nla_put (skb,NFQA_TIMESTAMP ,sizeof (ts), &ts)) goto nla_put_failure;
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 6/35 netfilter: nfnetlink_queue: rename related to nfqueue attaching conntrack info
In reply to Pablo Neira AyusoFrom: Ken-ichirou MATSUZAWA <[email protected]>
The idea of this series of patch is to attach conntrack information to nflog like nfqueue has already done. nfqueue conntrack info attaching basis is generic, rename those names to generic one, glue.
--- include/linux/netfilter.h | 4 +-- net/netfilter/core.c | 4 +-- net/netfilter/nf_conntrack_netlink.c | 60 ++++++++++++++++++------------------ net/netfilter/nfnetlink_queue.c | 30 +++++++++--------- 4 files changed, 49 insertions(+), 49 deletions(-)
include/linux/netfilter.h +2 -2
@@ -377,7 +377,7 @@ struct nf_conn;enum ip_conntrack_info ;struct nlattr ; -struct nfq_ct_hook { +struct nfnl_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);
@@ -390,7 +390,7 @@ struct nfq_ct_hook {void (*seq_adjust)(struct sk_buff *skb,struct nf_conn *ct,enum ip_conntrack_info ctinfo,s32 off); }; -extern struct nfq_ct_hook __rcu *nfq_ct_hook; +extern struct nfnl_ct_hook __rcu *nfnl_ct_hook;/** * nf_skb_duplicated - TEE target has sent a packet
net/netfilter/core.c +2 -2
@@ -351,8 +351,8 @@ EXPORT_SYMBOL(skb_make_writable);/* This needs to be compiled in any case to avoid dependencies between the * nfnetlink_queue code and nf_conntrack. */ -struct nfq_ct_hook __rcu *nfq_ct_hook__read_mostly ; -EXPORT_SYMBOL_GPL (nfq_ct_hook); +struct nfnl_ct_hook __rcu *nfnl_ct_hook__read_mostly ; +EXPORT_SYMBOL_GPL (nfnl_ct_hook);#if IS_ENABLED (CONFIG_NF_CONNTRACK )/* This does not belong here, but locally generated errors need it if connection
net/netfilter/nf_conntrack_netlink.c +30 -30
149 lines not on this page · raw message
net/netfilter/nfnetlink_queue.c +15 -15
@@ -313,7 +313,7 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,struct net_device *outdev;struct nf_conn *ct =NULL ;enum ip_conntrack_info uninitialized_var (ctinfo ); -struct nfq_ct_hook *nfq_ct; +struct nfnl_ct_hook *nfnl_ct;bool csum_verify;char *secdata =NULL ;u32 seclen =0 ;
@@ -366,11 +366,11 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue, }if (queue->flags &NFQA_CFG_F_CONNTRACK ) { - nfq_ct =rcu_dereference (nfq_ct_hook); -if (nfq_ct !=NULL ) { - ct = nfq_ct->get_ct (entskb, &ctinfo); + nfnl_ct =rcu_dereference (nfnl_ct_hook); +if (nfnl_ct !=NULL ) { + ct = nfnl_ct->get_ct (entskb, &ctinfo);if (ct !=NULL ) - size += nfq_ct->build_size (ct); + size += nfnl_ct->build_size (ct); } }
@@ -516,7 +516,7 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,if (seclen &&nla_put (skb,NFQA_SECCTX , seclen, secdata)) goto nla_put_failure; -if (ct && nfq_ct->build (skb, ct, ctinfo,NFQA_CT ,NFQA_CT_INFO ) <0 ) +if (ct && nfnl_ct->build (skb, ct, ctinfo,NFQA_CT ,NFQA_CT_INFO ) <0 ) goto nla_put_failure; if (cap_len > data_len &&
@@ -1009,7 +1009,7 @@ nfqnl_recv_verdict_batch(struct sock *ctnl, struct sk_buff *skb,return 0 ; } -static struct nf_conn *nfqnl_ct_parse(struct nfq_ct_hook *nfq_ct, +static struct nf_conn *nfqnl_ct_parse(struct nfnl_ct_hook *nfnl_ct, const struct nlmsghdr *nlh, const struct nlattr * const nfqa[], struct nf_queue_entry *entry,
@@ -1017,15 +1017,15 @@ static struct nf_conn *nfqnl_ct_parse(struct nfq_ct_hook *nfq_ct, {struct nf_conn *ct; - ct = nfq_ct->get_ct (entry->skb, ctinfo); + ct = nfnl_ct->get_ct (entry->skb, ctinfo);if (ct ==NULL )return NULL ; -if (nfq_ct->parse (nfqa[NFQA_CT ], ct) <0 ) +if (nfnl_ct->parse (nfqa[NFQA_CT ], ct) <0 )return NULL ;if (nfqa[NFQA_EXP ]) - nfq_ct->attach_expect (nfqa[NFQA_EXP ], ct, + nfnl_ct->attach_expect (nfqa[NFQA_EXP ], ct,NETLINK_CB (entry->skb).portid,nlmsg_report (nlh));return ct;
@@ -1044,7 +1044,7 @@ nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb,unsigned int verdict;struct nf_queue_entry *entry;enum ip_conntrack_info uninitialized_var (ctinfo ); -struct nfq_ct_hook *nfq_ct; +struct nfnl_ct_hook *nfnl_ct;struct nf_conn *ct =NULL ;struct net *net =sock_net (ctnl);
@@ -1069,9 +1069,9 @@ nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb,if (nfqa[NFQA_CT ]) {/* rcu lock already held from nfnl->call_rcu. */ - nfq_ct =rcu_dereference (nfq_ct_hook); -if (nfq_ct !=NULL ) - ct =nfqnl_ct_parse (nfq_ct, nlh, nfqa, entry, &ctinfo); + nfnl_ct =rcu_dereference (nfnl_ct_hook); +if (nfnl_ct !=NULL ) + ct =nfqnl_ct_parse (nfnl_ct, nlh, nfqa, entry, &ctinfo); }if (nfqa[NFQA_PAYLOAD ]) {
@@ -1083,7 +1083,7 @@ nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb, verdict =NF_DROP ;if (ct && diff) - nfq_ct->seq_adjust (entry->skb, ct, ctinfo, diff); + nfnl_ct->seq_adjust (entry->skb, ct, ctinfo, diff); }if (nfqa[NFQA_MARK ])
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 7/35 netfilter: Kconfig rename QUEUE_CT to GLUE_CT
In reply to Pablo Neira AyusoFrom: Ken-ichirou MATSUZAWA <[email protected]>
Conntrack information attaching infrastructure is now generic and update it's name to use `glue' in previous patch. This patch updates Kconfig symbol name and adding NF_CT_NETLINK dependency.
--- net/netfilter/Kconfig | 10 +++++----- net/netfilter/nf_conntrack_netlink.c | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-)
net/netfilter/Kconfig +5 -5
@@ -354,7 +354,7 @@ config NF_CT_NETLINK_HELPER select NETFILTER_NETLINK depends on NF_CT_NETLINK depends on NETFILTER_NETLINK_QUEUE - depends on NETFILTER_NETLINK_QUEUE_CT + depends on NETFILTER_NETLINK_GLUE_CT depends on NETFILTER_ADVANCED help This option enables the user-space connection tracking helpers
@@ -362,10 +362,10 @@ config NF_CT_NETLINK_HELPER If unsure, say `N'. -config NETFILTER_NETLINK_QUEUE_CT - bool "NFQUEUE integration with Connection Tracking" - default n - depends on NETFILTER_NETLINK_QUEUE +config NETFILTER_NETLINK_GLUE_CT + bool "NFQUEUE integration with Connection Tracking" + default n + depends on NETFILTER_NETLINK_QUEUE && NF_CT_NETLINK help If this option is enabled, NFQUEUE can include Connection Tracking information together with the packet is the enqueued via NFNETLINK.
net/netfilter/nf_conntrack_netlink.c +4 -4
@@ -2133,7 +2133,7 @@ ctnetlink_alloc_expect(const struct nlattr *const cda[], struct nf_conn *ct,struct nf_conntrack_tuple *tuple, struct nf_conntrack_tuple *mask); -#ifdef CONFIG_NETFILTER_NETLINK_QUEUE_CT +#ifdef CONFIG_NETFILTER_NETLINK_GLUE_CT static size_t ctnetlink_glue_build_size (const struct nf_conn *ct) {
@@ -2403,7 +2403,7 @@ static struct nfnl_ct_hook ctnetlink_glue_hook = { .attach_expect = ctnetlink_glue_attach_expect, .seq_adjust = ctnetlink_glue_seqadj, }; -#endif /* CONFIG_NETFILTER_NETLINK_QUEUE_CT */ +#endif /* CONFIG_NETFILTER_NETLINK_GLUE_CT */ /*********************************************************************** * EXPECT
@@ -3387,7 +3387,7 @@ static int __init ctnetlink_init(void)pr_err ("ctnetlink_init: cannot register pernet operations\n" ); goto err_unreg_exp_subsys; } -#ifdef CONFIG_NETFILTER_NETLINK_QUEUE_CT +#ifdef CONFIG_NETFILTER_NETLINK_GLUE_CT /* setup interaction between nf_queue and nf_conntrack_netlink. */ RCU_INIT_POINTER (nfnl_ct_hook, &ctnetlink_glue_hook);#endif
@@ -3408,7 +3408,7 @@ static void __exit ctnetlink_exit(void)unregister_pernet_subsys (&ctnetlink_net_ops);nfnetlink_subsys_unregister (&ctnl_exp_subsys);nfnetlink_subsys_unregister (&ctnl_subsys); -#ifdef CONFIG_NETFILTER_NETLINK_QUEUE_CT +#ifdef CONFIG_NETFILTER_NETLINK_GLUE_CT RCU_INIT_POINTER (nfnl_ct_hook,NULL );#endif }
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 5/35 netfilter: remove dead code
In reply to Pablo Neira AyusoFrom: Flavio Leitner <[email protected]>
Remove __nf_conntrack_find() from headers.
--- include/net/netfilter/nf_conntrack.h | 4 ---- 1 file changed, 4 deletions(-)
include/net/netfilter/nf_conntrack.h +0 -4
@@ -183,10 +183,6 @@ void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls);void nf_ct_free_hashtable (void *hash,unsigned int size); -struct nf_conntrack_tuple_hash * -__nf_conntrack_find (struct net *net,u16 zone, -const struct nf_conntrack_tuple *tuple); -int nf_conntrack_hash_check_insert (struct nf_conn *ct);bool nf_ct_delete (struct nf_conn *ct,u32 pid,int report);
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 8/35 netfilter: ctnetlink: add const qualifier to nfnl_hook.get_ct
In reply to Pablo Neira AyusoFrom: Ken-ichirou MATSUZAWA <[email protected]>
get_ct as is and will not update its skb argument, and users of nfnl_ct_hook is currently only nfqueue, we can add const qualifier.
--- include/linux/netfilter.h | 2 +- net/netfilter/nf_conntrack_netlink.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/linux/netfilter.h +1 -1
@@ -378,7 +378,7 @@ enum ip_conntrack_info;struct nlattr ;struct nfnl_ct_hook { -struct nf_conn *(*get_ct)(struct sk_buff *skb, +struct nf_conn *(*get_ct)(const 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,
net/netfilter/nf_conntrack_netlink.c +1 -1
@@ -2162,7 +2162,7 @@ ctnetlink_glue_build_size(const struct nf_conn *ct) ; } -static struct nf_conn *ctnetlink_glue_get_ct (struct sk_buff *skb, +static struct nf_conn *ctnetlink_glue_get_ct (const struct sk_buff *skb,enum ip_conntrack_info *ctinfo) {struct nf_conn *ct;
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 9/35 netfilter: nfnetlink_log: allow to attach conntrack
In reply to Pablo Neira AyusoFrom: Ken-ichirou MATSUZAWA <[email protected]>
This patch enables to include the conntrack information together with the packet that is sent to user-space via NFLOG, then a user-space program can acquire NATed information by this NFULA_CT attribute.
Including the conntrack information is optional, you can set it via NFULNL_CFG_F_CONNTRACK flag with the NFULA_CFG_FLAGS attribute like NFQUEUE.
--- include/uapi/linux/netfilter/nfnetlink_log.h | 3 +++ net/netfilter/Kconfig | 9 ++++--- net/netfilter/nfnetlink_log.c | 37 ++++++++++++++++++++++++---- 3 files changed, 40 insertions(+), 9 deletions(-)
include/uapi/linux/netfilter/nfnetlink_log.h +3 -0
@@ -51,6 +51,8 @@ enum nfulnl_attr_type {NFULA_HWTYPE ,/* hardware type */ NFULA_HWHEADER ,/* hardware header */ NFULA_HWLEN ,/* hardware header length */ +NFULA_CT ,/* nf_conntrack_netlink.h */ +NFULA_CT_INFO ,/* enum ip_conntrack_info */ __NFULA_MAX };
@@ -93,5 +95,6 @@ enum nfulnl_attr_config {#define NFULNL_CFG_F_SEQ 0x0001#define NFULNL_CFG_F_SEQ_GLOBAL 0x0002 +#define NFULNL_CFG_F_CONNTRACK 0x0004#endif /* _NFNETLINK_LOG_H */
net/netfilter/Kconfig +5 -4
@@ -363,12 +363,13 @@ config NF_CT_NETLINK_HELPER If unsure, say `N'. config NETFILTER_NETLINK_GLUE_CT - bool "NFQUEUE integration with Connection Tracking" + bool "NFQUEUE and NFLOG integration with Connection Tracking" default n - depends on NETFILTER_NETLINK_QUEUE && NF_CT_NETLINK + depends on (NETFILTER_NETLINK_QUEUE || NETFILTER_NETLINK_LOG) && NF_CT_NETLINK help - If this option is enabled, NFQUEUE can include Connection Tracking - information together with the packet is the enqueued via NFNETLINK. + If this option is enabled, NFQUEUE and NFLOG can include + Connection Tracking information together with the packet is + the enqueued via NFNETLINK. config NF_NAT tristate
net/netfilter/nfnetlink_log.c +32 -5
@@ -27,6 +27,7 @@#include <net/netlink.h> #include <linux/netfilter/nfnetlink.h> #include <linux/netfilter/nfnetlink_log.h> +#include <linux/netfilter/nf_conntrack_common.h> #include <linux/spinlock.h> #include <linux/sysctl.h> #include <linux/proc_fs.h>
@@ -401,7 +402,9 @@ __build_packet_message(struct nfnl_log_net *log,unsigned int hooknum, const struct net_device *indev, const struct net_device *outdev, - const char *prefix, unsigned int plen) + const char *prefix, unsigned int plen, + const struct nfnl_ct_hook *nfnl_ct, + struct nf_conn *ct, enum ip_conntrack_info ctinfo) { struct nfulnl_msg_packet_hdr pmsg;struct nlmsghdr *nlh;
@@ -575,6 +578,10 @@ __build_packet_message(struct nfnl_log_net *log, htonl(atomic_inc_return(&log->global_seq)))) goto nla_put_failure; +if (ct && nfnl_ct->build (inst->skb, ct, ctinfo, +NFULA_CT ,NFULA_CT_INFO ) <0 ) + goto nla_put_failure; +if (data_len) {struct nlattr *nla;int size =nla_attr_size (data_len);
@@ -620,12 +627,16 @@ nfulnl_log_packet(struct net *net,const struct nf_loginfo *li_user, const char *prefix) { - unsigned int size, data_len; + size_t size; +unsigned int data_len;struct nfulnl_instance *inst;const struct nf_loginfo *li;unsigned int qthreshold;unsigned int plen;struct nfnl_log_net *log =nfnl_log_pernet (net); +const struct nfnl_ct_hook *nfnl_ct =NULL ; +struct nf_conn *ct =NULL ; +enum ip_conntrack_info uninitialized_var (ctinfo );if (li_user && li_user->type ==NF_LOG_TYPE_ULOG ) li = li_user;
@@ -671,6 +682,14 @@ nfulnl_log_packet(struct net *net, size +=nla_total_size (sizeof (u_int32_t));if (inst->flags &NFULNL_CFG_F_SEQ_GLOBAL ) size +=nla_total_size (sizeof (u_int32_t)); +if (inst->flags &NFULNL_CFG_F_CONNTRACK ) { + nfnl_ct =rcu_dereference (nfnl_ct_hook); +if (nfnl_ct !=NULL ) { + ct = nfnl_ct->get_ct (skb, &ctinfo); +if (ct !=NULL ) + size += nfnl_ct->build_size (ct); + } + } qthreshold = inst->qthreshold;/* per-rule qthreshold overrides per-instance */
@@ -715,7 +734,8 @@ nfulnl_log_packet(struct net *net, inst->qlen++;__build_packet_message (log, inst, skb, data_len, pf, - hooknum, in, out, prefix, plen); + hooknum, in, out, prefix, plen, + nfnl_ct, ct, ctinfo);if (inst->qlen >= qthreshold)__nfulnl_flush (inst);
@@ -899,13 +919,20 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, }if (nfula[NFULA_CFG_FLAGS ]) { -__be16 flags =nla_get_be16 (nfula[NFULA_CFG_FLAGS ]); +u16 flags =ntohs (nla_get_be16 (nfula[NFULA_CFG_FLAGS ]));if (!inst) { ret = -ENODEV ; goto out; } -nfulnl_set_flags (inst,ntohs (flags)); + +if (flags &NFULNL_CFG_F_CONNTRACK && +rcu_access_pointer (nfnl_ct_hook) ==NULL ) { + ret = -EOPNOTSUPP ; + goto out; + } + +nfulnl_set_flags (inst, flags); } out_put:
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 10/35 ipvs: Remove possibly unused variable from ip_vs_out
In reply to Pablo Neira AyusoFrom: David Ahern <[email protected]>
Eric's net namespace changes in 1b75097dd7a26 leaves net unreferenced if CONFIG_IP_VS_IPV6 is not enabled:
../net/netfilter/ipvs/ip_vs_core.c: In function ‘ip_vs_out’:../net/netfilter/ipvs/ip_vs_core.c:1177:14: warning: unused variable ‘net’ [-Wunused-variable]
After the net refactoring there is only 1 user; push the reference to the 1 user. While the line length slightly exceeds 80 it seems to be the best change.
--- net/netfilter/ipvs/ip_vs_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/netfilter/ipvs/ip_vs_core.c +1 -2
@@ -1172,7 +1172,6 @@ drop:static unsigned int ip_vs_out (struct netns_ipvs *ipvs,unsigned int hooknum,struct sk_buff *skb,int af) { -struct net *net = ipvs->net;struct ip_vs_iphdr iph;struct ip_vs_protocol *pp;struct ip_vs_proto_data *pd;
@@ -1272,7 +1271,7 @@ ip_vs_out(struct netns_ipvs *ipvs, unsigned int hooknum, struct sk_buff *skb, in#ifdef CONFIG_IP_VS_IPV6 if (af ==AF_INET6 ) {if (!skb->dev) - skb->dev = net->loopback_dev; + skb->dev = ipvs->net->loopback_dev; icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_PORT_UNREACH,
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 11/35 ipvs: Remove possibly unused variables from ip_vs_conn_net_{init,cleanup}
In reply to Pablo Neira AyusoFrom: Simon Horman <[email protected]>
If CONFIG_PROC_FS is undefined then the arguments of proc_create() and remove_proc_entry() are unused. As a result the net variables of ip_vs_conn_net_{init,cleanup} are unused.
net/netfilter/ipvs//ip_vs_conn.c: In function ‘ip_vs_conn_net_init’:
net/netfilter/ipvs//ip_vs_conn.c:1350:14: warning: unused variable ‘net’ [-Wunused-variable] net/netfilter/ipvs//ip_vs_conn.c: In function ‘ip_vs_conn_net_cleanup’:
net/netfilter/ipvs//ip_vs_conn.c:1361:14: warning: unused variable ‘net’ [-Wunused-variable]
...
Resolve this by dereferencing net as needed rather than storing it in a variable.
--- net/netfilter/ipvs/ip_vs_conn.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
net/netfilter/ipvs/ip_vs_conn.c +5 -8
@@ -1347,23 +1347,20 @@ flush_again:*/ int __net_init ip_vs_conn_net_init (struct netns_ipvs *ipvs) { -struct net *net = ipvs->net; -atomic_set (&ipvs->conn_count,0 ); -proc_create ("ip_vs_conn" ,0 , net->proc_net, &ip_vs_conn_fops); -proc_create ("ip_vs_conn_sync" ,0 , net->proc_net, &ip_vs_conn_sync_fops); +proc_create ("ip_vs_conn" ,0 , ipvs->net->proc_net, &ip_vs_conn_fops); +proc_create ("ip_vs_conn_sync" ,0 , ipvs->net->proc_net, + &ip_vs_conn_sync_fops);return 0 ; } void __net_exit ip_vs_conn_net_cleanup(struct netns_ipvs *ipvs) { -struct net *net = ipvs->net; -/* flush all the connection entries first */ ip_vs_conn_flush (ipvs); -remove_proc_entry ("ip_vs_conn" , net->proc_net); -remove_proc_entry ("ip_vs_conn_sync" , net->proc_net); +remove_proc_entry ("ip_vs_conn" , ipvs->net->proc_net); +remove_proc_entry ("ip_vs_conn_sync" , ipvs->net->proc_net); }int __init ip_vs_conn_init (void )
Signature · 6 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Pablo Neira Ayuso
maintainerPATCH 12/35 netfilter: xt_CT: don't put back reference to timeout policy object
In reply to Pablo Neira AyusoOn success, this shouldn't put back the timeout policy object, otherwise we may have module refcount overflow and we allow deletion of timeout that are still in use.
--- net/netfilter/xt_CT.c | 3 +++ 1 file changed, 3 insertions(+)
net/netfilter/xt_CT.c +3 -0
@@ -171,6 +171,9 @@ xt_ct_set_timeout(struct nf_conn *ct, const struct xt_tgchk_param *par,if (timeout_ext ==NULL ) ret = -ENOMEM ; +rcu_read_unlock (); +return ret; + err_put_timeout:__xt_ct_tg_timeout_put (timeout); out:
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 13/35 netfilter: conntrack: fix crash on timeout object removal
In reply to Pablo Neira AyusoThe object and module refcounts are updated for each conntrack template, however, if we delete the iptables rules and we flush the timeout database, we may end up with invalid references to timeout object that are just gone.
Resolve this problem by setting the timeout reference to NULL when the custom timeout entry is removed from our base. This patch requires some RCU trickery to ensure safe pointer handling.
This handling is similar to what we already do with conntrack helpers, the idea is to avoid bumping the timeout object reference counter from the packet path to avoid the cost of atomic ops.
--- include/net/netfilter/nf_conntrack_timeout.h | 25 ++++++++++++++++----- net/netfilter/nf_conntrack_core.c | 12 ++++++---- net/netfilter/nfnetlink_cttimeout.c | 33 ++++++++++++++++++++++++++++ net/netfilter/xt_CT.c | 4 +++- 4 files changed, 63 insertions(+), 11 deletions(-)
include/net/netfilter/nf_conntrack_timeout.h +19 -6
@@ -20,10 +20,20 @@ struct ctnl_timeout { };struct nf_conn_timeout { -struct ctnl_timeout *timeout; +struct ctnl_timeout __rcu *timeout; }; -#define NF_CT_TIMEOUT_EXT_DATA (__t) (unsigned int *) &((__t)->timeout->data) +static inline unsigned int * +nf_ct_timeout_data (struct nf_conn_timeout *t) +{ +struct ctnl_timeout *timeout; + + timeout =rcu_dereference (t->timeout); +if (timeout ==NULL ) +return NULL ; + +return (unsigned int *)timeout->data; +}static inline struct nf_conn_timeout *nf_ct_timeout_find (const struct nf_conn *ct)
@@ -47,7 +57,7 @@ struct nf_conn_timeout *nf_ct_timeout_ext_add(struct nf_conn *ct,if (timeout_ext ==NULL )return NULL ; - timeout_ext->timeout = timeout; +rcu_assign_pointer (timeout_ext->timeout, timeout);return timeout_ext;#else
@@ -64,10 +74,13 @@ nf_ct_timeout_lookup(struct net *net, struct nf_conn *ct,unsigned int *timeouts; timeout_ext =nf_ct_timeout_find (ct); -if (timeout_ext) - timeouts =NF_CT_TIMEOUT_EXT_DATA (timeout_ext); -else +if (timeout_ext) { + timeouts =nf_ct_timeout_data (timeout_ext); +if (unlikely (!timeouts)) + timeouts = l4proto->get_timeouts (net); + }else { timeouts = l4proto->get_timeouts (net); + }return timeouts;#else
net/netfilter/nf_conntrack_core.c +8 -4
@@ -940,10 +940,13 @@ init_conntrack(struct net *net, struct nf_conn *tmpl, } timeout_ext = tmpl ?nf_ct_timeout_find (tmpl) :NULL ; -if (timeout_ext) - timeouts =NF_CT_TIMEOUT_EXT_DATA (timeout_ext); -else +if (timeout_ext) { + timeouts =nf_ct_timeout_data (timeout_ext); +if (unlikely (!timeouts)) + timeouts = l4proto->get_timeouts (net); + }else { timeouts = l4proto->get_timeouts (net); + }if (!l4proto->new (ct, skb, dataoff, timeouts)) {nf_conntrack_free (ct);
@@ -952,7 +955,8 @@ init_conntrack(struct net *net, struct nf_conn *tmpl, }if (timeout_ext) -nf_ct_timeout_ext_add (ct, timeout_ext->timeout,GFP_ATOMIC ); +nf_ct_timeout_ext_add (ct,rcu_dereference (timeout_ext->timeout), +GFP_ATOMIC );nf_ct_acct_ext_add (ct,GFP_ATOMIC );nf_ct_tstamp_ext_add (ct,GFP_ATOMIC );
net/netfilter/nfnetlink_cttimeout.c +33 -0
@@ -291,6 +291,34 @@ cttimeout_get_timeout(struct sock *ctnl, struct sk_buff *skb,return ret; } +static void untimeout (struct nf_conntrack_tuple_hash *i, +struct ctnl_timeout *timeout) +{ +struct nf_conn *ct =nf_ct_tuplehash_to_ctrack (i); +struct nf_conn_timeout *timeout_ext =nf_ct_timeout_find (ct); + +if (timeout_ext && (!timeout || timeout_ext->timeout == timeout)) +RCU_INIT_POINTER (timeout_ext->timeout,NULL ); +} + +static void ctnl_untimeout (struct ctnl_timeout *timeout) +{ +struct nf_conntrack_tuple_hash *h; +const struct hlist_nulls_node *nn; +int i; + +local_bh_disable (); +for (i =0 ; i < init_net.ct.htable_size; i++) { +spin_lock (&nf_conntrack_locks[i %CONNTRACK_LOCKS ]); +if (i < init_net.ct.htable_size) { +hlist_nulls_for_each_entry (h, nn, &init_net.ct.hash[i], hnnode) +untimeout (h, timeout); + } +spin_unlock (&nf_conntrack_locks[i %CONNTRACK_LOCKS ]); + } +local_bh_enable (); +} +/* try to delete object, fail if it is still in use. */ static int ctnl_timeout_try_del (struct ctnl_timeout *timeout) {
@@ -301,6 +329,7 @@ static int ctnl_timeout_try_del(struct ctnl_timeout *timeout)/* We are protected by nfnl mutex. */ list_del_rcu (&timeout->head);nf_ct_l4proto_put (timeout->l4proto); +ctnl_untimeout (timeout);kfree_rcu (timeout, rcu_head); }else {/* still in use, restore reference counter. */
@@ -567,6 +596,10 @@ static void __exit cttimeout_exit(void)pr_info ("cttimeout: unregistering from nfnetlink.\n" );nfnetlink_subsys_unregister (&cttimeout_subsys); + +/* Make sure no conntrack objects refer to custom timeouts anymore. */ +ctnl_untimeout (NULL ); +list_for_each_entry_safe (cur, tmp, &cttimeout_list, head) {list_del_rcu (&cur->head);/* We are sure that our objects have no clients at this point,
net/netfilter/xt_CT.c +3 -1
@@ -321,8 +321,10 @@ static void xt_ct_destroy_timeout(struct nf_conn *ct)if (timeout_put) { timeout_ext =nf_ct_timeout_find (ct); -if (timeout_ext) +if (timeout_ext) {timeout_put (timeout_ext->timeout); +RCU_INIT_POINTER (timeout_ext->timeout,NULL ); + } }rcu_read_unlock ();#endif
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 14/35 nfnetlink_cttimeout: add rcu_barrier() on module removal
In reply to Pablo Neira AyusoMake sure kfree_rcu() released objects before leaving the module removal exit path.
--- net/netfilter/nfnetlink_cttimeout.c | 1 + 1 file changed, 1 insertion(+)
net/netfilter/nfnetlink_cttimeout.c +1 -0
@@ -612,6 +612,7 @@ static void __exit cttimeout_exit(void)RCU_INIT_POINTER (nf_ct_timeout_find_get_hook,NULL );RCU_INIT_POINTER (nf_ct_timeout_put_hook,NULL );#endif /* CONFIG_NF_CONNTRACK_TIMEOUT */ +rcu_barrier (); }module_init (cttimeout_init);
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 15/35 netfilter: bridge: avoid unused label warning
In reply to Pablo Neira AyusoFrom: Arnd Bergmann <[email protected]>
With the ARM mini2440_defconfig, the bridge netfilter code gets built with both CONFIG_NF_DEFRAG_IPV4 and CONFIG_NF_DEFRAG_IPV6 disabled, which leads to a harmless gcc warning:
net/bridge/br_netfilter_hooks.c: In function 'br_nf_dev_queue_xmit':net/bridge/br_netfilter_hooks.c:792:2: warning: label 'drop' defined but not used [-Wunused-label]
This gets rid of the warning by cleaning up the code to avoid the respective #ifdefs causing this problem, and replacing them with if(IS_ENABLED()) checks. I have verified that the resulting object code is unchanged, and an additional advantage is that we now get compile coverage of the unused functions in more configurations.
--- net/bridge/br_netfilter_hooks.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
net/bridge/br_netfilter_hooks.c +4 -12
@@ -111,7 +111,6 @@ static inline __be16 pppoe_proto(const struct sk_buff *skb)/* largest possible L2 header, see br_nf_dev_queue_xmit() */ #define NF_BRIDGE_MAX_MAC_HEADER_LENGTH (PPPOE_SES_HLEN + ETH_HLEN) -#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV4) || IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)struct brnf_frag_data {char mac[NF_BRIDGE_MAX_MAC_HEADER_LENGTH ];u8 encap_size;
@@ -121,7 +120,6 @@ struct brnf_frag_data { }; static DEFINE_PER_CPU(struct brnf_frag_data, brnf_frag_data_storage); -#endif static void nf_bridge_info_free (struct sk_buff *skb) {
@@ -666,7 +664,6 @@ static unsigned int br_nf_forward_arp(void *priv,return NF_STOLEN ; } -#if IS_ENABLED (CONFIG_NF_DEFRAG_IPV4 ) ||IS_ENABLED (CONFIG_NF_DEFRAG_IPV6 )static int br_nf_push_frag_xmit (struct net *net,struct sock *sk,struct sk_buff *skb) {struct brnf_frag_data *data;
@@ -696,9 +693,7 @@ static int br_nf_push_frag_xmit_sk(struct sock *sk, struct sk_buff *skb)struct net *net =dev_net (skb_dst (skb)->dev);return br_nf_push_frag_xmit (net, sk, skb); } -#endif -#if IS_ENABLED (CONFIG_NF_DEFRAG_IPV4 )static int br_nf_ip_fragment (struct net *net,struct sock *sk,struct sk_buff *skb,int (*output)(struct sock *,struct sk_buff *))
@@ -716,7 +711,6 @@ br_nf_ip_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,return ip_do_fragment (sk, skb, output); } -#endif static unsigned int nf_bridge_mtu_reduction (const struct sk_buff *skb) {
@@ -739,11 +733,11 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff nf_bridge =nf_bridge_info_get (skb); -#if IS_ENABLED (CONFIG_NF_DEFRAG_IPV4 )/* This is wrong! We should preserve the original fragment * boundaries by preserving frag_list rather than refragmenting. */ -if (skb->protocol ==htons (ETH_P_IP )) { +if (IS_ENABLED (CONFIG_NF_DEFRAG_IPV4 ) && + skb->protocol ==htons (ETH_P_IP )) {struct brnf_frag_data *data;if (br_validate_ipv4 (net, skb))
@@ -765,9 +759,8 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buffreturn br_nf_ip_fragment (net, sk, skb, br_nf_push_frag_xmit_sk); } -#endif -#if IS_ENABLED (CONFIG_NF_DEFRAG_IPV6 ) -if (skb->protocol ==htons (ETH_P_IPV6 )) { +if (IS_ENABLED (CONFIG_NF_DEFRAG_IPV6 ) && + skb->protocol ==htons (ETH_P_IPV6 )) {const struct nf_ipv6_ops *v6ops =nf_get_ipv6_ops ();struct brnf_frag_data *data;
@@ -791,7 +784,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buffkfree_skb (skb);return -EMSGSIZE ; } -#endif nf_bridge_info_free (skb);return br_dev_queue_push_xmit (net, sk, skb); drop:
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 16/35 netfilter: nfnetlink_log: autoload nf_conntrack_netlink module NFQA_CFG_F_CONNTRACK config flag
In reply to Pablo Neira AyusoFrom: Ken-ichirou MATSUZAWA <[email protected]>
This patch enables to load nf_conntrack_netlink module if NFULNL_CFG_F_CONNTRACK config flag is specified.
--- net/netfilter/nfnetlink_log.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
net/netfilter/nfnetlink_log.c +10 -1
@@ -927,7 +927,16 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, }if (flags &NFULNL_CFG_F_CONNTRACK && -rcu_access_pointer (nfnl_ct_hook) ==NULL ) { + !rcu_access_pointer (nfnl_ct_hook)) { +#ifdef CONFIG_MODULES +nfnl_unlock (NFNL_SUBSYS_ULOG ); +request_module ("ip_conntrack_netlink" ); +nfnl_lock (NFNL_SUBSYS_ULOG ); +if (rcu_access_pointer (nfnl_ct_hook)) { + ret = -EAGAIN ; + goto out; + } +#endif ret = -EOPNOTSUPP ; goto out; }
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 17/35 netfilter: nfqueue: don't use prev pointer
In reply to Pablo Neira AyusoFrom: Florian Westphal <[email protected]>
Usage of -prev seems buggy. While packet was out our hook cannot be removed but we have no way to know if the previous one is still valid.
So better not use ->prev at all. Since NF_REPEAT just asks to invoke same hook function again, just do so, and continue with nf_interate if we get an ACCEPT verdict.
A side effect of this change is that if nf_reinject(NF_REPEAT) causes another REPEAT we will now drop the skb instead of a kernel loop.
However, NF_REPEAT loops would be a bug so this should not happen anyway.
--- net/netfilter/nf_queue.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
net/netfilter/nf_queue.c +2 -4
@@ -192,10 +192,8 @@ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict)nf_queue_entry_release_refs (entry);/* Continue traversal iff userspace said ok... */ -if (verdict ==NF_REPEAT ) { - elem = list_entry(elem->list.prev, struct nf_hook_ops, list); - verdict =NF_ACCEPT ; - } +if (verdict ==NF_REPEAT ) + verdict = elem->hook (elem->priv, skb, &entry->state);if (verdict ==NF_ACCEPT ) { afinfo =nf_get_afinfo (entry->state.pf);
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 18/35 netfilter: ip6_tables: label placement
In reply to Pablo Neira AyusoFrom: Ian Morris <[email protected]>
Whitespace cleansing: Labels should not be indented.
No changes detected by objdiff.
--- net/ipv6/netfilter/ip6_tables.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/netfilter/ip6_tables.c +1 -1
@@ -561,7 +561,7 @@ mark_source_chains(const struct xt_table_info *newinfo, pos = newpos; } } - next: +next:duprintf ("Finished chain %u\n" , hook); }return 1 ;
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 19/35 netfilter: ip6_tables: function definition layout
In reply to Pablo Neira AyusoFrom: Ian Morris <[email protected]>
Use tabs instead of spaces to indent second line of parameters in function definitions.
No changes detected by objdiff.
--- net/ipv6/netfilter/ip6_tables.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/ipv6/netfilter/ip6_tables.c +3 -3
@@ -816,7 +816,7 @@ static void cleanup_entry(struct ip6t_entry *e, struct net *net)newinfo) */ static int translate_table (struct net *net,struct xt_table_info *newinfo,void *entry0, -const struct ip6t_replace *repl) +const struct ip6t_replace *repl) {struct ip6t_entry *iter;unsigned int i;
@@ -1090,7 +1090,7 @@ static int compat_table_info(const struct xt_table_info *info,#endif static int get_info (struct net *net,void __user *user, -const int *len,int compat) +const int *len,int compat) {char name[XT_TABLE_MAXNAMELEN ];struct xt_table *t;
@@ -1152,7 +1152,7 @@ static int get_info(struct net *net, void __user *user,static int get_entries (struct net *net,struct ip6t_get_entries __user *uptr, -const int *len) +const int *len) {int ret;struct ip6t_get_entries get;
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 20/35 netfilter: ipv6: code indentation
In reply to Pablo Neira AyusoFrom: Ian Morris <[email protected]>
Use tabs instead of spaces to indent code.
No changes detected by objdiff.
--- net/ipv6/netfilter/ip6_tables.c | 4 ++-- net/ipv6/netfilter/ip6t_SYNPROXY.c | 2 +- net/ipv6/netfilter/nft_chain_route_ipv6.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-)
net/ipv6/netfilter/ip6_tables.c +2 -2
@@ -443,8 +443,8 @@ ip6t_do_table(struct sk_buff *skb,break ; }while (!acpar.hotdrop); -xt_write_recseq_end (addend); -local_bh_enable (); +xt_write_recseq_end (addend); +local_bh_enable ();#ifdef DEBUG_ALLOW_ALL return NF_ACCEPT ;
net/ipv6/netfilter/ip6t_SYNPROXY.c +1 -1
@@ -244,7 +244,7 @@ synproxy_send_client_ack(const struct synproxy_net *snet,synproxy_build_options (nth, opts);synproxy_send_tcp (snet, skb, nskb, skb->nfct,IP_CT_ESTABLISHED_REPLY , - niph, nth, tcp_hdr_size); + niph, nth, tcp_hdr_size); } static bool
net/ipv6/netfilter/nft_chain_route_ipv6.c +3 -3
@@ -61,11 +61,11 @@ static const struct nf_chain_type nft_chain_route_ipv6 = { .name = "route", .type = NFT_CHAIN_T_ROUTE, .family = NFPROTO_IPV6, - .owner = THIS_MODULE, + .owner = THIS_MODULE, .hook_mask = (1 << NF_INET_LOCAL_OUT), .hooks = { - [NF_INET_LOCAL_OUT] = nf_route_table_hook, - }, + [NF_INET_LOCAL_OUT] = nf_route_table_hook, + }, };static int __init nft_chain_route_init (void )
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 21/35 netfilter: ipv6: whitespace around operators
In reply to Pablo Neira AyusoFrom: Ian Morris <[email protected]>
This patch cleanses whitespace around arithmetical operators.
No changes detected by objdiff.
--- net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 4 ++-- net/ipv6/netfilter/nf_conntrack_reasm.c | 2 +- net/ipv6/netfilter/nf_reject_ipv6.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-)
net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +2 -2
@@ -57,12 +57,12 @@ static const u_int8_t invmap[] = { [ICMPV6_ECHO_REQUEST - 128] = ICMPV6_ECHO_REPLY + 1, [ICMPV6_ECHO_REPLY - 128] = ICMPV6_ECHO_REQUEST + 1, [ICMPV6_NI_QUERY - 128] = ICMPV6_NI_REPLY + 1, - [ICMPV6_NI_REPLY -128 ] =ICMPV6_NI_QUERY +1 + [ICMPV6_NI_REPLY -128 ] =ICMPV6_NI_QUERY +1 };static const u_int8_t noct_valid_new[] = { [ICMPV6_MGM_QUERY -130 ] =1 , - [ICMPV6_MGM_REPORT -130 ] =1 , + [ICMPV6_MGM_REPORT -130 ] =1 , [ICMPV6_MGM_REDUCTION -130 ] =1 , [NDISC_ROUTER_SOLICITATION -130 ] =1 , [NDISC_ROUTER_ADVERTISEMENT -130 ] =1 ,
net/ipv6/netfilter/nf_conntrack_reasm.c +1 -1
@@ -445,7 +445,7 @@ nf_ct_frag6_reasm(struct frag_queue *fq, struct net_device *dev)skb_reset_transport_header (head);skb_push (head, head->data -skb_network_header (head)); -for (fp=head->next; fp; fp = fp->next) { +for (fp = head->next; fp; fp = fp->next) { head->data_len += fp->len; head->len += fp->len;if (head->ip_summed != fp->ip_summed)
net/ipv6/netfilter/nf_reject_ipv6.c +2 -2
@@ -26,7 +26,7 @@ const struct tcphdr *nf_reject_ip6_tcphdr_get(struct sk_buff *oldskb,int tcphoff; proto = oip6h->nexthdr; - tcphoff =ipv6_skip_exthdr (oldskb, ((u8 *)(oip6h+1 ) - oldskb->data), + tcphoff =ipv6_skip_exthdr (oldskb, ((u8 *)(oip6h +1 ) - oldskb->data), &proto, &frag_off);if ((tcphoff <0 ) || (tcphoff > oldskb->len)) {
@@ -224,7 +224,7 @@ static bool reject6_csum_ok(struct sk_buff *skb, int hook)return true; proto = ip6h->nexthdr; - thoff =ipv6_skip_exthdr (skb, ((u8 *)(ip6h+1 ) - skb->data), &proto, &fo); + thoff =ipv6_skip_exthdr (skb, ((u8 *)(ip6h +1 ) - skb->data), &proto, &fo);if (thoff <0 || thoff >= skb->len || (fo &htons (~0x7 )) !=0 )return false;
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 22/35 netfilter: ip6_tables: ternary operator layout
In reply to Pablo Neira AyusoFrom: Ian Morris <[email protected]>
Correct whitespace layout of ternary operators in the netfilter-ipv6 code.
No changes detected by objdiff.
--- net/ipv6/netfilter/ip6_tables.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv6/netfilter/ip6_tables.c +2 -2
@@ -117,7 +117,7 @@ ip6_packet_match(const struct sk_buff *skb,if (FWINV (ret !=0 ,IP6T_INV_VIA_IN )) {dprintf ("VIA in mismatch (%s vs %s).%s\n" , indev, ip6info->iniface, - ip6info->invflags&IP6T_INV_VIA_IN ?" (INV)" :"" ); + ip6info->invflags &IP6T_INV_VIA_IN ?" (INV)" :"" );return false; }
@@ -126,7 +126,7 @@ ip6_packet_match(const struct sk_buff *skb,if (FWINV (ret !=0 ,IP6T_INV_VIA_OUT )) {dprintf ("VIA out mismatch (%s vs %s).%s\n" , outdev, ip6info->outiface, - ip6info->invflags&IP6T_INV_VIA_OUT ?" (INV)" :"" ); + ip6info->invflags &IP6T_INV_VIA_OUT ?" (INV)" :"" );return false; }
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 23/35 netfilter: ip6_tables: improve if statements
In reply to Pablo Neira AyusoFrom: Ian Morris <[email protected]>
Correct whitespace layout of if statements.
No changes detected by objdiff.
--- net/ipv6/netfilter/ip6_tables.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/ipv6/netfilter/ip6_tables.c +3 -3
@@ -133,7 +133,7 @@ ip6_packet_match(const struct sk_buff *skb,/* ... might want to do something with class and flowlabel here ... */ /* look for the desired protocol header */ -if ((ip6info->flags &IP6T_F_PROTO )) { +if (ip6info->flags &IP6T_F_PROTO ) {int protohdr;unsigned short _frag_off;
@@ -151,9 +151,9 @@ ip6_packet_match(const struct sk_buff *skb, ip6info->proto);if (ip6info->proto == protohdr) { -if (ip6info->invflags &IP6T_INV_PROTO ) { +if (ip6info->invflags &IP6T_INV_PROTO )return false; - } +return true; }
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 24/35 netfilter: ipv6: pointer cast layout
In reply to Pablo Neira AyusoFrom: Ian Morris <[email protected]>
Correct whitespace layout of a pointer casting.
No changes detected by objdiff.
--- net/ipv6/netfilter/nf_conntrack_reasm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/netfilter/nf_conntrack_reasm.c +1 -1
@@ -59,7 +59,7 @@ struct nf_ct_frag6_skb_cbstruct sk_buff *orig; }; -#define NFCT_FRAG6_CB (skb) ((struct nf_ct_frag6_skb_cb*)((skb)->cb)) +#define NFCT_FRAG6_CB (skb) ((struct nf_ct_frag6_skb_cb *)((skb)->cb))static struct inet_frags nf_frags;
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 25/35 netfilter: nfnetlink_log: consolidate check for instance in nfulnl_recv_config()
In reply to Pablo Neira AyusoThis patch consolidates the check for valid logger instance once we have passed the command handling:
The config message that we receive may contain the following info:
1) Command only: We always get a valid instance pointer if we just created it. In case that the instance is being destroyed or the command is unknown, we jump to exit path of nfulnl_recv_config(). This patch doesn't modify this handling.
2) Config only: In this case, the instance must always exist since the user is asking for configuration updates. If the instance doesn't exist this returns -ENODEV.
3) No command and no configs are specified: This case is rare. The user is sending us a config message with neither commands nor config options. In this case, we have to check if the instance exists and bail out otherwise. Before this patch, it was possible to send a config message with no command and no config updates for an unexisting instance without triggering an error. So this is the only case that changes.
--- net/netfilter/nfnetlink_log.c | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-)
net/netfilter/nfnetlink_log.c +5 -23
@@ -874,16 +874,15 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, ret = -ENOTSUPP ;break ; } + }else if (!inst) { + ret = -ENODEV ; + goto out; }if (nfula[NFULA_CFG_MODE ]) { -struct nfulnl_msg_config_mode *params; - params =nla_data (nfula[NFULA_CFG_MODE ]); +struct nfulnl_msg_config_mode *params = +nla_data (nfula[NFULA_CFG_MODE ]); -if (!inst) { - ret = -ENODEV ; - goto out; - }nfulnl_set_mode (inst, params->copy_mode,ntohl (params->copy_range)); }
@@ -891,41 +890,24 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,if (nfula[NFULA_CFG_TIMEOUT ]) {__be32 timeout =nla_get_be32 (nfula[NFULA_CFG_TIMEOUT ]); -if (!inst) { - ret = -ENODEV ; - goto out; - }nfulnl_set_timeout (inst,ntohl (timeout)); }if (nfula[NFULA_CFG_NLBUFSIZ ]) {__be32 nlbufsiz =nla_get_be32 (nfula[NFULA_CFG_NLBUFSIZ ]); -if (!inst) { - ret = -ENODEV ; - goto out; - }nfulnl_set_nlbufsiz (inst,ntohl (nlbufsiz)); }if (nfula[NFULA_CFG_QTHRESH ]) {__be32 qthresh =nla_get_be32 (nfula[NFULA_CFG_QTHRESH ]); -if (!inst) { - ret = -ENODEV ; - goto out; - }nfulnl_set_qthresh (inst,ntohl (qthresh)); }if (nfula[NFULA_CFG_FLAGS ]) {u16 flags =ntohs (nla_get_be16 (nfula[NFULA_CFG_FLAGS ])); -if (!inst) { - ret = -ENODEV ; - goto out; - } -if (flags &NFULNL_CFG_F_CONNTRACK && !rcu_access_pointer (nfnl_ct_hook)) {#ifdef CONFIG_MODULES
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 26/35 netfilter: nfnetlink_log: validate dependencies to avoid breaking atomicity
In reply to Pablo Neira AyusoFrom: Pablo Neira <[email protected]>
Check that dependencies are fulfilled before updating the logger instance, otherwise we can leave things in intermediate state on errors in nfulnl_recv_config().
[ Ken-ichirou reports that this is also fixing missing instance refcnt drop
on error introduced in his patch 914eebf2f434 ("netfilter: nfnetlink_log:
autoload nf_conntrack_netlink module NFQA_CFG_F_CONNTRACK config flag"). ]
--- net/netfilter/nfnetlink_log.c | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-)
net/netfilter/nfnetlink_log.c +24 -19
@@ -825,6 +825,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,struct net *net =sock_net (ctnl);struct nfnl_log_net *log =nfnl_log_pernet (net);int ret =0 ; +u16 flags;if (nfula[NFULA_CFG_CMD ]) {u_int8_t pf = nfmsg->nfgen_family;
@@ -846,6 +847,28 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, goto out_put; } +/* Check if we support these flags in first place, dependencies should +* be there too not to break atomicity. +*/ +if (nfula[NFULA_CFG_FLAGS ]) { + flags =ntohs (nla_get_be16 (nfula[NFULA_CFG_FLAGS ])); + +if ((flags &NFULNL_CFG_F_CONNTRACK ) && + !rcu_access_pointer (nfnl_ct_hook)) { +#ifdef CONFIG_MODULES +nfnl_unlock (NFNL_SUBSYS_ULOG ); +request_module ("ip_conntrack_netlink" ); +nfnl_lock (NFNL_SUBSYS_ULOG ); +if (rcu_access_pointer (nfnl_ct_hook)) { + ret = -EAGAIN ; + goto out_put; + } +#endif + ret = -EOPNOTSUPP ; + goto out_put; + } + } +if (cmd !=NULL ) {switch (cmd->command) {case NFULNL_CFG_CMD_BIND :
@@ -905,26 +928,8 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,nfulnl_set_qthresh (inst,ntohl (qthresh)); } -if (nfula[NFULA_CFG_FLAGS ]) { -u16 flags =ntohs (nla_get_be16 (nfula[NFULA_CFG_FLAGS ])); - -if (flags &NFULNL_CFG_F_CONNTRACK && - !rcu_access_pointer (nfnl_ct_hook)) { -#ifdef CONFIG_MODULES -nfnl_unlock (NFNL_SUBSYS_ULOG ); -request_module ("ip_conntrack_netlink" ); -nfnl_lock (NFNL_SUBSYS_ULOG ); -if (rcu_access_pointer (nfnl_ct_hook)) { - ret = -EAGAIN ; - goto out; - } -#endif - ret = -EOPNOTSUPP ; - goto out; - } - +if (nfula[NFULA_CFG_FLAGS ])nfulnl_set_flags (inst, flags); - } out_put:instance_put (inst);
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 28/35 netfilter: make nf_queue_entry_get_refs return void
In reply to Pablo Neira AyusoFrom: Florian Westphal <[email protected]>
We don't care if module is being unloaded anymore since hook unregister handling will destroy queue entries using that hook.
--- include/net/netfilter/nf_queue.h | 2 +- net/netfilter/core.c | 2 -- net/netfilter/nf_queue.c | 11 ++--------- net/netfilter/nfnetlink_queue.c | 11 ++++------- 4 files changed, 7 insertions(+), 19 deletions(-)
include/net/netfilter/nf_queue.h +1 -1
@@ -32,7 +32,7 @@ void nf_register_queue_handler(const struct nf_queue_handler *qh);void nf_unregister_queue_handler (void );void nf_reinject (struct nf_queue_entry *entry,unsigned int verdict); -bool nf_queue_entry_get_refs (struct nf_queue_entry *entry); +void nf_queue_entry_get_refs (struct nf_queue_entry *entry);void nf_queue_entry_release_refs (struct nf_queue_entry *entry);static inline void init_hashrandom (u32 *jhash_initval)
net/netfilter/core.c +0 -2
@@ -313,8 +313,6 @@ next_hook:int err =nf_queue (skb, elem, state, verdict >>NF_VERDICT_QBITS );if (err <0 ) { -if (err == -ECANCELED ) - goto next_hook;if (err == -ESRCH && (verdict &NF_VERDICT_FLAG_QUEUE_BYPASS )) goto next_hook;
net/netfilter/nf_queue.c +2 -9
@@ -73,7 +73,7 @@ void nf_queue_entry_release_refs(struct nf_queue_entry *entry)EXPORT_SYMBOL_GPL (nf_queue_entry_release_refs);/* Bump dev refs so they don't vanish while packet is out */ -bool nf_queue_entry_get_refs (struct nf_queue_entry *entry) +void nf_queue_entry_get_refs (struct nf_queue_entry *entry) {struct nf_hook_state *state = &entry->state;
@@ -95,8 +95,6 @@ bool nf_queue_entry_get_refs(struct nf_queue_entry *entry) dev_hold(physdev); }#endif - -return true; }EXPORT_SYMBOL_GPL (nf_queue_entry_get_refs);
@@ -151,10 +149,7 @@ int nf_queue(struct sk_buff *skb, .size = sizeof(*entry) + afinfo->route_key_size, }; -if (!nf_queue_entry_get_refs (entry)) { - status = -ECANCELED ; - goto err_unlock; - } +nf_queue_entry_get_refs (entry);skb_dst_force (skb); afinfo->saveroute (skb, entry); status = qh->outfn (entry, queuenum);
@@ -215,8 +210,6 @@ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict) err =nf_queue (skb, elem, &entry->state, verdict >>NF_VERDICT_QBITS );if (err <0 ) { -if (err == -ECANCELED ) - goto next_hook;if (err == -ESRCH && (verdict &NF_VERDICT_FLAG_QUEUE_BYPASS )) goto next_hook;
net/netfilter/nfnetlink_queue.c +4 -7
@@ -606,12 +606,9 @@ static struct nf_queue_entry * nf_queue_entry_dup(struct nf_queue_entry *e) {struct nf_queue_entry *entry =kmemdup (e, e->size,GFP_ATOMIC ); -if (entry) { -if (nf_queue_entry_get_refs (entry)) -return entry; -kfree (entry); - } -return NULL ; +if (entry) +nf_queue_entry_get_refs (entry); +return entry; }#if IS_ENABLED (CONFIG_BRIDGE_NETFILTER )
@@ -706,7 +703,7 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum)nf_bridge_adjust_skb_data (skb); segs =skb_gso_segment (skb,0 );/* Does not use PTR_ERR to limit the number of error codes that can be -* returned by nf_queue. For instance, callers rely on -ECANCELED to +* returned by nf_queue. For instance, callers rely on -ESRCH to * mean 'ignore this hook'. */ if (IS_ERR_OR_NULL (segs))
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 29/35 netfilter: nf_queue: remove rcu_read_lock calls
In reply to Pablo Neira AyusoFrom: Florian Westphal <[email protected]>
All verdict handlers make use of the nfnetlink .call_rcu callback so rcu readlock is already held.
--- net/netfilter/nf_queue.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
net/netfilter/nf_queue.c +4 -12
@@ -124,22 +124,20 @@ int nf_queue(struct sk_buff *skb,const struct nf_queue_handler *qh;/* QUEUE == DROP if no one is waiting, to be safe. */ -rcu_read_lock (); - qh =rcu_dereference (queue_handler);if (!qh) { status = -ESRCH ; - goto err_unlock; + goto err; } afinfo =nf_get_afinfo (state->pf);if (!afinfo) - goto err_unlock; + goto err; entry =kmalloc (sizeof (*entry) + afinfo->route_key_size,GFP_ATOMIC );if (!entry) { status = -ENOMEM ; - goto err_unlock; + goto err; } *entry = (struct nf_queue_entry ) {
@@ -154,8 +152,6 @@ int nf_queue(struct sk_buff *skb, afinfo->saveroute (skb, entry); status = qh->outfn (entry, queuenum); -rcu_read_unlock (); -if (status <0 ) {nf_queue_entry_release_refs (entry); goto err;
@@ -163,8 +159,6 @@ int nf_queue(struct sk_buff *skb,return 0 ; -err_unlock: -rcu_read_unlock (); err:kfree (entry);return status;
@@ -177,8 +171,6 @@ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict)const struct nf_afinfo *afinfo;int err; -rcu_read_lock (); -nf_queue_entry_release_refs (entry);/* Continue traversal iff userspace said ok... */
@@ -221,7 +213,7 @@ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict)default :kfree_skb (skb); } -rcu_read_unlock (); +kfree (entry); }EXPORT_SYMBOL (nf_reinject);
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 30/35 netfilter: turn NF_HOOK into an inline function
In reply to Pablo Neira AyusoFrom: Arnd Bergmann <[email protected]>
A recent change to the dst_output handling caused a new warning when the call to NF_HOOK() is the only used of a local variable passed as 'dev', and CONFIG_NETFILTER is disabled:
net/ipv6/ip6_output.c: In function 'ip6_output':net/ipv6/ip6_output.c:135:21: warning: unused variable 'dev' [-Wunused-variable]
The reason for this is that the NF_HOOK macro in this case does not reference the variable at all, and the call to dev_net(dev) got removed from the ip6_output function. To avoid that warning now and in the future, this changes the macro into an equivalent inline function, which tells the compiler that the variable is passed correctly but still unused.
The dn_forward function apparently had the same problem in the past and added a local workaround that no longer works with the inline function. In order to avoid a regression, we have to also remove the #ifdef from decnet in the same patch.
--- include/linux/netfilter.h | 19 +++++++++++++++++-- net/decnet/dn_route.c | 2 -- 2 files changed, 17 insertions(+), 4 deletions(-)
include/linux/netfilter.h +17 -2
@@ -346,8 +346,23 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family) }#else /* !CONFIG_NETFILTER */ -#define NF_HOOK (pf, hook, net, sk, skb, indev, outdev, okfn) (okfn)(net, sk, skb) -#define NF_HOOK_COND (pf, hook, net, sk, skb, indev, outdev, okfn, cond) (okfn)(net, sk, skb) +static inline int +NF_HOOK_COND (uint8_t pf,unsigned int hook,struct net *net,struct sock *sk, +struct sk_buff *skb,struct net_device *in,struct net_device *out, +int (*okfn)(struct net *,struct sock *,struct sk_buff *), +bool cond) +{ +return okfn (net, sk, skb); +} + +static inline int +NF_HOOK (uint8_t pf,unsigned int hook,struct net *net,struct sock *sk, +struct sk_buff *skb,struct net_device *in,struct net_device *out, +int (*okfn)(struct net *,struct sock *,struct sk_buff *)) +{ +return okfn (net, sk, skb); +} + static inline int nf_hook(u_int8_t pf, unsigned int hook, struct net *net, struct sock *sk, struct sk_buff *skb, struct net_device *indev, struct net_device *outdev,
net/decnet/dn_route.c +0 -2
@@ -789,9 +789,7 @@ static int dn_forward(struct sk_buff *skb)struct dn_dev *dn_db =rcu_dereference (dst->dev->dn_ptr);struct dn_route *rt;int header_len; -#ifdef CONFIG_NETFILTER struct net_device *dev = skb->dev; -#endif if (skb->pkt_type !=PACKET_HOST ) goto drop;
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 31/35 netfilter: ipv4: label placement
In reply to Pablo Neira AyusoFrom: Ian Morris <[email protected]>
Whitespace cleansing: Labels should not be indented.
No changes detected by objdiff.
--- net/ipv4/netfilter/arp_tables.c | 2 +- net/ipv4/netfilter/ip_tables.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/netfilter/arp_tables.c +1 -1
@@ -468,7 +468,7 @@ static int mark_source_chains(const struct xt_table_info *newinfo, pos = newpos; } } - next: +next:duprintf ("Finished chain %u\n" , hook); }return 1 ;
net/ipv4/netfilter/ip_tables.c +1 -1
@@ -549,7 +549,7 @@ mark_source_chains(const struct xt_table_info *newinfo, pos = newpos; } } - next: +next:duprintf ("Finished chain %u\n" , hook); }return 1 ;
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 32/35 netfilter: ipv4: ternary operator layout
In reply to Pablo Neira AyusoFrom: Ian Morris <[email protected]>
Correct whitespace layout of ternary operators in the netfilter-ipv4 code.
No changes detected by objdiff.
--- net/ipv4/netfilter/arp_tables.c | 4 ++-- net/ipv4/netfilter/ip_tables.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
net/ipv4/netfilter/arp_tables.c +2 -2
@@ -186,7 +186,7 @@ static inline int arp_packet_match(const struct arphdr *arphdr,if (FWINV (ret !=0 ,ARPT_INV_VIA_IN )) {dprintf ("VIA in mismatch (%s vs %s).%s\n" , indev, arpinfo->iniface, - arpinfo->invflags&ARPT_INV_VIA_IN ?" (INV)" :"" ); + arpinfo->invflags &ARPT_INV_VIA_IN ?" (INV)" :"" );return 0 ; }
@@ -195,7 +195,7 @@ static inline int arp_packet_match(const struct arphdr *arphdr,if (FWINV (ret !=0 ,ARPT_INV_VIA_OUT )) {dprintf ("VIA out mismatch (%s vs %s).%s\n" , outdev, arpinfo->outiface, - arpinfo->invflags&ARPT_INV_VIA_OUT ?" (INV)" :"" ); + arpinfo->invflags &ARPT_INV_VIA_OUT ?" (INV)" :"" );return 0 ; }
net/ipv4/netfilter/ip_tables.c +3 -3
@@ -102,7 +102,7 @@ ip_packet_match(const struct iphdr *ip,if (FWINV (ret !=0 ,IPT_INV_VIA_IN )) {dprintf ("VIA in mismatch (%s vs %s).%s\n" , indev, ipinfo->iniface, - ipinfo->invflags&IPT_INV_VIA_IN ?" (INV)" :"" ); + ipinfo->invflags &IPT_INV_VIA_IN ?" (INV)" :"" );return false; }
@@ -111,7 +111,7 @@ ip_packet_match(const struct iphdr *ip,if (FWINV (ret !=0 ,IPT_INV_VIA_OUT )) {dprintf ("VIA out mismatch (%s vs %s).%s\n" , outdev, ipinfo->outiface, - ipinfo->invflags&IPT_INV_VIA_OUT ?" (INV)" :"" ); + ipinfo->invflags &IPT_INV_VIA_OUT ?" (INV)" :"" );return false; }
@@ -120,7 +120,7 @@ ip_packet_match(const struct iphdr *ip, FWINV(ip->protocol != ipinfo->proto, IPT_INV_PROTO)) {dprintf ("Packet protocol %hi does not match %hi.%s\n" , ip->protocol, ipinfo->proto, - ipinfo->invflags&IPT_INV_PROTO ?" (INV)" :"" ); + ipinfo->invflags &IPT_INV_PROTO ?" (INV)" :"" );return false; }
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 33/35 netfilter: ipv4: function definition layout
In reply to Pablo Neira AyusoFrom: Ian Morris <[email protected]>
Use tabs instead of spaces to indent second line of parameters in function definitions.
No changes detected by objdiff.
--- net/ipv4/netfilter/arp_tables.c | 6 +++--- net/ipv4/netfilter/ip_tables.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
net/ipv4/netfilter/arp_tables.c +3 -3
@@ -632,7 +632,7 @@ static inline void cleanup_entry(struct arpt_entry *e)* newinfo). */ static int translate_table (struct xt_table_info *newinfo,void *entry0, -const struct arpt_replace *repl) +const struct arpt_replace *repl) {struct arpt_entry *iter;unsigned int i;
@@ -892,7 +892,7 @@ static int compat_table_info(const struct xt_table_info *info,#endif static int get_info (struct net *net,void __user *user, -const int *len,int compat) +const int *len,int compat) {char name[XT_TABLE_MAXNAMELEN ];struct xt_table *t;
@@ -1069,7 +1069,7 @@ static int __do_replace(struct net *net, const char *name, }static int do_replace (struct net *net,const void __user *user, -unsigned int len) +unsigned int len) {int ret;struct arpt_replace tmp;
net/ipv4/netfilter/ip_tables.c +3 -3
@@ -804,7 +804,7 @@ cleanup_entry(struct ipt_entry *e, struct net *net)newinfo) */ static int translate_table (struct net *net,struct xt_table_info *newinfo,void *entry0, -const struct ipt_replace *repl) +const struct ipt_replace *repl) {struct ipt_entry *iter;unsigned int i;
@@ -1078,7 +1078,7 @@ static int compat_table_info(const struct xt_table_info *info,#endif static int get_info (struct net *net,void __user *user, -const int *len,int compat) +const int *len,int compat) {char name[XT_TABLE_MAXNAMELEN ];struct xt_table *t;
@@ -1304,7 +1304,7 @@ do_replace(struct net *net, const void __user *user, unsigned int len)static int do_add_counters (struct net *net,const void __user *user, -unsigned int len,int compat) +unsigned int len,int compat) {unsigned int i;struct xt_counters_info tmp;
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 34/35 netfilter: ipv4: code indentation
In reply to Pablo Neira AyusoFrom: Ian Morris <[email protected]>
Use tabs instead of spaces to indent code.
No changes detected by objdiff.
--- net/ipv4/netfilter/ip_tables.c | 6 +++--- net/ipv4/netfilter/ipt_SYNPROXY.c | 2 +- net/ipv4/netfilter/iptable_security.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
net/ipv4/netfilter/ip_tables.c +3 -3
@@ -431,8 +431,8 @@ ipt_do_table(struct sk_buff *skb, }while (!acpar.hotdrop);pr_debug ("Exiting %s; sp at %u\n" , __func__, stackidx); -xt_write_recseq_end (addend); -local_bh_enable (); +xt_write_recseq_end (addend); +local_bh_enable ();#ifdef DEBUG_ALLOW_ALL return NF_ACCEPT ;
@@ -484,7 +484,7 @@ mark_source_chains(const struct xt_table_info *newinfo,unsigned int oldpos, size;if ((strcmp (t->target.u.user.name, -XT_STANDARD_TARGET ) ==0 ) && +XT_STANDARD_TARGET ) ==0 ) && t->verdict < -NF_MAX_VERDICT -1 ) { duprintf("mark_source_chains: bad " "negative verdict (%i)\n",
net/ipv4/netfilter/ipt_SYNPROXY.c +1 -1
@@ -231,7 +231,7 @@ synproxy_send_client_ack(const struct synproxy_net *snet,synproxy_build_options (nth, opts);synproxy_send_tcp (snet, skb, nskb, skb->nfct,IP_CT_ESTABLISHED_REPLY , - niph, nth, tcp_hdr_size); + niph, nth, tcp_hdr_size); } static bool
net/ipv4/netfilter/iptable_security.c +1 -1
@@ -79,7 +79,7 @@ static int __init iptable_security_init(void)int ret; ret =register_pernet_subsys (&iptable_security_net_ops); -if (ret <0 ) +if (ret <0 )return ret; sectbl_ops =xt_hook_link (&security_table, iptable_security_hook);
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 35/35 netfilter: ipv4: whitespace around operators
In reply to Pablo Neira AyusoFrom: Ian Morris <[email protected]>
This patch cleanses whitespace around arithmetical operators.
No changes detected by objdiff.
--- net/ipv4/netfilter/ipt_CLUSTERIP.c | 8 ++++---- net/ipv4/netfilter/ipt_ah.c | 2 +- net/ipv4/netfilter/nf_nat_snmp_basic.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-)
net/ipv4/netfilter/ipt_CLUSTERIP.c +4 -4
@@ -492,14 +492,14 @@ static void arp_print(struct arp_payload *payload) {#define HBUFFERLEN 30char hbuffer[HBUFFERLEN ]; -int j,k; +int j, k; -for (k=0 , j=0 ; k <HBUFFERLEN -3 && j <ETH_ALEN ; j++) { +for (k =0 , j =0 ; k <HBUFFERLEN -3 && j <ETH_ALEN ; j++) { hbuffer[k++] =hex_asc_hi (payload->src_hw[j]); hbuffer[k++] =hex_asc_lo (payload->src_hw[j]); - hbuffer[k++]=':' ; + hbuffer[k++] =':' ; } - hbuffer[--k]='\0' ; + hbuffer[--k] ='\0' ;pr_debug ("src %pI4@%s, dst %pI4\n" , &payload->src_ip, hbuffer, &payload->dst_ip);
net/ipv4/netfilter/ipt_ah.c +1 -1
@@ -25,7 +25,7 @@ spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, bool invert)bool r;pr_debug ("spi_match:%c 0x%x <= 0x%x <= 0x%x\n" , invert ?'!' :' ' , min, spi, max); - r=(spi >= min && spi <= max) ^ invert; + r = (spi >= min && spi <= max) ^ invert;pr_debug (" result %s\n" , r ?"PASS" :"FAILED" );return r; }
net/ipv4/netfilter/nf_nat_snmp_basic.c +1 -1
@@ -1156,7 +1156,7 @@ static int snmp_parse_mangle(unsigned char *msg, }if (obj->type ==SNMP_IPADDR ) -mangle_address (ctx.begin, ctx.pointer -4 , map, check); +mangle_address (ctx.begin, ctx.pointer -4 , map, check);kfree (obj->id);kfree (obj);
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 27/35 netfilter: remove hook owner refcounting
In reply to Pablo Neira AyusoFrom: Florian Westphal <[email protected]>
since commit 8405a8fff3f8 ("netfilter: nf_qeueue: Drop queue entries on nf_unregister_hook") all pending queued entries are discarded.
So we can simply remove all of the owner handling -- when module is removed it also needs to unregister all its hooks.
--- include/linux/netfilter.h | 1 - net/bridge/br_netfilter_hooks.c | 7 ------- net/bridge/netfilter/ebtable_filter.c | 3 --- net/bridge/netfilter/ebtable_nat.c | 3 --- net/ipv4/netfilter/ipt_SYNPROXY.c | 2 -- net/ipv4/netfilter/iptable_nat.c | 4 ---- net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 6 ------ net/ipv4/netfilter/nf_defrag_ipv4.c | 2 -- net/ipv6/netfilter/ip6t_SYNPROXY.c | 2 -- net/ipv6/netfilter/ip6table_nat.c | 4 ---- net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | 6 ------ net/ipv6/netfilter/nf_defrag_ipv6_hooks.c | 2 -- net/netfilter/ipvs/ip_vs_core.c | 12 ------------ net/netfilter/nf_queue.c | 5 ----- net/netfilter/nf_tables_api.c | 1 - net/netfilter/x_tables.c | 1 - security/selinux/hooks.c | 5 ----- security/smack/smack_netfilter.c | 2 -- 18 files changed, 68 deletions(-)
include/linux/netfilter.h +0 -1
@@ -90,7 +90,6 @@ struct nf_hook_ops {/* User fills in from here down. */ nf_hookfn *hook;struct net_device *dev; -struct module *owner;void *priv;u_int8_t pf;unsigned int hooknum;
net/bridge/br_netfilter_hooks.c +0 -7
@@ -901,49 +901,42 @@ EXPORT_SYMBOL_GPL(br_netfilter_enable);static struct nf_hook_ops br_nf_ops[]__read_mostly = { { .hook = br_nf_pre_routing, - .owner =THIS_MODULE , .pf =NFPROTO_BRIDGE , .hooknum =NF_BR_PRE_ROUTING , .priority =NF_BR_PRI_BRNF , }, { .hook = br_nf_local_in, - .owner =THIS_MODULE , .pf =NFPROTO_BRIDGE , .hooknum =NF_BR_LOCAL_IN , .priority =NF_BR_PRI_BRNF , }, { .hook = br_nf_forward_ip, - .owner =THIS_MODULE , .pf =NFPROTO_BRIDGE , .hooknum =NF_BR_FORWARD , .priority =NF_BR_PRI_BRNF -1 , }, { .hook = br_nf_forward_arp, - .owner =THIS_MODULE , .pf =NFPROTO_BRIDGE , .hooknum =NF_BR_FORWARD , .priority =NF_BR_PRI_BRNF , }, { .hook = br_nf_post_routing, - .owner =THIS_MODULE , .pf =NFPROTO_BRIDGE , .hooknum =NF_BR_POST_ROUTING , .priority =NF_BR_PRI_LAST , }, { .hook = ip_sabotage_in, - .owner =THIS_MODULE , .pf =NFPROTO_IPV4 , .hooknum =NF_INET_PRE_ROUTING , .priority =NF_IP_PRI_FIRST , }, { .hook = ip_sabotage_in, - .owner =THIS_MODULE , .pf =NFPROTO_IPV6 , .hooknum =NF_INET_PRE_ROUTING , .priority =NF_IP6_PRI_FIRST ,
net/bridge/netfilter/ebtable_filter.c +0 -3
@@ -73,21 +73,18 @@ ebt_out_hook(void *priv, struct sk_buff *skb,static struct nf_hook_ops ebt_ops_filter[]__read_mostly = { { .hook = ebt_in_hook, - .owner =THIS_MODULE , .pf =NFPROTO_BRIDGE , .hooknum =NF_BR_LOCAL_IN , .priority =NF_BR_PRI_FILTER_BRIDGED , }, { .hook = ebt_in_hook, - .owner =THIS_MODULE , .pf =NFPROTO_BRIDGE , .hooknum =NF_BR_FORWARD , .priority =NF_BR_PRI_FILTER_BRIDGED , }, { .hook = ebt_out_hook, - .owner =THIS_MODULE , .pf =NFPROTO_BRIDGE , .hooknum =NF_BR_LOCAL_OUT , .priority =NF_BR_PRI_FILTER_OTHER ,
net/bridge/netfilter/ebtable_nat.c +0 -3
@@ -73,21 +73,18 @@ ebt_nat_out(void *priv, struct sk_buff *skb,static struct nf_hook_ops ebt_ops_nat[]__read_mostly = { { .hook = ebt_nat_out, - .owner =THIS_MODULE , .pf =NFPROTO_BRIDGE , .hooknum =NF_BR_LOCAL_OUT , .priority =NF_BR_PRI_NAT_DST_OTHER , }, { .hook = ebt_nat_out, - .owner =THIS_MODULE , .pf =NFPROTO_BRIDGE , .hooknum =NF_BR_POST_ROUTING , .priority =NF_BR_PRI_NAT_SRC , }, { .hook = ebt_nat_in, - .owner =THIS_MODULE , .pf =NFPROTO_BRIDGE , .hooknum =NF_BR_PRE_ROUTING , .priority =NF_BR_PRI_NAT_DST_BRIDGED ,
net/ipv4/netfilter/ipt_SYNPROXY.c +0 -2
@@ -437,14 +437,12 @@ static struct xt_target synproxy_tg4_reg __read_mostly = {static struct nf_hook_ops ipv4_synproxy_ops[]__read_mostly = { { .hook = ipv4_synproxy_hook, - .owner =THIS_MODULE , .pf =NFPROTO_IPV4 , .hooknum =NF_INET_LOCAL_IN , .priority =NF_IP_PRI_CONNTRACK_CONFIRM -1 , }, { .hook = ipv4_synproxy_hook, - .owner =THIS_MODULE , .pf =NFPROTO_IPV4 , .hooknum =NF_INET_POST_ROUTING , .priority =NF_IP_PRI_CONNTRACK_CONFIRM -1 ,
net/ipv4/netfilter/iptable_nat.c +0 -4
@@ -68,7 +68,6 @@ static struct nf_hook_ops nf_nat_ipv4_ops[] __read_mostly = {/* Before packet filtering, change destination */ { .hook = iptable_nat_ipv4_in, - .owner = THIS_MODULE, .pf = NFPROTO_IPV4, .hooknum = NF_INET_PRE_ROUTING, .priority = NF_IP_PRI_NAT_DST,
@@ -76,7 +75,6 @@ static struct nf_hook_ops nf_nat_ipv4_ops[] __read_mostly = {/* After packet filtering, change source */ { .hook = iptable_nat_ipv4_out, - .owner = THIS_MODULE, .pf = NFPROTO_IPV4, .hooknum = NF_INET_POST_ROUTING, .priority = NF_IP_PRI_NAT_SRC,
@@ -84,7 +82,6 @@ static struct nf_hook_ops nf_nat_ipv4_ops[] __read_mostly = {/* Before packet filtering, change destination */ { .hook = iptable_nat_ipv4_local_fn, - .owner = THIS_MODULE, .pf = NFPROTO_IPV4, .hooknum = NF_INET_LOCAL_OUT, .priority = NF_IP_PRI_NAT_DST,
@@ -92,7 +89,6 @@ static struct nf_hook_ops nf_nat_ipv4_ops[] __read_mostly = {/* After packet filtering, change source */ { .hook = iptable_nat_ipv4_fn, - .owner = THIS_MODULE, .pf = NFPROTO_IPV4, .hooknum = NF_INET_LOCAL_IN, .priority = NF_IP_PRI_NAT_SRC,
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +0 -6
@@ -166,42 +166,36 @@ static unsigned int ipv4_conntrack_local(void *priv,static struct nf_hook_ops ipv4_conntrack_ops[]__read_mostly = { { .hook = ipv4_conntrack_in, - .owner =THIS_MODULE , .pf =NFPROTO_IPV4 , .hooknum =NF_INET_PRE_ROUTING , .priority =NF_IP_PRI_CONNTRACK , }, { .hook = ipv4_conntrack_local, - .owner =THIS_MODULE , .pf =NFPROTO_IPV4 , .hooknum =NF_INET_LOCAL_OUT , .priority =NF_IP_PRI_CONNTRACK , }, { .hook = ipv4_helper, - .owner =THIS_MODULE , .pf =NFPROTO_IPV4 , .hooknum =NF_INET_POST_ROUTING , .priority =NF_IP_PRI_CONNTRACK_HELPER , }, { .hook = ipv4_confirm, - .owner =THIS_MODULE , .pf =NFPROTO_IPV4 , .hooknum =NF_INET_POST_ROUTING , .priority =NF_IP_PRI_CONNTRACK_CONFIRM , }, { .hook = ipv4_helper, - .owner =THIS_MODULE , .pf =NFPROTO_IPV4 , .hooknum =NF_INET_LOCAL_IN , .priority =NF_IP_PRI_CONNTRACK_HELPER , }, { .hook = ipv4_confirm, - .owner =THIS_MODULE , .pf =NFPROTO_IPV4 , .hooknum =NF_INET_LOCAL_IN , .priority =NF_IP_PRI_CONNTRACK_CONFIRM ,
net/ipv4/netfilter/nf_defrag_ipv4.c +0 -2
@@ -94,14 +94,12 @@ static unsigned int ipv4_conntrack_defrag(void *priv,static struct nf_hook_ops ipv4_defrag_ops[] = { { .hook = ipv4_conntrack_defrag, - .owner =THIS_MODULE , .pf =NFPROTO_IPV4 , .hooknum =NF_INET_PRE_ROUTING , .priority =NF_IP_PRI_CONNTRACK_DEFRAG , }, { .hook = ipv4_conntrack_defrag, - .owner =THIS_MODULE , .pf =NFPROTO_IPV4 , .hooknum =NF_INET_LOCAL_OUT , .priority =NF_IP_PRI_CONNTRACK_DEFRAG ,
net/ipv6/netfilter/ip6t_SYNPROXY.c +0 -2
@@ -458,14 +458,12 @@ static struct xt_target synproxy_tg6_reg __read_mostly = {static struct nf_hook_ops ipv6_synproxy_ops[]__read_mostly = { { .hook = ipv6_synproxy_hook, - .owner =THIS_MODULE , .pf =NFPROTO_IPV6 , .hooknum =NF_INET_LOCAL_IN , .priority =NF_IP_PRI_CONNTRACK_CONFIRM -1 , }, { .hook = ipv6_synproxy_hook, - .owner =THIS_MODULE , .pf =NFPROTO_IPV6 , .hooknum =NF_INET_POST_ROUTING , .priority =NF_IP_PRI_CONNTRACK_CONFIRM -1 ,
net/ipv6/netfilter/ip6table_nat.c +0 -4
@@ -70,7 +70,6 @@ static struct nf_hook_ops nf_nat_ipv6_ops[] __read_mostly = {/* Before packet filtering, change destination */ { .hook = ip6table_nat_in, - .owner = THIS_MODULE, .pf = NFPROTO_IPV6, .hooknum = NF_INET_PRE_ROUTING, .priority = NF_IP6_PRI_NAT_DST,
@@ -78,7 +77,6 @@ static struct nf_hook_ops nf_nat_ipv6_ops[] __read_mostly = {/* After packet filtering, change source */ { .hook = ip6table_nat_out, - .owner = THIS_MODULE, .pf = NFPROTO_IPV6, .hooknum = NF_INET_POST_ROUTING, .priority = NF_IP6_PRI_NAT_SRC,
@@ -86,7 +84,6 @@ static struct nf_hook_ops nf_nat_ipv6_ops[] __read_mostly = {/* Before packet filtering, change destination */ { .hook = ip6table_nat_local_fn, - .owner = THIS_MODULE, .pf = NFPROTO_IPV6, .hooknum = NF_INET_LOCAL_OUT, .priority = NF_IP6_PRI_NAT_DST,
@@ -94,7 +91,6 @@ static struct nf_hook_ops nf_nat_ipv6_ops[] __read_mostly = {/* After packet filtering, change source */ { .hook = ip6table_nat_fn, - .owner = THIS_MODULE, .pf = NFPROTO_IPV6, .hooknum = NF_INET_LOCAL_IN, .priority = NF_IP6_PRI_NAT_SRC,
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c +0 -6
@@ -187,42 +187,36 @@ static unsigned int ipv6_conntrack_local(void *priv,static struct nf_hook_ops ipv6_conntrack_ops[]__read_mostly = { { .hook = ipv6_conntrack_in, - .owner =THIS_MODULE , .pf =NFPROTO_IPV6 , .hooknum =NF_INET_PRE_ROUTING , .priority =NF_IP6_PRI_CONNTRACK , }, { .hook = ipv6_conntrack_local, - .owner =THIS_MODULE , .pf =NFPROTO_IPV6 , .hooknum =NF_INET_LOCAL_OUT , .priority =NF_IP6_PRI_CONNTRACK , }, { .hook = ipv6_helper, - .owner =THIS_MODULE , .pf =NFPROTO_IPV6 , .hooknum =NF_INET_POST_ROUTING , .priority =NF_IP6_PRI_CONNTRACK_HELPER , }, { .hook = ipv6_confirm, - .owner =THIS_MODULE , .pf =NFPROTO_IPV6 , .hooknum =NF_INET_POST_ROUTING , .priority =NF_IP6_PRI_LAST , }, { .hook = ipv6_helper, - .owner =THIS_MODULE , .pf =NFPROTO_IPV6 , .hooknum =NF_INET_LOCAL_IN , .priority =NF_IP6_PRI_CONNTRACK_HELPER , }, { .hook = ipv6_confirm, - .owner =THIS_MODULE , .pf =NFPROTO_IPV6 , .hooknum =NF_INET_LOCAL_IN , .priority =NF_IP6_PRI_LAST -1 ,
net/ipv6/netfilter/nf_defrag_ipv6_hooks.c +0 -2
@@ -84,14 +84,12 @@ static unsigned int ipv6_defrag(void *priv,static struct nf_hook_ops ipv6_defrag_ops[] = { { .hook = ipv6_defrag, - .owner =THIS_MODULE , .pf =NFPROTO_IPV6 , .hooknum =NF_INET_PRE_ROUTING , .priority =NF_IP6_PRI_CONNTRACK_DEFRAG , }, { .hook = ipv6_defrag, - .owner =THIS_MODULE , .pf =NFPROTO_IPV6 , .hooknum =NF_INET_LOCAL_OUT , .priority =NF_IP6_PRI_CONNTRACK_DEFRAG ,
net/netfilter/ipvs/ip_vs_core.c +0 -12
@@ -1923,7 +1923,6 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = {/* After packet filtering, change source only for VS/NAT */ { .hook = ip_vs_reply4, - .owner = THIS_MODULE, .pf = NFPROTO_IPV4, .hooknum = NF_INET_LOCAL_IN, .priority = NF_IP_PRI_NAT_SRC - 2,
@@ -1933,7 +1932,6 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = {* applied to IPVS. */ { .hook = ip_vs_remote_request4, - .owner = THIS_MODULE, .pf = NFPROTO_IPV4, .hooknum = NF_INET_LOCAL_IN, .priority = NF_IP_PRI_NAT_SRC - 1,
@@ -1941,7 +1939,6 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = {/* Before ip_vs_in, change source only for VS/NAT */ { .hook = ip_vs_local_reply4, - .owner = THIS_MODULE, .pf = NFPROTO_IPV4, .hooknum = NF_INET_LOCAL_OUT, .priority = NF_IP_PRI_NAT_DST + 1,
@@ -1949,7 +1946,6 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = {/* After mangle, schedule and forward local requests */ { .hook = ip_vs_local_request4, - .owner = THIS_MODULE, .pf = NFPROTO_IPV4, .hooknum = NF_INET_LOCAL_OUT, .priority = NF_IP_PRI_NAT_DST + 2,
@@ -1958,7 +1954,6 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = {* destined for 0.0.0.0/0, which is for incoming IPVS connections */ { .hook = ip_vs_forward_icmp, - .owner = THIS_MODULE, .pf = NFPROTO_IPV4, .hooknum = NF_INET_FORWARD, .priority = 99,
@@ -1966,7 +1961,6 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = {/* After packet filtering, change source only for VS/NAT */ { .hook = ip_vs_reply4, - .owner = THIS_MODULE, .pf = NFPROTO_IPV4, .hooknum = NF_INET_FORWARD, .priority = 100,
@@ -1975,7 +1969,6 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = {/* After packet filtering, change source only for VS/NAT */ { .hook = ip_vs_reply6, - .owner = THIS_MODULE, .pf = NFPROTO_IPV6, .hooknum = NF_INET_LOCAL_IN, .priority = NF_IP6_PRI_NAT_SRC - 2,
@@ -1985,7 +1978,6 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = {* applied to IPVS. */ { .hook = ip_vs_remote_request6, - .owner = THIS_MODULE, .pf = NFPROTO_IPV6, .hooknum = NF_INET_LOCAL_IN, .priority = NF_IP6_PRI_NAT_SRC - 1,
@@ -1993,7 +1985,6 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = {/* Before ip_vs_in, change source only for VS/NAT */ { .hook = ip_vs_local_reply6, - .owner = THIS_MODULE, .pf = NFPROTO_IPV6, .hooknum = NF_INET_LOCAL_OUT, .priority = NF_IP6_PRI_NAT_DST + 1,
@@ -2001,7 +1992,6 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = {/* After mangle, schedule and forward local requests */ { .hook = ip_vs_local_request6, - .owner = THIS_MODULE, .pf = NFPROTO_IPV6, .hooknum = NF_INET_LOCAL_OUT, .priority = NF_IP6_PRI_NAT_DST + 2,
@@ -2010,7 +2000,6 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = {* destined for 0.0.0.0/0, which is for incoming IPVS connections */ { .hook = ip_vs_forward_icmp_v6, - .owner = THIS_MODULE, .pf = NFPROTO_IPV6, .hooknum = NF_INET_FORWARD, .priority = 99,
@@ -2018,7 +2007,6 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = {/* After packet filtering, change source only for VS/NAT */ { .hook = ip_vs_reply6, - .owner = THIS_MODULE, .pf = NFPROTO_IPV6, .hooknum = NF_INET_FORWARD, .priority = 100,
net/netfilter/nf_queue.c +0 -5
@@ -69,8 +69,6 @@ void nf_queue_entry_release_refs(struct nf_queue_entry *entry) dev_put(physdev); }#endif -/* Drop reference to owner of hook which queued us. */ -module_put (entry->elem->owner); }EXPORT_SYMBOL_GPL (nf_queue_entry_release_refs);
@@ -79,9 +77,6 @@ bool nf_queue_entry_get_refs(struct nf_queue_entry *entry) {struct nf_hook_state *state = &entry->state; -if (!try_module_get (entry->elem->owner)) -return false; -if (state->in)dev_hold (state->in);if (state->out)
net/netfilter/nf_tables_api.c +0 -1
@@ -1433,7 +1433,6 @@ static int nf_tables_newchain(struct sock *nlsk, struct sk_buff *skb,for (i =0 ; i < afi->nops; i++) { ops = &basechain->ops[i]; ops->pf = family; - ops->owner = afi->owner; ops->hooknum = hooknum; ops->priority = priority; ops->priv = chain;
net/netfilter/x_tables.c +0 -1
@@ -1193,7 +1193,6 @@ struct nf_hook_ops *xt_hook_link(const struct xt_table *table, nf_hookfn *fn)if (!(hook_mask &1 ))continue ; ops[i].hook = fn; - ops[i].owner = table->me; ops[i].pf = table->af; ops[i].hooknum = hooknum; ops[i].priority = table->priority;
security/selinux/hooks.c +0 -5
@@ -6127,21 +6127,18 @@ security_initcall(selinux_init);static struct nf_hook_ops selinux_nf_ops[] = { { .hook = selinux_ipv4_postroute, - .owner =THIS_MODULE , .pf =NFPROTO_IPV4 , .hooknum =NF_INET_POST_ROUTING , .priority =NF_IP_PRI_SELINUX_LAST , }, { .hook = selinux_ipv4_forward, - .owner =THIS_MODULE , .pf =NFPROTO_IPV4 , .hooknum =NF_INET_FORWARD , .priority =NF_IP_PRI_SELINUX_FIRST , }, { .hook = selinux_ipv4_output, - .owner =THIS_MODULE , .pf =NFPROTO_IPV4 , .hooknum =NF_INET_LOCAL_OUT , .priority =NF_IP_PRI_SELINUX_FIRST ,
@@ -6149,14 +6146,12 @@ static struct nf_hook_ops selinux_nf_ops[] = { #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) { .hook = selinux_ipv6_postroute, - .owner = THIS_MODULE, .pf = NFPROTO_IPV6, .hooknum = NF_INET_POST_ROUTING, .priority = NF_IP6_PRI_SELINUX_LAST, }, { .hook = selinux_ipv6_forward, - .owner = THIS_MODULE, .pf = NFPROTO_IPV6, .hooknum = NF_INET_FORWARD, .priority = NF_IP6_PRI_SELINUX_FIRST,
security/smack/smack_netfilter.c +0 -2
@@ -57,7 +57,6 @@ static unsigned int smack_ipv4_output(void *priv,static struct nf_hook_ops smack_nf_ops[] = { { .hook = smack_ipv4_output, - .owner =THIS_MODULE , .pf =NFPROTO_IPV4 , .hooknum =NF_INET_LOCAL_OUT , .priority =NF_IP_PRI_SELINUX_FIRST ,
@@ -65,7 +64,6 @@ static struct nf_hook_ops smack_nf_ops[] = {#if defined(CONFIG_IPV6 ) || defined(CONFIG_IPV6_MODULE ) { .hook = smack_ipv6_output, - .owner = THIS_MODULE, .pf = NFPROTO_IPV6, .hooknum = NF_INET_LOCAL_OUT, .priority = NF_IP6_PRI_SELINUX_FIRST,
Signature · 1 line
2.1.4
David Miller
maintainerFrom: Pablo Neira Ayuso <[email protected]>
Date: Sat, 17 Oct 2015 13:32:35 +0200
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.gitHEAD
Pablo, this gives merge conflicts.
This is the second or third time in the past few pulls from you that there have been merge conflicts, even when I haven't made a single change between when you sent the pull request and when I try to integrate it into my tree.
If you can't be certain there won't be merge conflicts, do a test pull into a clone of my tree to see what happens.
Or, if you think the merge conflict is simple enough for me to deal with, mention and explain it in the header posting for the patch series.
Please fix this up and resend your pull request.
Thanks.
Pablo Neira Ayuso
maintainerQuoted 11 lines · David Miller
From: Pablo Neira Ayuso <[email protected]>
Date: Sat, 17 Oct 2015 13:32:35 +0200Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.gitHEADPablo, this gives merge conflicts.
This is the second or third time in the past few pulls from you that there have been merge conflicts, even when I haven't made a single change between when you sent the pull request and when I try to integrate it into my tree.
I was about to fix this here, sorry.