Subject: Re: tcp/udp vector h/w checksum
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: john heasley <heas@shrubbery.net>
List: tech-net
Date: 02/05/2005 13:54:14
Sun, Feb 06, 2005 at 04:58:42AM +0900, YAMAMOTO Takashi:
> hi,
> 
> > --- netinet/ip_output.c	15 Dec 2004 04:25:19 -0000	1.138
> > +++ netinet/ip_output.c	5 Feb 2005 18:14:51 -0000
> > @@ -128,6 +128,8 @@
> >  #include <netinet/in_pcb.h>
> >  #include <netinet/in_var.h>
> >  #include <netinet/ip_var.h>
> > +#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?

> > +				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?

Thanks.