From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Jeff Barnhill <0xeffeff@gmail.com>,
"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 4.16 04/18] net/ipv6: Increment OUTxxx counters after netfilter hook
Date: Wed, 11 Apr 2018 00:23:39 +0200 [thread overview]
Message-ID: <20180410212758.789994485@linuxfoundation.org> (raw)
In-Reply-To: <20180410212758.564682823@linuxfoundation.org>
4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Barnhill <0xeffeff@gmail.com>
[ 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 | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -375,6 +375,11 @@ static int ip6_forward_proxy_check(struc
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);
next prev parent reply other threads:[~2018-04-10 22:23 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-10 22:23 [PATCH 4.16 00/18] 4.16.2-stable review Greg Kroah-Hartman
2018-04-10 22:23 ` [PATCH 4.16 01/18] sparc64: Oracle DAX driver depends on SPARC64 Greg Kroah-Hartman
2018-04-10 22:23 ` [PATCH 4.16 02/18] arp: fix arp_filter on l3slave devices Greg Kroah-Hartman
2018-04-10 22:23 ` [PATCH 4.16 03/18] net: dsa: Discard frames from unused ports Greg Kroah-Hartman
2018-04-10 22:23 ` Greg Kroah-Hartman [this message]
2018-04-10 22:23 ` [PATCH 4.16 05/18] net/sched: fix NULL dereference in the error path of tcf_bpf_init() Greg Kroah-Hartman
2018-04-10 22:23 ` [PATCH 4.16 06/18] pptp: remove a buggy dst release in pptp_connect() Greg Kroah-Hartman
2018-04-10 22:23 ` [PATCH 4.16 07/18] sctp: do not leak kernel memory to user space Greg Kroah-Hartman
2018-04-10 22:23 ` [PATCH 4.16 08/18] sctp: sctp_sockaddr_af must check minimal addr length for AF_INET6 Greg Kroah-Hartman
2018-04-10 22:23 ` [PATCH 4.16 09/18] sky2: Increase D3 delay to sky2 stops working after suspend Greg Kroah-Hartman
2018-04-10 22:23 ` [PATCH 4.16 10/18] vlan: also check phy_driver ts_info for vlans real device Greg Kroah-Hartman
2018-04-10 22:23 ` [PATCH 4.16 11/18] net: fool proof dev_valid_name() Greg Kroah-Hartman
2018-04-10 22:23 ` [PATCH 4.16 12/18] ip_tunnel: better validate user provided tunnel names Greg Kroah-Hartman
2018-04-10 22:23 ` [PATCH 4.16 13/18] ipv6: sit: " Greg Kroah-Hartman
2018-04-10 22:23 ` [PATCH 4.16 14/18] ip6_gre: " Greg Kroah-Hartman
2018-04-10 22:23 ` [PATCH 4.16 15/18] ip6_tunnel: " Greg Kroah-Hartman
2018-04-10 22:23 ` [PATCH 4.16 16/18] vti6: " Greg Kroah-Hartman
2018-04-10 22:23 ` [PATCH 4.16 17/18] net_sched: fix a missing idr_remove() in u32_delete_key() Greg Kroah-Hartman
2018-04-10 22:23 ` [PATCH 4.16 18/18] nfp: use full 40 bits of the NSP buffer address Greg Kroah-Hartman
2018-04-11 6:02 ` [PATCH 4.16 00/18] 4.16.2-stable review kernelci.org bot
2018-04-11 17:15 ` Shuah Khan
2018-04-12 12:31 ` Greg Kroah-Hartman
2018-04-11 17:27 ` Guenter Roeck
2018-04-12 12:31 ` Greg Kroah-Hartman
2018-04-11 19:26 ` Dan Rue
2018-04-12 12:32 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180410212758.789994485@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=0xeffeff@gmail.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).