From patchwork Thu Sep 8 11:58:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vyacheslav V. Mitrofanov" X-Patchwork-Id: 1675562 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=yadro.com header.i=@yadro.com header.a=rsa-sha256 header.s=mta-01 header.b=Rz5KL2Vu; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MNd4b2WjBz1yhR for ; Thu, 8 Sep 2022 22:01:03 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3909084B47; Thu, 8 Sep 2022 13:59:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=yadro.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=yadro.com header.i=@yadro.com header.b="Rz5KL2Vu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 871C884B0D; Thu, 8 Sep 2022 13:59:35 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mta-01.yadro.com (mta-02.yadro.com [89.207.88.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8C03C84B0C for ; Thu, 8 Sep 2022 13:59:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=yadro.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=v.v.mitrofanov@yadro.com Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id DD6B64171B; Thu, 8 Sep 2022 11:59:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received:received; s= mta-01; t=1662638365; x=1664452766; bh=2sQNFI+vz0X/oa8P5P3F5lGf4 zq0807xo4Kad1OObuk=; b=Rz5KL2VuUces6EGJzEItvfQiHHUF+hNMBLa8lKnci kJV0hKf8ukdAR9BafIKuFCdSAj2t11OHYMzRy9QT6MeGedYceYUCkouTuDbj2FiV u9eFr/9BRwb0XX+yXjAZKJaPOXjzBUiVrzIHLz/fR/8W5PQtZ15EjG93nn8Yq778 Os= Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YaPMUZNwv7CK; Thu, 8 Sep 2022 14:59:25 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (T-EXCH-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 8966946C21; Thu, 8 Sep 2022 14:59:23 +0300 (MSK) Received: from T-EXCH-06.corp.yadro.com (172.17.10.110) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 8 Sep 2022 14:59:23 +0300 Received: from v.yadro.com (10.199.17.194) by T-EXCH-06.corp.yadro.com (172.17.10.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1118.9; Thu, 8 Sep 2022 14:59:22 +0300 From: Viacheslav Mitrofanov To: CC: , , , , , , , Subject: [PATCH 06/17] net: ipv6: Enable IPv6 typeconversion specifier Date: Thu, 8 Sep 2022 14:58:54 +0300 Message-ID: <20220908115905.70928-7-v.v.mitrofanov@yadro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220908115905.70928-1-v.v.mitrofanov@yadro.com> References: <20220908115905.70928-1-v.v.mitrofanov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [10.199.17.194] X-ClientProxiedBy: T-EXCH-02.corp.yadro.com (172.17.10.102) To T-EXCH-06.corp.yadro.com (172.17.10.110) X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Add the possibility to recognize IPv6 address in print function. To output IPv6 address use %pI6 specifier. Series-changes: 3 - Substituted #if (...) for if (...) to get better readability Signed-off-by: Viacheslav Mitrofanov Reviewed-by: Simon Glass --- lib/vsprintf.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/vsprintf.c b/lib/vsprintf.c index fe06aa2d71..530d8088c7 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -450,10 +450,6 @@ static char *uuid_string(char *buf, char *end, u8 *addr, int field_width, * decimal for v4 and colon separated network-order 16 bit hex for v6) * - 'i' [46] for 'raw' IPv4/IPv6 addresses, IPv6 omits the colons, IPv4 is * currently the same - * - * Note: IPv6 support is currently if(0)'ed out. If you ever need - * %pI6, please add an IPV6 Kconfig knob, make your code select or - * depend on that, and change the 0 below to CONFIG_IS_ENABLED(IPV6). */ static char *pointer(const char *fmt, char *buf, char *end, void *ptr, int field_width, int precision, int flags) @@ -498,8 +494,7 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr, flags |= SPECIAL; /* Fallthrough */ case 'I': - /* %pI6 currently unused */ - if (0 && fmt[1] == '6') + if (IS_ENABLED(CONFIG_IPV6) && fmt[1] == '6') return ip6_addr_string(buf, end, ptr, field_width, precision, flags); if (fmt[1] == '4')