/usr/bin/test-performance-check.sh
/usr/bin/setup-nether-tests-nns.sh
/usr/bin/teardown-nether-tests-nns.sh
+/usr/bin/setup-nether-tests-dns.sh
+/usr/bin/teardown-nether-tests-dns.sh
/etc/dbus-1/system.d/security-tests.conf
INSTALL(FILES
${PROJECT_SOURCE_DIR}/src/nether-tests/setup-nether-tests-nns.sh
${PROJECT_SOURCE_DIR}/src/nether-tests/teardown-nether-tests-nns.sh
+ ${PROJECT_SOURCE_DIR}/src/nether-tests/setup-nether-tests-dns.sh
+ ${PROJECT_SOURCE_DIR}/src/nether-tests/teardown-nether-tests-dns.sh
DESTINATION bin
PERMISSIONS OWNER_READ
OWNER_WRITE
const std::string NETNS_RUN_DIR = "/var/run/netns"; // taken from iproute2
const std::string NETHER_NETNS_SETUP_COMMAND = "/usr/bin/setup-nether-tests-nns.sh " + NETHER_NETNS_NAME_TEST;
const std::string NETHER_NETNS_TEARDOWN_COMMAND = "/usr/bin/teardown-nether-tests-nns.sh " + NETHER_NETNS_NAME_TEST;
+const std::string NETHER_DNS_SETUP_COMMAND = "/usr/bin/setup-nether-tests-dns.sh";
+const std::string NETHER_DNS_TEARDOWN_COMMAND = "/usr/bin/teardown-nether-tests-dns.sh";
+
const ssize_t NET_BUFFER_SIZE = 1024;
const int UDP_MESSAGES_COUNT = 20000;
RUNNER_CHILD_TEST(nether_check_gethostbyname_internet_access_granted)
{
RUNNER_IGNORED_MSG("Disabled until the implementation of handling of DNS queries is finished.");
+
+ ScopedShellScriptRunner networkDNSRunner(NETHER_DNS_SETUP_COMMAND,
+ NETHER_DNS_TEARDOWN_COMMAND);
+
const auto getHostAddress = [](void) {
struct hostent *server = gethostbyname(DNS_TEST_ADDRESS.c_str());
RUNNER_ASSERT_MSG(server != nullptr, "Couldn't find host "
RUNNER_CHILD_TEST(nether_check_gethostbyname_internet_access_denied)
{
RUNNER_IGNORED_MSG("Disabled until the implementation of handling of DNS queries is finished.");
+
+ ScopedShellScriptRunner networkDNSRunner(NETHER_DNS_SETUP_COMMAND,
+ NETHER_DNS_TEARDOWN_COMMAND);
+
const auto getHostAddress = [](void) {
struct hostent *server = gethostbyname(DNS_TEST_ADDRESS.c_str());
RUNNER_ASSERT_MSG(server == nullptr, "Host was found " << DNS_TEST_ADDRESS);
--- /dev/null
+#!/bin/sh
+
+#####################################################################
+# Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#####################################################################
+
+# make sure the filesystem is mounted in RW mode
+rw
+
+# backup old resolv.conf
+cp /etc/resolv.conf /etc/resolv.conf.back
+
+# configure Connman as a local DNS server
+echo "nameserver 127.0.0.1" > /etc/resolv.conf
--- /dev/null
+#!/bin/sh
+
+#####################################################################
+# Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#####################################################################
+
+# restore old resolv.conf
+mv /etc/resolv.conf.back /etc/resolv.conf
+
+