Skip to contentSkip to conversation

save source address on accept()

PATCH In review Tim Hockin 2 participants 3 messages Jun 1, 2001

Subsystems (2)
lore
Share & tools
lore

Tim Hockin

author
#0 lore raw

PATCH 1/1 save source address on accept()

All,

attached is a (small) patch which saves the src address on tcp_accept(). Please let me know if there are any problems taking this for general inclusion.

Tim

Signature · 4 lines
Tim Hockin
Systems Software Engineer
Sun Microsystems, Cobalt Server Appliances
[email protected]
net/ipv4/tcp.c +1 -0
diff -ruN dist-2.4.5/net/ipv4/tcp.c cobalt-2.4.5/net/ipv4/tcp.c
@@ -2138,6 +2138,7 @@
 		tp->accept_queue_tail = NULL;
 
  	newsk = req->sk;
+	newsk->rcv_saddr = req->af.v4_req.loc_addr;
 	tcp_acceptq_removed(sk);
 	tcp_openreq_fastfree(req);
 	BUG_TRAP(newsk->state != TCP_SYN_RECV);
#1 lore raw
Quoted 3 lines · Tim Hockin

attached is a (small) patch which saves the src address on tcp_accept(). Please let me know if there are any problems taking this for general inclusion.

And what would this even be used for? I see no need for it.

Later,
David S. Miller
[email protected]

#2 lore raw
In reply to Tim Hockin
Quoted 3 lines · Tim Hockin

attached is a (small) patch which saves the src address on tcp_accept(). Please let me know if there are any problems taking this for general inclusion.

..

net/ipv4/tcp.c line 2144

Quoted 10 lines
net/ipv4/tcp.c +1 -0
@@ -2138,6 +2138,7 @@
 		tp->accept_queue_tail = NULL;
 
  	newsk = req->sk;
+	newsk->rcv_saddr = req->af.v4_req.loc_addr;
 	tcp_acceptq_removed(sk);
 	tcp_openreq_fastfree(req);
 	BUG_TRAP(newsk->state != TCP_SYN_RECV);

Tim, this is in fact completely bogus, it is already being done in tcp_v{4,6}_syn_recv_sock(), so there is no reason to do the exact same thing again here in tcp_accept().

Later,
David S. Miller
[email protected]