aboutsummaryrefslogtreecommitdiff
path: root/net/udpxy
diff options
context:
space:
mode:
authorMartin Wilke <miwi@FreeBSD.org>2010-03-17 07:42:04 +0000
committerMartin Wilke <miwi@FreeBSD.org>2010-03-17 07:42:04 +0000
commit10dc0b9df27c5e1e69f58f3f5f62ba7fac7b3eaf (patch)
tree4f3f93c1916882c2acf53da799c947db5591f278 /net/udpxy
parentf72d71e8525766ef3d33971e808a8ede069dae6a (diff)
downloadports-10dc0b9df27c5e1e69f58f3f5f62ba7fac7b3eaf.tar.gz
ports-10dc0b9df27c5e1e69f58f3f5f62ba7fac7b3eaf.zip
Notes
Diffstat (limited to 'net/udpxy')
-rw-r--r--net/udpxy/Makefile3
-rw-r--r--net/udpxy/distinfo6
-rw-r--r--net/udpxy/files/patch-ifaddr.c149
-rw-r--r--net/udpxy/files/patch-ifaddr.h11
-rw-r--r--net/udpxy/files/udpxy.in23
5 files changed, 180 insertions, 12 deletions
diff --git a/net/udpxy/Makefile b/net/udpxy/Makefile
index c97694b75a3a..68194bc5480d 100644
--- a/net/udpxy/Makefile
+++ b/net/udpxy/Makefile
@@ -6,8 +6,7 @@
#
PORTNAME= udpxy
-PORTVERSION= 1.0.14
-PORTREVISION= 1
+PORTVERSION= 1.0.15
CATEGORIES= net
MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/${RELEASE_MASCOT}-${PORTVERSION:R}
DISTNAME= ${PORTNAME}.${PORTVERSION:R}-${RELEASE_MASCOT}-${PORTVERSION:E}
diff --git a/net/udpxy/distinfo b/net/udpxy/distinfo
index dd03f23c9be0..0bb1c772fe86 100644
--- a/net/udpxy/distinfo
+++ b/net/udpxy/distinfo
@@ -1,3 +1,3 @@
-MD5 (udpxy.1.0-Chipmunk-14.tgz) = 96c7a71bddd90c85721926af0435bab9
-SHA256 (udpxy.1.0-Chipmunk-14.tgz) = 11f0efa7726c6daeb6b7b40a06507d5818662f55548857786a90b8610cef8010
-SIZE (udpxy.1.0-Chipmunk-14.tgz) = 79232
+MD5 (udpxy.1.0-Chipmunk-15.tgz) = ef992c1f2f4622439252968c8e920b20
+SHA256 (udpxy.1.0-Chipmunk-15.tgz) = ca2ded933336c7cd6afe530539a85624b2cd497a11b79dc6cf051be25e91f14c
+SIZE (udpxy.1.0-Chipmunk-15.tgz) = 79093
diff --git a/net/udpxy/files/patch-ifaddr.c b/net/udpxy/files/patch-ifaddr.c
new file mode 100644
index 000000000000..016bc18fddc4
--- /dev/null
+++ b/net/udpxy/files/patch-ifaddr.c
@@ -0,0 +1,149 @@
+--- ifaddr.c.orig 2010-01-14 23:49:24.515378502 +0300
++++ ifaddr.c 2010-01-14 23:50:07.723908032 +0300
+@@ -10,6 +10,7 @@
+ #include <stdlib.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
++#include <ifaddrs.h>
+
+ #include <assert.h>
+ #include <limits.h>
+@@ -21,114 +22,29 @@
+ */
+ int
+ if2addr( const char* ifname,
+- struct sockaddr *addr, size_t addrlen )
++ struct sockaddr_in *addr, size_t addrlen )
+ {
+- int rc, sockfd;
+- char *buf, *rec;
+- size_t buflen, sa_len;
+- int last_len;
+- struct ifconf ifc;
+- struct ifreq ifr;
+-
+- static size_t IFC_TABLE_SIZE;
+-
+- static const size_t IFC_ENTRIES = 32;
+- static const size_t MAX_IFCBUF_SIZE = (1024 * 256);
+-
+- IFC_TABLE_SIZE = sizeof(struct ifreq) * IFC_ENTRIES;
++ int rc = -1;
++ struct ifaddrs *ifr, *ifc;
++ struct sockaddr_in *sin;
+
+ assert( ifname && addr && addrlen );
+- rc = 0;
+-
+- /* acquire the list of network interfaces */
+-
+- sockfd = socket( AF_INET, SOCK_DGRAM, 0 );
+- if( -1 == sockfd ) return -1;
+-
+- buf = NULL; buflen = IFC_TABLE_SIZE; last_len = 0;
+- for( ; buflen < MAX_IFCBUF_SIZE; buflen += IFC_TABLE_SIZE ) {
+- if( NULL == (buf = malloc( buflen )) ) {
+- rc = -1;
+- break;
+- }
+-
+- ifc.ifc_len = buflen;
+- ifc.ifc_buf = buf;
+- if( ioctl( sockfd, SIOCGIFCONF, &ifc ) < 0 ) {
+- if( (EINVAL != errno) || (last_len != 0) ) {
+- rc = errno;
+- break;
+- }
+- }
+- else {
+- if( ifc.ifc_len == last_len )
+- break;
+- else
+- last_len = ifc.ifc_len;
+- }
+-
+- free( buf );
+- buf = NULL;
+- } /* for */
+-
+- (void) close( sockfd );
+- if( buflen > MAX_IFCBUF_SIZE ) rc = -1;
+-
+- if( 0 != rc ) {
+- if( NULL != buf ) free( buf );
+- return rc;
+- }
+
+- assert( ifc.ifc_buf );
++ getifaddrs(&ifr);
+
+- /* look for ifname in the list */
+-
+- for( rec = ifc.ifc_buf; rec < (ifc.ifc_buf + ifc.ifc_len); ) {
+- (void) memcpy( &ifr, rec, sizeof(struct ifreq) );
+-
+- #ifdef NO_SOCKADDR_SA_LEN
+- switch( ifr.ifr_addr.sa_family )
+- {
+- case AF_INET:
+- sa_len = sizeof(struct sockaddr); break;
+-#ifndef NO_INET6_SUPPORT
+- case AF_INET6:
+- sa_len = sizeof(struct sockaddr_in6); break;
+-#endif
+- default:
+- rc = -1; break;
+- }
+- #else
+- sa_len = ifr.ifr_addr.sa_len;
+- #endif
+- if( 0 != rc ) break;
+-
+- if( ifr.ifr_addr.sa_family != AF_INET )
++ for (ifc = ifr; ifc != NULL; ifc = ifc->ifa_next) {
++ if (strcmp(ifc->ifa_name, ifname) != 0)
+ continue;
+-
+- if( 0 == strncmp(ifname, ifr.ifr_name, sizeof(struct ifreq)) ) {
+- if( addrlen < sa_len ) {
+- rc = -1;
+- break;
+- }
+-
+- (void) memcpy( addr, &(ifr.ifr_addr), sa_len );
+- break;
+- }
+- else {
+- /* rec += (sa_len + sizeof( ifr.ifr_name )); */
+- /**** the above is per R. Stevens' book and not working
+- **** on 64-bit Linux */
+-
+- rec += sizeof(ifr);
+- }
+- } /* for */
+-
+- if( rec >= (buf + ifc.ifc_len) ) {
+- rc = -1;
++ if (ifc->ifa_addr == NULL)
++ continue;
++ sin = (struct sockaddr_in *)ifc->ifa_addr;
++ if (sin->sin_family != AF_INET)
++ continue;
++ memcpy(addr, sin, addrlen);
++ rc = 0;
+ }
+
+- free( buf );
++ freeifaddrs(ifr);
+ return rc;
+ }
+
+@@ -147,7 +63,7 @@
+ (void) strncpy( buf, s, len );
+ }
+ else {
+- rc = if2addr( s, (struct sockaddr*)&saddr, sizeof(saddr) );
++ rc = if2addr( s, (struct sockaddr_in *)&saddr, sizeof(saddr) );
+ if( 0 != rc ) return rc;
+
+ (void) strncpy( buf, inet_ntoa(saddr.sin_addr), len );
diff --git a/net/udpxy/files/patch-ifaddr.h b/net/udpxy/files/patch-ifaddr.h
new file mode 100644
index 000000000000..bcec3471de16
--- /dev/null
+++ b/net/udpxy/files/patch-ifaddr.h
@@ -0,0 +1,11 @@
+--- ifaddr.h.orig 2010-01-14 23:49:31.288490434 +0300
++++ ifaddr.h 2010-01-14 23:49:56.636770433 +0300
+@@ -21,7 +21,7 @@
+ */
+ int
+ if2addr( const char* ifname,
+- struct sockaddr *addr, size_t addrlen );
++ struct sockaddr_in *addr, size_t addrlen );
+
+
+ /* convert input parameter into an IPv4-address string
diff --git a/net/udpxy/files/udpxy.in b/net/udpxy/files/udpxy.in
index 1796bf14dda5..669d27d92048 100644
--- a/net/udpxy/files/udpxy.in
+++ b/net/udpxy/files/udpxy.in
@@ -6,20 +6,29 @@
# PROVIDE: udpxy
# REQUIRE: NETWORKING
-# The following variables are provided to control startup of udpxy:
-# rc configuration file (eg /etc/rc.conf):
+# Define these udpxy_* variables in one of these files:
+# /etc/rc.conf
+# /etc/rc.conf.local
+# /etc/rc.conf.d/udpxy
+#
# udpxy_enable (bool): Set to "NO" by default.
# Set it to "YES" to enable udpxy.
-# udpxy_flags (str): Set to "" by default.
-# Extra flags passed to start command.
+# udpxy_port (number): Set to "4022" by default.
+# Set listening port number.
+# udpxy_flags (str): Set to "-S" by default.
+# Extra flags passed to start command.
. %%RC_SUBR%%
name="udpxy"
-rcvar=`set_rcvar`
-command="%%PREFIX%%/sbin/${name}"
-command_args="${udpxy_flags}"
+rcvar=$(set_rcvar)
+
udpxy_enable=${udpxy_enable-"NO"}
+udpxy_port=${udpxy_port-"4022"}
+udpxy_flags=${udpxy_flags-"-S"}
+command="%%PREFIX%%/sbin/${name}"
+pidfile="/var/run/${name}${udpxy_port}.pid"
+command_args="-p ${udpxy_port} ${udpxy_flags}"
load_rc_config $name
run_rc_command "$1"