- 论坛徽章:
- 0
|
各位大虾们:我是内核新手
最近在内核的协议栈里面的代码动了手脚,
我在net/ipv4/tcp_ipv4.c 文件的int tcp_v4_rcv函数中 加了一点代码
int tcp_v4_rcv(struct sk_buff *skb)
{
。。。。
th = tcp_hdr(skb);
if (th->doff < sizeof(struct tcphdr) / 4)
goto bad_packet;
if (!pskb_may_pull(skb, th->doff * 4))
goto discard_it;
/* An explanation is required here, I think.
* Packet length and doff are validated by ader prediction,
* provided case of th->doff==0 is eliminated.
* So, we defer the checks. */
if (!skb_csum_unnecessary(skb) && tcp_v4_checnksum_init(skb))
goto bad_packet;
if(sk->sk_state == TCP_ESTABLISHED)//no three hand
{
}
......
}
我的想法是准备在建立连接之后 接收方 在tcp_v4_rcv接收数据的时候 对数据进行处理。我把编译成功之后,内核重启但是系统重启不起来的。
不知道原因,我估计是在内核启动的时候调用了这个函数,我在正常的内核里面的tcp_v4_rcv函数里面加了打印信息,显示在内核启动的时候会调用tcp_v4_rcv函数,也就是调用协议栈的,在内核启动的时候会收到数据
我的问题是:为什么内核启动会用到tcp_v4_rcv,也就是协议栈,数据是从哪里来的?
望各位大虾们帮忙!
谢谢各位的时间了!
再次感谢! |
|