linux-2.6.22中API結構體的變化

來源:互聯網
上載者:User

主要是昨天在搞Hacking Linux Network Stack的時候,發現裡面的代碼,不能夠在2.6.22下編譯通過,並且提示找不到nh這個成員,我猜想一定是結構體發生了變化。查看/include/linux/skbuff.h發現沒有了原先的聯合h,nh和mac。

union {
struct tcphdr *th;
struct udphdr *uh;
struct icmphdr *icmph;
struct igmphdr *igmph;
struct iphdr *ipiph;
struct ipv6hdr *ipv6h;
unsigned char *raw;
} h;

union {
struct iphdr *iph;
struct ipv6hdr *ipv6h;
struct arphdr *arph;
unsigned char *raw;
} nh;

union {
unsigned char *raw;
} mac;

換成了
sk_buff_data_t transport_header;
sk_buff_data_t network_header;
sk_buff_data_t mac_header;

本身我並不是很支援聯合的使用,即使它能夠節省記憶體,但是實際運行時候還是有一定的時空開銷的。這一改變將會導致很多程式不能夠在2.6.22下使用,比如VMWare;幾乎所有的網卡驅動需要打patch。感覺從2.6.18之後的變化比較大,看Kernel還是選擇2.6.18比較合適。

另外,ktime替換掉了jiffies,這也算是網路部分改變比較大的一個地方了。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.