From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 42A7540527 for ; Tue, 25 Jan 2022 05:28:22 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4660968B01D; Tue, 25 Jan 2022 07:28:20 +0200 (EET) Received: from mail.comstyle.com (speedy.comstyle.com [206.51.28.2]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6610B68B007 for ; Tue, 25 Jan 2022 07:28:14 +0200 (EET) Received: from mail.comstyle.com (localhost [127.0.0.1]) by mail.comstyle.com (Postfix) with ESMTP id 4Jjb3c5lqBz8PbN for ; Tue, 25 Jan 2022 00:28:12 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=comstyle.com; h=date:from :to:subject:message-id:references:mime-version:content-type :in-reply-to; s=default; bh=IwLPkgq5QqnIec+KUSb+BACnjXk=; b=iy8k 0I9wOUT01qGDXq/AxzwnYOdknbWfkRdTbPBQ0NlqnZWVSiRigLiBtPPDfliMd8zr BvRj6MR5auTqLNxvYxbvYP/SrqSVQmO8IrhUmFhJgXB4cFyFa+xFq2S+RIFC2jp1 WNSjTLe/8Gq2b7xxlGEzBHVSGACw9BQYKiw2GB0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=comstyle.com; h=date:from:to :subject:message-id:references:mime-version:content-type :in-reply-to; q=dns; s=default; b=QGmbYU1gGX/5JCLiPu5hXWmR2zjLXx ic6D6cCqXZsw/N6uUj25r9dS6geYFaF2hV4kof6F9YDN2T0+s5qnxq1rhAISseMZ SNSAll3dSluk5OqujoB/sbJYiOj9V3xhoy0m+LQ5+6w1L6cxXnvkjM5kjcL2Q2qm gcxb4IGkwujaU= Received: from humpty.home.comstyle.com (bras-base-toroon2719w-grc-53-142-114-5-252.dsl.bell.ca [142.114.5.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: brad) by mail.comstyle.com (Postfix) with ESMTPSA id 4Jjb3c4wbsz8PbK for ; Tue, 25 Jan 2022 00:28:12 -0500 (EST) Date: Tue, 25 Jan 2022 00:28:11 -0500 From: Brad Smith To: FFmpeg development discussions and patches Message-ID: References: <20220123115700.GB2829255@pb2> <20220124124047.GC2829255@pb2> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220124124047.GC2829255@pb2> Subject: Re: [FFmpeg-devel] [PATCH] Fix setsockopt IP_MULTICAST_TTL on OpenBSD X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Mon, Jan 24, 2022 at 01:40:47PM +0100, Michael Niedermayer wrote: > On Sun, Jan 23, 2022 at 02:55:38PM -0500, Brad Smith wrote: > > On 1/23/2022 6:57 AM, Michael Niedermayer wrote: > > > > > On Wed, Jan 12, 2022 at 12:13:13AM -0500, Brad Smith wrote: > > > > Fix setsockopt() usage on OpenBSD with IP_MULTICAST_TTL. The field > > > > type should be an unsigned char on anything but Linux. > > > > > > > > > > > > diff --git a/libavformat/udp.c b/libavformat/udp.c > > > > index 180d96a988..29aa865fff 100644 > > > > --- a/libavformat/udp.c > > > > +++ b/libavformat/udp.c > > > > @@ -163,7 +163,13 @@ static int udp_set_multicast_ttl(int sockfd, int mcastTTL, > > > > { > > > > #ifdef IP_MULTICAST_TTL > > > > if (addr->sa_family == AF_INET) { > > > > - if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, &mcastTTL, sizeof(mcastTTL)) < 0) { > > > > +#ifdef __linux__ > > > > + int ttl = mcastTTL; > > > > +#else > > > > + unsigned char ttl = mcastTTL; > > > > +#endif > > > this "ifdef __linux__" feels like the wrong thing to check, dont you agree ? > > > > Not sure what you mean. > > "__linux__" seems the wrong property to check for > this is not > #ifdef __linux__ > osname = "linux" > #else > > i would have expected more something like > #if HAVE_INT_TTL > int ttl = mcastTTL; > #else > > or maybe even something along the lines of > > WHATEVER_TTL_TYPE ttl = mcastTTL; > > thx Ok, how about something like this? diff --git a/configure b/configure index 493493b4c5..055ff3c206 100755 --- a/configure +++ b/configure @@ -3838,6 +3838,8 @@ doc_deps_any="manpages htmlpages podpages txtpages" logfile="ffbuild/config.log" +multicast_ttl_type='unsigned char' + # installation paths prefix_default="/usr/local" bindir_default='${prefix}/bin' @@ -5653,6 +5655,7 @@ case $target_os in linux) enable section_data_rel_ro enabled_any arm aarch64 && enable_weak linux_perf + multicast_ttl_type='int' ;; irix*) target_os=irix @@ -7784,6 +7787,7 @@ cat > $TMPH <sa_family == AF_INET) { - if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, &mcastTTL, sizeof(mcastTTL)) < 0) { + MULTICAST_TTL_TYPE ttl = mcastTTL; + + if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl)) < 0) { ff_log_net_error(logctx, AV_LOG_ERROR, "setsockopt(IP_MULTICAST_TTL)"); return ff_neterrno(); } _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".