[rtems-net-legacy PATCH 1/4] tests/resolv: Fix test configuration

chrisj at rtems.org chrisj at rtems.org
Sat Apr 22 23:02:27 UTC 2023


From: Chris Johns <chrisj at rtems.org>

---
 config.inc                             | 1 +
 netlegacy.py                           | 3 ++-
 testsuites/include/network-config.h.in | 6 ++++++
 testsuites/resolve/init.c              | 3 ---
 testsuites/support/net-legacy-config.c | 6 ++++++
 5 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/config.inc b/config.inc
index 56497b3..7d348b7 100644
--- a/config.inc
+++ b/config.inc
@@ -4,3 +4,4 @@ NET_CFG_SELF_IP = 127.0.0.1
 NET_CFG_NETMASK = 255.0.0.0
 NET_CFG_MAC_ADDR = 00:00:00:00:00:00
 NET_CFG_GATEWAY_IP = 0.0.0.0
+NET_CFG_DOMAINNAME = localnet
diff --git a/netlegacy.py b/netlegacy.py
index c21e26c..bf816f4 100644
--- a/netlegacy.py
+++ b/netlegacy.py
@@ -60,7 +60,8 @@ def net_config_header(bld):
                   (bld.env.NET_CONFIG))
     net_tags = [
         'NET_CFG_IFACE', 'NET_CFG_BOOT_PROT', 'NET_CFG_SELF_IP',
-        'NET_CFG_NETMASK', 'NET_CFG_MAC_ADDR', 'NET_CFG_GATEWAY_IP'
+        'NET_CFG_NETMASK', 'NET_CFG_MAC_ADDR', 'NET_CFG_GATEWAY_IP',
+        'NET_CFG_DOMAINNAME', 'NET_CFG_DNS_IP', 'NET_CFG_NTP_IP'
     ]
     try:
         net_cfg_lines = open(bld.env.NET_CONFIG).readlines()
diff --git a/testsuites/include/network-config.h.in b/testsuites/include/network-config.h.in
index 756e3b5..e61dcce 100755
--- a/testsuites/include/network-config.h.in
+++ b/testsuites/include/network-config.h.in
@@ -38,4 +38,10 @@
 
 #define NET_CFG_GATEWAY_IP "@NET_CFG_GATEWAY_IP@"
 
+#define NET_CFG_DNS_IP "@NET_CFG_DNS_IP@"
+
+#define NET_CFG_DOMAINNAME "@NET_CFG_DOMAINNAME@"
+
+#define NET_CFG_NTP_IP "@NET_CFG_NTP_IP@"
+
 #endif /* _TEST_NETWORK_CONFIG_H_ */
diff --git a/testsuites/resolve/init.c b/testsuites/resolve/init.c
index beb0e9a..da5adb1 100644
--- a/testsuites/resolve/init.c
+++ b/testsuites/resolve/init.c
@@ -113,9 +113,6 @@ static rtems_task Init(rtems_task_argument argument)
 
   rtems_test_assert(rtems_net_legacy_config(&rtems_bsdnet_config));
 
-  rtems_bsdnet_config.domainname = "gemini.edu";
-  rtems_bsdnet_config.name_server[0] = "10.1.5.8";
-
   rv = rtems_bsdnet_initialize_network();
   rtems_test_assert(rv == 0);
 
diff --git a/testsuites/support/net-legacy-config.c b/testsuites/support/net-legacy-config.c
index bb512d2..1ae2468 100644
--- a/testsuites/support/net-legacy-config.c
+++ b/testsuites/support/net-legacy-config.c
@@ -25,6 +25,9 @@ static char* boot_prot = NET_CFG_BOOT_PROT;
 static char* ip = NET_CFG_SELF_IP;
 static char* netmask = NET_CFG_NETMASK;
 static char* gateway = NET_CFG_GATEWAY_IP;
+static char* domainname = NET_CFG_DOMAINNAME;
+static char* dns_ip = NET_CFG_DNS_IP;
+static char* ntp = NET_CFG_NTP_IP;
 static struct rtems_bsdnet_ifconfig ifcfg = {
   RTEMS_BSP_NETWORK_DRIVER_NAME,
   RTEMS_BSP_NETWORK_DRIVER_ATTACH
@@ -38,6 +41,9 @@ bool rtems_net_legacy_config(struct rtems_bsdnet_config* bsd) {
   ifcfg.ip_address = ip;
   ifcfg.ip_netmask = netmask;
   bsd->gateway = gateway;
+  bsd->domainname = domainname;
+  bsd->name_server[0] = dns_ip;
+  bsd->ntp_server[0] = ntp;
   if (strcmp(boot_prot, "static") == 0) {
     bsd->bootp = NULL;
   } else if (strcmp(boot_prot, "bootp") == 0) {
-- 
2.37.1



More information about the devel mailing list