net/ipv6: Increment OUTxxx counters after netfilter hook
authorJeff Barnhill <0xeffeff@gmail.com>
Thu, 5 Apr 2018 21:29:47 +0000 (21:29 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Apr 2018 17:48:32 +0000 (19:48 +0200)
commit584d541c12157989af1491b007721e18ea0503c1
treea154285e77ed4e4c928fe2580d03f191e79655f3
parenteb3dd0f9fedef46620c75818af56213df1935e42
net/ipv6: Increment OUTxxx counters after netfilter hook

[ Upstream commit 71a1c915238c970cd9bdd5bf158b1279d6b6d55b ]

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv6/ip6_output.c