Date: Fri, 24 Apr 2026 00:54:31 +0000 From: Jose Luis Duran <jlduran@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Christos Longros <chris.longros@gmail.com> Subject: git: 2d2f92194f07 - stable/14 - ping6: treat setsockopt failures as fatal Message-ID: <69eabf47.213df.65263a01@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/14 has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=2d2f92194f0776c89afcbc1244fcc8e1de69107e commit 2d2f92194f0776c89afcbc1244fcc8e1de69107e Author: Christos Longros <chris.longros@gmail.com> AuthorDate: 2026-04-17 18:19:24 +0000 Commit: Jose Luis Duran <jlduran@FreeBSD.org> CommitDate: 2026-04-24 00:52:26 +0000 ping6: treat setsockopt failures as fatal ping6 needs IPV6_RECVPKTINFO and IPV6_RECVHOPLIMIT to process incoming replies. When these options fail, replies are silently dropped and ping6 appears to hang. Use err(3) instead of warn(3) so the user gets a clear error and immediate exit. Signed-off-by: Christos Longros <chris.longros@gmail.com> Reviewed by: pouria, jlduran, glebius MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D56237 (cherry picked from commit 9a4a9f623bbaf991b3ba580593d47f2ee9f7b03b) --- sbin/ping/ping6.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sbin/ping/ping6.c b/sbin/ping/ping6.c index afbaba33e4f7..de2f34dd78db 100644 --- a/sbin/ping/ping6.c +++ b/sbin/ping/ping6.c @@ -1096,21 +1096,21 @@ ping6(int argc, char *argv[]) #ifdef IPV6_RECVPKTINFO if (setsockopt(srecv, IPPROTO_IPV6, IPV6_RECVPKTINFO, &optval, sizeof(optval)) < 0) - warn("setsockopt(IPV6_RECVPKTINFO)"); /* XXX err? */ + err(1, "setsockopt(IPV6_RECVPKTINFO)"); #else /* old adv. API */ if (setsockopt(srecv, IPPROTO_IPV6, IPV6_PKTINFO, &optval, sizeof(optval)) < 0) - warn("setsockopt(IPV6_PKTINFO)"); /* XXX err? */ + err(1, "setsockopt(IPV6_PKTINFO)"); #endif #endif /* USE_SIN6_SCOPE_ID */ #ifdef IPV6_RECVHOPLIMIT if (setsockopt(srecv, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &optval, sizeof(optval)) < 0) - warn("setsockopt(IPV6_RECVHOPLIMIT)"); /* XXX err? */ + err(1, "setsockopt(IPV6_RECVHOPLIMIT)"); #else /* old adv. API */ if (setsockopt(srecv, IPPROTO_IPV6, IPV6_HOPLIMIT, &optval, sizeof(optval)) < 0) - warn("setsockopt(IPV6_HOPLIMIT)"); /* XXX err? */ + err(1, "setsockopt(IPV6_HOPLIMIT)"); #endif cap_rights_clear(&rights_srecv, CAP_SETSOCKOPT);home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69eabf47.213df.65263a01>
