2012-03-15 13 views
1

我在/ net/core的dev.c中編輯函數netif_rx,只是爲了在數據包到達時創建printk。重新編輯netif_Rx函數並啓動相應的模塊

I called "make" at the kernel's root directory but i don't know witch module was compiled. I need to update the old-module ir order to turn on the changes that i made. 

If i want to see my changes i need to: 

1-make at the kernel's root directory; 
2- make modules; 
3-make bzImage; 
4- insert the new bzImage on the grub file; 
5-Reboot; 

I want to to access directly to the modulean update withou do all that things. 

你能幫助我嗎?

最好的問候, 裏卡多·裏貝羅

+0

你不能,dev.c被內置到主內核映像中。如果對其進行更改,則必須重新編譯整個內核。 你試圖完成什麼? – ldx 2012-03-17 11:58:32

+0

我想捕獲通過該函數的數據包。我插入一個printk來通知每次數據包到達。我重新編譯了內核並重新啓動。這些變化是成功的。我發送數據包以太網到接口並且不會發生打印,但是如果我使用wireshark進行監控,則數據包會成功到達。可能是什麼問題呢? – Ricardo 2012-03-19 14:43:45

+0

我在網上搜索信息,我發現這個:netif_rx仍然在文件dev.c中,但是用處不大。現在用來接收數據包的函數是netif_receive_skb。你可以向我確認嗎?我還沒有找到原因。非常感謝 – Ricardo 2012-03-19 17:18:02

回答

2

如果我正確地得到你的目標,你可以做最簡單的就是實現,你註冊一個協議處理程序ETH_P_ALLdev_add_pack()自己的內核模塊。這樣,您將接收特定設備(如果還指定pt->dev)或所有設備(如果pt->devNULL)的所有傳入數據包。

+0

謝謝。 veru幫助 – Ricardo 2012-03-27 14:42:54

相關問題