Bug 170917 - net/udpxy on freebsd 9.0 allow only one client for each multicast stream
Summary: net/udpxy on freebsd 9.0 allow only one client for each multicast stream
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Alex Kozlov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-23 14:20 UTC by Denis Zaika
Modified: 2012-09-15 11:59 UTC (History)
0 users

See Also:


Attachments
file.diff (535 bytes, patch)
2012-08-23 14:20 UTC, Denis Zaika
no flags Details | Diff
udpxy-23.txt (2.10 KB, text/plain; charset=US-ASCII)
2012-08-23 23:32 UTC, alex.deiter
no flags Details
udpxy-23.txt (1.34 KB, text/plain; charset=US-ASCII)
2012-08-27 16:57 UTC, alex.deiter
no flags Details
patch.txt (2.25 KB, text/plain; charset=us-ascii)
2012-08-29 02:59 UTC, Alex Kozlov
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Denis Zaika 2012-08-23 14:20:01 UTC
If someone watches any IPTV channel (UDP multicast) via udpxy proxy next client can't watch it.
Udpxy rise error "setup_mcast_listener: bind: Address already in use". On RELENG8 I've never seen such issue.

Fix: In the file netop.c replace a few strings in setup_mcast_listener

from:

rc = setsockopt( sockfd, SOL_SOCKET, SO_REUSEADDR,
                         &ON, sizeof(ON) );

to:

rc = setsockopt( sockfd, SOL_SOCKET, SO_REUSEPORT,
                         &ON, sizeof(ON) );

Patch attached with submission follows:
How-To-Repeat: Start to watch any IPTV channel via udpxy on FreeBSD 9.0 and try to watch the same channel from another IP.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2012-08-23 14:59:56 UTC
Maintainer of net/udpxy,

Please note that PR ports/170917 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/170917

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2012-08-23 14:59:58 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2012-08-23 23:57:22 UTC
State Changed
From-To: feedback->open

Maintainer approved.
Comment 4 Alex Kozlov freebsd_committer freebsd_triage 2012-08-24 02:56:58 UTC
Responsible Changed
From-To: freebsd-ports-bugs->ak

I'll take it.
Comment 5 Denis Zaika 2012-08-27 16:19:49 UTC
On 24.08.2012 01:32, Alex Deiter wrote:
> Patch approved. patch + update up to version 23 attached.
> 

Thank you, Alex!

I'm not sure, but I've just read that such issue has been solved in release 1.23.
Changelog cut:

>Build 23 (3-Jul-2012)
>    (*) HTTP response lines are now separated by CRLF (not just LF), as per RFC2616;
>    (*) SO_REUSEPORT used (where available) to allow more that one client
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>        to subscribe to the same channel on BSD-derived systems;
>    (*) optimization patches by Alexey Suhinin integrated (tcp_nodelay, pause_timeout, mstream_type);
>    (*) sloop.c uses syscall.h & -DUSE_SELECT to alternate between select(2)- and pselect(2)-based
implementations of server loop
>    (*) FIXED: idle timeout displayed incorrectly in select(2)-based version;
>    (*) HTTP response includes 'Server:' clause;

I've examined sources to make certain of that and found the following piece of code:

>#ifdef SO_REUSEPORT
>        /*  On some systems (such as FreeBSD) SO_REUSEADDR
>            just isn't enough to subscribe to N same channels for different clients.
>        */
>        rc = setsockopt( sockfd, SOL_SOCKET, SO_REUSEPORT,
>                         &ON, sizeof(ON) );
>        if( 0 != rc ) {
>            mperror(g_flog, errno, "%s: setsockopt SO_REUSEPORT",
>                    __func__);
>            break;
>        }
>#endif /* SO_REUSEPORT */

I've built 1.23 without patch and it works! I think that patch is unneeded with latest version of udpxy.

-- 
Cheers, Denis Zaika,				ZDS-RIPE
"Soniko-svyaz" NOC engineer,			ZDS-UANIC
Donetsk, Ukraine				ZDS-EUNIC
+380933407844, +380623323232
Comment 6 Alex Kozlov 2012-08-29 02:59:17 UTC
Hi, Alex

While I'm here, I also want to convert port to new options framework.
What do you think about next patch?


-- 
Alex
Comment 7 dfilter service freebsd_committer freebsd_triage 2012-09-15 10:38:41 UTC
Author: ak
Date: Sat Sep 15 09:38:26 2012
New Revision: 304312
URL: http://svn.freebsd.org/changeset/ports/304312

Log:
  - Update to 1.0.23 [1]
  - Convert to new options framework
  
  PR:	ports/170917 [1]
  Submitted by:	Denis Zaika <i@doct.org.ua> [1]

