All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH kexec-tools 0/2] kexec/ifdown.c: minimise errors printed
@ 2025-10-22  2:07 Mason Rocha
  2025-10-22  2:07 ` [PATCH kexec-tools 1/2] kexec/ifdown.c: Use AF_NETLINK instead of AF_INET Mason Rocha
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Mason Rocha @ 2025-10-22  2:07 UTC (permalink / raw)
  To: horms; +Cc: kexec, Mason Rocha

On some embedded configurations, kexec generates messages when rebooting
to the new kernel.  This patch line helps eliminate these messages in
the event certain kernel options are set.  I'm not too worried about the
second patch, but it is along the same line as the first patch and I
thought that it should included.  Thanks!

Mason Rocha (2):
  kexec/ifdown.c: Use AF_NETLINK instead of AF_INET
  kexec/ifdown.c: Hide error if sockets are disabled

 kexec/ifdown.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--
2.51.0



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

* [PATCH kexec-tools 1/2] kexec/ifdown.c: Use AF_NETLINK instead of AF_INET
  2025-10-22  2:07 [PATCH kexec-tools 0/2] kexec/ifdown.c: minimise errors printed Mason Rocha
@ 2025-10-22  2:07 ` Mason Rocha
  2025-10-22  2:07 ` [PATCH kexec-tools 2/2] kexec/ifdown.c: Hide error if sockets are disabled Mason Rocha
  2025-11-11 13:38 ` [PATCH kexec-tools 0/2] kexec/ifdown.c: minimise errors printed Simon Horman
  2 siblings, 0 replies; 5+ messages in thread
From: Mason Rocha @ 2025-10-22  2:07 UTC (permalink / raw)
  To: horms; +Cc: kexec, Mason Rocha

On embedded systems, there is no guarantee that INET support has been
built in.  However, as long as network support is built into the kernel,
we can use the netlink protocol to create a socket to still then use for
the ioctl calls since they don't require any certain family.  This will
help prevent EAFNOSUPPORT from being returned and printed to the console
on these systems.

Signed-off-by: Mason Rocha <mrocha@turretllc.us>
---
 kexec/ifdown.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kexec/ifdown.c b/kexec/ifdown.c
index 3ac19c1..6a60bcb 100644
--- a/kexec/ifdown.c
+++ b/kexec/ifdown.c
@@ -31,7 +31,7 @@ int ifdown(void)
 	struct ifreq ifr;
 	int fd, shaper;
 
