From patchwork Thu Feb 4 15:39:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 12067611 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F279C433DB for ; Thu, 4 Feb 2021 15:43:55 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E318C64F4A for ; Thu, 4 Feb 2021 15:43:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E318C64F4A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=zx2c4.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:47182 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7gnR-0006kW-W6 for qemu-devel@archiver.kernel.org; Thu, 04 Feb 2021 10:43:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51888) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7gjO-00030V-0N for qemu-devel@nongnu.org; Thu, 04 Feb 2021 10:39:42 -0500 Received: from mail.zx2c4.com ([104.131.123.232]:36682) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7gjK-0002Oj-7a for qemu-devel@nongnu.org; Thu, 04 Feb 2021 10:39:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1612453173; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Dr4rQZbGbc/VL5lm5IbTJmHVcud2noviZG6/MiSOg98=; b=Fq4YgKLN6iyBnScWaLcJn0c4/5IgFsgdSa2QvYFKmCX0d+iGqUGvHy1y0/5TavdIQS9BWY RwQkv2G09i0SnkbL1HiHc/iLyvZ6s4Kswh0POwHuMV7OzrWpVpoftFNetn1uSRHG2k9LMC SU/7e9BO4JypXW+WPu3oJpj4uoAnPCs= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 8ba96afa (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Thu, 4 Feb 2021 15:39:32 +0000 (UTC) From: "Jason A. Donenfeld" To: qemu-devel@nongnu.org Subject: [PATCH] linux-user: add TARGET_SO_{DOMAIN,PROTOCOL} Date: Thu, 4 Feb 2021 16:39:25 +0100 Message-Id: <20210204153925.2030606-1-Jason@zx2c4.com> MIME-Version: 1.0 Received-SPF: pass client-ip=104.131.123.232; envelope-from=Jason@zx2c4.com; helo=mail.zx2c4.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Jason A. Donenfeld" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" These were defined for other platforms but mistakenly left out of mips and generic, so this commit adds them to the places missing. Then it makes them be translated in getsockopt. Signed-off-by: Jason A. Donenfeld Reviewed-by: Laurent Vivier --- linux-user/generic/sockbits.h | 3 +++ linux-user/mips/sockbits.h | 2 ++ linux-user/syscall.c | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/linux-user/generic/sockbits.h b/linux-user/generic/sockbits.h index e44733c601..b3b4a8e44c 100644 --- a/linux-user/generic/sockbits.h +++ b/linux-user/generic/sockbits.h @@ -55,4 +55,7 @@ #define TARGET_SO_ACCEPTCONN 30 #define TARGET_SO_PEERSEC 31 + +#define TARGET_SO_PROTOCOL 38 +#define TARGET_SO_DOMAIN 39 #endif diff --git a/linux-user/mips/sockbits.h b/linux-user/mips/sockbits.h index 0f022cd598..562cad88e2 100644 --- a/linux-user/mips/sockbits.h +++ b/linux-user/mips/sockbits.h @@ -40,6 +40,8 @@ #define TARGET_SO_SNDTIMEO 0x1005 /* send timeout */ #define TARGET_SO_RCVTIMEO 0x1006 /* receive timeout */ #define TARGET_SO_ACCEPTCONN 0x1009 +#define TARGET_SO_PROTOCOL 0x1028 /* protocol type */ +#define TARGET_SO_DOMAIN 0x1029 /* domain/socket family */ /* linux-specific, might as well be the same as on i386 */ #define TARGET_SO_NO_CHECK 11 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 34760779c8..264b3265b1 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -2832,6 +2832,12 @@ get_timeout: case TARGET_SO_ACCEPTCONN: optname = SO_ACCEPTCONN; goto int_case; + case TARGET_SO_PROTOCOL: + optname = SO_PROTOCOL; + goto int_case; + case TARGET_SO_DOMAIN: + optname = SO_DOMAIN; + goto int_case; default: goto int_case; }