Aaron,

        I get a Bus Error on trying offset 3.

Regards,

--Joseph 

-----Original Message-----
From: Aaron Turner [mailto:[email protected]] 
Sent: Friday, January 16, 2009 6:56 PM
To: Main forum for tcpreplay
Subject: Re: [Tcpreplay-users] tcpreplay-3.4.0pre3/3.3.2 compiling
issuesonSolaris

Doh, forgot to include code...

On Fri, Jan 16, 2009 at 3:53 PM, Aaron Turner <[email protected]> wrote:
> Hi Joseph,
>
> Your diagnosis is correct, bus errors are non-aligned memory accesses 
> on strictly aligned systems like SPARC.  I wasn't aware that 64bit 
> solaris was 8 byte aligned... *sigh*.  I'll have to write an
> additional autoconf check and hack up some code for that.   Basically
> de-referencing pointers/memory which isn't 8 byte aligned is bad.
>
> Actually, I'm surprised the bug is on line 560, I would of expected it 
> on 555 where I process the sender IP address in the first packet in 
> test/test.pcap since that starts at byte offset 28 (28 / 8 = 3.5, but
> 28 / 4 = 7).   If the issue really is line 560, that's a failure of a
> 4 byte memory alignment (pointer at byte offset 38). Basically what 
> I'm saying is I that maybe 64bit Solaris/SPARC is 4 byte aligned after 
> all.
>
> I've attached a bit of code which tests offsets 0, 3, 7 and 9.
> Compile it and on your system, it should crash w/ a bus error at 3 if 
> it's 8 byte aligned and at 9 if it is 4 byte aligned.  If it doesn't 
> crash on SPARC, then my test sucks. :)
>
> Anyways, the trick is to use a temporary variable, memcpy the data 
> over, do the editing, and then memcpy() it back into the packet 
> buffer.  A good example of this is src/common/get.c:get_ipv4().
> You'll see the #ifdef FORCE_ALIGN crap which deals with it.
>
> Please let me know what you find out... fixing this 4 byte memory 
> alignment issue isn't a big deal.  Making Tcpreplay 8 byte alignment 
> safe is a *lot* more work.
>
> Re: err.h... whoops... yeah, bad integration of the fragroute code on 
> my part.  You did the correct fix.
>
> Re: fakepcap... Not sure why you're having issues with fakepcap
> though.   Seems like you're having some linker issue- I'd guess you
> have multiple versions of libpcap installed on your system?  If not, 
> then what version do you have?
>
> Let me know what you find out.
>
> Regards,
> Aaron
>
> --
> Aaron Turner
> http://synfin.net/
> http://tcpreplay.synfin.net/ - Pcap editing and replay tools for Unix 
> & Windows They that can give up essential liberty to obtain a little 
> temporary safety deserve neither liberty nor safety.  -- Benjamin 
> Franklin
>


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Tcpreplay-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tcpreplay-users
Support Information: http://tcpreplay.synfin.net/trac/wiki/Support

Reply via email to