LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] Add a header in ifcfg and nm keyfiles describing the owner of the files
@ 2024-04-18 12:05 Ani Sinha
  2024-04-18 16:15 ` Easwar Hariharan
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ani Sinha @ 2024-04-18 12:05 UTC (permalink / raw
  To: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui
  Cc: Ani Sinha, shradhagupta, eahariha, linux-hyperv, linux-kernel

A comment describing the source of writing the contents of the ifcfg and
network manager keyfiles (hyperv kvp daemon) is useful. It is valuable both
for debugging as well as for preventing users from modifying them.

CC: shradhagupta@linux.microsoft.com
CC: eahariha@linux.microsoft.com
CC: wei.liu@kernel.org
Signed-off-by: Ani Sinha <anisinha@redhat.com>
---
 tools/hv/hv_kvp_daemon.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

changelog:
v2: simplify and fix issues with error handling.

diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
index ae57bf69ad4a..014e45be6981 100644
--- a/tools/hv/hv_kvp_daemon.c
+++ b/tools/hv/hv_kvp_daemon.c
@@ -94,6 +94,8 @@ static char *lic_version = "Unknown version";
 static char full_domain_name[HV_KVP_EXCHANGE_MAX_VALUE_SIZE];
 static struct utsname uts_buf;
 
+#define CFG_HEADER "# Generated by hyperv key-value pair daemon. Please do not modify.\n"
+
 /*
  * The location of the interface configuration file.
  */
@@ -1435,6 +1437,18 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
 		return HV_E_FAIL;
 	}
 
+	/* Write the config file headers */
+	error = fprintf(ifcfg_file, CFG_HEADER);
+	if (error < 0) {
+		error = HV_E_FAIL;
+		goto setval_error;
+	}
+	error = fprintf(nmfile, CFG_HEADER);
+	if (error < 0) {
+		error = HV_E_FAIL;
+		goto setval_error;
+	}
+
 	/*
 	 * First write out the MAC address.
 	 */
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] Add a header in ifcfg and nm keyfiles describing the owner of the files
  2024-04-18 12:05 [PATCH v2] Add a header in ifcfg and nm keyfiles describing the owner of the files Ani Sinha
@ 2024-04-18 16:15 ` Easwar Hariharan
  2024-04-18 19:01   ` Dexuan Cui
  2024-04-19 16:54 ` Shradha Gupta
  2024-04-22 22:28 ` Wei Liu
  2 siblings, 1 reply; 6+ messages in thread
From: Easwar Hariharan @ 2024-04-18 16:15 UTC (permalink / raw
  To: Ani Sinha, K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui
  Cc: shradhagupta, linux-hyperv, linux-kernel

On 4/18/2024 5:05 AM, Ani Sinha wrote:
> A comment describing the source of writing the contents of the ifcfg and
> network manager keyfiles (hyperv kvp daemon) is useful. It is valuable both
> for debugging as well as for preventing users from modifying them.
> 
> CC: shradhagupta@linux.microsoft.com
> CC: eahariha@linux.microsoft.com
> CC: wei.liu@kernel.org
> Signed-off-by: Ani Sinha <anisinha@redhat.com>
> ---
>  tools/hv/hv_kvp_daemon.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> changelog:
> v2: simplify and fix issues with error handling.
> 
> diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
> index ae57bf69ad4a..014e45be6981 100644
> --- a/tools/hv/hv_kvp_daemon.c
> +++ b/tools/hv/hv_kvp_daemon.c
> @@ -94,6 +94,8 @@ static char *lic_version = "Unknown version";
>  static char full_domain_name[HV_KVP_EXCHANGE_MAX_VALUE_SIZE];
>  static struct utsname uts_buf;
>  
> +#define CFG_HEADER "# Generated by hyperv key-value pair daemon. Please do not modify.\n"
> +
>  /*
>   * The location of the interface configuration file.
>   */
> @@ -1435,6 +1437,18 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
>  		return HV_E_FAIL;
>  	}
>  
> +	/* Write the config file headers */
> +	error = fprintf(ifcfg_file, CFG_HEADER);
> +	if (error < 0) {
> +		error = HV_E_FAIL;
> +		goto setval_error;
> +	}
> +	error = fprintf(nmfile, CFG_HEADER);
> +	if (error < 0) {
> +		error = HV_E_FAIL;
> +		goto setval_error;
> +	}
> +
>  	/*
>  	 * First write out the MAC address.
>  	 */


Looks good to me, I'll defer to other folks on the recipient list on whether "hyperv" should be capitalized
as HyperV or other such feedback.

Reviewed-by: Easwar Hariharan <eahariha@linux.microsoft.com>

Thanks,
Easwar

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH v2] Add a header in ifcfg and nm keyfiles describing the owner of the files
  2024-04-18 16:15 ` Easwar Hariharan
