Subject: Re: kern/34751: regular panics in tcp_sack_option on NetBSD/alpha 3.0_STABLE
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Christos Zoulas <christos@zoulas.com>
List: netbsd-bugs
Date: 10/09/2006 02:15:10
The following reply was made to PR kern/34751; it has been noted by GNATS.

From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, kern-bug-people@netbsd.org,
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, eric@cirr.com
Cc: 
Subject: Re: kern/34751: regular panics in tcp_sack_option on NetBSD/alpha 3.0_STABLE
Date: Sun, 8 Oct 2006 22:13:08 -0400

 On Oct 8,  4:55am, christianbiere@gmx.de (Christian Biere) wrote:
 -- Subject: Re: kern/34751: regular panics in tcp_sack_option on NetBSD/alpha
 
 Breaks on big endian machines.
 
 christos
 
 |  +static inline u_int32_t
 |  +peek_be32(const void *p)
 |  +{
 |  +	const u_int8_t *u8 = p;
 |  +	return	((u_int32_t) u8[0] << 24) |
 |  +		((u_int32_t) u8[1] << 16) |
 |  +		((u_int32_t) u8[2] << 8) |
 |  +		((u_int32_t) u8[3]);
 |  +}
 |  +
 |   void
 |   tcp_new_dsack(struct tcpcb *tp, tcp_seq seq, u_int32_t len)
 |   {
 |  @@ -223,10 +233,8 @@
 |   	num_sack_blks = optlen / 8;
 |   	acked = (SEQ_GT(th->th_ack, tp->snd_una)) ? th->th_ack : tp->snd_una;
 |   	for (i = 0; i < num_sack_blks; i++, lp += 2) {
 |  -		memcpy(&left, lp, sizeof(*lp));
 |  -		memcpy(&right, lp + 1, sizeof(*lp));
 |  -		left = ntohl(left);
 |  -		right = ntohl(right);
 |  +		left = peek_be32(lp);
 |  +		right = peek_be32(lp + 1);
 |   
 |   		if (SEQ_LEQ(right, acked) || SEQ_GT(right, tp->snd_max) ||
 |   		    SEQ_GEQ(left, right)) {
 |  
 -- End of excerpt from Christian Biere