lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20160310015500.GA68025@kafai-mba.local>
Date:	Wed, 9 Mar 2016 17:55:00 -0800
From:	Martin KaFai Lau <kafai@...com>
To:	Yuchung Cheng <ycheng@...gle.com>
CC:	netdev <netdev@...r.kernel.org>, Kernel Team <kernel-team@...com>,
	Chris Rapier <rapier@....edu>,
	Eric Dumazet <edumazet@...gle.com>,
	Marcelo Ricardo Leitner <mleitner@...hat.com>,
	Neal Cardwell <ncardwell@...gle.com>
Subject: Re: [PATCH net-next v3] tcp: Add RFC4898 tcpEStatsPerfDataSegsOut/In

On Wed, Mar 09, 2016 at 03:11:50PM -0800, Yuchung Cheng wrote:
> On Wed, Mar 9, 2016 at 10:43 AM, Martin KaFai Lau <kafai@...com> wrote:
> > diff --git a/include/net/tcp.h b/include/net/tcp.h
> > index e90db85..24557a8 100644
> > --- a/include/net/tcp.h
> > +++ b/include/net/tcp.h
> > @@ -1816,4 +1816,14 @@ static inline void skb_set_tcp_pure_ack(struct sk_buff *skb)
> >         skb->truesize = 2;
> >  }
> >
> > +static inline void tcp_segs_in(struct tcp_sock *tp, const struct sk_buff *skb)
> > +{
> > +       u16 segs_in;
> > +
> > +       segs_in = max_t(u16, 1, skb_shinfo(skb)->gso_segs);
> > +       tp->segs_in += segs_in;
> > +       if (skb->len > tcp_hdrlen(skb))
> > +               tp->data_segs_in += segs_in;
> > +}
> > +
> >  #endif /* _TCP_H */
> > diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c
> > index fdb286d..f583c85 100644
> > --- a/net/ipv4/tcp_fastopen.c
> > +++ b/net/ipv4/tcp_fastopen.c
> > @@ -131,6 +131,7 @@ static bool tcp_fastopen_cookie_gen(struct request_sock *req,
> >  void tcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb)
> >  {
> >         struct tcp_sock *tp = tcp_sk(sk);
> > +       u16 segs_in;
> >
> >         if (TCP_SKB_CB(skb)->end_seq == tp->rcv_nxt)
> >                 return;
> > @@ -154,6 +155,9 @@ void tcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb)
> >          * as we certainly are not changing upper 32bit value (0)
> >          */
> >         tp->bytes_received = skb->len;
> > +       segs_in = max_t(u16, 1, skb_shinfo(skb)->gso_segs);
> > +       tp->segs_in = segs_in;
> > +       tp->data_segs_in = segs_in;
> why not use the new tcp_segs_in() helper?
It is because
segs_in has been set to 1 by tcp_create_openreq_child(), so calling
tcp_segs_in() will have it double counted
and
tcphdr has been pulled from skb, so skb->len does not include tcp_hdrlen.

I will add some remark in this change.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