From 532ace635a095d4613e37f880b573ad126671aef Mon Sep 17 00:00:00 2001 From: Sean Qureshi Date: Fri, 10 Oct 2014 18:09:52 -0700 Subject: [PATCH 1/2] Enable IPv6, fix systemd PID bug --- other/bootstrap_daemon/tox-bootstrapd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/other/bootstrap_daemon/tox-bootstrapd.c b/other/bootstrap_daemon/tox-bootstrapd.c index e4cadb35..0848cd17 100644 --- a/other/bootstrap_daemon/tox-bootstrapd.c +++ b/other/bootstrap_daemon/tox-bootstrapd.c @@ -53,7 +53,7 @@ #define DAEMON_NAME "tox-bootstrapd" -#define DAEMON_VERSION_NUMBER 2014081600UL // yyyymmmddvv format: yyyy year, mm month, dd day, vv version change count for that day +#define DAEMON_VERSION_NUMBER 2014101000UL // yyyymmmddvv format: yyyy year, mm month, dd day, vv version change count for that day #define SLEEP_TIME_MILLISECONDS 30 #define sleep usleep(1000*SLEEP_TIME_MILLISECONDS) @@ -61,7 +61,7 @@ #define DEFAULT_PID_FILE_PATH "tox-bootstrapd.pid" #define DEFAULT_KEYS_FILE_PATH "tox-bootstrapd.keys" #define DEFAULT_PORT 33445 -#define DEFAULT_ENABLE_IPV6 0 // 1 - true, 0 - false +#define DEFAULT_ENABLE_IPV6 1 // 1 - true, 0 - false #define DEFAULT_ENABLE_LAN_DISCOVERY 1 // 1 - true, 0 - false #define DEFAULT_ENABLE_TCP_RELAY 1 // 1 - true, 0 - false #define DEFAULT_TCP_RELAY_PORTS 443, 3389, 33445 // comma-separated list of ports. make sure to adjust DEFAULT_TCP_RELAY_PORTS_COUNT accordingly @@ -616,7 +616,7 @@ int main(int argc, char *argv[]) pid_t pid = fork(); if (pid > 0) { - fprintf(pidf, "%d ", pid); + fprintf(pidf,"%d", pid); fclose(pidf); syslog(LOG_DEBUG, "Forked successfully: PID: %d.\n", pid); return 0; From 2df986f6b951aee49f403ff076f213213ce873eb Mon Sep 17 00:00:00 2001 From: Sean Qureshi Date: Fri, 10 Oct 2014 18:23:23 -0700 Subject: [PATCH 2/2] Does a realloc with a size of 0 if every port is invalid --- other/bootstrap_daemon/tox-bootstrapd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/other/bootstrap_daemon/tox-bootstrapd.c b/other/bootstrap_daemon/tox-bootstrapd.c index 0848cd17..a0f93bb3 100644 --- a/other/bootstrap_daemon/tox-bootstrapd.c +++ b/other/bootstrap_daemon/tox-bootstrapd.c @@ -210,7 +210,9 @@ void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_ports, int } // the loop above skips invalid ports, so we adjust the allocated memory size - *tcp_relay_ports = realloc(*tcp_relay_ports, (*tcp_relay_port_count) * sizeof(uint16_t)); + if ((*tcp_relay_port_count) * sizeof(uint16_t) > 0) { + *tcp_relay_ports = realloc(*tcp_relay_ports, (*tcp_relay_port_count) * sizeof(uint16_t)); + } } // Gets general config options