Re: Bug with FIONREAD for TCP?

From: Richard Gooch (rgooch@ras.ucalgary.ca)
Date: Wed Apr 12 2000 - 11:21:48 EST


kuznet@ms2.inr.ac.ru writes:
> Hello!
>
> > I've been using this technique for nearly 10 years, and FIONREAD has
> > always yielded 0 bytes readable on close
>
> Please, check this.

Yep, it fixes it. Thanks.

> --- ../vger3-000409/linux/net/ipv4/tcp.c Sun Apr 9 18:45:19 2000
> +++ linux/net/ipv4/tcp.c Tue Apr 11 21:43:40 2000
> @@ -583,9 +583,13 @@
> answ = 0;
> else if (sk->urginline || !tp->urg_data ||
> before(tp->urg_seq,tp->copied_seq) ||
> - !before(tp->urg_seq,tp->rcv_nxt))
> + !before(tp->urg_seq,tp->rcv_nxt)) {
> answ = tp->rcv_nxt - tp->copied_seq;
> - else
> +
> + /* Subtract 1, if FIN is in queue. */
> + if (answ && !skb_queue_empty(&sk->receive_queue))
> + answ -= ((struct sk_buff*)sk->receive_queue.prev)->h.th->fin;
> + } else
> answ = tp->urg_seq - tp->copied_seq;
> release_sock(sk);
> break;

-- 
				Regards,

Richard.... Permanent: rgooch@atnf.csiro.au Current: rgooch@ras.ucalgary.ca

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Apr 15 2000 - 21:00:19 EST