[IPV4]: Add 'rtable' field in struct sk_buff to alias 'dst' and avoid casts
[deliverable/linux.git] / net / ipv4 / tcp_ipv4.c
index 3b26f9586dcb7a30f278c84bb6a98858235cd7be..a79e324638eb3c89ec222d58b7d375da82c5ae02 100644 (file)
@@ -552,7 +552,7 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)
        if (th->rst)
                return;
 
-       if (((struct rtable *)skb->dst)->rt_type != RTN_LOCAL)
+       if (skb->rtable->rt_type != RTN_LOCAL)
                return;
 
        /* Swap the send and the receive. */
@@ -1262,8 +1262,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
 #endif
 
        /* Never answer to SYNs send to broadcast or multicast */
-       if (((struct rtable *)skb->dst)->rt_flags &
-           (RTCF_BROADCAST | RTCF_MULTICAST))
+       if (skb->rtable->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST))
                goto drop;
 
        /* TW buckets are converted to open requests without
@@ -1355,8 +1354,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
                            (s32)(peer->tcp_ts - req->ts_recent) >
                                                        TCP_PAWS_WINDOW) {
                                NET_INC_STATS_BH(LINUX_MIB_PAWSPASSIVEREJECTED);
-                               dst_release(dst);
-                               goto drop_and_free;
+                               goto drop_and_release;
                        }
                }
                /* Kill the following clause, if you dislike this way. */
@@ -1376,24 +1374,21 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
                                       "request from %u.%u.%u.%u/%u\n",
                                       NIPQUAD(saddr),
                                       ntohs(tcp_hdr(skb)->source));
-                       dst_release(dst);
-                       goto drop_and_free;
+                       goto drop_and_release;
                }
 
                isn = tcp_v4_init_sequence(skb);
        }
        tcp_rsk(req)->snt_isn = isn;
 
-       if (__tcp_v4_send_synack(sk, req, dst))
+       if (__tcp_v4_send_synack(sk, req, dst) || want_cookie)
                goto drop_and_free;
 
-       if (want_cookie) {
-               reqsk_free(req);
-       } else {
-               inet_csk_reqsk_queue_hash_add(sk, req, TCP_TIMEOUT_INIT);
-       }
+       inet_csk_reqsk_queue_hash_add(sk, req, TCP_TIMEOUT_INIT);
        return 0;
 
+drop_and_release:
+       dst_release(dst);
 drop_and_free:
        reqsk_free(req);
 drop:
This page took 0.036074 seconds and 5 git commands to generate.