On Tue, 2012-05-29 at 22:36 +0200, Christoph Paasch wrote: [...cut...] > >> Concerning (2): > >> > >> Imagine, a SYN coming in, when the reqsk-queue is not yet full. A > >> request-sock will be added to the reqsk-queue. Then, a retransmission of > >> this SYN comes in and the queue got full by the time. This time > >> tcp_v4_syn_conn_limit will do syn-cookies and thus generate a different > >> seq-number for the SYN/ACK. > > > > I have addressed your issue, by checking the reqsk_queue in > > tcp_v4_syn_conn_limit() before allocating a new req via > > inet_reqsk_alloc(). > > If I find an existing reqsk, I choose to drop it, so the SYN cookie > > SYN-ACK takes precedence, as the path/handling of the last ACK doesn't > > find this reqsk. This is done under the lock. > > Then the receiver will receive two SYN/ACK's for the same SYN with > different sequence-numbers. As the "SYN cookie SYN-ACK" will arrive > second, it will be discarded and seq-numbers from the first one will be > taken on the client-side. I thought that the retransmitted SYN packet, were caused by the SYN-ACK didn't reach the client? > Then, the connection will never establish, as both sides "agreed" on > different sequence numbers. > > I would say, you have to handle the retransmitted SYN as in > tcp_v4_hnd_req by calling tcp_check_req. Choosing that code path, should be easy by simply returning 0 (no_limit) from my function tcp_v4_syn_conn_limit(), to indicate that the normal slow code path should be chosen. I guess this will not pose a big attack angle, as the entries in reqsk_queue will be fairly small. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html