+Fri 05 Apr 2019 11:38:53 PM CEST
+ Use paths of sysctl, ip, ifconfig and ip(6)tables from configure
+ if they work. (#5352). -CG
+
Thu 04 Apr 2019 12:39:44 PM CEST
Hotfix for build issue. Releasing GNUnet 0.11.2. -CG/MS
AC_MSG_WARN([warning: 'iptables' not found.])
fi
+# ip6tables is a soft requirement for some features
+AC_PATH_TARGET_TOOL(VAR_IP6TABLES_BINARY, ip6tables, false)
+
+if test x"$VAR_IP6TABLES_BINARY" = x"false"
+then
+ if test -x "/sbin/ip6tables"
+ then
+ VAR_IP6TABLES_BINARY="/sbin/ip6tables"
+ elif test -x "/usr/sbin/ip6tables"
+ then
+ VAR_IP6TABLES_BINARY="/usr/sbin/ip6tables"
+ fi
+fi
+
+if test x"$VAR_IP6TABLES_BINARY" != x"false"
+then
+AC_DEFINE_UNQUOTED([IP6TABLES], "$VAR_IP6TABLES_BINARY", [Path to ip6tables])
+else
+AC_MSG_WARN([warning: 'ip6tables' not found.])
+fi
+
+# ip is a soft requirement for some features
+AC_PATH_TARGET_TOOL(VAR_IP_BINARY, ip, false)
+
+if test x"$VAR_IP_BINARY" = x"false"
+then
+ if test -x "/sbin/ip"
+ then
+ VAR_IP_BINARY="/sbin/ip"
+ elif test -x "/usr/sbin/ip"
+ then
+ VAR_IP_BINARY="/usr/sbin/ip"
+ fi
+fi
+
+if test x"$VAR_IP_BINARY" != x"false"
+then
+AC_DEFINE_UNQUOTED([PATH_TO_IP], "$VAR_IP_BINARY", [Path to ip])
+else
+AC_MSG_WARN([warning: 'ip' not found.])
+fi
+
+# locate 'ifconfig'
AC_PATH_TARGET_TOOL(VAR_IFCONFIG_BINARY, ifconfig, false)
AC_CHECK_PROG(VAR_IFCONFIG_BINARY, ifconfig, true, false)
AC_MSG_WARN(['ifconfig' not found.])
fi
+
+AC_PATH_TARGET_TOOL(VAR_SYSCTL_BINARY, sysctl, false)
+
+AC_CHECK_PROG(VAR_SYSCTL_BINARY, sysctl, true, false)
+AS_IF([test x"$VAR_SYSCTL_BINARY" = x"false"],
+ [AS_IF([test -x "/sbin/sysctl"],
+ [VAR_SYSCTL_BINARY="/sbin/sysctl"],
+ [AS_IF([test -x "/usr/sbin/sysctl"],
+ [VAR_SYSCTL_BINARY="/usr/sbin/sysctl"])])])
+AS_IF([test x"$VAR_SYSCTL_BINARY" != x"false"],
+ [AC_DEFINE_UNQUOTED([SYSCTL], "$VAR_SYSCTL_BINARY", [Path to sysctl])],
+ [AC_MSG_WARN(['sysctl' not found.])])
+
# miniupnpc / upnpc binary is a soft runtime requirement
AC_PATH_TARGET_TOOL(VAR_UPNPC_BINARY, upnpc, false)
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
-
+
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
if (0 == nortsetup)
{
/* verify that the binaries we care about are executable */
+#ifdef IPTABLES
+ if (0 == access (IPTABLES, X_OK))
+ sbin_iptables = IPTABLES;
+ else
+#endif
if (0 == access ("/sbin/iptables", X_OK))
sbin_iptables = "/sbin/iptables";
else if (0 == access ("/usr/sbin/iptables", X_OK))
strerror (errno));
return 3;
}
+#ifdef IP6TABLES
+ if (0 == access (IP6TABLES, X_OK))
+ sbin_ip6tables = IP6TABLES;
+ else
+#endif
if (0 == access ("/sbin/ip6tables", X_OK))
sbin_ip6tables = "/sbin/ip6tables";
else if (0 == access ("/usr/sbin/ip6tables", X_OK))
strerror (errno));
return 3;
}
+#ifdef PATH_TO_IP
+ if (0 == access (PATH_TO_IP, X_OK))
+ sbin_ip = PATH_TO_IP;
+ else
+#endif
if (0 == access ("/sbin/ip", X_OK))
sbin_ip = "/sbin/ip";
else if (0 == access ("/usr/sbin/ip", X_OK))
strerror (errno));
return 4;
}
+#ifdef SYSCTL
+ if (0 == access (SYSCTL, X_OK))
+ sbin_sysctl = SYSCTL;
+ else
+#endif
if (0 == access ("/sbin/sysctl", X_OK))
sbin_sysctl = "/sbin/sysctl";
else if (0 == access ("/usr/sbin/sysctl", X_OK))
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
-
+
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
}
if (0 != strcmp (argv[2], "-"))
{
+#ifdef IPTABLES
+ if (0 == access (IPTABLES, X_OK))
+ sbin_iptables = IPTABLES;
+ else
+#endif
if (0 == access ("/sbin/iptables", X_OK))
sbin_iptables = "/sbin/iptables";
else if (0 == access ("/usr/sbin/iptables", X_OK))
strerror (errno));
return 1;
}
+#ifdef SYSCTL
+ if (0 == access (SYSCTL, X_OK))
+ sbin_sysctl = SYSCTL;
+ else
+#endif
if (0 == access ("/sbin/sysctl", X_OK))
sbin_sysctl = "/sbin/sysctl";
else if (0 == access ("/usr/sbin/sysctl", X_OK))
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
-
+
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
struct sockaddr *pass_bcaddr;
struct sockaddr *pass_netmask;
int prefixlen;
+ static char *pcall;
+
+ if (NULL == pcall)
+ {
+ const char *sbin_ifconfig;
- if (system ("ifconfig -a > /dev/null 2> /dev/null"))
- if (0 == system ("/sbin/ifconfig -a > /dev/null 2> /dev/null"))
- f = popen ("/sbin/ifconfig -a 2> /dev/null", "r");
+#ifdef IFCONFIG
+ if (0 == access (IFCONFIG, X_OK))
+ sbin_ifconfig = IFCONFIG;
else
- f = NULL;
- else
- f = popen ("ifconfig -a 2> /dev/null", "r");
- if (! f)
+#endif
+ if (0 == access ("/sbin/ifconfig", X_OK))
+ sbin_ifconfig = "/sbin/ifconfig";
+ else if (0 == access ("/usr/sbin/ifconfig", X_OK))
+ sbin_ifconfig = "/usr/sbin/ifconfig";
+ else
+ sbin_ifconfig = "ifconfig";
+ GNUNET_asprintf (&pcall,
+ "%s -a 2> /dev/null",
+ sbin_ifconfig);
+ }
+ f = popen (pcall, "r");
+ if (NULL == f)
{
LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK,
"popen",
struct sockaddr_in6 netmask6;
unsigned int i;
unsigned int prefixlen;
+ static char *pcall;
- f = popen ("ip -o add 2> /dev/null", "r");
+ if (NULL == pcall)
+ {
+ const char *sbin_ip;
+
+#ifdef IFCONFIG
+ if (0 == access (PATH_TO_IP, X_OK))
+ sbin_ip = PATH_TO_IP;
+ else
+#endif
+ if (0 == access ("/sbin/ip", X_OK))
+ sbin_ip = "/sbin/ip";
+ else if (0 == access ("/usr/sbin/ip", X_OK))
+ sbin_ip = "/usr/sbin/ip";
+ else
+ sbin_ip = "if";
+ GNUNET_asprintf (&pcall,
+ "%s -o add 2> /dev/null",
+ sbin_ip);
+ }
+ f = popen (pcall, "r");
if (! f)
{
LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK,
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
-
+
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
* (success).
*/
static int
-proc (void *cls, const char *name, int isDefault, const struct sockaddr *addr,
- const struct sockaddr *broadcast_addr, const struct sockaddr *netmask,
+proc (void *cls,
+ const char *name,
+ int isDefault,
+ const struct sockaddr *addr,
+ const struct sockaddr *broadcast_addr,
+ const struct sockaddr *netmask,
socklen_t addrlen)
{
int *ok = cls;
else
protocol = "IPv6";
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%s Address `%s'\n", protocol, GNUNET_a2s ((const struct sockaddr *) addr,addrlen) );
+ "%s Address `%s'\n",
+ protocol,
+ GNUNET_a2s ((const struct sockaddr *) addr,
+ addrlen) );
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Netmask `%s'\n", GNUNET_a2s ((const struct sockaddr *) netmask, addrlen) );
+ "Netmask `%s'\n",
+ GNUNET_a2s ((const struct sockaddr *) netmask,
+ addrlen) );
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "`%s'\n", GNUNET_a2s ((const struct sockaddr *) broadcast_addr,addrlen) );
+ "`%s'\n",
+ GNUNET_a2s ((const struct sockaddr *) broadcast_addr,
+ addrlen) );
inet_ntop (addr->sa_family,
(addr->sa_family ==
AF_INET) ? (void *) &((struct sockaddr_in *) addr)->sin_addr
{
int ret;
- GNUNET_log_setup ("test-os-network", "WARNING", NULL);
+ GNUNET_log_setup ("test-os-network",
+ "WARNING",
+ NULL);
ret = 1;
- GNUNET_OS_network_interfaces_list (&proc, &ret);
+ GNUNET_OS_network_interfaces_list (&proc,
+ &ret);
return ret;
}