- when listen_ipv6=YES sets socket option to listen IPv6 only

This commit is contained in:
Jiri Skala 2010-05-17 08:06:22 +00:00
parent 25dc91b983
commit 6c0de0d1ef
2 changed files with 50 additions and 1 deletions

44
vsftpd-2.2.2-v6only.patch Normal file
View File

@ -0,0 +1,44 @@
diff -up vsftpd-2.2.2/standalone.c.v6only vsftpd-2.2.2/standalone.c
--- vsftpd-2.2.2/standalone.c.v6only 2010-05-14 16:09:38.181388723 +0200
+++ vsftpd-2.2.2/standalone.c 2010-05-14 16:09:38.207398800 +0200
@@ -77,6 +77,7 @@ vsf_standalone_main(void)
else
{
listen_sock = vsf_sysutil_get_ipv6_sock();
+ vsf_sysutil_v6only(listen_sock);
}
vsf_sysutil_activate_reuseaddr(listen_sock);
diff -up vsftpd-2.2.2/sysutil.c.v6only vsftpd-2.2.2/sysutil.c
--- vsftpd-2.2.2/sysutil.c.v6only 2010-05-17 09:09:59.848587511 +0200
+++ vsftpd-2.2.2/sysutil.c 2010-05-17 09:11:04.965806472 +0200
@@ -649,6 +649,18 @@ vsf_sysutil_wait_get_exitcode(const stru
status = ((struct vsf_sysutil_wait_retval*) p_waitret)->exit_status;
return WEXITSTATUS(status);
}
+
+void
+vsf_sysutil_v6only(int fd)
+{
+ int v6only = 1;
+ int retval = setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &v6only,
+ sizeof(v6only));
+ if (retval != 0)
+ {
+ die("setsockopt: ipv6_v6only");
+ }
+}
void
vsf_sysutil_activate_keepalive(int fd)
diff -up vsftpd-2.2.2/sysutil.h.v6only vsftpd-2.2.2/sysutil.h
--- vsftpd-2.2.2/sysutil.h.v6only 2010-05-17 09:10:04.021567360 +0200
+++ vsftpd-2.2.2/sysutil.h 2010-05-17 09:11:24.343557618 +0200
@@ -264,6 +264,7 @@ int vsf_sysutil_connect_timeout(int fd,
void vsf_sysutil_dns_resolve(struct vsf_sysutil_sockaddr** p_sockptr,
const char* p_name);
/* Option setting on sockets */
+void vsf_sysutil_v6only(int fd);
void vsf_sysutil_activate_keepalive(int fd);
void vsf_sysutil_set_iptos_throughput(int fd);
void vsf_sysutil_activate_reuseaddr(int fd);

View File

@ -2,7 +2,7 @@
Name: vsftpd
Version: 2.2.2
Release: 6%{?dist}
Release: 7%{?dist}
Summary: Very Secure Ftp Daemon
Group: System Environment/Daemons
@ -53,6 +53,7 @@ Patch14: vsftpd-2.2.0-wildchar.patch
Patch15: vsftpd-2.2.2-dso.patch
Patch16: vsftpd-2.2.2-clone.patch
Patch17: vsftpd-2.2.2-v6only.patch
%description
vsftpd is a Very Secure FTP daemon. It was written completely from
@ -80,6 +81,7 @@ cp %{SOURCE1} .
%patch14 -p1 -b .wildchar
%patch15 -p1 -b .dso
%patch16 -p1 -b .clone
%patch17 -p1 -b .v6only
%build
%ifarch s390x sparcv9 sparc64
@ -144,6 +146,9 @@ fi
%changelog
* Mon May 17 2010 Jiri Skala <jskala@redhat.com> - 2.2.2-7
- when listen_ipv6=YES sets socket option to listen IPv6 only
* Fri May 14 2010 Jiri Skala <jskala@redhat.com> - 2.2.2-6
- syscall(__NR_clone) replaced by clone() to fix incorrect order of params on s390 arch