Time Issue on OpenBSD 4.2 with rc.69 (Was: Re: Sparc64 OpenBSD4.1 Compile issue)

Carter Bullard carter at qosient.com
Sat Feb 9 15:08:23 EST 2008


So you see the problem!!!!
Argus is generating good time numbers and the clients are not
unpacking them correctly.

So in ra() set another break point in ArgusGenerateRecordStruct(),
so we can see what is going wrong.

(gdb) l ArgusGenerateRecordStruct
(gdb) break 2938
(gdb) run -S argus.source
Breakpoint 1, ArgusGenerateRecordStruct

dump the contents of the buffer off the wire
(gdb) x/12x dsr

and then just step through, so we can see what is going on.
(gdb) n
(gdb) n
(gbb) n
  ...

until you come to line 3079, and then print the contents of the dsr
(gdb) print retn->canon.time

Hopefully that will give us all the info we need.

Carter





On Feb 8, 2008, at 6:11 PM, Eric Pancer wrote:

> Carter -
>
> Ok, my gdb results are below.
>
> On Fri, 2008-02-08 at 11:00:49 -0500, Carter Bullard proclaimed...
>
>> So the key is on line 2551, in ArgusGenerateRecord().  When it copies
>> the tv_sec
>> from the flow control block to the packet output buffer, is it  
>> getting
>> the right value.
>> So do this at the break point on line 2551:
>
> # gdb argus
> GNU gdb 6.3
> Copyright 2004 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and  
> you are
> welcome to change it and/or distribute copies of it under certain
> conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for  
> details.
> This GDB was configured as "i386-unknown-openbsd4.2"...
> (gdb) break ArgusProcessPacket
> Breakpoint 1 at 0x1c0070dd: file ArgusModeler.c, line 1138.
> (gdb) run -w /tmp/ff.out
> Starting program: /usr/local/argus/sbin/argus -w /tmp/ff.out
>  ArgusWarning: argus[10629]: 08 Feb 08 17:03:07.315247 started
>  ArgusWarning: argus[10629]: 08 Feb 08 17:03:07.315844
> ArgusGetInterfaceStatus: interface em0 is up
>
> Breakpoint 1, ArgusProcessPacket (src=0x819f801c, p=0x8ac10012 "",
> length=170, tvp=0x8a5da174, type=1) at ArgusModeler.c:1138
> 1138       struct ArgusModelerStruct *model = src->ArgusModel;
> (gdb) print sizeof(*tvp)
> $1 = 8
> (gdb) print *tvp
> $2 = {tv_sec = 1202511787, tv_usec = 315744}
> (gdb) break 1297
> Breakpoint 2 at 0x1c00789e: file ArgusModeler.c, line 1297.
> (gdb) cont
> Continuing.
>
> Breakpoint 2, ArgusProcessPacket (src=0x819f801c, p=0x8ac10012 "",  
> length=170,
>    tvp=0x8a5da174, type=0) at ArgusModeler.c:1297
> 1297       return (retn);
> (gdb) print flow->qhdr
> Cannot access memory at address 0x0
> (gdb) print model->ArgusGlobalTime
> $3 = {tv_sec = 1202511787, tv_usec = 315744}
> (gdb) delete
> Delete all breakpoints? (y or n) y
> (gdb) list ArgusGenerateRecord
> 2402    */
> 2403
> 2404    struct ArgusRecord *
> 2405    ArgusGenerateRecord (struct ArgusModelerStruct *model,  
> struct ArgusRecordStruct *rec,
> 2406                        unsigned char state, struct ArgusRecord  
> *retn)
> 2407    {
> 2408
> 2409       if (rec) {
> 2410          if (rec->hdr.type & ARGUS_FAR) {
> 2411             unsigned int ind, dsrindex, *dsrptr;
> (gdb) break 2522
> Breakpoint 3 at 0x1c00a707: file ArgusModeler.c, line 2522.
> (gdb) cont
> Continuing.
>
> Breakpoint 3, ArgusGenerateRecord (model=0x8bf3801c, rec=0x8ac1ac38,
>    state=0 '\0', retn=0x888b306c) at ArgusModeler.c:2522
> 2522                         if (model->ArgusReportAllTime) {
> (gdb) print *dtime
> $4 = {hdr = {type = 3 '\003', subtype = 2 '\002', dsr_un = {fl =  
> {data = 792},
>      vl8 = {qual = 24 '\030', len = 3 '\003'}, vl16 = {len = 792}}},  
> src = {
>    start = {tv_sec = 1202511787, tv_usec = 315744}, end = {
>      tv_sec = 1202511822, tv_usec = 957994}}, dst = {start = {
>      tv_sec = 1202511787, tv_usec = 316154}, end = {tv_sec =  
> 1202511823,
>      tv_usec = 71675}}}
> (gdb) break 2551
> Breakpoint 4 at 0x1c00a81d: file ArgusModeler.c, line 2551.
> (gdb) cont
> Continuing.
>
> Breakpoint 4, ArgusGenerateRecord (model=0x8bf3801c, rec=0x8ac1ac38,
>    state=0 '\0', retn=0x888b306c) at ArgusModeler.c:2551
> 2551                                        *dsrptr++ = dtime- 
> >src.start.tv_usec;
> (gdb) print sizeof(dtime->src.start)
> $5 = 8
> (gdb) x/2x &dtime->src.start
> 0x8ac1ad08:     0x47acdfab      0x0004d160
> (gdb) print dsrptr
> $6 = (unsigned int *) 0x888b3098
> (gdb) n
> 2552                                        break;
> (gdb) n
> 2546                            for (x = 0; x < 4; x++) {
> (gdb) x/2x 0x8ac1ad08
> 0x8ac1ad08:     0x47acdfab      0x0004d160
>
> End of # `gdb argus'
>
>> The next step will be to run ra() under gdb, and stop in the routine
>> ArgusGenerateRecordStruct(), to see what numbers get unpacked
>> into the time structs.
>
>
> $ gdb ra
> GNU gdb 6.3
> Copyright 2004 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and  
> you are
> welcome to change it and/or distribute copies of it under certain
> conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for  
> details.
> This GDB was configured as "i386-unknown-openbsd4.2"...
> (gdb) l ArgusGenerateRecordStruct
> 2559
> 2560    struct ArgusRecordStruct ArgusGenerateRecordBuffer;
> 2561
> 2562    struct ArgusRecordStruct *
> 2563    ArgusGenerateRecordStruct (struct ArgusParserStruct *parser,  
> struct
> ArgusInput *input, struct ArgusRecord *argus)
> 2564    {
> 2565       struct ArgusRecordStruct *retn = NULL;
> 2566       unsigned int ArgusReverse = 0, status = 0;
> 2567
> 2568       if (argus == NULL) {
> (gdb) break 3079
> Breakpoint 1 at 0x1c04eae1: file argus_client.c, line 3079.
> (gdb) run -S 10.15.223.177
> Starting program: /usr/local/argus/bin/ra -S 10.15.223.177
> [Switching to process 17026, thread 0x869ac000]
>
> Breakpoint 1, ArgusGenerateRecordStruct (parser=0x7e26601c,
> input=0x88c4e01c,
>    argus=0x7c20701c) at argus_client.c:3079
> 3079                         retn->dsrs[ARGUS_TIME_INDEX] = (struct
> ArgusDSRHeader*) &retn->canon.time;
> (gdb) print retn->canon.time
> $1 = {hdr = {type = 3 '\003', subtype = 9 '\t', dsr_un = {fl = {data  
> = 792},
>      vl8 = {qual = 24 '\030', len = 3 '\003'}, vl16 = {len = 792}}},  
> src =
> {
>    start = {tv_sec = 670348, tv_usec = 60}, end = {tv_sec = 670348,
>      tv_usec = 60}}, dst = {start = {tv_sec = 0, tv_usec = 0}, end = {
>      tv_sec = 0, tv_usec = 0}}}
> (gdb) break RaProcessRecord
> Breakpoint 2 at 0x1c002d6b: file ra.c, line 188.
> (gdb) c
> Continuing.
>
> Breakpoint 2, RaProcessRecord (parser=0x7e26601c, argus=0x88c4e268) at
> ra.c:188
> 188        if (argus->hdr.type & ARGUS_MAR) {
> (gdb) print argus->canon.time
> $2 = {hdr = {type = 3 '\003', subtype = 9 '\t', dsr_un = {fl = {data  
> = 792},
>      vl8 = {qual = 24 '\030', len = 3 '\003'}, vl16 = {len = 792}}},  
> src =
> {
>    start = {tv_sec = 670348, tv_usec = 60}, end = {tv_sec = 670348,
>      tv_usec = 60}}, dst = {start = {tv_sec = 0, tv_usec = 0}, end = {
>      tv_sec = 0, tv_usec = 0}}}
> (gdb) l ArgusPrintStartDate
> 1843       }
> 1844    }
> 1845
> 1846    void
> 1847    ArgusPrintStartDate (struct ArgusParserStruct *parser, char  
> *buf, struct ArgusRecordStruct *argus, int len)
> 1848    {
> 1849       struct timeval tvpbuf, *tvp = &tvpbuf;
> 1850       char tbuf[256];
> 1851
> 1852       len += parser->pflag;
> (gdb) break 1867
> Breakpoint 3 at 0x1c0198a4: file argus_util.c, line 1867.
> (gdb) c
> Continuing.
>
> Breakpoint 3, ArgusPrintStartDate (parser=0x7e26601c, buf=0x3c01f6e0  
> "",
>    argus=0x88c4e268, len=18) at argus_util.c:1867
> 1867       ArgusPrintTime(parser, tbuf, tvp);
> (gdb) print *tvp
> $3 = {tv_sec = 670348, tv_usec = 60}
> (gdb) print sizeof(*tvp)
> $4 = 8
> (gdb)
>
> End of `gdb ra'
>
> - Eric
>



More information about the argus mailing list