Messages in this thread | | | From | Leo Mauro <> | Subject | Re: Incremental update of TCP Checksum | Date | Tue, 16 Sep 2003 16:47:38 -0400 |
| |
On Tuesday 16 September 2003 04:32 pm, Vishwas Raman wrote:
> As mentioned in RFC1624, I did the following. > void changePacket(struct sk_buff* skb) > { > struct tcphdr *tcpHdr = skb->h.th; > > // Verifying the tcp checksum works here... > > __u16 oldDoff = tcpHeader->doff; > tcpHeader->doff += 1; > > // Formula from RFC1624 is HC' = ~(C + (-m) + m') > // where HC - old checksum in header > // C - one's complement sum of old header > // HC' - new checksum in header > // C' - one's complement sum of new header > // m - old value of a 16-bit field > // m' - new value of a 16-bit field > > long cksum = (~(tcpHdr->check))&0xffff; > cksum += (__u16)~oldDoff; ^ should be a -
> cksum += tcpHeader->doff; > while (cksum >> 16) > { > cksum = (cksum & 0xffff) + (cksum >> 16); > } > tcpHeader->check = ~cksum; > > // Verifying tcp checksum here fails with bad cksum > }
-- Leo Mauro Network Security Simon Bolivar University Caracas, Venezuela
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |