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 On Thu, Jan 15, 2009 at 2:41 PM, Joseph Karwisch <jkarwisc...@bellsouth.net> wrote: > Aaron, > > I installed gcc version 4.3.2 on my Solaris machine and reran > configure on tcpreplay. Since Solaris does not have err.h and the associated > warn/error routines, I had to edit some of the source files in src/fragroute > to use common/err.h and changed the parameters to the warnx function calls > in those source files. I also had to edit the Makefile under src/common to > remove fakepcap (My libpcap already has the necessary functions). After I > did that, I ran make with no errors. > > I ran make test and had several errors using tcprewrite as shown in > the attached file. I ran one of the tests manually (rewrite_endpoint), and > it failed with a 'BUS ERROR'. When I used gdb, it shows I fails with a > Segmentation fault. This occurs in the rewrite_iparp function in the > edit_packet.c file on line 560. After several hours of debugging I think I > finally narrowed it down to a root cause. Solaris 64 bit uses 8 byte > boundaries instead of 4 for its memory addresses. The second IP address > happens to start in the 3 octet of a memory location, so when the function > trys to access it, the call fails because the starting address is not on a > memory boundary and therefore it's invalid. At least that's my thinking, I > could be wrong. > > I know you don't have a Sun Sparc machine, but if you could give me > some ideas to try out I will be glad to do so. I really need tcprewrite to > work on Solaris. > > Regards, > > --Joseph > > > -----Original Message----- > From: Aaron Turner [mailto:synfina...@gmail.com] > Sent: Wednesday, January 14, 2009 2:01 PM > To: Main forum for tcpreplay > Subject: Re: [Tcpreplay-users] tcpreplay-3.4.0pre3/3.3.2 compiling issues > onSolaris > > Well that's sucks... Unfortunately: > > 1) It won't be fixed in 3.4.0 > 2) I don't know when it will be fixed since I don't have access to Solaris > and the Sun compiler. > > What I would suggest is edit configure.ac, jump to line 31 and comment out > the following lines: > > USER_CFLAGS=$CFLAGS > CFLAGS="${CFLAGS} -Wall -O3 -std=gnu99" > > and re-run "autoconf" & ./configure > > That may not solve all your problems though... > > The other option is to install gcc (check sunfreeware.com) and use that > (CC=gcc ./configure) > > That should resolve any issues you have. Anyways, I'll open a ticket for > this, but like I said, I don't have an eta. > > Regards, > Aaron > > P.S. In the future, large log files are easier to deal with if you attach > them rather then pasting them inline. > > > On Wed, Jan 14, 2009 at 10:14 AM, Joseph Karwisch > <jkarwisc...@bellsouth.net> wrote: >> I am having problems compiling tcpreplay on my Solaris platform. >> Details >> below: >> >> - tcpreplay version: 3.4.0 pre 3 & 3.3.2 >> - Platform: Solaris 8 on SPARC >> - Compiler: Sun Studio 11 >> >> Compiler/Platform compatibility issues found: >> >> Sun Studio 11 does not support -Wall flag. >> >> gcc struct attributes used in src/common/cache.h - line 83 >> >> #include file <err.h> not included on Solaris systems. >> >> Has anyone been successful in compiling tcpreplay 3.3.2 on Solaris 8? > > > -- > 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 > Tcpreplay-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/tcpreplay-users > Support Information: http://tcpreplay.synfin.net/trac/wiki/Support > > ------------------------------------------------------------------------------ > 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 > Tcpreplay-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/tcpreplay-users > Support Information: http://tcpreplay.synfin.net/trac/wiki/Support > -- ------------------------------------------------------------------------------ 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 Tcpreplay-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tcpreplay-users Support Information: http://tcpreplay.synfin.net/trac/wiki/Support