From patchwork Thu Aug 22 23:14:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhijian Li (Fujitsu)\" via" X-Patchwork-Id: 11110229 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6AC5313A4 for ; Thu, 22 Aug 2019 23:19:46 +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 002A92173E for ; Thu, 22 Aug 2019 23:19:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="FLu97IIq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 002A92173E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=nongnu.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:48714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0wMr-0000Sd-1I for patchwork-qemu-devel@patchwork.kernel.org; Thu, 22 Aug 2019 19:19:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53980) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <37yFfXQMKCqASCWGOOGLE.COMQEMU-DEVELNONGNU.ORG@flex--scw.bounces.google.com>) id 1i0wIE-0003Yj-6L for qemu-devel@nongnu.org; Thu, 22 Aug 2019 19:14:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <37yFfXQMKCqASCWGOOGLE.COMQEMU-DEVELNONGNU.ORG@flex--scw.bounces.google.com>) id 1i0wID-0007lg-76 for qemu-devel@nongnu.org; Thu, 22 Aug 2019 19:14:58 -0400 Received: from mail-yw1-xc4a.google.com ([2607:f8b0:4864:20::c4a]:32942) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from <37yFfXQMKCqASCWGOOGLE.COMQEMU-DEVELNONGNU.ORG@flex--scw.bounces.google.com>) id 1i0wID-0007kl-3k for qemu-devel@nongnu.org; Thu, 22 Aug 2019 19:14:57 -0400 Received: by mail-yw1-xc4a.google.com with SMTP id j132so5241718ywa.0 for ; Thu, 22 Aug 2019 16:14:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=wjAAokdz+BjWOrP6H30Bj42YsWMqshehdtDNsRq7YK8=; b=FLu97IIqMrnv5IXsDnUWMYqmE2u9JgQuy0QfXdtzfgV4ysmf+AA1VmbPVoj1QSV2Zz FzNwwwp0/+2qq6ySKXq3oc5/9P42BxZ9gORLXyx/8WOozJAAiM4ofoDt/t6CVKap1xDN NPiRsIxtzwihjqLwiW8Q0+IfjqS212ebrrjS1F4ujpjfcWT+xco7a/B8UrtVpnWj85HF 5ggds/LzOo66jyR2mr1BUYz9LEVhfFX9ttbBhvqAdD0bITADOM8G2lfoig66JFIZNkLM aNCFAjYuG0eQ5O95CJhfsn5aLG354pGZU2P1w9YiNCNUf6jK/I/dixFpo8LIESInoAot mLsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=wjAAokdz+BjWOrP6H30Bj42YsWMqshehdtDNsRq7YK8=; b=bJwC8XgaYUm6u4sFFL02/XPfBD/8DK+tAO5AOSFnrlX1k7PHzgywwpmCW/ONIiqGbi HA6a9YH5AkwO4Ahib+IKvA+g1REnjqgaJL03Rvk1edmLKCc/4AeZXl4Aonwj3olVSA6x v64aQl9gmO9m6orOI9vHMbOP7GwHtLAOAkLL3WvHeqms4yIAoyOsW9rWWaDAnNsHYvLu yboj+fZPZuWLB3XfoEEZ7VBZk15JXgPHQajYDRJB4A8Hev2iLRHrxfZdwNv6bCR1YzZ9 VcwUT6ui8QJL/mQyqohuBHUaB/11isKTz3AL31aiJdqmSRrxxm6JyhpSPReHiLVPFuOF Z57g== X-Gm-Message-State: APjAAAWFSySr7QpKp9ZJqSJhv024Gs3HJbxwO85guS9KLl1NHlyifN3F BQdfUUUcQlJUFhCKFMIcv3tONxA= X-Google-Smtp-Source: APXvYqxPS7mnYfHCiNZUyhbutPZ82qHtoLtEtL77YWEGtBS9pzaOLrEC+VB1TNOq35w1Z7+OqQWwwBs= X-Received: by 2002:a81:4c55:: with SMTP id z82mr1292478ywa.367.1566515695253; Thu, 22 Aug 2019 16:14:55 -0700 (PDT) Date: Thu, 22 Aug 2019 16:14:42 -0700 In-Reply-To: <20190822231443.172099-1-scw@google.com> Message-Id: <20190822231443.172099-2-scw@google.com> Mime-Version: 1.0 References: <20190822231443.172099-1-scw@google.com> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog To: Laurent Vivier X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::c4a Subject: [Qemu-devel] [PATCH 1/2] linux-user: add missing UDP and IPv6 setsockopt options 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: , X-Patchwork-Original-From: Shu-Chun Weng via Qemu-devel From: "Zhijian Li (Fujitsu)\" via" Reply-To: Shu-Chun Weng Cc: Riku Voipio , qemu-devel@nongnu.org, Shu-Chun Weng Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" UDP: SOL_UDP manipulate options at UDP level. All six options currently defined in linux source include/uapi/linux/udp.h take integer values. IPv6: IPV6_ADDR_PREFERENCES (RFC5014: Source address selection) was not supported. Signed-off-by: Shu-Chun Weng --- linux-user/syscall.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 8367cb138d..8dc4255f12 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -49,8 +49,10 @@ #include #include //#include +#include #include #include +#include #include #include #include @@ -1837,7 +1839,8 @@ static abi_long do_setsockopt(int sockfd, int level, int optname, switch(level) { case SOL_TCP: - /* TCP options all take an 'int' value. */ + case SOL_UDP: + /* TCP and UDP options all take an 'int' value. */ if (optlen < sizeof(uint32_t)) return -TARGET_EINVAL; @@ -2488,6 +2491,7 @@ static abi_long do_getsockopt(int sockfd, int level, int optname, case IPV6_RECVDSTOPTS: case IPV6_2292DSTOPTS: case IPV6_TCLASS: + case IPV6_ADDR_PREFERENCES: #ifdef IPV6_RECVPATHMTU case IPV6_RECVPATHMTU: #endif From patchwork Thu Aug 22 23:14:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhijian Li (Fujitsu)\" via" X-Patchwork-Id: 11110227 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A80E913A4 for ; Thu, 22 Aug 2019 23:19:22 +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 7C9DD2173E for ; Thu, 22 Aug 2019 23:19:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="h1xznDfp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7C9DD2173E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=nongnu.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:48710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0wMT-0008Qv-CD for patchwork-qemu-devel@patchwork.kernel.org; Thu, 22 Aug 2019 19:19:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53997) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <38iFfXQMKCqMVFZJRRJOH.FRPTHPX-GHYHOQRQJQX.RUJ@flex--scw.bounces.google.com>) id 1i0wII-0003dt-AZ for qemu-devel@nongnu.org; Thu, 22 Aug 2019 19:15:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <38iFfXQMKCqMVFZJRRJOH.FRPTHPX-GHYHOQRQJQX.RUJ@flex--scw.bounces.google.com>) id 1i0wIH-0007nb-Av for qemu-devel@nongnu.org; Thu, 22 Aug 2019 19:15:02 -0400 Received: from mail-pf1-x44a.google.com ([2607:f8b0:4864:20::44a]:33716) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from <38iFfXQMKCqMVFZJRRJOH.FRPTHPX-GHYHOQRQJQX.RUJ@flex--scw.bounces.google.com>) id 1i0wIG-0007mP-5K for qemu-devel@nongnu.org; Thu, 22 Aug 2019 19:15:01 -0400 Received: by mail-pf1-x44a.google.com with SMTP id r130so5104670pfc.0 for ; Thu, 22 Aug 2019 16:14:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=ohZHbdryKXSynjo681jhUMl4RCCWauFt1xkFVh1KbPw=; b=h1xznDfpJa+SzNBk6jmopaHlF8rLmA3ldeZ5xQubxAyFEYY/s6dRm5XcGp0soBOC8k CWT+D+zCafv7ay58U1J+LQupUYiBLCttL5APz1iFhw70A1kEpU5rXHvTm8Hsr9axTzu4 D/d5gWnTJE4ryRmst5TuZQqfVTb8FTPccwVUAaMj9JEI5ILuO53C2TDRRQYBSfHWzyAN QOEytPxGJ3k9aspTRBoQYTxUOJxz9wUn5zhsjrIMaFeqKgNszlXK2NMgnm0dUZrZpX6i G4+Dv0fqDc0ZHlOZzrkKGmgfldMgWRKevjBUuKX6WOJnXtK2gtRb2+AHHMdNtWQstID7 iMKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=ohZHbdryKXSynjo681jhUMl4RCCWauFt1xkFVh1KbPw=; b=t35zQVlA7EYUC6ynhT+e6YblsAUnoCXx7cXga91RM4F5whZEJMj0ogWGE9x0+SLmSQ tD5bOFJ6KkDEOF7Jj+dyJ5rY2SWDLxpz/B9IoGDGBycNwJkD4vA73RQ/BtvAFkO1QUiZ R4dt1DAbl6hhBDt65OVmxEFM5uUnN35ZBWiJA7xCSi7gaFo4n3QHowtzGgED7R4A+ur9 dr91LdJQtMtxVEwuWgmwPBIgo+ezNuCaRrqFNALP/8rDkDsnNbvoHfE9JVsNYF5KB8Gb MGscOXxQmvfjQMc0PDsjVHRsMep537YS1Zd9R4L2xmcbXQtihf4iT2iqTjoAvA4hmBBj 9hNg== X-Gm-Message-State: APjAAAX2jWE8DpyV2SfctFCcYELnMWlRseDN9H6pHmdkifQo5mwT5Qrj xR6qzuHmaq6mJW5sGihmK2/YI4Q= X-Google-Smtp-Source: APXvYqw+P9k2vez698x4M7kWpp0xm8fcWXI3wOSh/ZQXh7VG/SdR54XSSnqvwlDFdVZj4w7O46j/+7U= X-Received: by 2002:a65:6713:: with SMTP id u19mr1269816pgf.403.1566515698241; Thu, 22 Aug 2019 16:14:58 -0700 (PDT) Date: Thu, 22 Aug 2019 16:14:43 -0700 In-Reply-To: <20190822231443.172099-1-scw@google.com> Message-Id: <20190822231443.172099-3-scw@google.com> Mime-Version: 1.0 References: <20190822231443.172099-1-scw@google.com> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog To: Laurent Vivier X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::44a Subject: [Qemu-devel] [PATCH 2/2] linux-user: time stamping options for setsockopt() 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: , X-Patchwork-Original-From: Shu-Chun Weng via Qemu-devel From: "Zhijian Li (Fujitsu)\" via" Reply-To: Shu-Chun Weng Cc: Riku Voipio , qemu-devel@nongnu.org, Shu-Chun Weng Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" This change supports SO_TIMESTAMPNS and SO_TIMESTAMPING for setsocketopt() with SOL_SOCKET. The TARGET_SO_TIMESTAMP{NS,ING} constants are already defined for alpha, hppa, and sparc. In include/uapi/asm-generic/socket.h: In arch/mips/include/uapi/asm/socket.h: Signed-off-by: Shu-Chun Weng --- linux-user/generic/sockbits.h | 4 ++++ linux-user/mips/sockbits.h | 4 ++++ linux-user/syscall.c | 10 ++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/linux-user/generic/sockbits.h b/linux-user/generic/sockbits.h index e44733c601..5cbafdb49b 100644 --- a/linux-user/generic/sockbits.h +++ b/linux-user/generic/sockbits.h @@ -51,6 +51,10 @@ #define TARGET_SO_PEERNAME 28 #define TARGET_SO_TIMESTAMP 29 #define TARGET_SCM_TIMESTAMP TARGET_SO_TIMESTAMP +#define TARGET_SO_TIMESTAMPNS 35 +#define TARGET_SCM_TIMESTAMPNS TARGET_SO_TIMESTAMPNS +#define TARGET_SO_TIMESTAMPING 37 +#define TARGET_SCM_TIMESTAMPING TARGET_SO_TIMESTAMPING #define TARGET_SO_ACCEPTCONN 30 diff --git a/linux-user/mips/sockbits.h b/linux-user/mips/sockbits.h index 0f022cd598..1246b7d988 100644 --- a/linux-user/mips/sockbits.h +++ b/linux-user/mips/sockbits.h @@ -63,6 +63,10 @@ #define TARGET_SO_PEERNAME 28 #define TARGET_SO_TIMESTAMP 29 #define SCM_TIMESTAMP SO_TIMESTAMP +#define TARGET_SO_TIMESTAMPNS 35 +#define SCM_TIMESTAMPNS SO_TIMESTAMPNS +#define TARGET_SO_TIMESTAMPING 37 +#define SCM_TIMESTAMPING SO_TIMESTAMPING #define TARGET_SO_PEERSEC 30 #define TARGET_SO_SNDBUFFORCE 31 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 8dc4255f12..bac00d3fd4 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -2230,8 +2230,14 @@ set_timeout: optname = SO_PASSSEC; break; case TARGET_SO_TIMESTAMP: - optname = SO_TIMESTAMP; - break; + optname = SO_TIMESTAMP; + break; + case TARGET_SO_TIMESTAMPNS: + optname = SO_TIMESTAMPNS; + break; + case TARGET_SO_TIMESTAMPING: + optname = SO_TIMESTAMPING; + break; case TARGET_SO_RCVLOWAT: optname = SO_RCVLOWAT; break;