Re: hashing functions

David S. Miller (davem@dm.cobaltmicro.com)
Sun, 22 Feb 1998 13:59:51 -0800


Date: Sun, 22 Feb 1998 14:32:09 +0000 (GMT)
From: Mark Stacey <heathclf@skynet.csn.ul.ie>

The function do_tcp_sendmsg() is then called which looks after the
sending of the data. Using tcpdump, I can see the first packet with
the SYN, FIN and data being sent out, followed by the receipt of a
SYN, ACK (second packet in a three way handshake), but the
tcp_rcv() function bombs out on this packet when the
tcp_v4_lookup() code fails, and sends a reset.

I presume what's happening is that I'm missing out on something in
the setting up of the socket, something to do with the hash
table. I am actually calling the tcp_v4_rehash function whenever a
change of state occurs, I've even tried explicitly calling the
tcp_v4_hash() function.. All to no avail.

Any ideas as to where I'm going wrong.

A rehash is necessary not only at the point of a state change, it must
also be called whenever any of:

sk->rcv_saddr
sk->num
sk->daddr
sk->dummy_th.dest

change in any way, as these values determine the results of the hash
function. The state field of the socket only determines which hash
table the socket lives in.

So, in short, you must call rehash() during sk->state changes, and
also at the point of socket identity (addr/port) changes.

Later,
David S. Miller
davem@dm.cobaltmicro.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu