From nobody Mon Apr 29 08:57:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1510625785981203.00301881950918; Mon, 13 Nov 2017 18:16:25 -0800 (PST) Received: from localhost ([::1]:57280 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEQm1-0008PS-2I for importer@patchew.org; Mon, 13 Nov 2017 21:16:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57601) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEQha-0004Rz-PM for qemu-devel@nongnu.org; Mon, 13 Nov 2017 21:11:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eEQhZ-0000j8-Sb for qemu-devel@nongnu.org; Mon, 13 Nov 2017 21:11:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35702) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eEQhZ-0000ik-MY; Mon, 13 Nov 2017 21:11:49 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E88FC7652C; Tue, 14 Nov 2017 02:11:48 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-130.pek2.redhat.com [10.72.12.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4585A5D6AE; Tue, 14 Nov 2017 02:11:42 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Tue, 14 Nov 2017 10:11:31 +0800 Message-Id: <1510625498-4821-2-git-send-email-jasowang@redhat.com> In-Reply-To: <1510625498-4821-1-git-send-email-jasowang@redhat.com> References: <1510625498-4821-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 14 Nov 2017 02:11:48 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/8] net: fix check for number of parameters to -netdev socket X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Wang , Jens Freimann , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Jens Freimann Since commit 0f8c289ad "net: fix -netdev socket,fd=3D for UDP sockets" we allow more than one parameter for -netdev socket. But now we run into an assert when no parameter at all is specified > qemu-system-x86_64 -netdev socket socket.c:729: net_init_socket: Assertion `sock->has_udp' failed. Fix this by reverting the change of the if condition done in 0f8c289ad. Cc: Jason Wang Cc: qemu-stable@nongnu.org Fixes: 0f8c289ad539feb5135c545bea947b310a893f4b Reported-by: Mao Zhongyi Signed-off-by: Jens Freimann Signed-off-by: Jason Wang --- net/socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/socket.c b/net/socket.c index e6b471c..83a2a31 100644 --- a/net/socket.c +++ b/net/socket.c @@ -695,8 +695,8 @@ int net_init_socket(const Netdev *netdev, const char *n= ame, assert(netdev->type =3D=3D NET_CLIENT_DRIVER_SOCKET); sock =3D &netdev->u.socket; =20 - if (sock->has_listen + sock->has_connect + sock->has_mcast + - sock->has_udp > 1) { + if (sock->has_fd + sock->has_listen + sock->has_connect + sock->has_mc= ast + + sock->has_udp !=3D 1) { error_setg(errp, "exactly one of listen=3D, connect=3D, mcast=3D o= r udp=3D" " is required"); return -1; --=20 2.7.4 From nobody Mon Apr 29 08:57:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1510625644465848.4503090860125; Mon, 13 Nov 2017 18:14:04 -0800 (PST) Received: from localhost ([::1]:57263 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEQje-0006Lh-1q for importer@patchew.org; Mon, 13 Nov 2017 21:13:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEQhg-0004Z7-9C for qemu-devel@nongnu.org; Mon, 13 Nov 2017 21:11:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eEQhd-0000l1-1m for qemu-devel@nongnu.org; Mon, 13 Nov 2017 21:11:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33630) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eEQhc-0000ka-PO for qemu-devel@nongnu.org; Mon, 13 Nov 2017 21:11:52 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 04D39C0587DF; Tue, 14 Nov 2017 02:11:52 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-130.pek2.redhat.com [10.72.12.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 782E4173A5; Tue, 14 Nov 2017 02:11:49 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Tue, 14 Nov 2017 10:11:32 +0800 Message-Id: <1510625498-4821-3-git-send-email-jasowang@redhat.com> In-Reply-To: <1510625498-4821-1-git-send-email-jasowang@redhat.com> References: <1510625498-4821-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 14 Nov 2017 02:11:52 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/8] colo-compare: Insert packet into the suitable position of packet queue directly X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mao Zhongyi , Jason Wang , Li Zhijian , Zhang Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mao Zhongyi Currently, a packet from pri_dev or sec_dev is fristly pushed at the tail of the primary or secondary packet queue then sorted by the tcp sequence number. Now, this patch use g_queue_insert_sorted to insert the packet directly into the suitable position to avoid ordering all packets each time when a new packet is comming, thereby increasing efficiency. In addition, consolidate the code that add a packet to the list of Connection (primary or secondary) into a separate routine colo_insert_packe= t() since the same chunk of code is called from two place. Cc: Zhang Chen Cc: Li Zhijian Cc: Jason Wang Signed-off-by: Mao Zhongyi Signed-off-by: Zhang Chen Signed-off-by: Jason Wang --- net/colo-compare.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index b3f35d7..54b6347 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -113,6 +113,26 @@ static gint seq_sorter(Packet *a, Packet *b, gpointer = data) } =20 /* + * Return 1 on success, if return 0 means the + * packet will be dropped + */ +static int colo_insert_packet(GQueue *queue, Packet *pkt) +{ + if (g_queue_get_length(queue) <=3D MAX_QUEUE_SIZE) { + if (pkt->ip->ip_p =3D=3D IPPROTO_TCP) { + g_queue_insert_sorted(queue, + pkt, + (GCompareDataFunc)seq_sorter, + NULL); + } else { + g_queue_push_tail(queue, pkt); + } + return 1; + } + return 0; +} + +/* * Return 0 on success, if return -1 means the pkt * is unsupported(arp and ipv6) and will be sent later */ @@ -149,28 +169,12 @@ static int packet_enqueue(CompareState *s, int mode) } =20 if (mode =3D=3D PRIMARY_IN) { - if (g_queue_get_length(&conn->primary_list) <=3D - MAX_QUEUE_SIZE) { - g_queue_push_tail(&conn->primary_list, pkt); - if (conn->ip_proto =3D=3D IPPROTO_TCP) { - g_queue_sort(&conn->primary_list, - (GCompareDataFunc)seq_sorter, - NULL); - } - } else { + if (!colo_insert_packet(&conn->primary_list, pkt)) { error_report("colo compare primary queue size too big," "drop packet"); } } else { - if (g_queue_get_length(&conn->secondary_list) <=3D - MAX_QUEUE_SIZE) { - g_queue_push_tail(&conn->secondary_list, pkt); - if (conn->ip_proto =3D=3D IPPROTO_TCP) { - g_queue_sort(&conn->secondary_list, - (GCompareDataFunc)seq_sorter, - NULL); - } - } else { + if (!colo_insert_packet(&conn->secondary_list, pkt)) { error_report("colo compare secondary queue size too big," "drop packet"); } --=20 2.7.4 From nobody Mon Apr 29 08:57:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1510625648999637.889192757814; Mon, 13 Nov 2017 18:14:08 -0800 (PST) Received: from localhost ([::1]:57264 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEQjh-0006O9-3o for importer@patchew.org; Mon, 13 Nov 2017 21:14:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57672) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEQhh-0004d3-F2 for qemu-devel@nongnu.org; Mon, 13 Nov 2017 21:11:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eEQhg-0000mg-En for qemu-devel@nongnu.org; Mon, 13 Nov 2017 21:11:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52324) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eEQhg-0000mH-7t for qemu-devel@nongnu.org; Mon, 13 Nov 2017 21:11:56 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 60E286A7C5; Tue, 14 Nov 2017 02:11:55 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-130.pek2.redhat.com [10.72.12.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 928D55D6AE; Tue, 14 Nov 2017 02:11:52 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Tue, 14 Nov 2017 10:11:33 +0800 Message-Id: <1510625498-4821-4-git-send-email-jasowang@redhat.com> In-Reply-To: <1510625498-4821-1-git-send-email-jasowang@redhat.com> References: <1510625498-4821-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 14 Nov 2017 02:11:55 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/8] colo-compare: compare the packet in a specified Connection X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mao Zhongyi , Jason Wang , Li Zhijian , Zhang Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mao Zhongyi A package from pri_indev or sec_indev only belongs to a particular Connection, so we only need to compare the package in the specified Connection's primary_list and secondary_list, rather than for each the whole Connection list to compare. This is time-consuming and unnecessary. Less checkpoint more efficiency. Cc: Zhang Chen Cc: Li Zhijian Cc: Jason Wang Signed-off-by: Mao Zhongyi Signed-off-by: Jason Wang --- net/colo-compare.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index 54b6347..5d2429b 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -136,7 +136,7 @@ static int colo_insert_packet(GQueue *queue, Packet *pk= t) * Return 0 on success, if return -1 means the pkt * is unsupported(arp and ipv6) and will be sent later */ -static int packet_enqueue(CompareState *s, int mode) +static int packet_enqueue(CompareState *s, int mode, Connection **con) { ConnectionKey key; Packet *pkt =3D NULL; @@ -179,6 +179,7 @@ static int packet_enqueue(CompareState *s, int mode) "drop packet"); } } + con =3D &conn; =20 return 0; } @@ -728,8 +729,9 @@ static void compare_set_vnet_hdr(Object *obj, static void compare_pri_rs_finalize(SocketReadState *pri_rs) { CompareState *s =3D container_of(pri_rs, CompareState, pri_rs); + Connection *conn =3D NULL; =20 - if (packet_enqueue(s, PRIMARY_IN)) { + if (packet_enqueue(s, PRIMARY_IN, &conn)) { trace_colo_compare_main("primary: unsupported packet in"); compare_chr_send(s, pri_rs->buf, @@ -737,19 +739,20 @@ static void compare_pri_rs_finalize(SocketReadState *= pri_rs) pri_rs->vnet_hdr_len); } else { /* compare connection */ - g_queue_foreach(&s->conn_list, colo_compare_connection, s); + colo_compare_connection(conn, s); } } =20 static void compare_sec_rs_finalize(SocketReadState *sec_rs) { CompareState *s =3D container_of(sec_rs, CompareState, sec_rs); + Connection *conn =3D NULL; =20 - if (packet_enqueue(s, SECONDARY_IN)) { + if (packet_enqueue(s, SECONDARY_IN, &conn)) { trace_colo_compare_main("secondary: unsupported packet in"); } else { /* compare connection */ - g_queue_foreach(&s->conn_list, colo_compare_connection, s); + colo_compare_connection(conn, s); } } =20 --=20 2.7.4 From nobody Mon Apr 29 08:57:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1510625807415243.48481778794337; Mon, 13 Nov 2017 18:16:47 -0800 (PST) Received: from localhost ([::1]:57283 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEQmK-0000EN-Gj for importer@patchew.org; Mon, 13 Nov 2017 21:16:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57710) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEQhk-0004mw-MY for qemu-devel@nongnu.org; Mon, 13 Nov 2017 21:12:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eEQhj-0000ok-Ov for qemu-devel@nongnu.org; Mon, 13 Nov 2017 21:12:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37560) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eEQhj-0000oI-IL for qemu-devel@nongnu.org; Mon, 13 Nov 2017 21:11:59 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BF99C267E1; Tue, 14 Nov 2017 02:11:58 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-130.pek2.redhat.com [10.72.12.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED63E5D6AE; Tue, 14 Nov 2017 02:11:55 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Tue, 14 Nov 2017 10:11:34 +0800 Message-Id: <1510625498-4821-5-git-send-email-jasowang@redhat.com> In-Reply-To: <1510625498-4821-1-git-send-email-jasowang@redhat.com> References: <1510625498-4821-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 14 Nov 2017 02:11:58 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 4/8] colo-compare: Fix comments X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mao Zhongyi , Jason Wang , Li Zhijian , Zhang Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mao Zhongyi Cc: Zhang Chen Cc: Li Zhijian Cc: Jason Wang Signed-off-by: Mao Zhongyi Signed-off-by: Zhang Chen Signed-off-by: Jason Wang --- net/colo-compare.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index 5d2429b..ccdcba2 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -480,7 +480,9 @@ static void colo_old_packet_check(void *opaque) =20 /* * Called from the compare thread on the primary - * for compare connection + * for compare packet with secondary list of the + * specified connection when a new packet was + * queued to it. */ static void colo_compare_connection(void *opaque, void *user_data) { @@ -738,7 +740,7 @@ static void compare_pri_rs_finalize(SocketReadState *pr= i_rs) pri_rs->packet_len, pri_rs->vnet_hdr_len); } else { - /* compare connection */ + /* compare packet in the specified connection */ colo_compare_connection(conn, s); } } @@ -751,7 +753,7 @@ static void compare_sec_rs_finalize(SocketReadState *se= c_rs) if (packet_enqueue(s, SECONDARY_IN, &conn)) { trace_colo_compare_main("secondary: unsupported packet in"); } else { - /* compare connection */ + /* compare packet in the specified connection */ colo_compare_connection(conn, s); } } --=20 2.7.4 From nobody Mon Apr 29 08:57:29 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1510625652002237.93263325414034; Mon, 13 Nov 2017 18:14:12 -0800 (PST) Received: from localhost ([::1]:57265 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEQjm-0006Sf-4q for importer@patchew.org; Mon, 13 Nov 2017 21:14:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57740) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEQhq-00054s-3q for qemu-devel@nongnu.org; Mon, 13 Nov 2017 21:12:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eEQhm-0000qV-UN for qemu-devel@nongnu.org; Mon, 13 Nov 2017 21:12:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33702) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eEQhm-0000q4-OT for qemu-devel@nongnu.org; Mon, 13 Nov 2017 21:12:02 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E9292C0587FA; Tue, 14 Nov 2017 02:12:01 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-130.pek2.redhat.com [10.72.12.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 593205D6AE; Tue, 14 Nov 2017 02:11:59 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Tue, 14 Nov 2017 10:11:35 +0800 Message-Id: <1510625498-4821-6-git-send-email-jasowang@redhat.com> In-Reply-To: <1510625498-4821-1-git-send-email-jasowang@redhat.com> References: <1510625498-4821-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 14 Nov 2017 02:12:02 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 5/8] colo: Consolidate the duplicate code chunk into a routine X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mao Zhongyi , Jason Wang , Li Zhijian , Zhang Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mao Zhongyi Consolidate the code that extract the ip address(src,dst) and port number(src,dst) of the packet into a separate routine extract_ip_and_port() since the same chunk of code is called from two place. Cc: Zhang Chen Cc: Li Zhijian Cc: Jason Wang Signed-off-by: Mao Zhongyi Signed-off-by: Jason Wang --- net/colo.c | 18 ++++++++++-------- net/colo.h | 1 + 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/net/colo.c b/net/colo.c index 28ce7c8..a39d600 100644 --- a/net/colo.c +++ b/net/colo.c @@ -82,6 +82,14 @@ int parse_packet_early(Packet *pkt) return 0; } =20 +void extract_ip_and_port(uint32_t tmp_ports, ConnectionKey *key, Packet *p= kt) +{ + key->src =3D pkt->ip->ip_src; + key->dst =3D pkt->ip->ip_dst; + key->src_port =3D ntohs(tmp_ports >> 16); + key->dst_port =3D ntohs(tmp_ports & 0xffff); +} + void fill_connection_key(Packet *pkt, ConnectionKey *key) { uint32_t tmp_ports; @@ -97,17 +105,11 @@ void fill_connection_key(Packet *pkt, ConnectionKey *k= ey) case IPPROTO_SCTP: case IPPROTO_UDPLITE: tmp_ports =3D *(uint32_t *)(pkt->transport_header); - key->src =3D pkt->ip->ip_src; - key->dst =3D pkt->ip->ip_dst; - key->src_port =3D ntohs(tmp_ports & 0xffff); - key->dst_port =3D ntohs(tmp_ports >> 16); + extract_ip_and_port(tmp_ports, key, pkt); break; case IPPROTO_AH: tmp_ports =3D *(uint32_t *)(pkt->transport_header + 4); - key->src =3D pkt->ip->ip_src; - key->dst =3D pkt->ip->ip_dst; - key->src_port =3D ntohs(tmp_ports & 0xffff); - key->dst_port =3D ntohs(tmp_ports >> 16); + extract_ip_and_port(tmp_ports, key, pkt); break; default: break; diff --git a/net/colo.h b/net/colo.h index caedb0d..0658e86 100644 --- a/net/colo.h +++ b/net/colo.h @@ -76,6 +76,7 @@ typedef struct Connection { uint32_t connection_key_hash(const void *opaque); int connection_key_equal(const void *opaque1, const void *opaque2); int parse_packet_early(Packet *pkt); +void extract_ip_and_port(uint32_t tmp_ports, ConnectionKey *key, Packet *p= kt); void fill_connection_key(Packet *pkt, ConnectionKey *key); void reverse_connection_key(ConnectionKey *key); Connection *connection_new(ConnectionKey *key); --=20 2.7.4 From nobody Mon Apr 29 08:57:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 151062580502639.18109898362286; Mon, 13 Nov 2017 18:16:45 -0800 (PST) Received: from localhost ([::1]:57281 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEQmI-0000Bu-3t for importer@patchew.org; Mon, 13 Nov 2017 21:16:42 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEQhq-00056U-Ka for qemu-devel@nongnu.org; Mon, 13 Nov 2017 21:12:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eEQhp-0000re-NI for qemu-devel@nongnu.org; Mon, 13 Nov 2017 21:12:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35782) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eEQhp-0000rK-HD for qemu-devel@nongnu.org; Mon, 13 Nov 2017 21:12:05 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B6970820FF; Tue, 14 Nov 2017 02:12:04 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-130.pek2.redhat.com [10.72.12.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8006D5D6AE; Tue, 14 Nov 2017 02:12:02 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Tue, 14 Nov 2017 10:11:36 +0800 Message-Id: <1510625498-4821-7-git-send-email-jasowang@redhat.com> In-Reply-To: <1510625498-4821-1-git-send-email-jasowang@redhat.com> References: <1510625498-4821-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 14 Nov 2017 02:12:04 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 6/8] Fix eepro100 simple transmission mode X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Wang , Mike Nawrocki Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mike Nawrocki The simple transmission mode was treating the area immediately after the transmit command block (TCB) as if it were a transmit buffer descriptor, when in reality it is simply the packet data. This change simply copies the data following the TCB into the packet buffer. Signed-off-by: Mike Nawrocki Reviewed-by: Michael S. Tsirkin Signed-off-by: Jason Wang --- hw/net/eepro100.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c index 80b8f47..91dd058 100644 --- a/hw/net/eepro100.c +++ b/hw/net/eepro100.c @@ -774,23 +774,11 @@ static void tx_command(EEPRO100State *s) } assert(tcb_bytes <=3D sizeof(buf)); while (size < tcb_bytes) { - uint32_t tx_buffer_address =3D ldl_le_pci_dma(&s->dev, tbd_address= ); - uint16_t tx_buffer_size =3D lduw_le_pci_dma(&s->dev, tbd_address += 4); -#if 0 - uint16_t tx_buffer_el =3D lduw_le_pci_dma(&s->dev, tbd_address + 6= ); -#endif - if (tx_buffer_size =3D=3D 0) { - /* Prevent an endless loop. */ - logout("loop in %s:%u\n", __FILE__, __LINE__); - break; - } - tbd_address +=3D 8; TRACE(RXTX, logout ("TBD (simplified mode): buffer address 0x%08x, size 0x%04x\n", - tx_buffer_address, tx_buffer_size)); - tx_buffer_size =3D MIN(tx_buffer_size, sizeof(buf) - size); - pci_dma_read(&s->dev, tx_buffer_address, &buf[size], tx_buffer_siz= e); - size +=3D tx_buffer_size; + tbd_address, tcb_bytes)); + pci_dma_read(&s->dev, tbd_address, &buf[size], tcb_bytes); + size +=3D tcb_bytes; } if (tbd_array =3D=3D 0xffffffff) { /* Simplified mode. Was already handled by code above. */ --=20 2.7.4 From nobody Mon Apr 29 08:57:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15106259140051005.6691958233496; Mon, 13 Nov 2017 18:18:34 -0800 (PST) Received: from localhost ([::1]:57294 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEQo5-0002d4-9M for importer@patchew.org; Mon, 13 Nov 2017 21:18:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57793) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEQhv-0005Ke-Ju for qemu-devel@nongnu.org; Mon, 13 Nov 2017 21:12:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eEQhu-0000vP-2p for qemu-devel@nongnu.org; Mon, 13 Nov 2017 21:12:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54038) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eEQht-0000uK-Q5 for qemu-devel@nongnu.org; Mon, 13 Nov 2017 21:12:10 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 053575D5E9; Tue, 14 Nov 2017 02:12:09 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-130.pek2.redhat.com [10.72.12.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 460C65D6AE; Tue, 14 Nov 2017 02:12:04 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Tue, 14 Nov 2017 10:11:37 +0800 Message-Id: <1510625498-4821-8-git-send-email-jasowang@redhat.com> In-Reply-To: <1510625498-4821-1-git-send-email-jasowang@redhat.com> References: <1510625498-4821-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 14 Nov 2017 02:12:09 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 7/8] Add new PCI ID for i82559a X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Wang , Mike Nawrocki Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mike Nawrocki Adds a new PCI ID for the i82559a (0x8086 0x1030) interface. The "x-use-alt-device-id" property controls whether this new ID is to be used, and is true by default, and set to false in a compat entry. Signed-off-by: Mike Nawrocki Reviewed-by: Michael S. Tsirkin Signed-off-by: Jason Wang --- hw/net/eepro100.c | 13 +++++++++++++ include/hw/compat.h | 4 ++++ include/hw/pci/pci.h | 1 + qemu-options.hx | 2 +- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c index 91dd058..a63ed2c 100644 --- a/hw/net/eepro100.c +++ b/hw/net/eepro100.c @@ -132,6 +132,7 @@ typedef struct { const char *name; const char *desc; uint16_t device_id; + uint16_t alt_device_id; uint8_t revision; uint16_t subsystem_vendor_id; uint16_t subsystem_id; @@ -276,6 +277,7 @@ typedef struct { /* Quasi static device properties (no need to save them). */ uint16_t stats_size; bool has_extended_tcb_support; + bool use_alt_device_id; } EEPRO100State; =20 /* Word indices in EEPROM. */ @@ -1855,6 +1857,14 @@ static void e100_nic_realize(PCIDevice *pci_dev, Err= or **errp) =20 TRACE(OTHER, logout("\n")); =20 + /* By default, the i82559a adapter uses the legacy PCI ID (for the + * i82557). This allows the PCI ID to be changed to the alternate + * i82559 ID if needed. + */ + if (s->use_alt_device_id && strcmp(info->name, "i82559a") =3D=3D 0) { + pci_config_set_device_id(s->dev.config, info->alt_device_id); + } + s->device =3D info->device; =20 e100_pci_reset(s, &local_err); @@ -1974,6 +1984,7 @@ static E100PCIDeviceInfo e100_devices[] =3D { .desc =3D "Intel i82559A Ethernet", .device =3D i82559A, .device_id =3D PCI_DEVICE_ID_INTEL_82557, + .alt_device_id =3D PCI_DEVICE_ID_INTEL_82559, .revision =3D 0x06, .stats_size =3D 80, .has_extended_tcb_support =3D true, @@ -2067,6 +2078,8 @@ static E100PCIDeviceInfo *eepro100_get_class(EEPRO100= State *s) =20 static Property e100_properties[] =3D { DEFINE_NIC_PROPERTIES(EEPRO100State, conf), + DEFINE_PROP_BOOL("x-use-alt-device-id", EEPRO100State, use_alt_device_= id, + true), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/include/hw/compat.h b/include/hw/compat.h index cf389b4..f96212c 100644 --- a/include/hw/compat.h +++ b/include/hw/compat.h @@ -10,6 +10,10 @@ .driver =3D "virtio-tablet-device",\ .property =3D "wheel-axis",\ .value =3D "false",\ + },{\ + .driver =3D "i82559a",\ + .property =3D "x-use-alt-device-id",\ + .value =3D "false",\ }, =20 #define HW_COMPAT_2_9 \ diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 8d02a0a..f30e2cf 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -70,6 +70,7 @@ extern bool pci_available; /* Intel (0x8086) */ #define PCI_DEVICE_ID_INTEL_82551IT 0x1209 #define PCI_DEVICE_ID_INTEL_82557 0x1229 +#define PCI_DEVICE_ID_INTEL_82559 0x1030 #define PCI_DEVICE_ID_INTEL_82801IR 0x2922 =20 /* Red Hat / Qumranet (for QEMU) -- see pci-ids.txt */ diff --git a/qemu-options.hx b/qemu-options.hx index 3728e9b..a39c7e4 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2047,7 +2047,7 @@ that the card should have; this option currently only= affects virtio cards; set @var{v} =3D 0 to disable MSI-X. If no @option{-net} option is specified, a= single NIC is created. QEMU can emulate several different models of network card. Valid values for @var{type} are -@code{virtio}, @code{i82551}, @code{i82557b}, @code{i82559er}, +@code{virtio}, @code{i82551}, @code{i82557b}, @code{i82559a}, @code{i82559= er}, @code{ne2k_pci}, @code{ne2k_isa}, @code{pcnet}, @code{rtl8139}, @code{e1000}, @code{smc91c111}, @code{lance} and @code{mcf_fec}. Not all devices are supported on all targets. Use @code{-net nic,model=3D= help} --=20 2.7.4 From nobody Mon Apr 29 08:57:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1510625811504943.9252821656154; Mon, 13 Nov 2017 18:16:51 -0800 (PST) Received: from localhost ([::1]:57284 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEQmQ-0000Jk-JG for importer@patchew.org; Mon, 13 Nov 2017 21:16:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57855) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEQi4-0005W2-6i for qemu-devel@nongnu.org; Mon, 13 Nov 2017 21:12:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eEQi1-00011m-1L for qemu-devel@nongnu.org; Mon, 13 Nov 2017 21:12:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40527) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eEQi0-000110-Rd; Mon, 13 Nov 2017 21:12:16 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 179BB5F176; Tue, 14 Nov 2017 02:12:16 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-130.pek2.redhat.com [10.72.12.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 909DD5D6AE; Tue, 14 Nov 2017 02:12:09 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Tue, 14 Nov 2017 10:11:38 +0800 Message-Id: <1510625498-4821-9-git-send-email-jasowang@redhat.com> In-Reply-To: <1510625498-4821-1-git-send-email-jasowang@redhat.com> References: <1510625498-4821-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 14 Nov 2017 02:12:16 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 8/8] net/socket: fix coverity issue X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Wang , Jens Freimann , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Jens Freimann This fixes coverity issue CID1005339. Make sure that saddr is not used uninitialized if the mcast parameter is NULL. Cc: qemu-stable@nongnu.org Reported-by: Peter Maydell Signed-off-by: Jens Freimann Signed-off-by: Jason Wang --- net/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/socket.c b/net/socket.c index 83a2a31..6917fbc 100644 --- a/net/socket.c +++ b/net/socket.c @@ -373,7 +373,7 @@ static NetSocketState *net_socket_fd_init_dgram(NetClie= ntState *peer, net_socket_read_poll(s, true); =20 /* mcast: save bound address as dst */ - if (is_connected) { + if (is_connected && mcast !=3D NULL) { s->dgram_dst =3D saddr; snprintf(nc->info_str, sizeof(nc->info_str), "socket: fd=3D%d (cloned mcast=3D%s:%d)", --=20 2.7.4