All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nf-next] netfilter: use_nf_conn_expires helper in more places
@ 2016-08-03  0:45 Florian Westphal
  2016-08-03  5:05 ` kbuild test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Florian Westphal @ 2016-08-03  0:45 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Florian Westphal

... so we don't need to touch all of these places when we get rid of the
timer in nf_conn.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c | 3 +--
 net/netfilter/nf_conntrack_netlink.c                  | 5 +----
 net/netfilter/nf_conntrack_standalone.c               | 3 +--
 net/netfilter/xt_conntrack.c                          | 4 +---
 4 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
index 6392371..67bfc69 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
@@ -163,8 +163,7 @@ static int ct_seq_show(struct seq_file *s, void *v)
 	ret = -ENOSPC;
 	seq_printf(s, "%-8s %u %ld ",
 		   l4proto->name, nf_ct_protonum(ct),
-		   timer_pending(&ct->timeout)
-		   ? (long)(ct->timeout.expires - jiffies)/HZ : 0);
+		   nf_ct_expires(ct) / HZ);
 
 	if (l4proto->print_conntrack)
 		l4proto->print_conntrack(s, ct);
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 050bb34..68800c1 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -149,10 +149,7 @@ nla_put_failure:
 
 static int ctnetlink_dump_timeout(struct sk_buff *skb, const struct nf_conn *ct)
 {
-	long timeout = ((long)ct->timeout.expires - (long)jiffies) / HZ;
-
-	if (timeout < 0)
-		timeout = 0;
+	long timeout = nf_ct_expires(ct) / HZ;
 
 	if (nla_put_be32(skb, CTA_TIMEOUT, htonl(timeout)))
 		goto nla_put_failure;
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
index 958a145..4e7becd 100644
--- a/net/netfilter/nf_conntrack_standalone.c
+++ b/net/netfilter/nf_conntrack_standalone.c
@@ -224,8 +224,7 @@ static int ct_seq_show(struct seq_file *s, void *v)
 	seq_printf(s, "%-8s %u %-8s %u %ld ",
 		   l3proto->name, nf_ct_l3num(ct),
 		   l4proto->name, nf_ct_protonum(ct),
-		   timer_pending(&ct->timeout)
-		   ? (long)(ct->timeout.expires - jiffies)/HZ : 0);
+		   nf_ct_expires(ct)  / HZ);
 
 	if (l4proto->print_conntrack)
 		l4proto->print_conntrack(s, ct);
diff --git a/net/netfilter/xt_conntrack.c b/net/netfilter/xt_conntrack.c
index 188404b9..a3b8f69 100644
--- a/net/netfilter/xt_conntrack.c
+++ b/net/netfilter/xt_conntrack.c
@@ -233,10 +233,8 @@ conntrack_mt(const struct sk_buff *skb, struct xt_action_param *par,
 		return false;
 
 	if (info->match_flags & XT_CONNTRACK_EXPIRES) {
-		unsigned long expires = 0;
+		unsigned long expires = nf_ct_expires(ct) / HZ;
 
-		if (timer_pending(&ct->timeout))
-			expires = (ct->timeout.expires - jiffies) / HZ;
 		if ((expires >= info->expires_min &&
 		    expires <= info->expires_max) ^
 		    !(info->invert_flags & XT_CONNTRACK_EXPIRES))
-- 
2.7.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH nf-next] netfilter: use_nf_conn_expires helper in more places
  2016-08-03  0:45 [PATCH nf-next] netfilter: use_nf_conn_expires helper in more places Florian Westphal
@ 2016-08-03  5:05 ` kbuild test robot
  2016-08-03 12:53   ` Florian Westphal
  2016-08-03  5:10 ` kbuild test robot
  2016-08-12 10:25 ` Pablo Neira Ayuso
  2 siblings, 1 reply; 6+ messages in thread
From: kbuild test robot @ 2016-08-03  5:05 UTC (permalink / raw)
  To: Florian Westphal; +Cc: kbuild-all, netfilter-devel, Florian Westphal

[-- Attachment #1: Type: text/plain, Size: 2484 bytes --]

Hi Florian,

[auto build test ERROR on nf-next/master]

url:    https://github.com/0day-ci/linux/commits/Florian-Westphal/netfilter-use_nf_conn_expires-helper-in-more-places/20160803-124239
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master
config: i386-randconfig-x018-201631 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   net/netfilter/nf_conntrack_standalone.c: In function 'ct_seq_show':
>> net/netfilter/nf_conntrack_standalone.c:227:6: error: implicit declaration of function 'nf_ct_expires' [-Werror=implicit-function-declaration]
         nf_ct_expires(ct)  / HZ);
         ^~~~~~~~~~~~~
>> net/netfilter/nf_conntrack_standalone.c:224:35: warning: format '%ld' expects argument of type 'long int', but argument 7 has type 'int' [-Wformat=]
     seq_printf(s, "%-8s %u %-8s %u %ld ",
                                      ^
   cc1: some warnings being treated as errors
--
   net/netfilter/nf_conntrack_netlink.c: In function 'ctnetlink_dump_timeout':
>> net/netfilter/nf_conntrack_netlink.c:152:17: error: implicit declaration of function 'nf_ct_expires' [-Werror=implicit-function-declaration]
     long timeout = nf_ct_expires(ct) / HZ;
                    ^~~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   net/netfilter/xt_conntrack.c: In function 'conntrack_mt':
>> net/netfilter/xt_conntrack.c:236:27: error: implicit declaration of function 'nf_ct_expires' [-Werror=implicit-function-declaration]
      unsigned long expires = nf_ct_expires(ct) / HZ;
                              ^~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/nf_ct_expires +227 net/netfilter/nf_conntrack_standalone.c

   218		l3proto = __nf_ct_l3proto_find(nf_ct_l3num(ct));
   219		NF_CT_ASSERT(l3proto);
   220		l4proto = __nf_ct_l4proto_find(nf_ct_l3num(ct), nf_ct_protonum(ct));
   221		NF_CT_ASSERT(l4proto);
   222	
   223		ret = -ENOSPC;
 > 224		seq_printf(s, "%-8s %u %-8s %u %ld ",
   225			   l3proto->name, nf_ct_l3num(ct),
   226			   l4proto->name, nf_ct_protonum(ct),
 > 227			   nf_ct_expires(ct)  / HZ);
   228	
   229		if (l4proto->print_conntrack)
   230			l4proto->print_conntrack(s, ct);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 26622 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH nf-next] netfilter: use_nf_conn_expires helper in more places
  2016-08-03  0:45 [PATCH nf-next] netfilter: use_nf_conn_expires helper in more places Florian Westphal
  2016-08-03  5:05 ` kbuild test robot
