* [PATCH net] net/ipv6: Increment OUTxxx counters after netfilter hook
@ 2018-04-05 21:29 Jeff Barnhill
2018-04-06 2:24 ` David Miller
2018-04-10 13:49 ` Sasha Levin
0 siblings, 2 replies; 4+ messages in thread
From: Jeff Barnhill @ 2018-04-05 21:29 UTC (permalink / raw)
To: netdev; +Cc: dsahern, Jeff Barnhill
At the end of ip6_forward(), IPSTATS_MIB_OUTFORWDATAGRAMS and
IPSTATS_MIB_OUTOCTETS are incremented immediately before the NF_HOOK call
for NFPROTO_IPV6 / NF_INET_FORWARD. As a result, these counters get
incremented regardless of whether or not the netfilter hook allows the
packet to continue being processed. This change increments the counters
in ip6_forward_finish() so that it will not happen if the netfilter hook
chooses to terminate the packet, which is similar to how IPv4 works.
Signed-off-by: Jeff Barnhill <0xeffeff@gmail.com>
---
net/ipv6/ip6_output.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index b8ee50e94af3..2e891d2c30ef 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -375,6 +375,11 @@ static int ip6_forward_proxy_check(struct sk_buff *skb)
static inline int ip6_forward_finish(struct net *net, struct sock *sk,
struct sk_buff *skb)
{
+ struct dst_entry *dst = skb_dst(skb);
+
+ __IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTFORWDATAGRAMS);
+ __IP6_ADD_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTOCTETS, skb->len);
+
return dst_output(net, sk, skb);
}
@@ -569,8 +574,6 @@ int ip6_forward(struct sk_buff *skb)
hdr->hop_limit--;
- __IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTFORWDATAGRAMS);
- __IP6_ADD_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTOCTETS, skb->len);
return NF_HOOK(NFPROTO_IPV6, NF_INET_FORWARD,
net, NULL, skb, skb->dev, dst->dev,
ip6_forward_finish);
--
2.14.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] net/ipv6: Increment OUTxxx counters after netfilter hook
2018-04-05 21:29 [PATCH net] net/ipv6: Increment OUTxxx counters after netfilter hook Jeff Barnhill
@ 2018-04-06 2:24 ` David Miller
2018-04-10 13:49 ` Sasha Levin
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2018-04-06 2:24 UTC (permalink / raw)
To: 0xeffeff; +Cc: netdev, dsahern
From: Jeff Barnhill <0xeffeff@gmail.com>
Date: Thu, 5 Apr 2018 21:29:47 +0000
> At the end of ip6_forward(), IPSTATS_MIB_OUTFORWDATAGRAMS and
> IPSTATS_MIB_OUTOCTETS are incremented immediately before the NF_HOOK call
> for NFPROTO_IPV6 / NF_INET_FORWARD. As a result, these counters get
> incremented regardless of whether or not the netfilter hook allows the
> packet to continue being processed. This change increments the counters
> in ip6_forward_finish() so that it will not happen if the netfilter hook
> chooses to terminate the packet, which is similar to how IPv4 works.
>
> Signed-off-by: Jeff Barnhill <0xeffeff@gmail.com>
Yep, this is more consistent with ipv4.
Applied, thank you.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net/ipv6: Increment OUTxxx counters after netfilter hook
2018-04-05 21:29 [PATCH net] net/ipv6: Increment OUTxxx counters after netfilter hook Jeff Barnhill
@ 2018-04-10 13:49 ` Sasha Levin
2018-04-10 13:49 ` Sasha Levin
1 sibling, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2018-04-10 13:49 UTC (permalink / raw)
To: Sasha Levin, Jeff Barnhill, netdev; +Cc: dsahern, Jeff Barnhill, stable
Hi,
[This is an automated email]
This commit has been processed by the -stable helper bot and determined
to be a high probability candidate for -stable trees. (score: 5.8567)
The bot has tested the following trees: v4.16.1, v4.15.16, v4.14.33, v4.9.93, v4.4.127.
v4.16.1: Build OK!
v4.15.16: Build OK!
v4.14.33: Build OK!
v4.9.93: Build OK!
v4.4.127: Failed to apply! Possible dependencies:
1d0155035918 ("ipv6: rename IP6_INC_STATS_BH()")
Please let us know if you'd like to have this patch included in a stable tree.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net/ipv6: Increment OUTxxx counters after netfilter hook
@ 2018-04-10 13:49 ` Sasha Levin
0 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2018-04-10 13:49 UTC (permalink / raw)
To: Sasha Levin, Jeff Barnhill, netdev; +Cc: dsahern, Jeff Barnhill, stable
Hi,
[This is an automated email]
This commit has been processed by the -stable helper bot and determined
to be a high probability candidate for -stable trees. (score: 5.8567)
The bot has tested the following trees: v4.16.1, v4.15.16, v4.14.33, v4.9.93, v4.4.127.
v4.16.1: Build OK!
v4.15.16: Build OK!
v4.14.33: Build OK!
v4.9.93: Build OK!
v4.4.127: Failed to apply! Possible dependencies:
1d0155035918 ("ipv6: rename IP6_INC_STATS_BH()")
Please let us know if you'd like to have this patch included in a stable tree.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-04-10 13:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-05 21:29 [PATCH net] net/ipv6: Increment OUTxxx counters after netfilter hook Jeff Barnhill
2018-04-06 2:24 ` David Miller
2018-04-10 13:49 ` Sasha Levin
2018-04-10 13:49 ` Sasha Levin
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.