- 论坛徽章:
- 0
|
本帖最后由 __dreamcatcher 于 2010-10-14 17:28 编辑
# /*重新计算TCP校验和*/
# tcph->check = 0;
# tcph->check = tcp_v4_check(tcph, sizeof(struct tcphdr),
# nskb->nh.iph->saddr,
# nskb->nh.iph->daddr,
# csum_partial((char *)tcph,
# sizeof(struct tcphdr), 0));
#
Godbach 发表于 2009-09-02 13:04 ![]()
Godbach兄,我对这个tcp_v4_check()函数一直不是很理解,最不明白的就是csum_partial()的使用,因为对其中的参数含义不是很明白,因为看到对它的调用中有的用到了skb_>csum,
例如:- void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb)
- {
- struct inet_sock *inet = inet_sk(sk);
- struct tcphdr *th = tcp_hdr(skb);
- if (skb->ip_summed == CHECKSUM_PARTIAL) {
- th->check = ~tcp_v4_check(len, inet->saddr,
- inet->daddr, 0);
- skb->csum_start = skb_transport_header(skb) - skb->head;
- skb->csum_offset = offsetof(struct tcphdr, check);
- } else {
- th->check = tcp_v4_check(len, inet->saddr, inet->daddr,
- csum_partial((char *)th,
- th->doff << 2,
- skb->csum));
- }
- }
复制代码 就不明白skb->csum的意义,所以一直都不是很明白,能否详细给讲解一下?谢谢! |
|