From 47404fc91479f3c825b3c210f2b9f2190a891fa7 Mon Sep 17 00:00:00 2001 From: Paul Wouters Date: Sep 21 2011 18:28:11 +0000 Subject: * Wed Sep 21 2011 Paul Wouters - 1.7.1.3-3 - support TUN endpoint without IP address (rhbz#706226) [Till Maas] --- diff --git a/socat-1.7.1.3-support-ipless-tuntap.patch b/socat-1.7.1.3-support-ipless-tuntap.patch new file mode 100644 index 0000000..e46a3fe --- /dev/null +++ b/socat-1.7.1.3-support-ipless-tuntap.patch @@ -0,0 +1,69 @@ +diff -up socat-1.7.1.3/xio-tun.c.orig socat-1.7.1.3/xio-tun.c +--- socat-1.7.1.3/xio-tun.c.orig 2011-05-19 20:25:38.654799000 +0200 ++++ socat-1.7.1.3/xio-tun.c 2011-05-19 20:37:48.675627004 +0200 +@@ -78,8 +78,8 @@ static int xioopen_tun(int argc, const c + char *ifaddr; + int result; + +- if (argc != 2) { +- Error2("%s: wrong number of parameters (%d instead of 1)", ++ if (argc > 2 || argc < 0) { ++ Error2("%s: wrong number of parameters (%d instead of 0 or 1)", + argv[0], argc-1); + } + +@@ -146,30 +146,31 @@ static int xioopen_tun(int argc, const c + } + + /*--------------------- setting interface address and netmask ------------*/ +- if ((ifaddr = strdup(argv[1])) == NULL) { +- Error1("strdup(\"%s\"): out of memory", argv[1]); +- return STAT_RETRYLATER; ++ if (argc == 2) { ++ if ((ifaddr = strdup(argv[1])) == NULL) { ++ Error1("strdup(\"%s\"): out of memory", argv[1]); ++ return STAT_RETRYLATER; ++ } ++ if ((result = xioparsenetwork(ifaddr, pf, &network)) != STAT_OK) { ++ /*! recover */ ++ return result; ++ } ++ socket_init(pf, (union sockaddr_union *)&ifr.ifr_addr); ++ ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr = ++ network.netaddr.ip4.sin_addr; ++ if (Ioctl(sockfd, SIOCSIFADDR, &ifr) < 0) { ++ Error4("ioctl(%d, SIOCSIFADDR, {\"%s\", \"%s\"}: %s", ++ sockfd, ifr.ifr_name, ifaddr, strerror(errno)); ++ } ++ ((struct sockaddr_in *)&ifr.ifr_netmask)->sin_addr = ++ network.netmask.ip4.sin_addr; ++ if (Ioctl(sockfd, SIOCSIFNETMASK, &ifr) < 0) { ++ Error4("ioctl(%d, SIOCSIFNETMASK, {\"0x%08u\", \"%s\"}, %s", ++ sockfd, ((struct sockaddr_in *)&ifr.ifr_netmask)->sin_addr.s_addr, ++ ifaddr, strerror(errno)); ++ } ++ free(ifaddr); + } +- if ((result = xioparsenetwork(ifaddr, pf, &network)) != STAT_OK) { +- /*! recover */ +- return result; +- } +- socket_init(pf, (union sockaddr_union *)&ifr.ifr_addr); +- ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr = +- network.netaddr.ip4.sin_addr; +- if (Ioctl(sockfd, SIOCSIFADDR, &ifr) < 0) { +- Error4("ioctl(%d, SIOCSIFADDR, {\"%s\", \"%s\"}: %s", +- sockfd, ifr.ifr_name, ifaddr, strerror(errno)); +- } +- ((struct sockaddr_in *)&ifr.ifr_netmask)->sin_addr = +- network.netmask.ip4.sin_addr; +- if (Ioctl(sockfd, SIOCSIFNETMASK, &ifr) < 0) { +- Error4("ioctl(%d, SIOCSIFNETMASK, {\"0x%08u\", \"%s\"}, %s", +- sockfd, ((struct sockaddr_in *)&ifr.ifr_netmask)->sin_addr.s_addr, +- ifaddr, strerror(errno)); +- } +- free(ifaddr); +- + /*--------------------- setting interface flags --------------------------*/ + applyopts_single(&xfd->stream, opts, PH_FD); + diff --git a/socat.spec b/socat.spec index 1b65472..454fda7 100644 --- a/socat.spec +++ b/socat.spec @@ -1,10 +1,11 @@ Summary: Bidirectional data relay between two data channels ('netcat++') Name: socat Version: 1.7.1.3 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2 Url: http://www.dest-unreach.org/%{name} Source: http://www.dest-unreach.org/socat/download/%{name}-%{version}.tar.gz +Patch1: socat-1.7.1.3-support-ipless-tuntap.patch Group: Applications/Internet BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: openssl-devel compat-readline5-devel ncurses-devel @@ -23,6 +24,7 @@ The compat-readline5 library is used to avoid GPLv2 vs GPLv3 issues. %setup -q iconv -f iso8859-1 -t utf-8 CHANGES > CHANGES.utf8 mv CHANGES.utf8 CHANGES +%patch1 -p1 %build autoconf @@ -62,6 +64,9 @@ rm -rf %{buildroot} %doc %{_mandir}/man1/socat.1* %changelog +* Wed Sep 21 2011 Paul Wouters - 1.7.1.3-3 +- support TUN endpoint without IP address (rhbz#706226) [Till Maas] + * Wed Feb 09 2011 Fedora Release Engineering - 1.7.1.3-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild