From: Ani Sinha <anisinha@redhat.com>
To: Shradha Gupta <shradhagupta@linux.microsoft.com>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
Saurabh Sengar <ssengar@linux.microsoft.com>,
linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hv/hv_kvp_daemon: Some small fixes for handling NM keyfiles
Date: Mon, 30 Oct 2023 10:45:03 +0530 [thread overview]
Message-ID: <E44432C5-17B2-47FC-B382-384659B21DCF@redhat.com> (raw)
In-Reply-To: <20231023053746.GA11148@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net>
> On 23-Oct-2023, at 11:07 AM, Shradha Gupta <shradhagupta@linux.microsoft.com> wrote:
>
> 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 <shradhagupta@linux.microsoft.com>
>> CC: Saurabh Sengar <ssengar@linux.microsoft.com>
>> Fixes: 42999c904612 ("hv/hv_kvp_daemon:Support for keyfile based connection profile")
>> Signed-off-by: Ani Sinha <anisinha@redhat.com>
>> ---
>> 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 <Shradhagupta@linux.microsoft.com>
Ping. Can anyone please queue this?
>
next prev parent reply other threads:[~2023-10-30 5:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-16 13:31 [PATCH] hv/hv_kvp_daemon: Some small fixes for handling NM keyfiles Ani Sinha
2023-10-23 5:37 ` Shradha Gupta
2023-10-30 5:15 ` Ani Sinha [this message]
2023-11-07 3:40 ` Ani Sinha
2023-11-10 4:02 ` Ani Sinha
[not found] ` <PH7PR21MB31164A4B84974856943DBBBACAAEA@PH7PR21MB3116.namprd21.prod.outlook.com>
2023-11-10 23:28 ` Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E44432C5-17B2-47FC-B382-384659B21DCF@redhat.com \
--to=anisinha@redhat.com \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shradhagupta@linux.microsoft.com \
--cc=ssengar@linux.microsoft.com \
--cc=wei.liu@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox