遇到的问题
1.调试老是弹出以下问题
/home/smb/pro/16th_virtnet/virtnet.c: In function 'emulator_rx_packet':
/home/smb/pro/16th_virtnet/virtnet.c:48: error: dereferencing pointer to incomplete type
/home/smb/pro/16th_virtnet/virtnet.c:49: error: dereferencing pointer to incomplete type
/home/smb/pro/16th_virtnet/virtnet.c:55: error: invalid application of 'sizeof' to incomplete type 'struct iphdr'
/home/smb/pro/16th_virtnet/virtnet.c:59: error: dereferencing pointer to incomplete type
/home/smb/pro/16th_virtnet/virtnet.c:60: error: dereferencing pointer to incomplete type
/home/smb/pro/16th_virtnet/virtnet.c:60: error: dereferencing pointer to incomplete type
make[2]: *** [/home/smb/pro/16th_virtnet/virtnet.o] 错误 1
make[1]: *** [_module_/home/smb/pro/16th_virtnet] 错误 2
make[1]: Leaving directory `/home/smb/pro/linux-2

本文记录了一次虚拟网卡的实验过程,包括在编译时遇到的因缺少头文件‘ip.h’导致的错误,以及在insmod模块后,ifconfig配置IP并进行ping测试时,发现hard_start_xmit函数未按预期调用的问题。实验揭示了广播通信和不同IP响应的网络行为。
最低0.47元/天 解锁文章
8188

被折叠的 条评论
为什么被折叠?



