Subject: Re: tcp/udp vector h/w checksum
To: None <firstname.lastname@example.org>
From: YAMAMOTO Takashi <email@example.com>
Date: 02/06/2005 19:34:44
> > > +#include <netinet/tcp.h>
> > > +#include <netinet/udp.h>
> > why you need these includes? isn't m_pkthdr.csum_data enough?
> Aren't these necessary for struct tcphdr and udphdr?
i think all you need is offset of th_sum (or uh_sum),
which is stored in csum_data.
> > > + th = (struct tcphdr *) (mtod(m, caddr_t) +
> > > + hlen);
> > > + th->th_sum = in_cksum_phdr(ip->ip_src.s_addr,
> > i don't think you can assume m->m_len is large enough.
> I thought that might not be a good assumption. so, I have to use
> m_copyback. Is that right?
yes. see in_delayed_cksum.