|
Matt Domsch |
31a2b97 |
diff -urNp --exclude-from=/home/mdomsch/excludes --minimal aiccu.orig/common/common.c aiccu/common/common.c
|
|
Matt Domsch |
31a2b97 |
--- aiccu.orig/common/common.c 2008-10-17 18:43:13.000000000 -0500
|
|
Matt Domsch |
31a2b97 |
+++ aiccu/common/common.c 2008-10-17 22:11:52.000000000 -0500
|
|
Matt Domsch |
31a2b97 |
@@ -365,6 +365,7 @@ TLSSOCKET connect_client(const char *hos
|
|
Matt Domsch |
31a2b97 |
{
|
|
Matt Domsch |
31a2b97 |
sock->socket = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
|
|
Matt Domsch |
31a2b97 |
if (sock->socket == -1) continue;
|
|
Matt Domsch |
31a2b97 |
+ fcntl(sock->socket, F_SETFD, FD_CLOEXEC);
|
|
Matt Domsch |
31a2b97 |
if (connect(sock->socket, res->ai_addr, (unsigned int)res->ai_addrlen) == 0) break;
|
|
Matt Domsch |
31a2b97 |
closesocket(sock->socket);
|
|
Matt Domsch |
31a2b97 |
sock->socket = -1;
|
|
Matt Domsch |
31a2b97 |
@@ -428,6 +429,7 @@ TLSSOCKET listen_server(const char *desc
|
|
Matt Domsch |
31a2b97 |
sock->socket = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
|
|
Matt Domsch |
31a2b97 |
if (!(sock->socket < 0))
|
|
Matt Domsch |
31a2b97 |
{
|
|
Matt Domsch |
31a2b97 |
+ fcntl(sock->socket, F_SETFD, FD_CLOEXEC);
|
|
Matt Domsch |
31a2b97 |
setsockopt(sock->socket, SOL_SOCKET, SO_REUSEADDR, (const char *)&on, sizeof(on));
|
|
Matt Domsch |
31a2b97 |
if (bind(sock->socket, res->ai_addr, (unsigned int)res->ai_addrlen) == 0) break;
|
|
Matt Domsch |
31a2b97 |
closesocket(sock->socket);
|
|
Matt Domsch |
31a2b97 |
diff -urNp --exclude-from=/home/mdomsch/excludes --minimal aiccu.orig/common/heartbeat.c aiccu/common/heartbeat.c
|
|
Matt Domsch |
31a2b97 |
--- aiccu.orig/common/heartbeat.c 2008-10-17 18:43:13.000000000 -0500
|
|
Matt Domsch |
31a2b97 |
+++ aiccu/common/heartbeat.c 2008-10-17 22:12:51.000000000 -0500
|
|
Matt Domsch |
31a2b97 |
@@ -58,6 +58,7 @@ SOCKET heartbeat_socket(
|
|
Matt Domsch |
31a2b97 |
dolog(LOG_ERR, "Couldn't open a socket for determining current IPv4 address\n");
|
|
Matt Domsch |
31a2b97 |
return -1;
|
|
Matt Domsch |
31a2b97 |
}
|
|
Matt Domsch |
31a2b97 |
+ fcntl(sockfd, F_SETFD, FD_CLOEXEC);
|
|
Matt Domsch |
31a2b97 |
|
|
Matt Domsch |
31a2b97 |
#if defined(SOL_SOCKET) && defined(SO_BINDTODEVICE)
|
|
Matt Domsch |
31a2b97 |
/*
|
|
Matt Domsch |
31a2b97 |
diff -urNp --exclude-from=/home/mdomsch/excludes --minimal aiccu.orig/common/tun.c aiccu/common/tun.c
|
|
Matt Domsch |
31a2b97 |
--- aiccu.orig/common/tun.c 2008-10-17 18:43:13.000000000 -0500
|
|
Matt Domsch |
31a2b97 |
+++ aiccu/common/tun.c 2008-10-17 22:12:42.000000000 -0500
|
|
Matt Domsch |
31a2b97 |
@@ -696,6 +696,8 @@ bool tun_start(struct tun_reader *tun)
|
|
Matt Domsch |
31a2b97 |
|
|
Matt Domsch |
31a2b97 |
/* Create a new tap device */
|
|
Matt Domsch |
31a2b97 |
tun_fd = open("/dev/net/tun", O_RDWR);
|
|
Matt Domsch |
31a2b97 |
+ if (tun_fd >= 0)
|
|
Matt Domsch |
31a2b97 |
+ fcntl(tun_fd, F_SETFD, FD_CLOEXEC);
|
|
Matt Domsch |
31a2b97 |
if (tun_fd == -1)
|
|
Matt Domsch |
31a2b97 |
{
|
|
Matt Domsch |
31a2b97 |
tun_log(LOG_ERR, "start", "Couldn't open device %s: %s (%d)\n", "/dev/net/tun", strerror(errno), errno);
|
|
Matt Domsch |
31a2b97 |
@@ -725,6 +727,8 @@ bool tun_start(struct tun_reader *tun)
|
|
Matt Domsch |
31a2b97 |
tun_log(LOG_DEBUG, "start", "Trying Configured TUN/TAP interface %s...\n", g_aiccu->ipv6_interface);
|
|
Matt Domsch |
31a2b97 |
snprintf(buf, sizeof(buf), "/dev/%s", g_aiccu->ipv6_interface);
|
|
Matt Domsch |
31a2b97 |
tun_fd = open(buf, O_RDWR);
|
|
Matt Domsch |
31a2b97 |
+ if (tun_fd >= 0)
|
|
Matt Domsch |
31a2b97 |
+ fcntl(tun_fd, F_SETFD, FD_CLOEXEC);
|
|
Matt Domsch |
31a2b97 |
if (tun_fd < 0)
|
|
Matt Domsch |
31a2b97 |
{
|
|
Matt Domsch |
31a2b97 |
/* Fall back to trying all /dev/tun* devices */
|
|
Matt Domsch |
31a2b97 |
@@ -735,6 +739,7 @@ bool tun_start(struct tun_reader *tun)
|
|
Matt Domsch |
31a2b97 |
tun_fd = open(buf, O_RDWR);
|
|
Matt Domsch |
31a2b97 |
if (tun_fd >= 0)
|
|
Matt Domsch |
31a2b97 |
{
|
|
Matt Domsch |
31a2b97 |
+ fcntl(tun_fd, F_SETFD, FD_CLOEXEC);
|
|
Matt Domsch |
31a2b97 |
/* Copy over the name of the interface so that configging goes okay */
|
|
Matt Domsch |
31a2b97 |
if (g_aiccu->ipv6_interface) free(g_aiccu->ipv6_interface);
|
|
Matt Domsch |
31a2b97 |
snprintf(buf, sizeof(buf), "tun%u", i);
|