From patchwork Tue Sep 10 03:43:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noah Peterson X-Patchwork-Id: 18660 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from diktynna.open-mesh.org (localhost [IPv6:::1]) by diktynna.open-mesh.org (Postfix) with ESMTP id DDBAC83AF2 for ; Tue, 10 Sep 2024 05:43:30 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=open-mesh.org; s=20121; t=1725939810; b=RvgYEOITzYxv5cibMahDEg8i4wW3fqc6tBPch/vo8zPygu+FwP8DEkSXzdwXfTdo6Zj8Q 5Dx6K0U704w9UZskbw0GWBDQnqwnBssRV0MQHMVRS4BLFe7vvwupd09YlEncDiMVCHtr4U5 u7381Z5xgww0mh6SlSGIACeiObAV7AE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1725939810; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=stGH7KcQT4lpGSCy7x5ylUPDY4NcjjRVce003ehpaOw=; b=4CiJxOH3QW22tv21EpxPYThTzkHZsf2Xiz1YiZ7Qiu2gIfrXUdkmNMYT0vNGueSnT3mvd fiUe7qMCRkjLDvmBVHFRSdUpSshb9yUBBFoHq0fnxAl1NYPeK0UsOxNPgm3bUF15N9V8Nmn mIQXQllHXijebt1i8otHPO29bgBgJ18= ARC-Authentication-Results: i=1; open-mesh.org; dkim=fail; arc=none (Message is not ARC signed); dmarc=fail (Used From Domain Record) header.from=gmail.com policy.dmarc=quarantine Authentication-Results: open-mesh.org; dkim=fail; arc=none (Message is not ARC signed); dmarc=fail (Used From Domain Record) header.from=gmail.com policy.dmarc=quarantine Received: from diktynna.open-mesh.org (localhost [IPv6:::1]) by diktynna.open-mesh.org (Postfix) with ESMTP id 78A348244E for ; Tue, 10 Sep 2024 05:43:25 +0200 (CEST) MIME-Version: 1.0 Subject: [PATCH v2] alfred: add more verbose error message From: noahbpeterson1997@gmail.com To: b.a.t.m.a.n@lists.open-mesh.org Date: Tue, 10 Sep 2024 03:43:25 -0000 Message-ID: <172593980548.1027.7186764909573595247@diktynna.open-mesh.org> User-Agent: HyperKitty on https://lists.open-mesh.org/ Message-ID-Hash: RL6Z3C7LGHUXZQQ6ZPIY5YISMFHVJLRE X-Message-ID-Hash: RL6Z3C7LGHUXZQQ6ZPIY5YISMFHVJLRE X-MailFrom: noahbpeterson1997@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-b.a.t.m.a.n.lists.open-mesh.org-0; header-match-b.a.t.m.a.n.lists.open-mesh.org-1; header-match-b.a.t.m.a.n.lists.open-mesh.org-2; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: There is an issue with some Linux distributions where network interfaces are up and active, but do not have the correct link-local address. This condition is now checked and output to stderr to help better users troubleshoot this issue. Signed-off-by: Noah Peterson noahbpeterson1997@gmail.com Signed-off-by: Noah Peterson --- netsock.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/netsock.c b/netsock.c index feed21d..a3101df 100644 --- a/netsock.c +++ b/netsock.c @@ -21,6 +21,7 @@ #include #include #include +#include #ifdef CONFIG_ALFRED_CAPABILITIES #include #endif @@ -321,8 +322,19 @@ static int netsock_open(struct globals *globals, struct interface *interface) } enable_raw_bind_capability(0); + if (bind(sock, (struct sockaddr *)&sin6, sizeof(sin6)) < 0) { - perror("can't bind"); + char ipstr_buf[INET6_ADDRSTRLEN]; + const char *ipstr; + ipstr = inet_ntop(AF_INET6, &interface->address.ipv6.s6_addr, + ipstr_buf, INET6_ADDRSTRLEN); + if (errno == EADDRNOTAVAIL) + fprintf(stderr, "can't bind to interface %s; " + "expected ipv6 address not found: %s\n", + interface->interface, + ipstr); + else + perror("can't bind"); goto err; }