阅读:1077回复:0
请教各位大虾, 关于调整校验和的问题
在 "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呢, 请达人赐教 |
|