aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--configure.ac56
-rw-r--r--src/dns/gnunet-helper-dns.c22
-rw-r--r--src/exit/gnunet-helper-exit.c12
-rw-r--r--src/util/os_network.c52
-rw-r--r--src/util/test_os_network.c30
6 files changed, 157 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 81ddd090e..31b0b637e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
1Fri 05 Apr 2019 11:38:53 PM CEST
2 Use paths of sysctl, ip, ifconfig and ip(6)tables from configure
3 if they work. (#5352). -CG
4
1Thu 04 Apr 2019 12:39:44 PM CEST 5Thu 04 Apr 2019 12:39:44 PM CEST
2 Hotfix for build issue. Releasing GNUnet 0.11.2. -CG/MS 6 Hotfix for build issue. Releasing GNUnet 0.11.2. -CG/MS
3 7
diff --git a/configure.ac b/configure.ac
index d9e6af74d..fbc447acb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -244,6 +244,49 @@ else
244AC_MSG_WARN([warning: 'iptables' not found.]) 244AC_MSG_WARN([warning: 'iptables' not found.])
245fi 245fi
246 246
247# ip6tables is a soft requirement for some features
248AC_PATH_TARGET_TOOL(VAR_IP6TABLES_BINARY, ip6tables, false)
249
250if test x"$VAR_IP6TABLES_BINARY" = x"false"
251then
252 if test -x "/sbin/ip6tables"
253 then
254 VAR_IP6TABLES_BINARY="/sbin/ip6tables"
255 elif test -x "/usr/sbin/ip6tables"
256 then
257 VAR_IP6TABLES_BINARY="/usr/sbin/ip6tables"
258 fi
259fi
260
261if test x"$VAR_IP6TABLES_BINARY" != x"false"
262then
263AC_DEFINE_UNQUOTED([IP6TABLES], "$VAR_IP6TABLES_BINARY", [Path to ip6tables])
264else
265AC_MSG_WARN([warning: 'ip6tables' not found.])
266fi
267
268# ip is a soft requirement for some features
269AC_PATH_TARGET_TOOL(VAR_IP_BINARY, ip, false)
270
271if test x"$VAR_IP_BINARY" = x"false"
272then
273 if test -x "/sbin/ip"
274 then
275 VAR_IP_BINARY="/sbin/ip"
276 elif test -x "/usr/sbin/ip"
277 then
278 VAR_IP_BINARY="/usr/sbin/ip"
279 fi
280fi
281
282if test x"$VAR_IP_BINARY" != x"false"
283then
284AC_DEFINE_UNQUOTED([PATH_TO_IP], "$VAR_IP_BINARY", [Path to ip])
285else
286AC_MSG_WARN([warning: 'ip' not found.])
287fi
288
289# locate 'ifconfig'
247AC_PATH_TARGET_TOOL(VAR_IFCONFIG_BINARY, ifconfig, false) 290AC_PATH_TARGET_TOOL(VAR_IFCONFIG_BINARY, ifconfig, false)
248 291
249AC_CHECK_PROG(VAR_IFCONFIG_BINARY, ifconfig, true, false) 292AC_CHECK_PROG(VAR_IFCONFIG_BINARY, ifconfig, true, false)
@@ -264,6 +307,19 @@ else
264AC_MSG_WARN(['ifconfig' not found.]) 307AC_MSG_WARN(['ifconfig' not found.])
265fi 308fi
266 309
310
311AC_PATH_TARGET_TOOL(VAR_SYSCTL_BINARY, sysctl, false)
312
313AC_CHECK_PROG(VAR_SYSCTL_BINARY, sysctl, true, false)
314AS_IF([test x"$VAR_SYSCTL_BINARY" = x"false"],
315 [AS_IF([test -x "/sbin/sysctl"],
316 [VAR_SYSCTL_BINARY="/sbin/sysctl"],
317 [AS_IF([test -x "/usr/sbin/sysctl"],
318 [VAR_SYSCTL_BINARY="/usr/sbin/sysctl"])])])
319AS_IF([test x"$VAR_SYSCTL_BINARY" != x"false"],
320 [AC_DEFINE_UNQUOTED([SYSCTL], "$VAR_SYSCTL_BINARY", [Path to sysctl])],
321 [AC_MSG_WARN(['sysctl' not found.])])
322
267# miniupnpc / upnpc binary is a soft runtime requirement 323# miniupnpc / upnpc binary is a soft runtime requirement
268AC_PATH_TARGET_TOOL(VAR_UPNPC_BINARY, upnpc, false) 324AC_PATH_TARGET_TOOL(VAR_UPNPC_BINARY, upnpc, false)
269 325
diff --git a/src/dns/gnunet-helper-dns.c b/src/dns/gnunet-helper-dns.c
index fb970224a..554727094 100644
--- a/src/dns/gnunet-helper-dns.c
+++ b/src/dns/gnunet-helper-dns.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
@@ -768,6 +768,11 @@ main (int argc, char *const*argv)
768 if (0 == nortsetup) 768 if (0 == nortsetup)
769 { 769 {
770 /* verify that the binaries we care about are executable */ 770 /* verify that the binaries we care about are executable */
771#ifdef IPTABLES
772 if (0 == access (IPTABLES, X_OK))
773 sbin_iptables = IPTABLES;
774 else
775#endif
771 if (0 == access ("/sbin/iptables", X_OK)) 776 if (0 == access ("/sbin/iptables", X_OK))
772 sbin_iptables = "/sbin/iptables"; 777 sbin_iptables = "/sbin/iptables";
773 else if (0 == access ("/usr/sbin/iptables", X_OK)) 778 else if (0 == access ("/usr/sbin/iptables", X_OK))
@@ -779,6 +784,11 @@ main (int argc, char *const*argv)
779 strerror (errno)); 784 strerror (errno));
780 return 3; 785 return 3;
781 } 786 }
787#ifdef IP6TABLES
788 if (0 == access (IP6TABLES, X_OK))
789 sbin_ip6tables = IP6TABLES;
790 else
791#endif
782 if (0 == access ("/sbin/ip6tables", X_OK)) 792 if (0 == access ("/sbin/ip6tables", X_OK))
783 sbin_ip6tables = "/sbin/ip6tables"; 793 sbin_ip6tables = "/sbin/ip6tables";
784 else if (0 == access ("/usr/sbin/ip6tables", X_OK)) 794 else if (0 == access ("/usr/sbin/ip6tables", X_OK))
@@ -790,6 +800,11 @@ main (int argc, char *const*argv)
790 strerror (errno)); 800 strerror (errno));
791 return 3; 801 return 3;
792 } 802 }
803#ifdef PATH_TO_IP
804 if (0 == access (PATH_TO_IP, X_OK))
805 sbin_ip = PATH_TO_IP;
806 else
807#endif
793 if (0 == access ("/sbin/ip", X_OK)) 808 if (0 == access ("/sbin/ip", X_OK))
794 sbin_ip = "/sbin/ip"; 809 sbin_ip = "/sbin/ip";
795 else if (0 == access ("/usr/sbin/ip", X_OK)) 810 else if (0 == access ("/usr/sbin/ip", X_OK))
@@ -803,6 +818,11 @@ main (int argc, char *const*argv)
803 strerror (errno)); 818 strerror (errno));
804 return 4; 819 return 4;
805 } 820 }
821#ifdef SYSCTL
822 if (0 == access (SYSCTL, X_OK))
823 sbin_sysctl = SYSCTL;
824 else
825#endif
806 if (0 == access ("/sbin/sysctl", X_OK)) 826 if (0 == access ("/sbin/sysctl", X_OK))
807 sbin_sysctl = "/sbin/sysctl"; 827 sbin_sysctl = "/sbin/sysctl";
808 else if (0 == access ("/usr/sbin/sysctl", X_OK)) 828 else if (0 == access ("/usr/sbin/sysctl", X_OK))
diff --git a/src/exit/gnunet-helper-exit.c b/src/exit/gnunet-helper-exit.c
index de9ea39be..cda38710f 100644
--- a/src/exit/gnunet-helper-exit.c
+++ b/src/exit/gnunet-helper-exit.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
@@ -670,6 +670,11 @@ main (int argc, char **argv)
670 } 670 }
671 if (0 != strcmp (argv[2], "-")) 671 if (0 != strcmp (argv[2], "-"))
672 { 672 {
673#ifdef IPTABLES
674 if (0 == access (IPTABLES, X_OK))
675 sbin_iptables = IPTABLES;
676 else
677#endif
673 if (0 == access ("/sbin/iptables", X_OK)) 678 if (0 == access ("/sbin/iptables", X_OK))
674 sbin_iptables = "/sbin/iptables"; 679 sbin_iptables = "/sbin/iptables";
675 else if (0 == access ("/usr/sbin/iptables", X_OK)) 680 else if (0 == access ("/usr/sbin/iptables", X_OK))
@@ -681,6 +686,11 @@ main (int argc, char **argv)
681 strerror (errno)); 686 strerror (errno));
682 return 1; 687 return 1;
683 } 688 }
689#ifdef SYSCTL
690 if (0 == access (SYSCTL, X_OK))
691 sbin_sysctl = SYSCTL;
692 else
693#endif
684 if (0 == access ("/sbin/sysctl", X_OK)) 694 if (0 == access ("/sbin/sysctl", X_OK))
685 sbin_sysctl = "/sbin/sysctl"; 695 sbin_sysctl = "/sbin/sysctl";
686 else if (0 == access ("/usr/sbin/sysctl", X_OK)) 696 else if (0 == access ("/usr/sbin/sysctl", X_OK))
diff --git a/src/util/os_network.c b/src/util/os_network.c
index dba61f1e4..9008c5c5a 100644
--- a/src/util/os_network.c
+++ b/src/util/os_network.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
@@ -67,15 +67,29 @@ try_ifconfig (GNUNET_OS_NetworkInterfaceProcessor proc,
67 struct sockaddr *pass_bcaddr; 67 struct sockaddr *pass_bcaddr;
68 struct sockaddr *pass_netmask; 68 struct sockaddr *pass_netmask;
69 int prefixlen; 69 int prefixlen;
70 static char *pcall;
71
72 if (NULL == pcall)
73 {
74 const char *sbin_ifconfig;
70 75
71 if (system ("ifconfig -a > /dev/null 2> /dev/null")) 76#ifdef IFCONFIG
72 if (0 == system ("/sbin/ifconfig -a > /dev/null 2> /dev/null")) 77 if (0 == access (IFCONFIG, X_OK))
73 f = popen ("/sbin/ifconfig -a 2> /dev/null", "r"); 78 sbin_ifconfig = IFCONFIG;
74 else 79 else
75 f = NULL; 80#endif
76 else 81 if (0 == access ("/sbin/ifconfig", X_OK))
77 f = popen ("ifconfig -a 2> /dev/null", "r"); 82 sbin_ifconfig = "/sbin/ifconfig";
78 if (! f) 83 else if (0 == access ("/usr/sbin/ifconfig", X_OK))
84 sbin_ifconfig = "/usr/sbin/ifconfig";
85 else
86 sbin_ifconfig = "ifconfig";
87 GNUNET_asprintf (&pcall,
88 "%s -a 2> /dev/null",
89 sbin_ifconfig);
90 }
91 f = popen (pcall, "r");
92 if (NULL == f)
79 { 93 {
80 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, 94 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK,
81 "popen", 95 "popen",
@@ -238,8 +252,28 @@ try_ip (GNUNET_OS_NetworkInterfaceProcessor proc,
238 struct sockaddr_in6 netmask6; 252 struct sockaddr_in6 netmask6;
239 unsigned int i; 253 unsigned int i;
240 unsigned int prefixlen; 254 unsigned int prefixlen;
255 static char *pcall;
241 256
242 f = popen ("ip -o add 2> /dev/null", "r"); 257 if (NULL == pcall)
258 {
259 const char *sbin_ip;
260
261#ifdef IFCONFIG
262 if (0 == access (PATH_TO_IP, X_OK))
263 sbin_ip = PATH_TO_IP;
264 else
265#endif
266 if (0 == access ("/sbin/ip", X_OK))
267 sbin_ip = "/sbin/ip";
268 else if (0 == access ("/usr/sbin/ip", X_OK))
269 sbin_ip = "/usr/sbin/ip";
270 else
271 sbin_ip = "if";
272 GNUNET_asprintf (&pcall,
273 "%s -o add 2> /dev/null",
274 sbin_ip);
275 }
276 f = popen (pcall, "r");
243 if (! f) 277 if (! f)
244 { 278 {
245 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, 279 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK,
diff --git a/src/util/test_os_network.c b/src/util/test_os_network.c
index b6e981bc3..fa769de6f 100644
--- a/src/util/test_os_network.c
+++ b/src/util/test_os_network.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
@@ -31,8 +31,12 @@
31 * (success). 31 * (success).
32 */ 32 */
33static int 33static int
34proc (void *cls, const char *name, int isDefault, const struct sockaddr *addr, 34proc (void *cls,
35 const struct sockaddr *broadcast_addr, const struct sockaddr *netmask, 35 const char *name,
36 int isDefault,
37 const struct sockaddr *addr,
38 const struct sockaddr *broadcast_addr,
39 const struct sockaddr *netmask,
36 socklen_t addrlen) 40 socklen_t addrlen)
37{ 41{
38 int *ok = cls; 42 int *ok = cls;
@@ -46,11 +50,18 @@ proc (void *cls, const char *name, int isDefault, const struct sockaddr *addr,
46 else 50 else
47 protocol = "IPv6"; 51 protocol = "IPv6";
48 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 52 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
49 "%s Address `%s'\n", protocol, GNUNET_a2s ((const struct sockaddr *) addr,addrlen) ); 53 "%s Address `%s'\n",
54 protocol,
55 GNUNET_a2s ((const struct sockaddr *) addr,
56 addrlen) );
50 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 57 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
51 "Netmask `%s'\n", GNUNET_a2s ((const struct sockaddr *) netmask, addrlen) ); 58 "Netmask `%s'\n",
59 GNUNET_a2s ((const struct sockaddr *) netmask,
60 addrlen) );
52 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 61 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
53 "`%s'\n", GNUNET_a2s ((const struct sockaddr *) broadcast_addr,addrlen) ); 62 "`%s'\n",
63 GNUNET_a2s ((const struct sockaddr *) broadcast_addr,
64 addrlen) );
54 inet_ntop (addr->sa_family, 65 inet_ntop (addr->sa_family,
55 (addr->sa_family == 66 (addr->sa_family ==
56 AF_INET) ? (void *) &((struct sockaddr_in *) addr)->sin_addr 67 AF_INET) ? (void *) &((struct sockaddr_in *) addr)->sin_addr
@@ -67,9 +78,12 @@ main (int argc, char *argv[])
67{ 78{
68 int ret; 79 int ret;
69 80
70 GNUNET_log_setup ("test-os-network", "WARNING", NULL); 81 GNUNET_log_setup ("test-os-network",
82 "WARNING",
83 NULL);
71 ret = 1; 84 ret = 1;
72 GNUNET_OS_network_interfaces_list (&proc, &ret); 85 GNUNET_OS_network_interfaces_list (&proc,
86 &ret);
73 return ret; 87 return ret;
74} 88}
75 89