From owner-freebsd-emulation@FreeBSD.ORG Thu Feb 24 02:43:32 2011 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 259AB106566B for ; Thu, 24 Feb 2011 02:43:32 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id B130B8FC14 for ; Thu, 24 Feb 2011 02:43:31 +0000 (UTC) Received: by eyg7 with SMTP id 7so32770eyg.13 for ; Wed, 23 Feb 2011 18:43:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=wLRr+m9AD3YIQ4agF0o9pbsikIwx7xMYEwRfU2MOJ4E=; b=vlAObgQxcajRUelwtY4bquJu93fuwJuR5zHF699VMjrtBTVVon2dxz3oaydpRr6co/ X7lA0PaGM+Nl0H7znQfmHUQNGH1gYqNQkEno2Bl1piiuOkiOLiXYCEBgUzDTeKglEVr7 6rNR+dgNcd1/MEfzyo2BZ9iHJWlMy1giXalcA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=Elc7Sks8F+aGwFXnr25qd3UAdcC5tHKFbx0+b1p1cdISIJMiJaoOcfNLirhVrR9fQ1 zjfHst0HN3rOBk8wtUAAJWgtOjECVvlMtsuu1uKe2ilxVYyUI9FfQi6XD6Y/qf6dY6fR MpdCw+pcXA1z0tjgMazaoTgvlLN3m+GINVURQ= MIME-Version: 1.0 Received: by 10.213.9.2 with SMTP id j2mr2706ebj.68.1298515410540; Wed, 23 Feb 2011 18:43:30 -0800 (PST) Received: by 10.213.20.135 with HTTP; Wed, 23 Feb 2011 18:43:30 -0800 (PST) Date: Wed, 23 Feb 2011 21:43:30 -0500 Message-ID: From: Ryan Stone To: freebsd-emulation@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: netstat counters on VirtualBox host-only counters are incorrect X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Feb 2011 02:43:32 -0000 When I use host-only networking with a FreeBSD host the netstat counters on vboxnetX are completely wrong. For example, if I run netperf between a guest and the host I see the following netstat output on the guest: input (em1) output packets errs idrops bytes packets errs bytes colls 7776 0 0 513672 11898 0 17745260 0 9498 0 0 626868 14557 0 21703130 0 8798 0 0 580668 13471 0 20091246 0 9371 0 0 620718 14239 0 21251326 0 9202 0 0 607332 14087 0 21016638 0 6088 0 0 403052 9307 0 13877798 0 6445 0 0 425882 9838 0 14687156 0 9227 0 0 609378 14142 0 21073308 0 7299 0 0 482634 11145 0 16621458 0 4721 0 0 314298 7120 0 10633528 0 9258 0 0 611028 14185 0 21154178 0 On the host, however, I see the following: input (vboxnet0) output packets errs idrops bytes packets errs bytes colls 2 0 0 15234809 2 0 467 0 0 0 0 21378232 0 0 0 0 0 0 0 21267106 0 0 0 0 2 0 0 16843302 2 0 508 0 0 0 0 19865678 0 0 0 0 0 0 0 12189452 0 0 0 0 0 0 0 17398526 0 0 0 0 0 0 0 15653006 0 0 0 0 0 0 0 13474242 0 0 0 0 0 0 0 22144532 0 0 0 0 0 0 0 11087250 0 0 0 0 Also, if I run tcpdump on vboxnet0, I see almost no packets from the host to the guest, only packets from the guest to the host. The exception is that I see broadcast packets transmitted by the host in tcpdump. Broadcast frames from the host seem to line up with the small number of packets that showed up in the netstat sample output in the "output" columns. Looking at the host-only networking kernel module that makes sense as the opackets counter is incremented right before the packet is passed to bpf. It would appear the only broadcast frames make it to VBoxNetAdpFreeBSDNetstart. I don't have a lot of insight into what's happening to the input counters, other than to note that the input packet counter line up suspiciously with the output packet counter. I have no idea what's happening with the input byte counter, unless bytes are getting double or triple counted somehow? I see this behaviour under both VirtualBox 3.2.12 and 4.0.4. Ryan