亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫(kù)
最近訪問(wèn)板塊 發(fā)新帖
查看: 1040 | 回復(fù): 0
打印 上一主題 下一主題

LINUX協(xié)議棧之(5) : IP layer process flow [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2007-12-24 11:57 |只看該作者 |倒序?yàn)g覽
Layer 3 : IP Protocol handling
Now we come into the IP world!
1.
The main ip receive routine is : ip_rcv();
2. The process flow of ip_rcv() function
2.1 first checking if this SKB is for other host, if so, free this SKB and return NET_RX_DROP directly
2.2 The share checking
    Checking if more than one person has a reference to this SKB buffer.
    The function skb_share_check() performs this
checking work. If the SKB is shared, then this skb will be cloned and
the old copy drops a reference, the new clone with a single reference
is returned. If the buffer is not shared, the original buffer is
returned.
    !!! i have a question here in the function
skb_share_check() : if the skb->users != 1 then we will clone this
skb and then call kfree_skb() function. In this function, we'll
continue to check the skb->users's value, if this value is 1 then
directly call __kfree_skb() to free this skb, else if this value != 1
then we'll first drop its reference and then test if this value is
equal to 0, if this value != 0 then call __kfree_skb(), else return
directly. ??? So, either skb->user equal to 1 or 2(3,4...), it will
always call __kfree_skb() ???
2.3 IP Layer header checking work
    pskb_may_pull() function check the IP header's length validation.
    first check the ip header length, atleast 5.
    the version must be 4
    the ip package size, at least the size of an ip header.   
    Check the CSUM of this IP header
    Check the total length of this IP package
    Then call the function : pskb_trim_rcsum(). this
function trim the received skb and update the checksum. Because the
transport layer may padded the buffer before.
2.4 The last step : Netfilter or Input finishe ?
    At the last step, we are caught with one of the most
interesting things in linux kernel : netfilter. It just a very famous
macro : NF_HOOK!
    While we'll not plan to describe the netfilter here, so we just jump into our function : ip_rcv_finish().
2.5 Complete the IP receive work : ip_rcv_finish()
    This function is not as simple as it looks!
    First we'll initialise the virtual path cache for
this skb and it describes how the skb travels inside the linux. The
function we used is ip_route_input().
    Second we'll check if this IP packet has options
header, if so we'll handle the option header by calling
ip_rcv_options() function.
    At last, we call the dst_input() to finish this process flow.
3. Enough for outlines
    Now we describes the simple process flow of IP layer
in linux kernel, and next we'll learn how the skb travels inside the
linux kernel stack --- the route!s
               
               
               

本文來(lái)自ChinaUnix博客,如果查看原文請(qǐng)點(diǎn):http://blog.chinaunix.net/u/26397/showart_449024.html
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國(guó)互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過(guò)ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP