Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Jun 1998 01:33:22 -0300 (EST)
From:      Joao Carlos Mendes Luis <jonny@jonny.eng.br>
To:        net@FreeBSD.ORG
Subject:   mrouting and ioctl(SIOCGETVIFCNT)
Message-ID:  <199806280433.BAA22277@roma.coe.ufrj.br>

next in thread | raw e-mail | index | archive | help
Hi,

  I'm trying to use ioctl SIOCGETVIFCNT to get traffic statistics
on multicast vifs.  But my results are very strange:

vif0, inp=12573, inb=503855516, outp=35900, outb=1835387904
vif1, inp=35900, inb=1835387904, outp=11262, outb=462654994
vif2, inp=0, inb=0, outp=1039, outb=34649536
vif3, inp=0, inb=0, outp=0, outb=0

On vif2, for example, suppose it has really sent 34649536 bytes,
using 1039 packets.  The average packet size would be 33348 !
No, this is not real...  Is there a known bug in kernel ?
It seems to be some kind of host/network format conversion.

The program couldn't be simpler (stripping includes):

void
main( void )
{
  int vif;
  int s;
  struct sioc_vif_req vr;

  if ( ( s = socket( AF_INET, SOCK_DGRAM, 0 ) ) < 0 )
    err( 1, "Cannot open control socket" );

  vif = 0;
  while ( 1 ) {
    vr.vifi = vif;
    if ( ioctl( s, SIOCGETVIFCNT, &vr ) < 0 ) {
      if ( errno == EINVAL ) break;
      err( 2, "socket(SIOCGETVIFCNT)" );
    }
    printf( "vif%d, inp=%lu, inb=%lu, outp=%lu, outb=%lu\n",
                vif, vr.icount, vr.ibytes, vr.ocount, vr.obytes );
    ++vif;
  }
  close( s );
} 

					Jonny

--
Joao Carlos Mendes Luis            M.Sc. Student
jonny@jonny.eng.br                 Universidade Federal do Rio de Janeiro

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199806280433.BAA22277>