Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Feb 2026 04:22:50 +0000
From:      Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav <des@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: d699bac8f6f9 - stable/15 - libfetch: Gracefully skip unsupported protocols
Message-ID:  <699fca9a.36299.17a51f0f@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/15 has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=d699bac8f6f9164ae456ab561b04ac42a695540d

commit d699bac8f6f9164ae456ab561b04ac42a695540d
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-02-21 01:18:18 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-02-26 04:02:28 +0000

    libfetch: Gracefully skip unsupported protocols
    
    If socket() fails because the address family or protocol is unsupported,
    just continue with the next address.
    
    MFC after:      1 week
    Reviewed by:    imp
    Differential Revision:  https://reviews.freebsd.org/D55407
    
    (cherry picked from commit b5d570e711da1dad303312bebaf1bd2fb720f0dc)
---
 lib/libfetch/common.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c
index 9d31b175c0fc..f8a0517b6a5b 100644
--- a/lib/libfetch/common.c
+++ b/lib/libfetch/common.c
@@ -637,8 +637,12 @@ fetch_connect(const char *host, int port, int af, int verbose)
 	/* try each server address in turn */
 	for (err = 0, sai = sais; sai != NULL; sai = sai->ai_next) {
 		/* open socket */
-		if ((sd = socket(sai->ai_family, SOCK_STREAM, 0)) < 0)
+		if ((sd = socket(sai->ai_family, SOCK_STREAM, 0)) < 0) {
+			err = -1;
+			if (errno == EAFNOSUPPORT || errno == EPROTONOSUPPORT)
+				continue;
 			goto syserr;
+		}
 		/* attempt to bind to client address */
 		for (err = 0, cai = cais; cai != NULL; cai = cai->ai_next) {
 			if (cai->ai_family != sai->ai_family)


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?699fca9a.36299.17a51f0f>