summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2023-10-07 10:58:11 +0200
committerSander Vrijders <sander@ouroboros.rocks>2023-10-25 09:53:27 +0200
commiteec388e8f54cb79061b15f9c614918d283c3dc0a (patch)
treea12d0a0c3a9af72c3fa68d255c5e80ace3a426eb
parent0d35f3772706200f5cff670ad33e7837db7d6a2e (diff)
downloadouroboros-eec388e8f54cb79061b15f9c614918d283c3dc0a.tar.gz
ouroboros-eec388e8f54cb79061b15f9c614918d283c3dc0a.zip
ipcpd: Improve logging in ipcpd-udp
Printed some more info on a few errors using strerror. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
-rw-r--r--src/ipcpd/udp/main.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/ipcpd/udp/main.c b/src/ipcpd/udp/main.c
index 8decb9be..aad068fe 100644
--- a/src/ipcpd/udp/main.c
+++ b/src/ipcpd/udp/main.c
@@ -625,7 +625,8 @@ static int udp_ipcp_bootstrap(const struct ipcp_config * conf)
udp_data.s_saddr.sin_port = htons(conf->udp.port);
if (bind(udp_data.s_fd, SADDR, SADDR_SIZE) < 0) {
- log_err("Couldn't bind to %s.", ipstr);
+ log_err("Couldn't bind to %s:%d. %s.",
+ ipstr, conf->udp.port, strerror(errno));
goto fail_bind;
}
@@ -648,7 +649,7 @@ static int udp_ipcp_bootstrap(const struct ipcp_config * conf)
for (i = 0; i < IPCP_UDP_WR_THR; ++i) {
if (pthread_create(&udp_data.packet_writer[i], NULL,
udp_ipcp_packet_writer, NULL)) {
- log_err("failed to create writer thread.");
+ log_err("Failed to create writer thread.");
goto fail_packet_writer;
}
}
@@ -656,7 +657,10 @@ static int udp_ipcp_bootstrap(const struct ipcp_config * conf)
log_dbg("Bootstrapped IPCP over UDP with pid %d.", getpid());
log_dbg("Bound to IP address %s.", ipstr);
log_dbg("Using port %u.", conf->udp.port);
- log_dbg("DNS server address is %s.", dnsstr);
+ if (conf->udp.dns_addr != 0)
+ log_dbg("DNS server address is %s.", dnsstr);
+ else
+ log_dbg("DNS server not in use.");
return 0;
@@ -691,13 +695,13 @@ static int ddns_send(char * cmd)
char * envp[] = {0};
if (pipe(pipe_fd)) {
- log_err("Failed to create pipe.");
+ log_err("Failed to create pipe: %s.", strerror(errno));
return -1;
}
pid = fork();
if (pid == -1) {
- log_err("Failed to fork.");
+ log_err("Failed to fork: %s.", strerror(errno));
close(pipe_fd[0]);
close(pipe_fd[1]);
return -1;
@@ -714,7 +718,8 @@ static int ddns_send(char * cmd)
close(pipe_fd[0]);
if (write(pipe_fd[1], cmd, strlen(cmd)) == -1) {
- log_err("Failed to communicate with nsupdate.");
+ log_err("Failed to communicate with nsupdate: %s.",
+ strerror(errno));
close(pipe_fd[1]);
return -1;
}
@@ -748,13 +753,13 @@ static uint32_t ddns_resolve(char * name,
return 0;
if (pipe(pipe_fd)) {
- log_err("Failed to create pipe.");
+ log_err("Failed to create pipe: %s.", strerror(errno));
return 0;
}
pid = fork();
if (pid == -1) {
- log_err("Failed to fork.");
+ log_err("Failed to fork: %s.", strerror(errno));
close(pipe_fd[0]);
close(pipe_fd[1]);
return -1;
@@ -1003,7 +1008,7 @@ static int udp_ipcp_flow_alloc(int fd,
return -1;
}
- log_dbg("Destination UDP ipcp resolved at %s.", ipstr);
+ log_dbg("Destination %s UDP ipcp resolved at %s.", dst, ipstr);
memset((char *) &r_saddr, 0, sizeof(r_saddr));
r_saddr.sin_family = AF_INET;