diff --git a/package/gluon-mesh-batman-adv/Makefile b/package/gluon-mesh-batman-adv/Makefile
index 8841d5c410d164a0c743c06495ef8253907ca718..70e9d99948fc87f48895665d6054b9a9b955e0c6 100644
--- a/package/gluon-mesh-batman-adv/Makefile
+++ b/package/gluon-mesh-batman-adv/Makefile
@@ -5,8 +5,8 @@ PKG_VERSION:=1
 
 include ../gluon.mk
 
-define Package/gluon-mesh-batman-adv/common
-  PROVIDES:=gluon-mesh-batman-adv
+define Package/gluon-mesh-batman-adv-common
+  TITLE:=Gluon scripts for batman-adv and batman-adv-legacy
   DEPENDS:= \
 	+gluon-core \
 	+libgluonutil \
@@ -24,31 +24,35 @@ define Package/gluon-mesh-batman-adv/common
 endef
 
 define Package/gluon-mesh-batman-adv-14
-$(Package/gluon-mesh-batman-adv/common)
+  PROVIDES:=gluon-mesh-batman-adv
   TITLE:=Support for batman-adv meshing (compat level 14)
-  CONFLICTS:=gluon-mesh-batman-adv-15
-  DEPENDS+=+kmod-batman-adv-legacy
+  DEPENDS+= \
+	+gluon-mesh-batman-adv-common \
+	+kmod-batman-adv-legacy
 endef
 
 define Package/gluon-mesh-batman-adv-15
-$(Package/gluon-mesh-batman-adv/common)
+  PROVIDES:=gluon-mesh-batman-adv
   TITLE:=Support for batman-adv meshing (compat level 15)
-  DEPENDS+=+kmod-batman-adv
+  DEPENDS+= \
+	+gluon-mesh-batman-adv-common \
+	+kmod-batman-adv
 endef
 
-define Package/gluon-mesh-batman-adv-14/install
+define Package/gluon-mesh-batman-adv-common/install
 	$(Gluon/Build/Install)
+endef
 
+define Package/gluon-mesh-batman-adv-14/install
 	$(INSTALL_DIR) $(1)/lib/gluon/mesh-batman-adv
-	echo 14 > $(1)/lib/gluon/mesh-batman-adv/compat
+	touch $(1)/lib/gluon/mesh-batman-adv/compat-14
 endef
-
+#
 define Package/gluon-mesh-batman-adv-15/install
-	$(Gluon/Build/Install)
-
 	$(INSTALL_DIR) $(1)/lib/gluon/mesh-batman-adv
-	echo 15 > $(1)/lib/gluon/mesh-batman-adv/compat
+	touch $(1)/lib/gluon/mesh-batman-adv/compat-15
 endef
 
+$(eval $(call BuildPackageGluon,gluon-mesh-batman-adv-common))
 $(eval $(call BuildPackageGluon,gluon-mesh-batman-adv-14))
 $(eval $(call BuildPackageGluon,gluon-mesh-batman-adv-15))
diff --git a/package/gluon-mesh-batman-adv/check_site.lua b/package/gluon-mesh-batman-adv/check_site.lua
index f5ea9fb4a7fe946a467bb6bd8514966b3a502755..aa930955e8ff7d11d25627ec06cc509ef874be6e 100644
--- a/package/gluon-mesh-batman-adv/check_site.lua
+++ b/package/gluon-mesh-batman-adv/check_site.lua
@@ -2,4 +2,18 @@
 need_boolean(in_domain({'mesh', 'vxlan'}), not this_domain())
 
 need_number({'mesh', 'batman_adv', 'gw_sel_class'}, false)
