diff --git a/luci/luci-app-ekhwizards/htdocs/luci-static/resources/view/morse/meshwizard.js b/luci/luci-app-ekhwizards/htdocs/luci-static/resources/view/morse/meshwizard.js index bb4b759..cd9d0ed 100644 --- a/luci/luci-app-ekhwizards/htdocs/luci-static/resources/view/morse/meshwizard.js +++ b/luci/luci-app-ekhwizards/htdocs/luci-static/resources/view/morse/meshwizard.js @@ -486,9 +486,11 @@ return wizard.AbstractWizardView.extend({ option.retain = true; option.widget = 'radio'; option.orientation = 'vertical'; + option.default = 'bridge'; + option.readonly = true; option.value('none', _('None')); - option.value('extender', _('Extender')); option.value('bridge', _('Bridge')); + option.value('extender', _('Extender')); option.onchange = function (ev, sectionId, value) { if (value == 'bridge') { this.page.updateInfoText(bridgeInfoSta, thisWizardView); diff --git a/luci/luci-app-morseconfig/htdocs/luci-static/resources/tools/morse/uci.js b/luci/luci-app-morseconfig/htdocs/luci-static/resources/tools/morse/uci.js index f353fc4..ea36f7e 100644 --- a/luci/luci-app-morseconfig/htdocs/luci-static/resources/tools/morse/uci.js +++ b/luci/luci-app-morseconfig/htdocs/luci-static/resources/tools/morse/uci.js @@ -133,8 +133,8 @@ function createDhcp(dnsmasqName, networkSectionId) { // We will also only use a range of /28 (16 addresses) to reduce the chance of clashes. // This means that the start address will be between x.x.0.255 and x.x.1.244 // (i.e. 255 + (16 * 15)). - //const randomStart = 255 + (16 * Math.floor(Math.random() * 15)); - const randomStart = 257; + const randomStart = 255 + (16 * Math.floor(Math.random() * 15)); + //const randomStart = 257; uci.add('dhcp', 'dhcp', proposedName); uci.set('dhcp', proposedName, 'start', randomStart.toString()); @@ -444,10 +444,20 @@ function setupBatmanDeviceOnNetwork(gwMode = 'client', deviceName = 'bat0') { } uci.set('network', deviceName, 'proto', 'batadv'); - uci.set('network', deviceName, 'routing_algo', 'BATMAN_IV'); + uci.set('network', deviceName, 'routing_algo', 'BATMAN_V'); uci.set('network', deviceName, 'bridge_loop_avoidance', '1'); uci.set('network', deviceName, 'hop_penalty', '30'); uci.set('network', deviceName, 'bonding', '1'); + uci.set('network', deviceName, 'aggregated_ogms', '1'); + uci.set('network', deviceName, 'ap_isolation', '0'); + uci.set('network', deviceName, 'fragmentation', '1'); + uci.set('network', deviceName, 'orig_interval', '1000'); + uci.set('network', deviceName, 'bridge_loop_avoidance', '1'); + uci.set('network', deviceName, 'distributed_arp_table', '1'); + uci.set('network', deviceName, 'multicast_mode', '1'); + uci.set('network', deviceName, 'network_coding', '1'); + uci.set('network', deviceName, 'hop_penalty', '30'); + uci.set('network', deviceName, 'isolation_mark', '0x00000000/0x00000000'); uci.set('network', deviceName, 'gw_mode', gwMode); return deviceName; @@ -561,7 +571,7 @@ function setupNetworkWithDnsmasq(sectionId, ip, uplink = true, isMeshPoint = tru uci.set('network', sectionId, 'dns', '1.1.1.1'); uci.set('network', sectionId, 'ipaddr', getRandomIpaddr(ip)); } else { - uci.set('network', sectionId, 'ipaddr', ip); + uci.set('network', sectionId, 'ipaddr', '10.41.1.1'); } if (!uplink) { diff --git a/luci/luci-app-morseconfig/htdocs/luci-static/resources/tools/morse/wizard.js b/luci/luci-app-morseconfig/htdocs/luci-static/resources/tools/morse/wizard.js index 43a3773..c00093f 100644 --- a/luci/luci-app-morseconfig/htdocs/luci-static/resources/tools/morse/wizard.js +++ b/luci/luci-app-morseconfig/htdocs/luci-static/resources/tools/morse/wizard.js @@ -291,6 +291,13 @@ function setDefaultWanFirewallRules(zone) { uci.set('firewall', sid, 'dest_port', '500'); uci.set('firewall', sid, 'proto', 'udp'); uci.set('firewall', sid, 'target', 'ACCEPT'); + sid = uci.add('firewall', 'rule'); + uci.set('firewall', sid, 'name', 'Allow Batman Mesh TCP 4242'); + uci.set('firewall', sid, 'src', '*'); + uci.set('firewall', sid, 'dest', '*'); + uci.set('firewall', sid, 'dest_port', '4242'); + uci.set('firewall', sid, 'proto', 'tcp'); + uci.set('firewall', sid, 'target', 'ACCEPT'); } /* Modify/add a network iface with the appropriate firewall zones/rules. diff --git a/netifd-morse/etc/init.d/mesh-routing b/netifd-morse/etc/init.d/mesh-routing new file mode 100755 index 0000000..8840966 --- /dev/null +++ b/netifd-morse/etc/init.d/mesh-routing @@ -0,0 +1,53 @@ +#!/bin/sh /etc/rc.common + +START=96 +STOP=10 + +USE_PROCD=1 + +start_service() { + # Enable cross-mesh client routing through batman-adv + logger "mesh-routing: Setting up cross-mesh client routes" + + # Wait for network services to be ready + sleep 45 + + # Add routes for cross-mesh connectivity + ( + # Wait for bat0 interface to be fully operational + local retry=0 + while [ $retry -lt 30 ]; do + if ip link show bat0 >/dev/null 2>&1 && ip addr show bat0; then + logger "mesh-routing: bat0 interface is ready" + break + fi + retry=$((retry + 1)) + logger "mesh-routing: Waiting for bat0 interface (attempt $retry/30)" + sleep 2 + done + + # Enable IP forwarding for cross-mesh client communication + echo 1 > /proc/sys/net/ipv4/ip_forward + logger "mesh-routing: IP forwarding enabled" + + # Add routing rules for 10.41.0.0/16 mesh client subnet + if ! ip route show | grep -q "10.41.0.0/16"; then + ip route add 10.41.0.0/16 dev bat0 metric 100 2>/dev/null || true + logger "mesh-routing: Added route for mesh client subnet" + fi + + # Enable multicast forwarding for batman-adv + echo 1 > /proc/sys/net/ipv4/conf/bat0/mc_forwarding 2>/dev/null || true + echo 1 > /proc/sys/net/ipv4/conf/br-ahwlan/mc_forwarding 2>/dev/null || true + + # Setup ARP proxying for cross-mesh client discovery + echo 1 > /proc/sys/net/ipv4/conf/bat0/proxy_arp 2>/dev/null || true + echo 1 > /proc/sys/net/ipv4/conf/br-ahwlan/proxy_arp 2>/dev/null || true + + logger "mesh-routing: Cross-mesh client routing configured" + ) & +} + +stop() { + logger "mesh-routing: Stopping mesh routing service" +} \ No newline at end of file