From b842ec43ff1bc2ec59db6cfa47d6a1e47aad0d08 Mon Sep 17 00:00:00 2001
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 8 May 2020 22:58:14 +0200
Subject: [PATCH] gluon-mesh-batman-adv: do not override WAN MAC address with
 VXLAN

As a partial fix to #496, do not touch the MAC address of the WAN
interface when using VXLANs (as only the MAC address of the VXLAN
interface matters to batman-adv).
---
 .../gluon/upgrade/330-gluon-mesh-batman-adv-mac-addresses  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/package/gluon-mesh-batman-adv/luasrc/lib/gluon/upgrade/330-gluon-mesh-batman-adv-mac-addresses b/package/gluon-mesh-batman-adv/luasrc/lib/gluon/upgrade/330-gluon-mesh-batman-adv-mac-addresses
index a8e69d786..d323c8633 100755
--- a/package/gluon-mesh-batman-adv/luasrc/lib/gluon/upgrade/330-gluon-mesh-batman-adv-mac-addresses
+++ b/package/gluon-mesh-batman-adv/luasrc/lib/gluon/upgrade/330-gluon-mesh-batman-adv-mac-addresses
@@ -1,10 +1,15 @@
 #!/usr/bin/lua
 
+local site = require 'gluon.site'
 local util = require 'gluon.util'
 local uci = require('simple-uci').cursor()
 
 
 -- fix up potentially duplicate MAC addresses (for meshing)
-uci:set('network', 'wan', 'macaddr', util.generate_mac(0))
+if not site.mesh.vxlan(true) then
+	uci:set('network', 'wan', 'macaddr', util.generate_mac(0))
+else
+	uci:delete('network', 'wan', 'macaddr')
+end
 uci:set('network', 'mesh_lan', 'macaddr', util.generate_mac(4))
 uci:save('network')
-- 
GitLab