Take a look on TCP source code (fast and slow path). All that you need is very well comented there.

I implemented a protocol called TCP-XM sometime ago (2.6.15.4 to be more precise), and all the doubts and problems that I had (related to the network subsystem) were answered there.

Mail me in private if you need a more detailed help.

DHAJOGLO escreveu:
I've hit a major wall while developing a small kernel module (2.6.18.8).  
Basically, my modules loads and handles ip protocol 253 (experimental).  I have 
successfully received the socket buffer, read the contents and am now trying to 
turn it around and send back a reply.  I'm not sure the proper method for this 
and am rather stuck.  Any help would do.  Here is a brief rundown:

get skb (OK)
read payload (OK)
send back out-----

skb->pkt_type = PACKET_OUTGOING;

iph = skb->nh.iph;
saddr = iph->saddr;
daddr = iph->daddr;
iph->saddr = daddr;
iph->daddr = saddr;

rt = (struct rtable *) skb->dst;

eth = (struct ethhdr *)skb->mac.raw;
memcpy(swap_mac,eth->h_dest,6);
memcpy(eth->h_dest,eth->h_source,6);
memcpy(eth->h_source,swap_mac,6);

NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, skb, NULL,rt->u.dst.dev,dst_output);

-----

This generates error:
ip_rt_bug: a.b.c.d -> e.f.g.h, eth0

if, instead of sending to NF_HOOK I send directly to dev:
dev_queue_xmit(skb_clone(skb, GFP_ATOMIC));

I get a buggy protocol error:
protocol 0800 is buggy, dev eth0

A tcpdump shows that the packet is being generated but its being dropped before 
being sent out.

I don't know how to figure out what to fix in my skb.

Thanks,
-dave


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ




--


--
Best Regards

Alan Menegotto

-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to