All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: "Adam Langley" <agl@imperialviolet.org>
Cc: netdev@vger.kernel.org
Subject: Re: MD5 SG fix
Date: Tue, 1 Jul 2008 15:49:05 -0700	[thread overview]
Message-ID: <20080701154905.5226863f@extreme> (raw)
In-Reply-To: <396556a20805301217k293e5718h6bbf02bfe0683153@europa>

On Tue, 1 Jul 2008 15:38:14 -0700
"Adam Langley" <agl@imperialviolet.org> wrote:

>  static int tcp_v6_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
>  				   struct in6_addr *saddr,
>  				   struct in6_addr *daddr,
> -				   struct tcphdr *th, int protocol,
> -				   unsigned int tcplen)
> +				   int protocol,
> +				   struct tcphdr *th, int data_off, int tcplen,
> +				   struct skb_shared_info *frags)
>  {
> -	struct scatterlist sg[4];
> -	__u16 data_len;
> +	struct scatterlist sg[MAX_SKB_FRAGS + 3];
> +	const int head_data_len = tcplen - data_off;
>  	int block = 0;
>  	__sum16 cksum;
>  	struct tcp_md5sig_pool *hp;
>  	struct tcp6_pseudohdr *bp;
>  	struct hash_desc *desc;
> -	int err;
> -	unsigned int nbytes = 0;
> +	int err, i;
> +	unsigned int nbytes = tcplen;
>  
>  	hp = tcp_get_md5sig_pool();
>  	if (!hp) {
> @@ -760,10 +761,15 @@ static int tcp_v6_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
>  	/* 1. TCP pseudo-header (RFC2460) */
>  	ipv6_addr_copy(&bp->saddr, saddr);
>  	ipv6_addr_copy(&bp->daddr, daddr);
> -	bp->len = htonl(tcplen);
>  	bp->protocol = htonl(protocol);
> +	if (frags)
> +		for (i = 0; i < frags->nr_frags; ++i)
> +			nbytes += frags->frags[i].size;
> +	bp->len = htonl(nbytes);
> +	nbytes = 0;

Just pass the skb in and not tcplen, frags, ...
avoid all this nonsense.  tcplen == skb->len, and you have the correct size info.


  parent reply	other threads:[~2008-07-01 22:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-01 21:16 MD5 SG fix Adam Langley
2008-07-01 21:39 ` Stephen Hemminger
2008-07-01 21:48   ` Adam Langley
2008-07-01 21:49     ` Adam Langley
2008-07-01 22:38       ` Adam Langley
2008-07-01 22:46         ` Stephen Hemminger
2008-07-01 22:49         ` Stephen Hemminger [this message]
2008-07-01 22:52           ` Adam Langley
2008-07-01 23:10             ` Stephen Hemminger
2008-07-02  4:55         ` Evgeniy Polyakov
2008-07-04  0:07           ` Adam Langley
2008-07-04  4:02             ` Stephen Hemminger

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=20080701154905.5226863f@extreme \
    --to=shemminger@vyatta.com \
    --cc=agl@imperialviolet.org \
    --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.