@ 2024-04-18 19:01   ` Dexuan Cui
  2024-04-19 16:51     ` Shradha Gupta
  0 siblings, 1 reply; 6+ messages in thread
From: Dexuan Cui @ 2024-04-18 19:01 UTC (permalink / raw
  To: Easwar Hariharan, Ani Sinha, KY Srinivasan, Haiyang Zhang,
	Wei Liu
  Cc: shradhagupta@linux.microsoft.com, linux-hyperv@vger.kernel.org,
	linux-kernel@vger.kernel.org

> From: Easwar Hariharan <eahariha@linux.microsoft.com>
> Sent: Thursday, April 18, 2024 9:16 AM
> 
> On 4/18/2024 5:05 AM, Ani Sinha wrote:
> > A comment describing the source of writing the contents of the ifcfg and
> > network manager keyfiles (hyperv kvp daemon) is useful. It is valuable

s/hyperv/Hyper-V/

> > +#define CFG_HEADER "# Generated by hyperv key-value pair daemon.
> Please do not modify.\n"

s/hyperv/Hyper-V/

> Looks good to me, I'll defer to other folks on the recipient list on whether
> "hyperv" should be capitalized as HyperV or other such feedback.

It's recommended to use "Hyper-V". Wei can help fix this so I guess
there is no need to resend the patch :-)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] Add a header in ifcfg and nm keyfiles describing the owner of the files
  2024-04-18 19:01   ` Dexuan Cui
@ 2024-04-19 16:51     ` Shradha Gupta
  0 siblings, 0 replies; 6+ messages in thread
