Re: in_cksum() for ip packets with multiple mbufs

2005-10-24 Thread Simon 'corecode' Schubert
kamal kc wrote: - final thing does this makes any difference (calling the htons() twice): ip->ip_id=htons(ip->ip_id); ip->ip_id=htons(ip->ip_id); on little endian machines: yes. on big endian machines: no. So don't do it. :) freebsd has several fields of the ip heade

Re: in_cksum() for ip packets with multiple mbufs

2005-10-24 Thread Giorgos Keramidas
On 2005-10-23 22:27, kamal kc <[EMAIL PROTECTED]> wrote: > one thing i would like to ask? > > does it make any difference if i free the mbuf 'm' passed to > if_output() and pass my own mbuf to if_output. > > is the original mbuf referenced by any other pointers or global > variables ?? If you are

Re: in_cksum() for ip packets with multiple mbufs

2005-10-23 Thread kamal kc
> > void copy_the_memorybuffer(struct mbuf **m) > > { > >struct mbuf *mbuf_pointer=*m; > >struct mbuf **next_packet; > > > >next_packet=&mbuf_pointer; > > > >struct ip *my_ip_hdr; > >my_ip_hdr=mtod((*next_packet),struct ip *); > >my_ip_hdr->ip_tos=64; > >my_ip_hdr->ip_s

Re: in_cksum() for ip packets with multiple mbufs

2005-10-23 Thread kamal kc
> > void copy_the_memorybuffer(struct mbuf **m) > > { > >struct mbuf *mbuf_pointer=*m; > >struct mbuf **next_packet; > > > >next_packet=&mbuf_pointer; > > > >struct ip *my_ip_hdr; > >my_ip_hdr=mtod((*next_packet),struct ip *); > >my_ip_hdr->ip_tos=64; > >my_ip_hdr->ip_s

Re: in_cksum() for ip packets with multiple mbufs

2005-10-23 Thread Giorgos Keramidas
On 2005-10-23 04:13, kamal kc <[EMAIL PROTECTED]> wrote: > /* the argument m is the (struct mbuf *) that > * contains the packet data > */ > > void copy_the_memorybuffer(struct mbuf **m) > { >struct mbuf *mbuf_pointer=*m; >struct mbuf **next_packet; > >next_packet=&mbuf_pointer; > >

Re: in_cksum() for ip packets with multiple mbufs

2005-10-23 Thread kamal kc
> > i changed the ip_tos field of the struct ip and > computed the checksum > > by using in_cksum(). > > > > when the packet uses only one mbuf the computed > checksum is ok but > > when the packet uses more than one mbuf then the > computed checksum is > > wrong. > > Note that the IP header conta

Re: in_cksum() for ip packets with multiple mbufs

2005-10-23 Thread Giorgos Keramidas
On 2005-10-23 01:30, kamal kc <[EMAIL PROTECTED]> wrote: > i come across this unusual problem. > > i changed the ip_tos field of the struct ip and computed the checksum > by using in_cksum(). > > when the packet uses only one mbuf the computed checksum is ok but > when the packet uses more than one