All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Suryaputra <ssuryaextr@gmail.com>
To: Julian Anastasov <ja@ssi.bg>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next] Per interface IPv4 stats (CONFIG_IP_IFSTATS_TABLE)
Date: Thu, 12 Apr 2018 11:58:24 -0400	[thread overview]
Message-ID: <CAHapkUg=XpRqL3y5nMAv+bR_dpCVgLY1Nj28Z1v86j=oM0y2mA@mail.gmail.com> (raw)
In-Reply-To: <alpine.LFD.2.20.1804112208190.2618@ja.home.ssi.bg>

Thanks for the feedbacks. Please see the detail below:

On Wed, Apr 11, 2018 at 3:37 PM, Julian Anastasov <ja@ssi.bg> wrote:
[snip]
>> -     __IP_INC_STATS(net, IPSTATS_MIB_INHDRERRORS);
>> +     __IP_INC_STATS(net, skb_dst(skb)->dev, IPSTATS_MIB_INHDRERRORS);
>
>         May be skb->dev if we want to account it to the
> input device.
>
Yes. I'm about to make change it but see the next one.

[snip]
>> diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c
>> index 4527921..32bd3af 100644
>> --- a/net/netfilter/ipvs/ip_vs_xmit.c
>> +++ b/net/netfilter/ipvs/ip_vs_xmit.c
>> @@ -286,7 +286,7 @@ static inline bool decrement_ttl(struct netns_ipvs *ipvs,
>>       {
>>               if (ip_hdr(skb)->ttl <= 1) {
>>                       /* Tell the sender its packet died... */
>> -                     __IP_INC_STATS(net, IPSTATS_MIB_INHDRERRORS);
>> +                     __IP_INC_STATS(net, skb_dst(skb)->dev, IPSTATS_MIB_INHDRERRORS);
>
>         At this point, skb_dst(skb) can be:
>
> - input route at LOCAL_IN => dst->dev is "lo", skb->dev = input_device
> - output route at LOCAL_OUT => dst->dev is output_device, skb->dev = NULL
>
>         We should see this error on LOCAL_IN but better to be
> safe: use 'skb->dev ? : skb_dst(skb)->dev' instead of just
> 'skb_dst(skb)->dev'.
>
This follows v6 implementation in the same function:

#ifdef CONFIG_IP_VS_IPV6
    if (skb_af == AF_INET6) {
        struct dst_entry *dst = skb_dst(skb);

        /* check and decrement ttl */
        if (ipv6_hdr(skb)->hop_limit <= 1) {
            /* Force OUTPUT device used as source address */
            skb->dev = dst->dev;
            icmpv6_send(skb, ICMPV6_TIME_EXCEED,
                    ICMPV6_EXC_HOPLIMIT, 0);
            __IP6_INC_STATS(net, ip6_dst_idev(dst),
                    IPSTATS_MIB_INHDRERRORS);

            return false;
        }

        /* don't propagate ttl change to cloned packets */
        if (!skb_make_writable(skb, sizeof(struct ipv6hdr)))
            return false;

        ipv6_hdr(skb)->hop_limit--;
    } else
#endif

[snip]
>
>         The patch probably has other errors, for example,
> using rt->dst.dev (lo) when rt->dst.error != 0 in ip_error,
> may be 'dev' should be used instead...

Same also here. Examples are ip6_forward and ip6_pkt_drop.

I think it's better be counted in the input device for them also. Thoughts?

Regards,
Stephen.

  reply	other threads:[~2018-04-12 15:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-11  2:55 [PATCH net-next] Per interface IPv4 stats (CONFIG_IP_IFSTATS_TABLE) Stephen Suryaputra
2018-04-11 16:14 ` Stephen Hemminger
2018-04-11 17:05   ` Stephen Suryaputra
2018-04-11 19:37 ` Julian Anastasov
2018-04-12 15:58   ` Stephen Suryaputra [this message]
2018-04-12 19:48     ` Julian Anastasov
2018-04-12 14:09 ` kbuild test robot

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='CAHapkUg=XpRqL3y5nMAv+bR_dpCVgLY1Nj28Z1v86j=oM0y2mA@mail.gmail.com' \
    --to=ssuryaextr@gmail.com \
    --cc=ja@ssi.bg \
    --cc=netdev@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 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.