git: c3f4736f049c - stable/14 - ping: Fix protocol selection with NOINET6 kernel.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 17 Mar 2024 15:26:55 UTC
The branch stable/14 has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=c3f4736f049cc469f081a5879097e391a56c728b
commit c3f4736f049cc469f081a5879097e391a56c728b
Author: Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2024-03-12 19:40:36 +0000
Commit: Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2024-03-17 14:38:12 +0000
ping: Fix protocol selection with NOINET6 kernel.
A missing else caused the correct resolver hint (AF_INET) to be
overwritten with AF_UNSPEC when the kernel supports IPv4 but not
IPv6.
MFC after: 3 days
PR: 277592
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D44304
(cherry picked from commit b53ae8a8333d730bb977276c511743b98c881423)
---
sbin/ping/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sbin/ping/main.c b/sbin/ping/main.c
index 65896a5dba7b..eb8065cf8309 100644
--- a/sbin/ping/main.c
+++ b/sbin/ping/main.c
@@ -150,7 +150,7 @@ main(int argc, char *argv[])
hints.ai_socktype = SOCK_RAW;
if (feature_present("inet") && !feature_present("inet6"))
hints.ai_family = AF_INET;
- if (feature_present("inet6") && !feature_present("inet"))
+ else if (feature_present("inet6") && !feature_present("inet"))
hints.ai_family = AF_INET6;
else
hints.ai_family = AF_UNSPEC;