Modified:
  head/net/udpxy/Makefile   (contents, props changed)
  head/net/udpxy/distinfo   (contents, props changed)
  head/net/udpxy/files/udpxy.in   (contents, props changed)

Modified: head/net/udpxy/Makefile
==============================================================================
--- head/net/udpxy/Makefile	Sat Sep 15 09:19:35 2012	(r304311)
+++ head/net/udpxy/Makefile	Sat Sep 15 09:38:26 2012	(r304312)
@@ -6,23 +6,26 @@
 #
 
 PORTNAME=	udpxy
-PORTVERSION=	1.0.21
+PORTVERSION=	1.0.23
 CATEGORIES=	net
 MASTER_SITES=	SF/${PORTNAME}/${PORTNAME}/${RELEASE_MASCOT}-${PORTVERSION:R}
-DISTNAME=	${PORTNAME}.${PORTVERSION}-2-prod
-EXTRACT_SUFX=	.tgz
+DISTNAME=	${PORTNAME}.${PORTVERSION}-0-prod
 
 MAINTAINER=	alex.deiter@gmail.com
 COMMENT=	UDP-to-HTTP multicast traffic relay daemon
 
-WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}-2
+WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}-0
 USE_RC_SUBR=	udpxy
 USE_GMAKE=	yes
 MAKE_JOBS_SAFE=	yes
 RELEASE_MASCOT=	Chipmunk
-OPTIONS=	RELEASE "No asserts, no debug symbols, verbose mode on"	on \
-		LEAN "No asserts, no debug symbols, verbose mode off" off \
-		DEBUG "Asserts, debug symbols, verbose mode on" off
+
+OPTIONS_SINGLE=	CONF
+OPTIONS_SINGLE_CONF=	RELEASE LEAN DEBUG
+RELEASE_DESC=	No asserts, no debug symbols, verbose on
+LEAN_DESC=	No asserts, no debug symbols, verbose off
+DEBUG_DESC=	Asserts, debug symbols, verbose on
+OPTIONS_DEFAULT=	RELEASE
 
 PLIST_FILES=	sbin/udpxy \
 		sbin/udpxrec
@@ -31,17 +34,15 @@ do-install:
 	@${INSTALL_PROGRAM} ${WRKSRC}/udpxy ${PREFIX}/sbin/
 	@${LN} -s udpxy ${PREFIX}/sbin/udpxrec
 
-.include <bsd.port.pre.mk>
+.include <bsd.port.options.mk>
 
-.if defined(WITH_RELEASE) && defined(WITHOUT_LEAN) && defined(WITHOUT_DEBUG)
+.if ${PORT_OPTIONS:MRELEASE}
 ALL_TARGET=release
-.elif defined(WITH_LEAN) && defined(WITHOUT_RELEASE) && defined(WITHOUT_DEBUG)
+.elif ${PORT_OPTIONS:MLEAN}
 ALL_TARGET=lean
-.elif defined(WITH_DEBUG) && defined(WITHOUT_RELEASE) && defined(WITHOUT_LEAN)
+.elif ${PORT_OPTIONS:MDEBUG}
 ALL_TARGET=debug
 WITH_DEBUG=yes
-.else
-IGNORE=please run 'make config' again and select one build option
 .endif
 
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>

Modified: head/net/udpxy/distinfo
==============================================================================
--- head/net/udpxy/distinfo	Sat Sep 15 09:19:35 2012	(r304311)
+++ head/net/udpxy/distinfo	Sat Sep 15 09:38:26 2012	(r304312)
@@ -1,2 +1,2 @@
-SHA256 (udpxy.1.0.21-2-prod.tgz) = 630ab98c9e1c8248be1b3a3b16efef48e6da439995dbc795700de028138f76eb
-SIZE (udpxy.1.0.21-2-prod.tgz) = 82947
+SHA256 (udpxy.1.0.23-0-prod.tar.gz) = b5b3523f20c82b0249acced317daa65ec1791ceed4e5f8f582ecf79067f41a18
+SIZE (udpxy.1.0.23-0-prod.tar.gz) = 79133

Modified: head/net/udpxy/files/udpxy.in
==============================================================================
--- head/net/udpxy/files/udpxy.in	Sat Sep 15 09:19:35 2012	(r304311)
+++ head/net/udpxy/files/udpxy.in	Sat Sep 15 09:38:26 2012	(r304312)
@@ -4,7 +4,7 @@
 #
 
 # PROVIDE: udpxy
-# REQUIRE: NETWORKING
+# REQUIRE: DAEMON
 
 # Define these udpxy_* variables in one of these files:
 #	/etc/rc.conf
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 8 Alex Kozlov freebsd_committer freebsd_triage 2012-09-15 11:59:37 UTC
State Changed
From-To: open->closed

Committed. Thanks!