net: skb->rtable accessor
[deliverable/linux.git] / net / ipv4 / tcp.c
index c3dcec5efea58b5004c25a28ebc9fc2d4a4e3503..17b89c523f9d1ac590dbc575c8d6be7664851cbb 100644 (file)
@@ -439,12 +439,14 @@ int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg)
                         !tp->urg_data ||
                         before(tp->urg_seq, tp->copied_seq) ||
                         !before(tp->urg_seq, tp->rcv_nxt)) {
+                       struct sk_buff *skb;
+
                        answ = tp->rcv_nxt - tp->copied_seq;
 
                        /* Subtract 1, if FIN is in queue. */
-                       if (answ && !skb_queue_empty(&sk->sk_receive_queue))
-                               answ -=
-                      tcp_hdr((struct sk_buff *)sk->sk_receive_queue.prev)->fin;
+                       skb = skb_peek_tail(&sk->sk_receive_queue);
+                       if (answ && skb)
+                               answ -= tcp_hdr(skb)->fin;
                } else
                        answ = tp->urg_seq - tp->copied_seq;
                release_sock(sk);
@@ -1382,11 +1384,7 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
 
                /* Next get a buffer. */
 
-               skb = skb_peek(&sk->sk_receive_queue);
-               do {
-                       if (!skb)
-                               break;
-
+               skb_queue_walk(&sk->sk_receive_queue, skb) {
                        /* Now that we have two receive queues this
                         * shouldn't happen.
                         */
@@ -1403,8 +1401,7 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
                        if (tcp_hdr(skb)->fin)
                                goto found_fin_ok;
                        WARN_ON(!(flags & MSG_PEEK));
-                       skb = skb->next;
-               } while (skb != (struct sk_buff *)&sk->sk_receive_queue);
+               }
 
                /* Well, if we have backlog, try to process it now yet. */
 
@@ -2570,7 +2567,7 @@ found:
        flush |= (flags ^ tcp_flag_word(th2)) &
                  ~(TCP_FLAG_CWR | TCP_FLAG_FIN | TCP_FLAG_PSH);
        flush |= th->ack_seq ^ th2->ack_seq;
-       for (i = sizeof(*th); !flush && i < thlen; i += 4)
+       for (i = sizeof(*th); i < thlen; i += 4)
                flush |= *(u32 *)((u8 *)th + i) ^
                         *(u32 *)((u8 *)th2 + i);
 
This page took 0.02724 seconds and 5 git commands to generate.