Skip to content

Commit f349b0a

Browse files
committed
rework all occurrences of 'M_ERR | M_ERRNO'
M_ERR is defined as (M_FATAL | M_ERRNO), so 'msg(M_ERR | M_ERRNO, ...)' is just the same as 'msg(M_ERR, ...)'. The occurances in tun.c and dco_freebsd.c are really "if this happens, we can not go on" errors, so 'M_ERR' (= FATAL, plus log errno string) is the correct thing to do. The occurances in dns.c do come with error handling and cleanup after the msg() call, so the right thing is 'M_WARN | M_ERRNO' instead (warning, plus log errno string). Github: fixes #939 Change-Id: I14395665f197349e374a81b56f28536ff88937a8 Signed-off-by: Gert Doering <gert@greenie.muc.de> Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1517 Message-Id: <20260211150648.113547-1-frank@lichtenheld.com> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35594.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
1 parent 344f13f commit f349b0a

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/openvpn/dco_freebsd.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ dco_new_peer(dco_context_t *dco, unsigned int peerid, int sd, struct sockaddr *l
177177
ret = ioctl(dco->fd, SIOCSDRVSPEC, &drv);
178178
if (ret)
179179
{
180-
msg(M_ERR | M_ERRNO, "Failed to create new peer");
180+
msg(M_ERR, "Failed to create new peer");
181181
}
182182

183183
free(drv.ifd_data);
@@ -317,7 +317,7 @@ remove_interface(struct tuntap *tt)
317317
ret = ioctl(tt->dco.fd, SIOCIFDESTROY, &ifr);
318318
if (ret)
319319
{
320-
msg(M_ERR | M_ERRNO, "Failed to remove interface %s", ifr.ifr_name);
320+
msg(M_ERR, "Failed to remove interface %s", ifr.ifr_name);
321321
}
322322

323323
tt->dco.ifname[0] = 0;
@@ -473,7 +473,7 @@ start_tun(dco_context_t *dco)
473473
ret = ioctl(dco->fd, SIOCSDRVSPEC, &drv);
474474
if (ret)
475475
{
476-
msg(M_ERR | M_ERRNO, "Failed to start vpn");
476+
msg(M_ERR, "Failed to start vpn");
477477
}
478478

479479
return ret;
@@ -511,7 +511,7 @@ dco_new_key(dco_context_t *dco, unsigned int peerid, int keyid, dco_key_slot_t s
511511
ret = ioctl(dco->fd, SIOCSDRVSPEC, &drv);
512512
if (ret)
513513
{
514-
msg(M_ERR | M_ERRNO, "Failed to set key");
514+
msg(M_ERR, "Failed to set key");
515515
}
516516
else
517517
{

src/openvpn/dns.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -611,13 +611,13 @@ run_updown_runner(bool up, struct options *o, const struct tuntap *tt,
611611
int ack_pipe_fd[2];
612612
if (pipe(dns_pipe_fd) != 0 || pipe(ack_pipe_fd) != 0)
613613
{
614-
msg(M_ERR | M_ERRNO, "run_dns_up_down: unable to create pipes");
614+
msg(M_WARN | M_ERRNO, "run_dns_up_down: unable to create pipes");
615615
return false;
616616
}
617617
updown_runner->pid = fork();
618618
if (updown_runner->pid == -1)
619619
{
620-
msg(M_ERR | M_ERRNO, "run_dns_up_down: unable to fork");
620+
msg(M_WARN | M_ERRNO, "run_dns_up_down: unable to fork");
621621
close(dns_pipe_fd[0]);
622622
close(dns_pipe_fd[1]);
623623
close(ack_pipe_fd[0]);
@@ -747,7 +747,7 @@ run_up_down_command(bool up, struct options *o, const struct tuntap *tt,
747747
{
748748
continue;
749749
}
750-
msg(M_ERR | M_ERRNO, "could not send dns vars filename");
750+
msg(M_WARN | M_ERRNO, "could not send dns vars filename");
751751
}
752752
break;
753753
}
@@ -762,7 +762,7 @@ run_up_down_command(bool up, struct options *o, const struct tuntap *tt,
762762
{
763763
continue;
764764
}
765-
msg(M_ERR | M_ERRNO, "could not receive dns updown status");
765+
msg(M_WARN | M_ERRNO, "could not receive dns updown status");
766766
}
767767
break;
768768
}

src/openvpn/tun.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3011,7 +3011,7 @@ open_darwin_utun(const char *dev, const char *dev_type, const char *dev_node, st
30113011
/* Retrieve the assigned interface name. */
30123012
if (getsockopt(fd, SYSPROTO_CONTROL, UTUN_OPT_IFNAME, utunname, &utunname_len))
30133013
{
3014-
msg(M_ERR | M_ERRNO, "Error retrieving utun interface name");
3014+
msg(M_ERR, "Error retrieving utun interface name");
30153015
}
30163016

30173017
tt->actual_name = string_alloc(utunname, NULL);

0 commit comments

Comments
 (0)