@ 2016-08-03  5:10 ` kbuild test robot
  2016-08-12 10:25 ` Pablo Neira Ayuso
  2 siblings, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2016-08-03  5:10 UTC (permalink / raw)
  To: Florian Westphal; +Cc: kbuild-all, netfilter-devel, Florian Westphal

[-- Attachment #1: Type: text/plain, Size: 1923 bytes --]

Hi Florian,

[auto build test ERROR on nf-next/master]

url:    https://github.com/0day-ci/linux/commits/Florian-Westphal/netfilter-use_nf_conn_expires-helper-in-more-places/20160803-124239
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master
config: sparc64-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 5.4.0-6) 5.4.0 20160609
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
        # save the attached .config to linux build tree
        make.cross ARCH=sparc64 

All error/warnings (new ones prefixed by >>):

   net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c: In function 'ct_seq_show':
>> net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c:166:6: error: implicit declaration of function 'nf_ct_expires' [-Werror=implicit-function-declaration]
         nf_ct_expires(ct) / HZ);
         ^
>> net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c:164:16: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'int' [-Wformat=]
     seq_printf(s, "%-8s %u %ld ",
                   ^
   cc1: some warnings being treated as errors

vim +/nf_ct_expires +166 net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c

   158		l3proto = __nf_ct_l3proto_find(nf_ct_l3num(ct));
   159		NF_CT_ASSERT(l3proto);
   160		l4proto = __nf_ct_l4proto_find(nf_ct_l3num(ct), nf_ct_protonum(ct));
   161		NF_CT_ASSERT(l4proto);
   162	
   163		ret = -ENOSPC;
 > 164		seq_printf(s, "%-8s %u %ld ",
   165			   l4proto->name, nf_ct_protonum(ct),
 > 166			   nf_ct_expires(ct) / HZ);
   167	
   168		if (l4proto->print_conntrack)
   169			l4proto->print_conntrack(s, ct);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 46462 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH nf-next] netfilter: use_nf_conn_expires helper in more places
  2016-08-03  5:05 ` kbuild test robot
@ 2016-08-03 12:53   ` Florian Westphal
  2016-08-03 13:26     ` [kbuild-all] " Fengguang Wu
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Westphal @ 2016-08-03 12:53 UTC (permalink / raw)
  To: kbuild test robot; +Cc: Florian Westphal, kbuild-all, netfilter-devel

kbuild test robot <lkp@intel.com> wrote:
> Hi Florian,
> 
> [auto build test ERROR on nf-next/master]
> 
> url:    https://github.com/0day-ci/linux/commits/Florian-Westphal/netfilter-use_nf_conn_expires-helper-in-more-places/20160803-124239
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master
> config: i386-randconfig-x018-201631 (attached as .config)
> compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=i386 
> 
> All error/warnings (new ones prefixed by >>):
> 
>    net/netfilter/nf_conntrack_standalone.c: In function 'ct_seq_show':
> >> net/netfilter/nf_conntrack_standalone.c:227:6: error: implicit declaration of function 'nf_ct_expires' [-Werror=implicit-function-declaration]
>          nf_ct_expires(ct)  / HZ);
>          ^~~~~~~~~~~~~

It would be nice to see the sha1 of 'master'.

Builds fine with this config for me; nf-next master is

commit 6a492b0f23d28e1f946cdf08e54617484400dafb
Merge: d85486d 354a086
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Wed Jul 27 14:48:37 2016 -0700

I guess this was with an older tree...?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [kbuild-all] [PATCH nf-next] netfilter: use_nf_conn_expires helper in more places
  2016-08-03 12:53   ` Florian Westphal
