From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 8ED734BE3D for ; Fri, 29 Aug 2025 14:06:35 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'Gy1khhrjs6flKHH//+T12HrvOjg+VrbBwim+FcQxoXc=', expected b'MdLVSbRS4VQcoOubDocVB/SSg0WhFMSorxjAnnPEnmE=')) header.d=axis.com header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1756476357; h=to : date : message-id : in-reply-to : references : mime-version : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=iy7JFAQZeLnxUn/H2x57vI9aEUF8Vv+vT9gSjSYiJCg=; b=jZzwDvLm4aXKpsuKFUtOQPxuL74OYGXaSUdZc6M2395lUJyOwPZCLbrTCqf0dp0w5aEPN pBqGIe5c6lHcKvBdQrWpaDZj3EXmugs1izG4Z5aA5DS7j+QUNy5xIvouMKvxXTEWVISciaq sgE8zwXmP2BRN/iEkF14SvONgMZzzmJJTGCpkqaUCSlrUAZ/s57FA22NGLOCvyO6SbYj17C 0GXZ6u3T7DTb05tYwW0VW/k8/uOzmWMpVrmZUKmx0Rry/Wt/wW1DTbCorm1lwad/ULpwc/p Ss0sxEjhAd1yYUwkoG2OY+kji3QqGCfpv6pUlZ0ICOEFnmKYrUc3Gvsg9P6A== Received: from [172.19.0.4] (unknown [172.19.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 5F45268E76A; Fri, 29 Aug 2025 17:05:57 +0300 (EEST) ARC-Seal: i=2; cv=pass; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1756476346; b=FevEgJP6pQVPncWYt+dDQTScQph7CsQm51MFrdmnBf0Tv5+Nulx6CNk4VuMcFTpgqSGpO 4fBkkdeUnbV3zoOPZTO/Xd8j+HOiBCqns5BNFerllIx+Eyx4VFS3ex+WRGcnXTwCe11js1o yyBEMcwQqUdVrSJg5uNBhdnOhdG4P8EBoHSde7bK5TAmQbhG8z8O39lDYc4WEaOqZMPiXnT gd2ZvfvPi9cKSEK3uEoijdeKh+l1Doi5KgevUprRoTr4UDGOwsn+Xxg2aW6PSWR6z3TdwqT O7+zSm5JXL3DW9Aev0KU4+aUNREbGwEAVHKBS4jy666ENzs0FU0+QbN6e9XA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1756476346; 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=Gy1khhrjs6flKHH//+T12HrvOjg+VrbBwim+FcQxoXc=; b=kTb8YlQKmMt3wE8E7HF4PY+fMZveqfElJHfSwU6es7oL3GPT4pxyIFtOZlq7xYTx1ZVXQ fH4hG4CBRvha/HRJTOpzq6cpE0vb0P/lHm0Vyut6w5VMThNLjk/sYyrLiW4W+XQUSEdMlpV AipNChHkc7Zv2K6Cemo++xIrIBNt/6LO6M4YKaAOa4Bst2YYBsKEKX7Vi8o4RRcs4yeBNLY EDMqQ3TM3hWKC7DVtRjmJJmq4OcCGQHn2zJnr9N1ETVMGKcqfL0+CRXS9kj0UgD98H8bC8w Ah1GT6IkF1i9OiX/IhwMtH1IFnbg3Ookk6yxhNyF5Qtm/g0qbdgbsEUq8Nig== ARC-Authentication-Results: i=2; ffmpeg.org; dkim=pass header.d=axis.com; arc=pass; dmarc=pass header.from=axis.com policy.dmarc=none Authentication-Results: ffmpeg.org; dkim=pass header.d=axis.com; arc=pass; dmarc=pass (Used From Domain Record) header.from=axis.com policy.dmarc=none Received: from OSPPR02CU001.outbound.protection.outlook.com (mail-norwayeastazon11013019.outbound.protection.outlook.com [40.107.159.19]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 38A9A68E714 for ; Fri, 29 Aug 2025 17:05:17 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JiRMtONCKx30tDKYZN7LIdPGO/IAwX4oNzfQqUEGN4hSC86Cz9/BI58lvNx1657gGbDLS7/yx3Ro04ol0vDsFQM+DVCuvlGNTFw6l+8OlfO9qpu+wh4B8LQhMt7c/wqAV5oUza1mcDCMsOzH0FJ/Gu0rGN60RlaDHb17SUjZvzf3Y5ckZEiT0gYvyDZLU2xOSLYtBLnMQgUrAhLn72SYOLn/tSyQOD3dQtqbeIgdDPS4VlX/2fasotInFghdNulSzSpTNcG3tcocm5SXjKI56VxQ6k1rAiNf8pV2rrQ+q8OQInIY+qPaxayFfwc8VFZxkZ2kaKLn9Pjn939fiEmkig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MdLVSbRS4VQcoOubDocVB/SSg0WhFMSorxjAnnPEnmE=; b=OeCQpgbF1Yw/If9VkI39szmx4KhleiJMPS97NgVxLgXNljZT01zDAJ0ozI9Tf4NMflCqFz6XSpSbb9K4oR1Rde0THX6cJ9t1iES/Met5bNxRrNNYlN60nzIg+sRiYcV8pfWhoso8r/Koc/2o1fKDjCeHmsELSxAx8QmjvvntjMe6aVR2fxgA79WyzesJN7v5DeCA0a8EtzSdo0KBnB5ct5dOoY0MH6j6lN148tpwUMMqrx6bUoOb7TBTDExb/vYrnLZhy2h20Y5/+pLnwASaYCh8jS2NYaPgmunvaT+HRTv8ABxJVKAPoEBwo8dtt/qTaVJWUGptTSd61oi6VgRkUA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=ffmpeg.org smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MdLVSbRS4VQcoOubDocVB/SSg0WhFMSorxjAnnPEnmE=; b=i55MEsDTwnb12YPswyZEM1fyiqVyvRVGjm/2tpRUv8tUv+qcNNoedxckffLoHYMfliM9zI8iUZbww7+IKFsaG4/4l5Xyef4UibE8lzumvx4LGjemjqJB++NfArUkOThqixZoLJz/Yu3hL42L7za1v+NmkbFKWZCBUZf6rY3hObw= Received: from DUZPR01CA0003.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c3::15) by VI1PR02MB10221.eurprd02.prod.outlook.com (2603:10a6:800:1bc::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9052.20; Fri, 29 Aug 2025 14:05:13 +0000 Received: from DB1PEPF00050A00.eurprd03.prod.outlook.com (2603:10a6:10:3c3:cafe::e7) by DUZPR01CA0003.outlook.office365.com (2603:10a6:10:3c3::15) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9073.19 via Frontend Transport; Fri, 29 Aug 2025 14:05:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by DB1PEPF00050A00.mail.protection.outlook.com (10.167.242.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.9073.11 via Frontend Transport; Fri, 29 Aug 2025 14:05:13 +0000 Received: from se-mail01w.axis.com (10.20.40.7) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Fri, 29 Aug 2025 16:05:07 +0200 Received: from se-intmail01x.se.axis.com (10.4.0.28) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 29 Aug 2025 16:05:07 +0200 Received: from pc55631-2335.se.axis.com (pc55631-2335.se.axis.com [10.94.180.160]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id DB3038D7; Fri, 29 Aug 2025 16:05:07 +0200 (CEST) Received: by pc55631-2335.se.axis.com (Postfix, from userid 18910) id D69AF43A423D; Fri, 29 Aug 2025 16:05:07 +0200 (CEST) To: , , Date: Fri, 29 Aug 2025 16:04:56 +0200 Message-ID: <20250829140459.3220037-3-peterend@axis.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250829140459.3220037-1-peterend@axis.com> References: <0250811223419.GF29660@pb2> <20250829140459.3220037-1-peterend@axis.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF00050A00:EE_|VI1PR02MB10221:EE_ X-MS-Office365-Filtering-Correlation-Id: f2886de0-d588-4243-481c-08dde70512f2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|1800799024|36860700013|4022899009; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?uM9142O+1TWYPTcvvLlo/e4l28op0kWO6kAxS/uRs/IvxrGRcToTc8RpEAR7?= =?us-ascii?Q?duWJS06FFZ8/EgPfhTcK7KBVI7gQXiJZYhMfWkXMTPtaq3lLIiqahMTbB5tS?= =?us-ascii?Q?rLnDCfk8QFbCTtOo17Iljl+UdTy/94nLWG4YSgQYegEq7jB7JfVXFx9BAEhb?= =?us-ascii?Q?GgvoinlhRN7EKs+DjQVyY9nfmEy1vcsh8pDK5SahZTzHtEESdnc4xAtS7uYy?= =?us-ascii?Q?Vbqwzt97H96Kq1NJmtW5T+D/2YgktKTg0SpqNHYkpHbh7c50NJ0zSMnzUZ3y?= =?us-ascii?Q?ROx68DNxC45a0AArbr/jd9c2+0Uoe+f7TtkLV1wJGhiohlkJiriVEwCwc0cd?= =?us-ascii?Q?ufyxWlOcfaElIJ8zjoXGhzPWVnDooFYozFr6daP6I4deUioHrhy9PVn0Zmfn?= =?us-ascii?Q?IX3OBssy1u/bRNY0C8kYu/EsTjOrL9mV9xB1DpaUDVVrqUFdXqgHdt9cgOah?= =?us-ascii?Q?riJCUmEqOhOAGWrOaenLZ8s8mI34CpTNGON7/XmcQcV4bZ+1SUPpFjXJgGiF?= =?us-ascii?Q?hNp9STWpj1O5xzXX0xvAg7nayxyOBlRD+PtkvQvCgqMWMdniYnRh5Ee9Qcnb?= =?us-ascii?Q?z7CRJdk1rc1nHy/4oQhWmwi/DYlcbZkaeG4blJ1M07Ua5/z2Ns76IKQkVjW1?= =?us-ascii?Q?xE15MBcYB4gU/GC59/bqA4DbjcpNN7VbpI1zBOHi+0SJuxOdC76INn38bTIZ?= =?us-ascii?Q?s0j0l+hDk42zMX2pFX5Zp5qiBnY23GWw8gAzG2WNU2m9W/XrynWPlB0lBJ+Z?= =?us-ascii?Q?Ax8L3YgVHi66PwND9qaQA1SNmnSP9AOOSRbWE/Qw6kTtwA8QWzQv6RhpHbjw?= =?us-ascii?Q?zJg0tacowMHiA8AHm0KGQ9ljm33AncOVMluUu/DZIApmPXcNXDC2J2G2JtN2?= =?us-ascii?Q?NEhSmaeAP9A1n+7Nco3JHNrRH8FuJImo3CBsaPrqNIBbVAtW9/kOP6GpAaBj?= =?us-ascii?Q?H5RlPRSvSnYHWjdttARZ7zULENnBQyvo9hBH3WTH1g2hwolSfhncUoyaySxx?= =?us-ascii?Q?+H74nCyx1hxe1M8i8h55LdY2WD+FpOFpzqvoz/DC1UQ7hSt+POkA7F/OAgRl?= =?us-ascii?Q?c7npKuwzmG6JL2Dc1kdcsdSa/DfGbUg0DZFLGWrD0AOHT4LgMLsgoUfq9XV1?= =?us-ascii?Q?AjgeBELXoAO4Mm/BH38HEU0WejcgggNUD85REn5PxNRhyenlo3VdLuzO2hOq?= =?us-ascii?Q?OPXCNv2I+uTrORdtl9b4kak+n8ntXm+RRb+5qVPv/f7xF7C3gozXVz4Dlf7Q?= =?us-ascii?Q?/9KGPgQIwagkz3KbHINHIDNY8ZCpPJZZJeKwUklHkN87Jx/zMyo4smtHz4jg?= =?us-ascii?Q?IcX7o/FeUPyBJKHma3EN/rcMiPNtKaKPPpmackV49jzcLvMrt0PeHLnSAuKi?= =?us-ascii?Q?c2HjDdfikKxqm+vaVeC/Sv1ALfvClBZPEXiBrzIe88qfhJo/7wBLAevvTQPd?= =?us-ascii?Q?mKeJ/RKUA2G5ZYwOVABzJ1WRRJfbqZT8EuIuKr1/ZLHPVt8M2Gy+YB5SPPIh?= =?us-ascii?Q?zm05p+ufdEk8XJOCwrHudQjHIm9gn20NYjZV?= X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(82310400026)(1800799024)(36860700013)(4022899009);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2025 14:05:13.4682 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f2886de0-d588-4243-481c-08dde70512f2 X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF00050A00.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR02MB10221 Message-ID-Hash: 5S3NPADBI2H7Z62GX4WFTAZAJDGDFMPD X-Message-ID-Hash: 5S3NPADBI2H7Z62GX4WFTAZAJDGDFMPD X-MailFrom: SRS0=YjuK=3J=axis.com=Peter.Enderborg@ffmpeg.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH v3 2/5] avformat/udp: Select output interfaces for ipv6 multicast List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Enderborg via ffmpeg-devel Cc: Peter Enderborg Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: This fixes two old TODO's in ipv6 multicast handling. If the system as SIOCGIFINDEX ioctl a helper function to iterate over all interfaces added to join the multicast group on interface if approperite. The default value is IN6ADDR_ANY (::) and it then joins all interfaces that are up and have multicast support. Local address can be specified and then it join ALL interfaces that use that specific local address. Limitations (TODO's) Handling when network configuration is changed. if up/down etc. Change-Id: Ifea9c0504469b108de94643a525d9b55fad5466f Signed-off-by: Peter Enderborg --- libavformat/udp.c | 101 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 99 insertions(+), 2 deletions(-) diff --git a/libavformat/udp.c b/libavformat/udp.c index 84f9d3e62e..9ffd55e017 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -68,6 +68,13 @@ #include "libavutil/thread.h" #endif +#if HAVE_STRUCT_IPV6_MREQ && HAVE_IOCTL_GIFINDEX && defined(IPPROTO_IPV6) +#include +#include +#include +#include +#endif + #ifndef IPV6_ADD_MEMBERSHIP #define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP #define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP @@ -205,6 +212,82 @@ static int udp_set_multicast_ttl(int sockfd, int mcastTTL, return 0; } +#if HAVE_STRUCT_IPV6_MREQ && HAVE_IOCTL_GIFINDEX && defined(IPPROTO_IPV6) +static int udp_ipv6_mc_devname_membership(int mop, const char *name, + int iindex_fd,struct in6_addr *mca, + int sockfd,void *logctx) +{ + struct ifreq if_req; + strncpy(if_req.ifr_name,name , IFNAMSIZ); + + if (ioctl(iindex_fd, SIOCGIFINDEX, &if_req) != -1) { + struct ipv6_mreq mreq6; + memcpy(&mreq6.ipv6mr_multiaddr, mca, sizeof(struct in6_addr)); + mreq6.ipv6mr_interface = if_req.ifr_ifindex; + + switch (mop) { + case IPV6_JOIN_GROUP: + if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &mreq6, sizeof(mreq6)) == 0) { + return 1; + } else { + /* Subscribe for all ipv6 addresses belong to a + interface.It can generate EADDRINUSE but + is accaptable. */ + if (errno != EADDRINUSE) + ff_log_net_error(logctx, AV_LOG_ERROR, "setsockopt(IPV6_ADD_MEMBERSHIP)"); + } + break; + case IPV6_LEAVE_GROUP: + if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, &mreq6, sizeof(mreq6)) == 0) { + return 1; + } else { + /* Unsubscribe for all ipv6 addresses belong to a + interface. Ignore EADDRNOTAVAIL. */ + if (errno != EADDRNOTAVAIL) + ff_log_net_error(logctx, AV_LOG_ERROR, "setsockopt(IPV6_DROP_MEMBERSHIP)"); + } + break; + default: + av_log(logctx, AV_LOG_ERROR, "unknown multicast operation\n"); + } + } + return -1; +} + +static int udp_ipv6_multicast_iterate(int sockfd, struct sockaddr_in6 *addr, + struct sockaddr_in6 *local_addr, int mop, void *logctx) +{ + struct in6_addr anyipv6 = IN6ADDR_ANY_INIT; + struct ifaddrs *ifal=NULL,*ife=NULL; + int iindex_fd = socket(AF_INET, SOCK_STREAM, IPPROTO_IP); + int membership_changed = 0; + + if (iindex_fd >= 0 && !getifaddrs(&ifal)) { + for(ife=ifal; ife!=NULL; ife=ife->ifa_next) { + if (ife->ifa_addr && + (ife->ifa_addr->sa_family == AF_INET6) && + (ife->ifa_flags & IFF_MULTICAST) && + (ife->ifa_flags & IFF_UP)) { + if ((!memcmp(&local_addr->sin6_addr, &anyipv6, sizeof(struct in6_addr))) || + (!memcmp(&local_addr->sin6_addr, &((struct sockaddr_in6 *)ife->ifa_addr)->sin6_addr, sizeof(struct in6_addr)))) { + if (udp_ipv6_mc_devname_membership(mop,ife->ifa_name, + iindex_fd, &addr->sin6_addr, + sockfd, logctx) == 1) + membership_changed = 1; + } + } + } + } + freeifaddrs(ifal); + close(iindex_fd); + + if (!membership_changed) { + av_log(logctx, AV_LOG_ERROR, "no valid interfaces found\n"); + return AVERROR(EINVAL); + } + return 0; +} +#endif static int udp_join_multicast_group(int sockfd, struct sockaddr *addr, struct sockaddr *local_addr, void *logctx) @@ -226,15 +309,22 @@ static int udp_join_multicast_group(int sockfd, struct sockaddr *addr, #endif #if HAVE_STRUCT_IPV6_MREQ && defined(IPPROTO_IPV6) if (addr->sa_family == AF_INET6) { +#if HAVE_IOCTL_GIFINDEX + return udp_ipv6_multicast_iterate(sockfd, + (struct sockaddr_in6 *)addr, + (struct sockaddr_in6 *)local_addr, + IPV6_JOIN_GROUP, + logctx); +#else struct ipv6_mreq mreq6; memcpy(&mreq6.ipv6mr_multiaddr, &(((struct sockaddr_in6 *)addr)->sin6_addr), sizeof(struct in6_addr)); - //TODO: Interface index should be looked up from local_addr mreq6.ipv6mr_interface = 0; if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &mreq6, sizeof(mreq6)) < 0) { ff_log_net_error(logctx, AV_LOG_ERROR, "setsockopt(IPV6_ADD_MEMBERSHIP)"); return ff_neterrno(); } +#endif } #endif return 0; @@ -260,15 +350,22 @@ static int udp_leave_multicast_group(int sockfd, struct sockaddr *addr, #endif #if HAVE_STRUCT_IPV6_MREQ && defined(IPPROTO_IPV6) if (addr->sa_family == AF_INET6) { +#if HAVE_IOCTL_GIFINDEX + return udp_ipv6_multicast_iterate(sockfd, + (struct sockaddr_in6 *)addr, + (struct sockaddr_in6 *)local_addr, + IPV6_LEAVE_GROUP, + logctx); +#else struct ipv6_mreq mreq6; memcpy(&mreq6.ipv6mr_multiaddr, &(((struct sockaddr_in6 *)addr)->sin6_addr), sizeof(struct in6_addr)); - //TODO: Interface index should be looked up from local_addr mreq6.ipv6mr_interface = 0; if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, &mreq6, sizeof(mreq6)) < 0) { ff_log_net_error(logctx, AV_LOG_ERROR, "setsockopt(IPV6_DROP_MEMBERSHIP)"); return -1; } +#endif } #endif return 0; -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org