]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
rework all occurrences of 'M_ERR | M_ERRNO'
authorGert Doering <gert@greenie.muc.de>
Wed, 11 Feb 2026 15:06:48 +0000 (16:06 +0100)
committerGert Doering <gert@greenie.muc.de>
Mon, 16 Feb 2026 14:52:26 +0000 (15:52 +0100)
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 OpenVPN/openvpn#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>
src/openvpn/dco_freebsd.c
src/openvpn/dns.c
src/openvpn/tun.c

index d1ad0921294112f30bb3d4049abe108ec2acff07..ee3a5d0c23aa38d8f174d3d6dd998f38cbfdf9ff 100644 (file)
@@ -177,7 +177,7 @@ dco_new_peer(dco_context_t *dco, unsigned int peerid, int sd, struct sockaddr *l
     ret = ioctl(dco->fd, SIOCSDRVSPEC, &drv);
     if (ret)
     {
-        msg(M_ERR | M_ERRNO, "Failed to create new peer");
+        msg(M_ERR, "Failed to create new peer");
     }
 
     free(drv.ifd_data);
@@ -317,7 +317,7 @@ remove_interface(struct tuntap *tt)
     ret = ioctl(tt->dco.fd, SIOCIFDESTROY, &ifr);
     if (ret)
     {
-        msg(M_ERR | M_ERRNO, "Failed to remove interface %s", ifr.ifr_name);
+        msg(M_ERR, "Failed to remove interface %s", ifr.ifr_name);
     }
 
     tt->dco.ifname[0] = 0;
@@ -473,7 +473,7 @@ start_tun(dco_context_t *dco)
     ret = ioctl(dco->fd, SIOCSDRVSPEC, &drv);
     if (ret)
     {
-        msg(M_ERR | M_ERRNO, "Failed to start vpn");
+        msg(M_ERR, "Failed to start vpn");
     }
 
     return ret;
@@ -511,7 +511,7 @@ dco_new_key(dco_context_t *dco, unsigned int peerid, int keyid, dco_key_slot_t s
     ret = ioctl(dco->fd, SIOCSDRVSPEC, &drv);
     if (ret)
     {
-        msg(M_ERR | M_ERRNO, "Failed to set key");
+        msg(M_ERR, "Failed to set key");
     }
     else
     {
index c00d4b9cd3219f06cc6e1ad18a09e388c663f8b6..3d24050e3d2cef9dafddaffaf2825262e1e72fbd 100644 (file)
@@ -611,13 +611,13 @@ run_updown_runner(bool up, struct options *o, const struct tuntap *tt,
     int ack_pipe_fd[2];
     if (pipe(dns_pipe_fd) != 0 || pipe(ack_pipe_fd) != 0)
     {
-        msg(M_ERR | M_ERRNO, "run_dns_up_down: unable to create pipes");
+        msg(M_WARN | M_ERRNO, "run_dns_up_down: unable to create pipes");
         return false;
     }
     updown_runner->pid = fork();
     if (updown_runner->pid == -1)
     {
-        msg(M_ERR | M_ERRNO, "run_dns_up_down: unable to fork");
+        msg(M_WARN | M_ERRNO, "run_dns_up_down: unable to fork");
         close(dns_pipe_fd[0]);
         close(dns_pipe_fd[1]);
         close(ack_pipe_fd[0]);
@@ -747,7 +747,7 @@ run_up_down_command(bool up, struct options *o, const struct tuntap *tt,
                 {
                     continue;
                 }
-                msg(M_ERR | M_ERRNO, "could not send dns vars filename");
+                msg(M_WARN | M_ERRNO, "could not send dns vars filename");
             }
             break;
         }
@@ -762,7 +762,7 @@ run_up_down_command(bool up, struct options *o, const struct tuntap *tt,
                 {
                     continue;
                 }
-                msg(M_ERR | M_ERRNO, "could not receive dns updown status");
+                msg(M_WARN | M_ERRNO, "could not receive dns updown status");
             }
             break;
         }
index e38df3ede772a4cad9c8998590ef751878911bd5..3f9ee5dcd631b19980b30e95afefc2bc5ef995b8 100644 (file)
@@ -3011,7 +3011,7 @@ open_darwin_utun(const char *dev, const char *dev_type, const char *dev_node, st
     /* Retrieve the assigned interface name. */
     if (getsockopt(fd, SYSPROTO_CONTROL, UTUN_OPT_IFNAME, utunname, &utunname_len))
     {
-        msg(M_ERR | M_ERRNO, "Error retrieving utun interface name");
+        msg(M_ERR, "Error retrieving utun interface name");
     }
 
     tt->actual_name = string_alloc(utunname, NULL);