@ 2016-08-03 13:26     ` Fengguang Wu
  0 siblings, 0 replies; 6+ messages in thread
From: Fengguang Wu @ 2016-08-03 13:26 UTC (permalink / raw)
  To: Florian Westphal; +Cc: netfilter-devel, kbuild-all

On Wed, Aug 03, 2016 at 02:53:19PM +0200, Florian Westphal wrote:
>kbuild test robot <lkp@intel.com> wrote:
>> Hi Florian,
>>
>> [auto build test ERROR on nf-next/master]
>>
>> url:    https://github.com/0day-ci/linux/commits/Florian-Westphal/netfilter-use_nf_conn_expires-helper-in-more-places/20160803-124239
>> base:   https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master
>> config: i386-randconfig-x018-201631 (attached as .config)
>> compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
>> reproduce:
>>         # save the attached .config to linux build tree
>>         make ARCH=i386
>>
>> All error/warnings (new ones prefixed by >>):
>>
>>    net/netfilter/nf_conntrack_standalone.c: In function 'ct_seq_show':
>> >> net/netfilter/nf_conntrack_standalone.c:227:6: error: implicit declaration of function 'nf_ct_expires' [-Werror=implicit-function-declaration]
>>          nf_ct_expires(ct)  / HZ);
>>          ^~~~~~~~~~~~~
>
>It would be nice to see the sha1 of 'master'.

It's this SHA1:

https://github.com/0day-ci/linux/commit/4b512e1c1f8de6b9ceb796ecef8658e0a083cab7

Which you may find out by following this URL:

>> url:    https://github.com/0day-ci/linux/commits/Florian-Westphal/netfilter-use_nf_conn_expires-helper-in-more-places/20160803-124239

>Builds fine with this config for me; nf-next master is
>
>commit 6a492b0f23d28e1f946cdf08e54617484400dafb
>Merge: d85486d 354a086
>Author: Linus Torvalds <torvalds@linux-foundation.org>
>Date:   Wed Jul 27 14:48:37 2016 -0700
>
>I guess this was with an older tree...?

Yeah the tested base is the previous version and older than that one.

Thanks,
Fengguang

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH nf-next] netfilter: use_nf_conn_expires helper in more places
  2016-08-03  0:45 [PATCH nf-next] netfilter: use_nf_conn_expires helper in more places Florian Westphal
  2016-08-03  5:05 ` kbuild test robot
  2016-08-03  5:10 ` kbuild test robot
@ 2016-08-12 10:25 ` Pablo Neira Ayuso
  2 siblings, 0 replies; 6+ messages in thread
From: Pablo Neira Ayuso @ 2016-08-12 10:25 UTC (permalink / raw)
  To: Florian Westphal; +Cc: netfilter-devel

On Wed, Aug 03, 2016 at 02:45:07AM +0200, Florian Westphal wrote:
> ... so we don't need to touch all of these places when we get rid of the
> timer in nf_conn.

Also applied, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-08-12 10:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-03  0:45 [PATCH nf-next] netfilter: use_nf_conn_expires helper in more places Florian Westphal
2016-08-03  5:05 ` kbuild test robot
2016-08-03 12:53   ` Florian Westphal
2016-08-03 13:26     ` [kbuild-all] " Fengguang Wu
2016-08-03  5:10 ` kbuild test robot
2016-08-12 10:25 ` Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.