]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
networking: use OPENVPN_ETH_ALEN instead of ETH_ALEN
authorAntonio Quartulli <a@unstable.cc>
Wed, 23 Feb 2022 08:06:28 +0000 (09:06 +0100)
committerGert Doering <gert@greenie.muc.de>
Thu, 17 Mar 2022 12:21:57 +0000 (13:21 +0100)
With the introduction of SITNL two occurrences of ETH_ALEN
were introduced in the code. This define exists on Linux in
the linux/if_ether.h header, however the latter is included
in linux/if_tun.h which may or may not exist (depending on
how old your system is).

If the system lacks if_tun.h then the compilation fails because
ETH_ALEN cannot be found.

For this reason, swap ETH_ALEN with OPENVPN_ETH_ALEN which is
already used in other places of the code.

Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220223080628.4773-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23882.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/lladdr.c
src/openvpn/networking_sitnl.c

index 3ddbebb3896e97909c9f66c3e69283587d371574..ee677187d82f0f73cdb6f8dd5097bc0693d7da57 100644 (file)
@@ -13,6 +13,7 @@
 #include "misc.h"
 #include "run_command.h"
 #include "lladdr.h"
+#include "proto.h"
 
 int
 set_lladdr(openvpn_net_ctx_t *ctx, const char *ifname, const char *lladdr,
@@ -26,7 +27,7 @@ set_lladdr(openvpn_net_ctx_t *ctx, const char *ifname, const char *lladdr,
     }
 
 #if defined(TARGET_LINUX)
-    uint8_t addr[ETH_ALEN];
+    uint8_t addr[OPENVPN_ETH_ALEN];
 
     sscanf(lladdr, MAC_FMT, MAC_SCAN_ARG(addr));
     r = (net_addr_ll_set(ctx, ifname, addr) == 0);
index 959c897f1172c121bc6f27606bc3de010ca57038..515a30d6f0c49ca16696628b8b596863ab9e9bc7 100644 (file)
@@ -32,6 +32,7 @@
 #include "buffer.h"
 #include "misc.h"
 #include "networking.h"
+#include "proto.h"
 
 #include <errno.h>
 #include <string.h>
@@ -748,7 +749,7 @@ net_addr_ll_set(openvpn_net_ctx_t *ctx, const openvpn_net_iface_t *iface,
     req.i.ifi_family = AF_PACKET;
     req.i.ifi_index = ifindex;
 
-    SITNL_ADDATTR(&req.n, sizeof(req), IFLA_ADDRESS, addr, ETH_ALEN);
+    SITNL_ADDATTR(&req.n, sizeof(req), IFLA_ADDRESS, addr, OPENVPN_ETH_ALEN);
 
     msg(M_INFO, "%s: lladdr " MAC_FMT " for %s", __func__, MAC_PRINT_ARG(addr),
         iface);