Skip to contentSkip to conversation

Network implementation

DISCUSSION an7 1 participant 1 message Oct 20, 2003

lore
Share & tools
lore

an7

author
#0 lore raw

Hi, i am a french engineer who has some work to do on TCP/IP implementation in the linux kernel.

I have three questions on it :

1) What are the advantages of using a ring buffer for receiving and queuing packets ?

2) in tcp_minisocks.c in linux i get, in the function which handles segment arrival in FIN_WAIT_2 state :

if (th->syn && !before(TCP_SKB_CB(skb)->seq, tw->rcv_nxt))

                         goto kill_with_rst;

Just to confirm : in the state FIN_WAIT_2 a SYN segment is automatically killed by a RST, unless its sequence number is superior to the waited sequence number. But in this case , what happens ? I think the RFC tells to send a ACK. Am i right ?

3) the function tcp_recv_skb() (tcp.c)

struct sk_buff *tcp_recv_skb(struct sock *sk, u32 seq, u32 *off)
1383 {
1384 struct sk_buff *skb;
1385 u32 offset;
1386
1387 skb_queue_walk(&sk->receive_queue, skb) {
1388 offset = seq -
TCP_SKB_CB(skb)->seq;
1389 if (skb->h.th->syn)
1390 offset--;
1391 if (offset < skb->len ||
skb->h.th->fin) {
1392 *off = offset;
1393 return skb;
1394 }
1395 }
1396 return NULL;
1397 }

I just can't understand the role of offset (and thus, i can't undersand why it is decremented with a syn segment, and why we can return the skb structure when we have an offset inferior to the skb len, or a FIN segment)

Could you help please ?

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com