in_cksum() for ip packets with multiple mbufs

Simon 'corecode' Schubert corecode at fs.ei.tum.de
Mon Oct 24 02:50:34 PDT 2005


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 headerin host byte order to speed 
up access.  they get converted to network byte order at a very late 
stage of the ip output path.

cheers
   simon

-- 
Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low $$$ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \


More information about the freebsd-hackers mailing list