From owner-freebsd-net Sat Jun 27 21:33:26 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id VAA22834 for freebsd-net-outgoing; Sat, 27 Jun 1998 21:33:26 -0700 (PDT) (envelope-from owner-freebsd-net@FreeBSD.ORG) Received: from roma.coe.ufrj.br (jonny@roma.coe.ufrj.br [146.164.53.65]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id VAA22829 for ; Sat, 27 Jun 1998 21:33:23 -0700 (PDT) (envelope-from jonny@jonny.eng.br) Received: (from jonny@localhost) by roma.coe.ufrj.br (8.8.8/8.8.8) id BAA22277 for net@freebsd.org; Sun, 28 Jun 1998 01:33:22 -0300 (EST) (envelope-from jonny) From: Joao Carlos Mendes Luis Message-Id: <199806280433.BAA22277@roma.coe.ufrj.br> Subject: mrouting and ioctl(SIOCGETVIFCNT) To: net@FreeBSD.ORG Date: Sun, 28 Jun 1998 01:33:22 -0300 (EST) X-Mailer: ELM [version 2.4ME+ PL40 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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