[Ns-bugs] [Bug 316] Build fails on OSX Intel

bugzilla-daemon@nsnam-www.ece.gatech.edu bugzilla-daemon at nsnam-www.ece.gatech.edu
Sun Sep 7 08:39:21 PDT 2008


http://www.nsnam.org/bugzilla/show_bug.cgi?id=316





------- Comment #14 from gjcarneiro at gmail.com  2008-09-07 11:39 -------
(In reply to comment #13)
> (In reply to comment #12)
> > By the way, the patch is not sound:
> > 
> > -    m_remotePort = ntohs(port);
> > +    m_remotePort = nsc_bytswap_16 (port);
> > 
> > ntohs is _not_ a simple byte swap.  It only swaps bytes on little endian
> > architectures.
> 
> no, it is safe. It is just suboptimal because it will use shifts and masks to
> access a value when it could just read it.

It's safe?  I must be missing something.  Clearly ntohs and nsc_bytswap_16
yield different results in x86 and PowerPC?  Are you saying the code is safe
even on PowerPC, or that you don't expect it to be used on PowerPC systems?

Well, we could say that, if ntohs swaps bytes and htons also swaps, then the
system will be self-consistent as long as no packet is transmitted to another
computer.  However, even then things will appear wrong if you capture packets
to pcap file and display them in wireshark.


-- 
Configure bugmail: http://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


More information about the Ns-bugs mailing list