From: Shradha Gupta @ 2024-04-19 16:51 UTC (permalink / raw
  To: Dexuan Cui
  Cc: Easwar Hariharan, Ani Sinha, KY Srinivasan, Haiyang Zhang,
	Wei Liu, linux-hyperv@vger.kernel.org,
	linux-kernel@vger.kernel.org

On Thu, Apr 18, 2024 at 07:01:20PM +0000, Dexuan Cui wrote:
> > From: Easwar Hariharan <eahariha@linux.microsoft.com>
> > Sent: Thursday, April 18, 2024 9:16 AM
> > 
> > On 4/18/2024 5:05 AM, Ani Sinha wrote:
> > > A comment describing the source of writing the contents of the ifcfg and
> > > network manager keyfiles (hyperv kvp daemon) is useful. It is valuable
> 
> s/hyperv/Hyper-V/
> 
> > > +#define CFG_HEADER "# Generated by hyperv key-value pair daemon.
> > Please do not modify.\n"
> 
> s/hyperv/Hyper-V/
> 
> > Looks good to me, I'll defer to other folks on the recipient list on whether
> > "hyperv" should be capitalized as HyperV or other such feedback.
> 
> It's recommended to use "Hyper-V". Wei can help fix this so I guess
> there is no need to resend the patch :-)
Sounds good!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] Add a header in ifcfg and nm keyfiles describing the owner of the files
  2024-04-18 12:05 [PATCH v2] Add a header in ifcfg and nm keyfiles describing the owner of the files Ani Sinha
  2024-04-18 16:15 ` Easwar Hariharan
@ 2024-04-19 16:54 ` Shradha Gupta
  2024-04-22 22:28 ` Wei Liu
  2 siblings, 0 replies; 6+ messages in thread
From: Shradha Gupta @ 2024-04-19 16:54 UTC (permalink / raw
  To: Ani Sinha
  Cc: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, eahariha,
	linux-hyperv, linux-kernel

On Thu, Apr 18, 2024 at 05:35:49PM +0530, Ani Sinha wrote:
> A comment describing the source of writing the contents of the ifcfg and
> network manager keyfiles (hyperv kvp daemon) is useful. It is valuable both
> for debugging as well as for preventing users from modifying them.
> 
> CC: shradhagupta@linux.microsoft.com
> CC: eahariha@linux.microsoft.com
> CC: wei.liu@kernel.org
> Signed-off-by: Ani Sinha <anisinha@redhat.com>
> ---
>  tools/hv/hv_kvp_daemon.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> changelog:
> v2: simplify and fix issues with error handling.
> 
> diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
> index ae57bf69ad4a..014e45be6981 100644
> --- a/tools/hv/hv_kvp_daemon.c
> +++ b/tools/hv/hv_kvp_daemon.c
> @@ -94,6 +94,8 @@ static char *lic_version = "Unknown version";
>  static char full_domain_name[HV_KVP_EXCHANGE_MAX_VALUE_SIZE];
>  static struct utsname uts_buf;
>  
> +#define CFG_HEADER "# Generated by hyperv key-value pair daemon. Please do not modify.\n"
> +
>  /*
>   * The location of the interface configuration file.
>   */
> @@ -1435,6 +1437,18 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
>  		return HV_E_FAIL;
>  	}
>  
> +	/* Write the config file headers */
> +	error = fprintf(ifcfg_file, CFG_HEADER);
> +	if (error < 0) {
> +		error = HV_E_FAIL;
> +		goto setval_error;
> +	}
> +	error = fprintf(nmfile, CFG_HEADER);
> +	if (error < 0) {
> +		error = HV_E_FAIL;
> +		goto setval_error;
> +	}
> +
>  	/*
>  	 * First write out the MAC address.
>  	 */
> -- 
> 2.42.0
Reviewed-by: Shradha Gupta <shradhagupta@linux.microsoft.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] Add a header in ifcfg and nm keyfiles describing the owner of the files
  2024-04-18 12:05 [PATCH v2] Add a header in ifcfg and nm keyfiles describing the owner of the files Ani Sinha
  2024-04-18 16:15 ` Easwar Hariharan
  2024-04-19 16:54 ` Shradha Gupta
@ 2024-04-22 22:28 ` Wei Liu
  2 siblings, 0 replies; 6+ messages in thread
From: Wei Liu @ 2024-04-22 22:28 UTC (permalink / raw
  To: Ani Sinha
  Cc: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui,
	shradhagupta, eahariha, linux-hyperv, linux-kernel

On Thu, Apr 18, 2024 at 05:35:49PM +0530, Ani Sinha wrote:
> A comment describing the source of writing the contents of the ifcfg and
> network manager keyfiles (hyperv kvp daemon) is useful. It is valuable both
> for debugging as well as for preventing users from modifying them.
> 
> CC: shradhagupta@linux.microsoft.com
> CC: eahariha@linux.microsoft.com
> CC: wei.liu@kernel.org
> Signed-off-by: Ani Sinha <anisinha@redhat.com>

Applied to hyperv-fixes.

I changed hyperv to Hyper-V and changed the subject to

  hv/hv_kvp_daemon: indicate the configuration files are generated

Thanks,
Wei.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-22 22:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-18 12:05 [PATCH v2] Add a header in ifcfg and nm keyfiles describing the owner of the files Ani Sinha
2024-04-18 16:15 ` Easwar Hariharan
2024-04-18 19:01   ` Dexuan Cui
2024-04-19 16:51     ` Shradha Gupta
2024-04-19 16:54 ` Shradha Gupta
2024-04-22 22:28 ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).