{"id":809708,"url":"http://patchwork.ozlabs.org/api/1.0/patches/809708/?format=json","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.0/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<c4e3a38b93b7c1e2cb54882954f90cc30d55c661.1504533674.git.maozy.fnst@cn.fujitsu.com>","date":"2017-09-04T14:35:37","name":"[v9,1/4] net/socket: Don't treat odd socket type as SOCK_STREAM","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"f34f5c520f2f5ef0b6a8455584624eb772f8b6eb","submitter":{"id":71231,"url":"http://patchwork.ozlabs.org/api/1.0/people/71231/?format=json","name":"Mao Zhongyi","email":"maozy.fnst@cn.fujitsu.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/c4e3a38b93b7c1e2cb54882954f90cc30d55c661.1504533674.git.maozy.fnst@cn.fujitsu.com/mbox/","series":[{"id":1398,"url":"http://patchwork.ozlabs.org/api/1.0/series/1398/?format=json","date":"2017-09-04T14:35:37","name":"Improve error reporting","version":9,"mbox":"http://patchwork.ozlabs.org/series/1398/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/809708/checks/","tags":{},"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xmCC35vrnz9s7c\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue,  5 Sep 2017 00:38:39 +1000 (AEST)","from localhost ([::1]:47865 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dosWL-0005sF-Rc\n\tfor incoming@patchwork.ozlabs.org; Mon, 04 Sep 2017 10:38:37 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:33604)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <maozy.fnst@cn.fujitsu.com>) id 1dosVc-0005mz-H4\n\tfor qemu-devel@nongnu.org; Mon, 04 Sep 2017 10:37:57 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <maozy.fnst@cn.fujitsu.com>) id 1dosVX-0003z5-Ry\n\tfor qemu-devel@nongnu.org; Mon, 04 Sep 2017 10:37:52 -0400","from mail.cn.fujitsu.com ([183.91.158.132]:32749\n\thelo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <maozy.fnst@cn.fujitsu.com>) id 1dosVX-0003xu-Gz\n\tfor qemu-devel@nongnu.org; Mon, 04 Sep 2017 10:37:47 -0400","from localhost (HELO cn.fujitsu.com) ([10.167.33.5])\n\tby heian.cn.fujitsu.com with ESMTP; 04 Sep 2017 22:37:40 +0800","from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85])\n\tby cn.fujitsu.com (Postfix) with ESMTP id CDE444725548;\n\tMon,  4 Sep 2017 22:37:39 +0800 (CST)","from maozy.g08.fujitsu.local (10.167.225.76) by\n\tG08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP\n\tServer (TLS) id 14.3.361.1; Mon, 4 Sep 2017 22:37:45 +0800"],"X-IronPort-AV":"E=Sophos;i=\"5.41,475,1498492800\"; d=\"scan'208\";a=\"25197757\"","From":"Mao Zhongyi <maozy.fnst@cn.fujitsu.com>","To":"<qemu-devel@nongnu.org>","Date":"Mon, 4 Sep 2017 22:35:37 +0800","Message-ID":"<c4e3a38b93b7c1e2cb54882954f90cc30d55c661.1504533674.git.maozy.fnst@cn.fujitsu.com>","X-Mailer":"git-send-email 2.9.4","In-Reply-To":"<cover.1504533674.git.maozy.fnst@cn.fujitsu.com>","References":"<cover.1504533674.git.maozy.fnst@cn.fujitsu.com>","MIME-Version":"1.0","Content-Type":"text/plain","X-Originating-IP":"[10.167.225.76]","X-yoursite-MailScanner-ID":"CDE444725548.A14DB","X-yoursite-MailScanner":"Found to be clean","X-yoursite-MailScanner-From":"maozy.fnst@cn.fujitsu.com","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"183.91.158.132","Subject":"[Qemu-devel] [PATCH v9 1/4] net/socket: Don't treat odd socket type\n\tas SOCK_STREAM","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"jasowang@redhat.com, armbru@redhat.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"In net_socket_fd_init(), the 'default' case is odd: it warns,\nthen continues as if the socket type was SOCK_STREAM. The\ncomment explains \"this could be a eg. a pty\", but that makes\nno sense. If @fd really was a pty, getsockopt() would fail\nwith ENOTSOCK. If @fd was a socket, but neither SOCK_DGRAM nor\nSOCK_STREAM. It should not be treated as if it was SOCK_STREAM.\n\nTurn this case into an Error. If there is a genuine reason to\nsupport something like SOCK_RAW, it should be explicitly\nhandled.\n\nCc: jasowang@redhat.com\nCc: armbru@redhat.com\nCc: berrange@redhat.com\nCc: armbru@redhat.com\nCc: eblake@redhat.com\nSuggested-by: Markus Armbruster <armbru@redhat.com>\nSuggested-by: Daniel P. Berrange <berrange@redhat.com>\nSigned-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>\nReviewed-by: Markus Armbruster <armbru@redhat.com>\n---\n net/socket.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)","diff":"diff --git a/net/socket.c b/net/socket.c\nindex 18af2ab..b4c5a04 100644\n--- a/net/socket.c\n+++ b/net/socket.c\n@@ -448,9 +448,9 @@ static NetSocketState *net_socket_fd_init(NetClientState *peer,\n     case SOCK_STREAM:\n         return net_socket_fd_init_stream(peer, model, name, fd, is_connected);\n     default:\n-        /* who knows ... this could be a eg. a pty, do warn and continue as stream */\n-        fprintf(stderr, \"qemu: warning: socket type=%d for fd=%d is not SOCK_DGRAM or SOCK_STREAM\\n\", so_type, fd);\n-        return net_socket_fd_init_stream(peer, model, name, fd, is_connected);\n+        error_report(\"socket type=%d for fd=%d must be either\"\n+                     \" SOCK_DGRAM or SOCK_STREAM\", so_type, fd);\n+        closesocket(fd);\n     }\n     return NULL;\n }\n","prefixes":["v9","1/4"]}