[rtems-libbsd commit] Add DHCP clientid to test default network init
Sebastian Huber
sebh at rtems.org
Mon Apr 30 11:42:59 UTC 2018
Module: rtems-libbsd
Branch: master
Commit: b1404f23928a7be109ba48db972031719ed4a535
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=b1404f23928a7be109ba48db972031719ed4a535
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Mon Apr 30 13:35:25 2018 +0200
Add DHCP clientid to test default network init
---
.../include/rtems/bsd/test/default-network-init.h | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/testsuite/include/rtems/bsd/test/default-network-init.h b/testsuite/include/rtems/bsd/test/default-network-init.h
index d6949b8..d26df03 100644
--- a/testsuite/include/rtems/bsd/test/default-network-init.h
+++ b/testsuite/include/rtems/bsd/test/default-network-init.h
@@ -129,30 +129,34 @@ default_network_route_hwif0(char *ifname)
static void
default_network_dhcpcd_task(rtems_task_argument arg)
{
+ static const char default_cfg[] = "clientid libbsd test client\n";
int exit_code;
char *dhcpcd[] = {
"dhcpcd",
NULL
};
-
- (void)arg;
-
-#ifdef DEFAULT_NETWORK_DHCPCD_NO_DHCP_DISCOVERY
- static const char cfg[] = "nodhcp\nnodhcp6\n";
int fd;
int rv;
ssize_t n;
+ (void)arg;
+
fd = open("/etc/dhcpcd.conf", O_CREAT | O_WRONLY,
S_IRWXU | S_IRWXG | S_IRWXO);
assert(fd >= 0);
- n = write(fd, cfg, sizeof(cfg));
- assert(n == (ssize_t) sizeof(cfg));
+ n = write(fd, default_cfg, sizeof(default_cfg));
+ assert(n == (ssize_t) sizeof(default_cfg));
+
+#ifdef DEFAULT_NETWORK_DHCPCD_NO_DHCP_DISCOVERY
+ static const char nodhcp_cfg[] = "nodhcp\nnodhcp6\n";
+
+ n = write(fd, nodhcp_cfg, sizeof(nodhcp_cfg));
+ assert(n == (ssize_t) sizeof(nodhcp_cfg));
+#endif
rv = close(fd);
assert(rv == 0);
-#endif
exit_code = rtems_bsd_command_dhcpcd(RTEMS_BSD_ARGC(dhcpcd), dhcpcd);
assert(exit_code == EXIT_SUCCESS);
More information about the vc
mailing list