Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1020044rda; Sun, 22 Oct 2023 22:38:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGeLCnLS1rkUAxMZP4OxdHeq6mss1epUthtCMmDZVxXWMDpMgDOy5ck+Bp7S1sYJ3hH+u2S X-Received: by 2002:a05:6a00:1488:b0:68a:54e5:24e6 with SMTP id v8-20020a056a00148800b0068a54e524e6mr9650112pfu.8.1698039530891; Sun, 22 Oct 2023 22:38:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698039530; cv=none; d=google.com; s=arc-20160816; b=X6+n1TME85M1iSEgpIjuVjm2+PsE4cM8/G9OamhUnmdJ6rb8xgNNWA7f9VHNlOelM+ CkGi1L3hxqFEKdZ854xpaJt6IoxaJnlXQojLShcfDUQKGmVv+4ieh81wsfKeQlqPEokO WIAiXyrfGM/GOKgsPYn6zj2Z/BJa4NM46MjXCcd0bKxQaojoSqybLf8XIXPc6ON2o2OQ hEQfVeyO5OjfKEuKpW7NpNBtUAqDZGFn3V1+BEGk1vf1Olf273VbSmScO/2T2DzHUvPZ 005eDDb97uGEWFSdP4mWA+vjfb2e+3tGovZwO54oj5oImTYMORktabG6O/CbeHezeDoS aDXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=wdBTgfyeYv6OIVrdKsx9E9VcCeZFvYAlw+80iTEMrps=; fh=mI6T20+NyPSUoXsT01LRLkhCeakBwI6L2RwUYvWXIt8=; b=MHUJU8Ox9BLXuMP67tWgowJ7WzmoomWXFfki+SRVW584wULZ+USmzj9eolwgg9E57f oRzHC+Rzjl5FwuEojxsKMig/s3w55/YirBocfyy1GgEeVyhd88rns/shdrgEXNFhrwUU ZwJCVaufiQm+LmxrjCTbz6lWf7y+RoR68z4CYE4PG6ich1Xry5k8+4oklsHrB0YdZ6WY H2WPeri5ODfKrgM61lnHQ/RZtz6+mdQMdxQA0neGHhX746nj2vjfxUgGXR40qi1p+KHi gsB/eOESW2HxA5kP3IXXxeLAw5SBK4J6B8tbdNISlgC5nLhTUQhWq/WOA/AOK/aKhfEg Ql6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=f5Jwgx+X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id h10-20020a056a00230a00b006be246c6decsi6130198pfh.351.2023.10.22.22.38.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Oct 2023 22:38:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=f5Jwgx+X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 4E80E807FD4C; Sun, 22 Oct 2023 22:38:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229463AbjJWFiL (ORCPT + 99 others); Mon, 23 Oct 2023 01:38:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233390AbjJWFhw (ORCPT ); Mon, 23 Oct 2023 01:37:52 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 20C48D7A; Sun, 22 Oct 2023 22:37:47 -0700 (PDT) Received: by linux.microsoft.com (Postfix, from userid 1134) id 61C0620B74C0; Sun, 22 Oct 2023 22:37:46 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 61C0620B74C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1698039466; bh=wdBTgfyeYv6OIVrdKsx9E9VcCeZFvYAlw+80iTEMrps=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=f5Jwgx+Xi1VRI/eExm57OFGigBWzze+6PSbDxMyTgK0FoF2rGx5ACsQudDhIn5Akr BuWlOrgxl+nCMkRZbmi1FXXkHaz4bJRjbrikVGMKmgNT9eoQBJJTIHFeRnOr3orjFy NKGyWoO2xM5R8pSvCR0kDuj4IPnj65A0hUd6TLUw= Date: Sun, 22 Oct 2023 22:37:46 -0700 From: Shradha Gupta To: Ani Sinha Cc: "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Saurabh Sengar , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] hv/hv_kvp_daemon: Some small fixes for handling NM keyfiles Message-ID: <20231023053746.GA11148@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <20231016133122.2419537-1-anisinha@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231016133122.2419537-1-anisinha@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-8.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Sun, 22 Oct 2023 22:38:28 -0700 (PDT) On Mon, Oct 16, 2023 at 07:01:22PM +0530, Ani Sinha wrote: > Some small fixes: > - lets make sure we are not adding ipv4 addresses in ipv6 section in > keyfile and vice versa. > - ADDR_FAMILY_IPV6 is a bit in addr_family. Test that bit instead of > checking the whole value of addr_family. > - Some trivial fixes in hv_set_ifconfig.sh. > > These fixes are proposed after doing some internal testing at Red Hat. > > CC: Shradha Gupta > CC: Saurabh Sengar > Fixes: 42999c904612 ("hv/hv_kvp_daemon:Support for keyfile based connection profile") > Signed-off-by: Ani Sinha > --- > tools/hv/hv_kvp_daemon.c | 20 ++++++++++++-------- > tools/hv/hv_set_ifconfig.sh | 4 ++-- > 2 files changed, 14 insertions(+), 10 deletions(-) > > diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c > index 264eeb9c46a9..318e2dad27e0 100644 > --- a/tools/hv/hv_kvp_daemon.c > +++ b/tools/hv/hv_kvp_daemon.c > @@ -1421,7 +1421,7 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val) > if (error) > goto setval_error; > > - if (new_val->addr_family == ADDR_FAMILY_IPV6) { > + if (new_val->addr_family & ADDR_FAMILY_IPV6) { > error = fprintf(nmfile, "\n[ipv6]\n"); > if (error < 0) > goto setval_error; > @@ -1455,14 +1455,18 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val) > if (error < 0) > goto setval_error; > > - error = fprintf(nmfile, "gateway=%s\n", (char *)new_val->gate_way); > - if (error < 0) > - goto setval_error; > - > - error = fprintf(nmfile, "dns=%s\n", (char *)new_val->dns_addr); > - if (error < 0) > - goto setval_error; > + /* we do not want ipv4 addresses in ipv6 section and vice versa */ > + if (is_ipv6 != is_ipv4((char *)new_val->gate_way)) { > + error = fprintf(nmfile, "gateway=%s\n", (char *)new_val->gate_way); > + if (error < 0) > + goto setval_error; > + } > > + if (is_ipv6 != is_ipv4((char *)new_val->dns_addr)) { > + error = fprintf(nmfile, "dns=%s\n", (char *)new_val->dns_addr); > + if (error < 0) > + goto setval_error; > + } > fclose(nmfile); > fclose(ifcfg_file); > > diff --git a/tools/hv/hv_set_ifconfig.sh b/tools/hv/hv_set_ifconfig.sh > index ae5a7a8249a2..440a91b35823 100755 > --- a/tools/hv/hv_set_ifconfig.sh > +++ b/tools/hv/hv_set_ifconfig.sh > @@ -53,7 +53,7 @@ > # or "manual" if no boot-time protocol should be used) > # > # address1=ipaddr1/plen > -# address=ipaddr2/plen > +# address2=ipaddr2/plen > # > # gateway=gateway1;gateway2 > # > @@ -61,7 +61,7 @@ > # > # [ipv6] > # address1=ipaddr1/plen > -# address2=ipaddr1/plen > +# address2=ipaddr2/plen > # > # gateway=gateway1;gateway2 > # > -- > 2.39.2 Reviewed-by: Shradha Gupta