資料包發送與鄰居子系統

來源:互聯網
上載者:User

資料包從L4傳到IP後,IP調用路由子系統來查詢路由,並且在查詢到路由後,建立一個新的鄰居項(struct neigh)

與該路由項綁定。該neigh的初始狀態為INCOMPLETE,此時在調用發送函數ip_finish_output2中調用

if (dst->hh)
  return neigh_hh_output(dst->hh, skb);
 else if (dst->neighbour)
  return dst->neighbour->output(skb);

 

處於INCOMPLETE狀態下,output函數為neigh_resolve_output

該函數為:

if (!dst || !(neigh = dst->neighbour))
  goto discard;

 __skb_pull(skb, skb_network_offset(skb));

 if (!neigh_event_send(neigh, skb))

 

在__neigh_event_send函數中,資料包被存入緩衝隊列

if (neigh->nud_state == NUD_INCOMPLETE) {
  if (skb) {
   if (skb_queue_len(&neigh->arp_queue) >=
       neigh->parms->queue_len) {
    struct sk_buff *buff;
    buff = __skb_dequeue(&neigh->arp_queue);
    kfree_skb(buff);
    NEIGH_CACHE_STAT_INC(neigh->tbl, unres_discards);
   }
   __skb_queue_tail(&neigh->arp_queue, skb);
  }
  rc = 1;
 }

 

可以看出,如果在neigh的ARP未收到應答包前,如果發出了多個資料包,且個數超過了緩衝隊列的大小,則會直接丟棄

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.