How to send ACKs from main receiving routine.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

In my transport protocol, like in others, there is one main receiving
routine called by IP when a packet arrives.
When I detect the packet is sort of 'SYN' packet and the socket is in
apropriate state, I would like to send the 'ACK' back to the client.
However, I am confused at this point, since sending this packet _from_ the
receiving routine will eventually trigger this very routine again - like
this /pseudocode/:

main_rcv(struct sk_buff *skb):
 sk = lookup(packet_info)

 if ( (sk->state = STATE_1) && (packet_info == state_1_packet) ) {
	send_ack(sk);
	return 0;
 } else {
	receive normally...
 }
 [...]
 send_ack will trigger main_rcv when sending a packet.


My kernel panicks at some point after 'send_ack(sk);' and this situation
is difficult to debug, so before I'll start inserting printks everywhere --
is my procedure correct? Can I send acks from receiving routine?
('send_ack' works ok in other cases)

Thanks!

-marek


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux