# Description: The Mesh11sd daemon expects the mesh interface name to follow the format 'mesh'. # If it doesn't find this format, it attempts to set it in the UCI wireless configuration. # However, when operating in other modes such as AP, STA, or Ad-Hoc, the script was patched to remove # the mesh interface name from UCI. This process can lead to a race condition between the UI and Mesh11sd, # resulting in stale interface name values. # This patch resolves the issue by removing the setting of the interface name from the script, as it is # now managed through the UI, ensuring consistency and eliminating the race condition. --- a/src/mesh11sd +++ b/src/mesh11sd @@ -387,45 +387,45 @@ elif [ "$1" = "daemon" ]; then if [ $mode -eq 5 ]; then # startup=4, statusmode=0, enabled=1 + syslogmessage="mesh11sd v$version has started: mesh management mode $mode" startup=0 statusmode=0 mode=1 - syslogmessage="mesh11sd v$version has started: mesh management mode $mode" elif [ $mode -eq 4 ]; then # startup=4, statusmode=0, enabled=0 + syslogmessage="mesh11sd v$version has started: mesh status mode $mode" startup=0 statusmode=2 mode=0 - syslogmessage="mesh11sd v$version has started: mesh status mode $mode" elif [ $mode -eq 3 ]; then # startup=0, statusmode=2, enabled=1 + syslogmessage="mesh11sd v$version has started: mesh management mode $mode" startup=0 statusmode=0 mode=1 - syslogmessage="mesh11sd v$version has started: mesh management mode $mode" elif [ $mode -eq 2 ]; then # startup=0, statusmode=2, enabled=0 + syslogmessage="mesh11sd v$version has started: mesh status mode $mode" startup=0 statusmode=2 mode=0 - syslogmessage="mesh11sd v$version has started: mesh status mode $mode" elif [ $mode -eq 1 ]; then # startup=0, statusmode=0, enabled=1 + syslogmessage="mesh11sd v$version has started, mesh management mode $mode" startup=0 statusmode=0 mode=1 - syslogmessage="mesh11sd v$version has started, mesh management mode $mode" elif [ $mode -eq 0 ]; then # startup=0, statusmode=0, enabled=0 + syslogmessage="mesh11sd v$version has started: mesh status mode $mode" startup=0 statusmode=2 mode=0 - syslogmessage="mesh11sd v$version has started: mesh status mode $mode" fi if [ $mode -ne $lastmode ]; then @@ -441,26 +441,6 @@ elif [ "$1" = "daemon" ]; then meshconfigs=$(uci show wireless 2> /dev/null | grep "mode='mesh'" | awk -F ".mode='mesh'" '{printf "%s " $1}') if [ ! -z "$meshconfigs" ]; then - for meshconfig in $meshconfigs; do - ifname=$(uci get $meshconfig.ifname 2> /dev/null) - - if [ -z "$ifname" ] || [ "$ifname" != "mesh$meshindex" ]; then - # No interface name in config, so add one - ucibatch="set $meshconfig.ifname='mesh$meshindex'" - echo "$ucibatch" | uci batch - changed=1 - syslogmessage="Setting mesh interface name to [ mesh$meshindex ]" - write_to_syslog - fi - meshindex=$(($meshindex+1)) - done - - if [ "$changed" -eq 1 ]; then - changed=0 - restart_mesh - continue - fi - # get a list of interfaces get_mesh_iflist @@ -482,13 +462,13 @@ elif [ "$1" = "daemon" ]; then # this is not a mesh interface continue else - # Check if this interface has a uci ifname - uciname=$(uci show wireless | grep "ifname='$iface'" | awk -F "." '{printf "wireless.%s" $2}') + # Check if this interface mode is 'mesh' + uciname=$(uci show wireless | grep "mode='mesh'" | awk -F "." '{printf "wireless.%s" $2}') if [ -z "$uciname" ]; then - # Error - No interface name in config, we should have added one + # Error - No interface with mode as mesh debugtype="err" - syslogmessage="Error getting mesh interface name" + syslogmessage="Error getting mesh interface section" write_to_syslog continue fi