From: Brendan Johnson <johnsobm@clarkson.edu> Date: 05 Dec 2002 12:04:58 -0500 Some explicit questions I have are: After being processed by the IP layer, what TCP function does it get handed up to? what forum does it get handed up in, a struct? If so what are the fields? I'm insanely pissed off when I see questions like this which show that the person asking them has made absolutely no reasonable effort on their part to figure out the answer on their own and wants other people to do the work for you. I don't think you're really reading any of the source code at all if you still have questions like this. In fact I'm going to demonstrate how little work is needed to answer your question. If you did read the code, you'd see that ip_input calls the handler indexed by protocal type in the array inet_protos[]. So you're next task would be to figure out how this inet_protos[] array gets initialized, let's run grep on net/ipv4/*.c to see where that happens: [davem@nuts sparc-2.5]$ egrep inet_protos net/ipv4/*.c net/ipv4/af_inet.c: struct inet_protosw *answer; net/ipv4/af_inet.c: answer = list_entry(p, struct inet_protosw, list); net/ipv4/af_inet.c:static struct inet_protosw inetsw_array[] = net/ipv4/af_inet.c:#define INETSW_ARRAY_LEN (sizeof(inetsw_array) / sizeof(struct inet_p\rotosw)) net/ipv4/af_inet.c:void inet_register_protosw(struct inet_protosw *p) net/ipv4/af_inet.c: struct inet_protosw *answer; net/ipv4/af_inet.c: answer = list_entry(lh, struct inet_protosw, list); net/ipv4/af_inet.c:void inet_unregister_protosw(struct inet_protosw *p) net/ipv4/af_inet.c: struct inet_protosw *q; net/ipv4/icmp.c: ipprot = inet_protos[hash]; net/ipv4/ip_input.c: if ((ipprot = inet_protos[hash]) != NULL) { net/ipv4/protocol.c:struct inet_protocol *inet_protos[MAX_INET_PROTOS]; net/ipv4/protocol.c: if (inet_protos[hash]) { net/ipv4/protocol.c: inet_protos[hash] = prot; net/ipv4/protocol.c: if (inet_protos[hash] == prot) { net/ipv4/protocol.c: inet_protos[hash] = NULL; [davem@nuts sparc-2.5]$ It seems the only place this gets assigned is in net/ipv4/protocol.c in the function "inet_add_protocol()" Let's see where that is invoked for TCP, and we'd discover that this occurs during inet_init() as we traverse the inet_protocol_base list, one of which is tcp_protocol in net/ipv4/protocol.c which has "handler" member "tcp_v4_rcv()". And you'd simply find tcp_v4_rcv in net/ipv4/tcp_ipv4.c, and you'd thus see the arguments to that function and thus how the packets are passed in by TCP input. So I am going to ask you blatantly why this was such a difficult thing to figure out on your own? This didn't require any specific kernel knowledge. Rather it took a few minutes, using a few simple text searching tools, some common sense and above all very basic C programming knowledge. Simply put, the answer is that you're too damn lazy to do the work to figure this stuff out yourself and you want other people to do the work for you. I simply can't respect such lazy people who leach off mailing lists to get answers they can full well answer yourself. - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html