FreeBSD Bugzilla – Attachment 221097 Details for
Bug 251725
sbin/ping: tries to use IPv6 on INET6-less kernels
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix ping when the kernel lacks INET6 support, v2
bug251725.v2.diff (text/plain), 1.45 KB, created by
Jan Beich
on 2020-12-30 02:35:44 UTC
(
hide
)
Description:
Fix ping when the kernel lacks INET6 support, v2
Filename:
MIME Type:
Creator:
Jan Beich
Created:
2020-12-30 02:35:44 UTC
Size:
1.45 KB
patch
obsolete
>From 9922069144adb283f3812556b9e61c14223676b6 Mon Sep 17 00:00:00 2001 >From: Alan Somers <asomers@gmail.com> >Date: Tue, 29 Dec 2020 15:26:08 -0700 >Subject: [PATCH] ping: fix ping when the kernel was built without INET6 > >If the kernel was built without INET6, default to ICMP. Or, if it was >built without INET, default to ICMPv6. > >PR: 251725 >Reported by: jbeich >Reviewed by: jbeich >Tested by: jbeich >MFC with: 368045 >--- > sbin/ping/main.c | 24 +++++++++++++++--------- > 1 file changed, 15 insertions(+), 9 deletions(-) > >diff --git a/sbin/ping/main.c b/sbin/ping/main.c >index 5d28a2b4a5cd..01442679efff 100644 >--- a/sbin/ping/main.c >+++ b/sbin/ping/main.c >@@ -126,15 +126,21 @@ main(int argc, char *argv[]) > else if (ipv4) > hints.ai_family = AF_INET; > else { >- struct addrinfo *res; >- >- memset(&hints, 0, sizeof(hints)); >- hints.ai_socktype = SOCK_RAW; >- hints.ai_family = AF_UNSPEC; >- getaddrinfo(argv[argc - 1], NULL, &hints, &res); >- if (res != NULL) { >- hints.ai_family = res[0].ai_family; >- freeaddrinfo(res); >+ if (!feature_present("inet6")) >+ hints.ai_family = AF_INET; >+ else if (!feature_present("inet")) >+ hints.ai_family = AF_INET6; >+ else { >+ struct addrinfo *res; >+ >+ memset(&hints, 0, sizeof(hints)); >+ hints.ai_socktype = SOCK_RAW; >+ hints.ai_family = AF_UNSPEC; >+ getaddrinfo(argv[argc - 1], NULL, &hints, &res); >+ if (res != NULL) { >+ hints.ai_family = res[0].ai_family; >+ freeaddrinfo(res); >+ } > } > } > #elif defined(INET)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 251725
:
221094
| 221097