From patchwork Sun May 6 15:21:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin X-Patchwork-Id: 157065 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6BAFAB6FAC for ; Sun, 6 May 2012 23:22:10 +1000 (EST) Received: from localhost ([::1]:53037 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SR1Pb-0003lJ-Qg for incoming@patchwork.ozlabs.org; Sun, 06 May 2012 09:22:07 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQuqH-0004rJ-1A for qemu-devel@nongnu.org; Sun, 06 May 2012 02:21:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SQuqF-0006MO-5g for qemu-devel@nongnu.org; Sun, 06 May 2012 02:21:12 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:50529) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQuqE-0006M2-Ti for qemu-devel@nongnu.org; Sun, 06 May 2012 02:21:11 -0400 Received: by pbbro12 with SMTP id ro12so7334158pbb.4 for ; Sat, 05 May 2012 23:21:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=FmgvLp9b7N7oOS0xTkg6Eui7QoZ4frTCs88PxajoQqM=; b=UvqDUIkO2Q58Ddjbn0u7XiH+sey14FOWm0SbiugIzQzSoJgh/wGBvMnfXsPjJLL+0M 8L+ukvdO2092tMtQssnDANNTkeK69L+lCeUAI/qHTikpJEhpVhb/mUzpwFDFS0i2GA8d GONdYxxRR86cRwDYarZCcu2YLAYaYaajsmoWsPpRSdVXWbvgrQp43+qOZqJqr76sEADR GWExfmATD8u7U6AeVf0hondQYTZy5GYxubk8s/vxDYZBa2s/9OgJZn1opyFo9B50SQUL 4idC92uc2sfB8rzaDozHyLAlVmhCm0Yzs34/rE358rxOV1EoZ8/QHhNdPQLOVJfcon9K ZhMg== Received: by 10.68.72.70 with SMTP id b6mr25906749pbv.58.1336285267625; Sat, 05 May 2012 23:21:07 -0700 (PDT) Received: from localhost.localdomain ([114.199.57.13]) by mx.google.com with ESMTPS id q1sm14003941pbp.62.2012.05.05.23.21.05 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 05 May 2012 23:21:06 -0700 (PDT) From: Benjamin MARSILI To: qemu-devel@nongnu.org Date: Mon, 7 May 2012 00:21:07 +0900 Message-Id: <1336317667-3484-1-git-send-email-mlspirat42@gmail.com> X-Mailer: git-send-email 1.7.6 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 X-Mailman-Approved-At: Sun, 06 May 2012 09:22:00 -0400 Cc: Benjamin MARSILI Subject: [Qemu-devel] [PATCH] net: Include the peer's information in VLANClientState->info_str when using the udp socket backend. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Benjamin MARSILI --- It makes it easier to debug and figure out what's going on behind the scene. When using this syntax: -device DEVICE,netdev=ID -netdev socket,id=ID,udp=LHOST:LPORT,localaddr=RHOST:RPORT Before: (qemu) info network Devices not on any VLAN: rtl8139.0: type=nic,model=rtl8139,macaddr=00:ab:29:8c:3e:00 \ gns3-0: type=socket,socket: udp=127.0.0.1:20003 rtl8139.1: type=nic,model=rtl8139,macaddr=00:ab:29:8c:3e:01 \ gns3-1: type=socket,socket: udp=127.0.0.1:20002 After: (qemu) info network Devices not on any VLAN: rtl8139.0: type=nic,model=rtl8139,macaddr=00:ab:29:8c:3e:00 \ gns3-0: type=socket,socket: udp=127.0.0.1:20003, localaddr=127.0.0.1,20004 rtl8139.1: type=nic,model=rtl8139,macaddr=00:ab:29:8c:3e:01 \ gns3-1: type=socket,socket: udp=127.0.0.1:20002, localaddr=127.0.0.1,10000 net/socket.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) -- 1.7.6 diff --git a/net/socket.c b/net/socket.c index 0bcf229..7613990 100644 --- a/net/socket.c +++ b/net/socket.c @@ -580,8 +580,9 @@ static int net_socket_udp_init(VLANState *vlan, s->dgram_dst = raddr; snprintf(s->nc.info_str, sizeof(s->nc.info_str), - "socket: udp=%s:%d", - inet_ntoa(raddr.sin_addr), ntohs(raddr.sin_port)); + "socket: udp=%s:%d, localaddr=%s,%d", + inet_ntoa(raddr.sin_addr), ntohs(raddr.sin_port), + inet_ntoa(laddr.sin_addr), ntohs(laddr.sin_port)); return 0; }