-	if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+	if ((fd = socket(AF_NETLINK, SOCK_DGRAM, 0)) < 0) {
 		fprintf(stderr, "ifdown: ");
 		perror("socket");
 		goto error;
-- 
2.51.0



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

* [PATCH kexec-tools 2/2] kexec/ifdown.c: Hide error if sockets are disabled
  2025-10-22  2:07 [PATCH kexec-tools 0/2] kexec/ifdown.c: minimise errors printed Mason Rocha
  2025-10-22  2:07 ` [PATCH kexec-tools 1/2] kexec/ifdown.c: Use AF_NETLINK instead of AF_INET Mason Rocha
@ 2025-10-22  2:07 ` Mason Rocha
  2025-11-11 13:39   ` Simon Horman
  2025-11-11 13:38 ` [PATCH kexec-tools 0/2] kexec/ifdown.c: minimise errors printed Simon Horman
  2 siblings, 1 reply; 5+ messages in thread
From: Mason Rocha @ 2025-10-22  2:07 UTC (permalink / raw)
  To: horms; +Cc: kexec, Mason Rocha

Prevents the message "Function not implemented" from being logged when
a system with networking support disabled, as there couldn't possibly be
any interfaces to bring down to the point where we need to make sure the
user knows that the interfaces were not brought down.

Signed-off-by: Mason Rocha <mrocha@turretllc.us>
---
 kexec/ifdown.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kexec/ifdown.c b/kexec/ifdown.c
index 6a60bcb..e6ea0ae 100644
--- a/kexec/ifdown.c
+++ b/kexec/ifdown.c
@@ -32,8 +32,10 @@ int ifdown(void)
 	int fd, shaper;
 
 	if ((fd = socket(AF_NETLINK, SOCK_DGRAM, 0)) < 0) {
-		fprintf(stderr, "ifdown: ");
-		perror("socket");
+		if(errno != ENOSYS) {
+			fprintf(stderr, "ifdown: ");
+			perror("socket");
+		}
 		goto error;
 	}
 
-- 
2.51.0



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

* Re: [PATCH kexec-tools 0/2] kexec/ifdown.c: minimise errors printed
  2025-10-22  2:07 [PATCH kexec-tools 0/2] kexec/ifdown.c: minimise errors printed Mason Rocha
  2025-10-22  2:07 ` [PATCH kexec-tools 1/2] kexec/ifdown.c: Use AF_NETLINK instead of AF_INET Mason Rocha
  2025-10-22  2:07 ` [PATCH kexec-tools 2/2] kexec/ifdown.c: Hide error if sockets are disabled Mason Rocha
@ 2025-11-11 13:38 ` Simon Horman
  2 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2025-11-11 13:38 UTC (permalink / raw)
  To: Mason Rocha; +Cc: kexec

On Tue, Oct 21, 2025 at 09:07:02PM -0500, Mason Rocha wrote:
> On some embedded configurations, kexec generates messages when rebooting
> to the new kernel.  This patch line helps eliminate these messages in
> the event certain kernel options are set.  I'm not too worried about the
> second patch, but it is along the same line as the first patch and I
> thought that it should included.  Thanks!

Thanks, applied.

- kexec/ifdown.c: Hide error if sockets are disabled
  https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=86c3d1f7b646
- kexec/ifdown.c: Use AF_NETLINK instead of AF_INET
  https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=eb8609a29363


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

* Re: [PATCH kexec-tools 2/2] kexec/ifdown.c: Hide error if sockets are disabled
  2025-10-22  2:07 ` [PATCH kexec-tools 2/2] kexec/ifdown.c: Hide error if sockets are disabled Mason Rocha
@ 2025-11-11 13:39   ` Simon Horman
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2025-11-11 13:39 UTC (permalink / raw)
  To: Mason Rocha; +Cc: kexec

On Tue, Oct 21, 2025 at 09:07:04PM -0500, Mason Rocha wrote:
> Prevents the message "Function not implemented" from being logged when
> a system with networking support disabled, as there couldn't possibly be
> any interfaces to bring down to the point where we need to make sure the
> user knows that the interfaces were not brought down.
> 
> Signed-off-by: Mason Rocha <mrocha@turretllc.us>
> ---
>  kexec/ifdown.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/kexec/ifdown.c b/kexec/ifdown.c
> index 6a60bcb..e6ea0ae 100644
> --- a/kexec/ifdown.c
> +++ b/kexec/ifdown.c
> @@ -32,8 +32,10 @@ int ifdown(void)
>  	int fd, shaper;
>  
>  	if ((fd = socket(AF_NETLINK, SOCK_DGRAM, 0)) < 0) {
> -		fprintf(stderr, "ifdown: ");
> -		perror("socket");
> +		if(errno != ENOSYS) {

nit: I'd prefer a space between 'if' and '('

     I added one when applying this series.

> +			fprintf(stderr, "ifdown: ");
> +			perror("socket");
> +		}
>  		goto error;
>  	}
>  
> -- 
> 2.51.0
> 


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

end of thread, other threads:[~2025-11-11 13:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-22  2:07 [PATCH kexec-tools 0/2] kexec/ifdown.c: minimise errors printed Mason Rocha
2025-10-22  2:07 ` [PATCH kexec-tools 1/2] kexec/ifdown.c: Use AF_NETLINK instead of AF_INET Mason Rocha
2025-10-22  2:07 ` [PATCH kexec-tools 2/2] kexec/ifdown.c: Hide error if sockets are disabled Mason Rocha
2025-11-11 13:39   ` Simon Horman
2025-11-11 13:38 ` [PATCH kexec-tools 0/2] kexec/ifdown.c: minimise errors printed Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.