xiong120
驱动牛犊
驱动牛犊
  • 注册日期2007-12-28
  • 最后登录2011-07-01
  • 粉丝0
  • 关注0
  • 积分20分
  • 威望3点
  • 贡献值0点
  • 好评度2点
  • 原创分0分
  • 专家分0分
阅读:1076回复:0

请教各位大虾, 关于调整校验和的问题

楼主#
更多 发布于:2008-04-19 09:14
在 "RFC1631 - The IP Network Address Translator (NAT)" 中有个增量计算ckecksum的算法void checksumadjust(unsigned char *chksum, unsigned char *optr,
int olen, unsigned char *nptr, int nlen)

我在使用中发现计算出来的ckecksum总是和实际值差1

然后看到函数前有这段话:
The only tricky part is determining whether the addition resulted in a wrap-around
(in either the positive or negative direction) of the checksum. If so, 1 must be added or subtracted to satisfy the one's complement

但是不懂 这个wrap-around是啥情况, 究竟何时要加1或减1呢, 请达人赐教
游客

返回顶部