-need_one_of({'mesh', 'batman_adv', 'routing_algo'}, {'BATMAN_IV', 'BATMAN_V'}, false)
+
+
+local allowed_algos = {}
+local has_compat_14 = (os.execute('exec ls "$IPKG_INSTROOT"/lib/gluon/mesh-batman-adv/compat-14 >/dev/null 2>&1') == 0)
+local has_compat_15 = (os.execute('exec ls "$IPKG_INSTROOT"/lib/gluon/mesh-batman-adv/compat-15 >/dev/null 2>&1') == 0)
+
+if has_compat_14 then
+	table.insert(allowed_algos, 'BATMAN_IV_LEGACY')
+end
+if has_compat_15 then
+	table.insert(allowed_algos, 'BATMAN_IV')
+	table.insert(allowed_algos, 'BATMAN_V')
+end
+
+need_one_of({'mesh', 'batman_adv', 'routing_algo'}, allowed_algos)
diff --git a/package/gluon-mesh-batman-adv/files/lib/netifd/proto/gluon_bat0.sh b/package/gluon-mesh-batman-adv/files/lib/netifd/proto/gluon_bat0.sh
index 5ce051ea475ae7e2760f4c22c706e3f4413dae12..dcc28f60a278f75529b0309168d40a04021e51ce 100755
--- a/package/gluon-mesh-batman-adv/files/lib/netifd/proto/gluon_bat0.sh
+++ b/package/gluon-mesh-batman-adv/files/lib/netifd/proto/gluon_bat0.sh
@@ -42,8 +42,14 @@ proto_gluon_bat0_setup() {
 	echo 1 > /proc/sys/net/ipv6/conf/primary0/disable_ipv6
 	ip link set primary0 address "$primary0_mac" mtu 1532 up
 
-	local routing_algo="$(uci -q get batman-adv.bat0.routing_algo || echo 'BATMAN_IV')"
-	(echo "$routing_algo" >/sys/module/batman_adv/parameters/routing_algo) 2>/dev/null
+	local routing_algo="$(lua -e 'print(require("gluon.site").mesh.batman_adv.routing_algo())')"
+
+	if [ "$routing_algo" = 'BATMAN_IV_LEGACY' ]; then
+		modprobe batman-adv-legacy
+	else
+		modprobe batman-adv
+		(echo "$routing_algo" >/sys/module/batman_adv/parameters/routing_algo) 2>/dev/null
+	fi
 
 	echo bat0 > /sys/class/net/primary0/batman_adv/mesh_iface
 
@@ -58,6 +64,8 @@ proto_gluon_bat0_teardown() {
 
 	ip link del bat0
 	ip link del primary0
+
+	rmmod batman-adv
 }
 
 add_protocol gluon_bat0
diff --git a/package/gluon-mesh-batman-adv/luasrc/lib/gluon/upgrade/310-gluon-mesh-batman-adv-mesh b/package/gluon-mesh-batman-adv/luasrc/lib/gluon/upgrade/310-gluon-mesh-batman-adv-mesh
index 6494d41fd5d98e1ce13a38a19869dcb2d078152e..c00f13255b3d90fdeab3864b709155d288f747f4 100755
--- a/package/gluon-mesh-batman-adv/luasrc/lib/gluon/upgrade/310-gluon-mesh-batman-adv-mesh
+++ b/package/gluon-mesh-batman-adv/luasrc/lib/gluon/upgrade/310-gluon-mesh-batman-adv-mesh
@@ -7,20 +7,32 @@ local util = require 'gluon.util'
 local uci = require('simple-uci').cursor()
 
 
-local gw_mode = uci:get('batman-adv', 'bat0', 'gw_mode') or 'client'
+local gw_mode = uci:get('batman-adv', 'bat0', 'gw_mode') or uci:get('batman-adv-legacy', 'bat0', 'gw_mode') or 'client'
 local gw_sel_class = site.mesh.batman_adv.gw_sel_class()
 local routing_algo = site.mesh.batman_adv.routing_algo()
 
-
+uci:delete('batman-adv-legacy', 'bat0')
 uci:delete('batman-adv', 'bat0')
-uci:section('batman-adv', 'mesh', 'bat0', {
-	orig_interval = 5000,
-	gw_mode = gw_mode,
-	gw_sel_class = gw_sel_class,
-	hop_penalty = 15,
-	routing_algo = routing_algo,
-	multicast_mode = true,
-})
+
+if routing_algo == 'BATMAN_IV_LEGACY' then
+	uci:section('batman-adv-legacy', 'mesh', 'bat0', {
+		orig_interval = 5000,
+		gw_mode = gw_mode,
+		gw_sel_class = gw_sel_class,
+		hop_penalty = 15,
+	})
+else
+	uci:section('batman-adv', 'mesh', 'bat0', {
+		orig_interval = 5000,
+		gw_mode = gw_mode,
+		gw_sel_class = gw_sel_class,
+		hop_penalty = 15,
+		routing_algo = routing_algo,
+		multicast_mode = true,
+	})
+end
+
+uci:save('batman-adv-legacy')
 uci:save('batman-adv')
 
 uci:delete('network', 'gluon_bat0')