Good one!

Actually, changing it to 

if(!memcmp(&iph->ip_dst,iui->addr1,4)){
                iui->frames1++;
                iui->bytes1+=pinfo->fd->pkt_len;
        } else {
                iui->frames2++;
                iui->bytes2+=pinfo->fd->pkt_len;
        }

Would probably align it better aesthetically (and algorithmically) with
the "eth" and"tr" subroutines.


Martin
 

Martin Visser ,CISSP
Network and Security Consultant 
Technology & Infrastructure - Consulting & Integration
HP Services

3 Richardson Place 
North Ryde, Sydney NSW 2113, Australia 
Phone *: +61-2-9022-1670    Mobile *: +61-411-254-513
   Fax 7: +61-2-9022-1800     E-mail * : [EMAIL PROTECTED]



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Monday, 19 May 2003 8:02 PM
To: Visser, Martin (Sydney); [EMAIL PROTECTED]
Subject: Re: [Ethereal-dev] Tethereal -z io,users,ip has stats in wrong
order


Martin Visser worte:
> 
> I had a quick look at the code in "tap-iousers.c", but I can't confirm

> where it is going wrong. I noticed some swapping/ordering going on 
> that looks a bit suss???
> 
> if(iph->ip_src>iph->ip_dst){
>               addr1=iph->ip_src;
>               addr2=iph->ip_dst;
>       } else {
>               addr2=iph->ip_src;
>               addr1=iph->ip_dst;
>       }
> 
> 
> 

I think that:
        if(!memcmp(&iph->ip_src,iui->addr1,4)){
                iui->frames1++;
                iui->bytes1+=pinfo->fd->pkt_len;
        } else {
                iui->frames2++;
                iui->bytes2+=pinfo->fd->pkt_len;
        }
should be changed to:
        if(memcmp(&iph->ip_src,iui->addr1,4)){  
                iui->frames1++;
                iui->bytes1+=pinfo->fd->pkt_len;
        } else {
                iui->frames2++;
                iui->bytes2+=pinfo->fd->pkt_len;
        }

when ip_src is NOT equal to addr1 then frames1 should be stepped it
seems from the udpip and tcpip (direction=1 in the udpip scenario). 
memcmp returns 0 if they are equal.

Reply via email to