Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: MeshChat 2.12.1 Does Not Work with Latest AREDN Nightly Builds #58

Open
K5RA opened this issue Dec 25, 2024 · 2 comments
Open

[Bug]: MeshChat 2.12.1 Does Not Work with Latest AREDN Nightly Builds #58

K5RA opened this issue Dec 25, 2024 · 2 comments
Assignees
Labels
bug Something isn't working needs triage

Comments

@K5RA
Copy link

K5RA commented Dec 25, 2024

Contact Details

[email protected]

Version

v2.12.0

System Type

Unknown

What happened?

System 1: meshchat_2.12.1_all.ipk running in a UBNT Rocket XW.
System 2: meshchat-api_2.12.1_all.ipk running in a hAP ac lite with meshchat_1.02_all.deb running in R-Pi 5b service computer

The systems in question are part of a mesh island with about forty AREDN nodes and about 120 devices. Six of the nodes have advertised MeshChat servers. The six nodes with servers are running AREDN firmware stable release 3.24.10.0. All advertised services have service name NEW-NTXChat with no appended service-type icon. The message databases of the six MeshChat servers are synchronized.

When the AREDN firmware of either System 1 or 2 was upgraded to a current nightly build, MeshChat ceased working correctly. Messages originated in the upgraded node would sync to the other five, but messages from nodes running the stable release would not appear on the node running the nightly build. This was demonstrated on one Type 1 system and three Type 2 systems.

Apparently a new version of MeshChat is needed because existing version does not work with the current AREDN nightly builds. The current MeshChat may not be compatible with changes to libraries that are shipped with AREDN and/or with how services are now represented (no longer in flat files). (per KN6PLV)

MeshChat configuration

No response

Connection type

Mesh network connected through IP tunnel

Node names

System 1: K5RA-RK2C-FB. This node is DTD to System 2. System 2: K5RA-HAP-FB with K5RA-RP5B1

What browsers are you seeing the problem on?

Chromium in the RP5B

@K5RA K5RA added bug Something isn't working needs triage labels Dec 25, 2024
@aanon4
Copy link
Contributor

aanon4 commented Dec 27, 2024

Below is the patch to get MeshChat working again .. but unfortunately against my repo (https://github.com/kn6plv/meshchat) rather than this one. Hopefully @hickey can extract the changes and apply them here.

diff --git a/apionly/control/control b/apionly/control/control
index 9b89eb5..d508c33 100755
--- a/apionly/control/control
+++ b/apionly/control/control
@@ -1,6 +1,6 @@
 Package: meshchat-api
-Version: 2.10
-Depends:
+Version: 2.13
+Depends: luci-lib-base
 Provides:
 Source: package/meshchat-api
 Section: net
diff --git a/src/control/control b/src/control/control
index 07e2cee..efc2c36 100644
--- a/src/control/control
+++ b/src/control/control
@@ -1,6 +1,6 @@
 Package: meshchat
-Version: 2.10
-Depends: curl
+Version: 2.13
+Depends: curl, luci-lib-base
 Provides:
 Source: package/meshchat
 Section: net
diff --git a/src/control/postinst b/src/control/postinst
index 67004c2..35446c4 100755
--- a/src/control/postinst
+++ b/src/control/postinst
@@ -1,38 +1,18 @@
 #!/bin/sh
 
-grep "|8080|meshchat" /etc/config.mesh/_setup.services.dmz &> /dev/null
-DMZPRESENT=$?
-grep "|8080|meshchat" /etc/config.mesh/_setup.services.nat &> /dev/null
-NATPRESENT=$?
-NODEMODE=$(uci -q -c /etc/local/uci/ get hsmmmesh.settings.config)
-RAND=$(awk 'BEGIN{srand();print int(rand()*10000) }')
-RESTART=0
+uci -c /etc/config.mesh show setup.services | grep "|8080|meshchat" &> /dev/null
+PRESENT=$?
 
-if [ "$DMZPRESENT" != 0 ]; then
-  echo "MeshChat-$RAND|1|http|$(uname -n)|8080|meshchat" >> /etc/config.mesh/_setup.services.dmz
-  RESTART=1
+if [ "$PRESENT" != 0 ]; then
+  RAND=$(awk 'BEGIN{srand();print int(rand()*10000) }')
+  uci -c /etc/config.mesh add_list setup.services.service="MeshChat-$RAND [chat]|1|http|$(uname -n)|8080|meshchat"
+  uci -c /etc/config.mesh commit setup
 fi
 
-if [ "$NATPRESENT" != 0 ]; then
-  echo "MeshChat-$RAND|1|http|$(uname -n)|8080|meshchat" >> /etc/config.mesh/_setup.services.nat
-  RESTART=1
-fi
-
-if [ "$NODEMODE" = "mesh" -a "$RESTART" = "1" ]; then
-  echo "Applying service announcement"
-  /usr/local/bin/node-setup -a -p mesh &> /dev/null
-  /etc/init.d/olsrd restart &> /dev/null
-fi
+/usr/local/bin/node-setup &> /dev/null
+/usr/local/bin/restart-services.sh &> /dev/null
 
 /etc/init.d/meshchatsync enable
 /etc/init.d/meshchatsync start
 
-echo "<br>"
-
-echo "Mesh Chat has been setup at http://$(uname -n):8080/meshchat"
-echo "<br>"
-if [ "$RESTART" = "1" ]; then
-  echo "An advertised service has been added for Mesh Chat on the Services configuration page"
-fi
-
 exit 0
diff --git a/src/data/www/cgi-bin/meshchat b/src/data/www/cgi-bin/meshchat
index 7c0fd52..225d19d 100755
--- a/src/data/www/cgi-bin/meshchat
+++ b/src/data/www/cgi-bin/meshchat
@@ -514,7 +514,7 @@ function hosts()
     
     local node = node_name()
     local hosts = {}
-    for line in io.lines("/var/dhcp.leases")
+    for line in io.lines("/tmp/dhcp.leases")
     do
         local epoch, mac1, ip, hostname, mac2 = line:match("^(%S+)%s(%S+)%s(%S+)%s(%S+)%s(%S+)$")
         hosts[#hosts + 1] = {
@@ -564,7 +564,7 @@ function hosts_raw()
     print("\r")
     
     local hosts = {}
-    for line in io.lines("/var/dhcp.leases")
+    for line in io.lines("/tmp/dhcp.leases")
     do
         local epoch, mac1, ip, hostname, mac2 = line:match("^(%S+)%s(%S+)%s(%S+)%s(%S+)%s(%S+)$")
         hosts[#hosts + 1] = {
diff --git a/src/data/www/cgi-bin/meshchatconfig.lua b/src/data/www/cgi-bin/meshchatconfig.lua
index 65e8b22..f9e7a3d 100755
--- a/src/data/www/cgi-bin/meshchatconfig.lua
+++ b/src/data/www/cgi-bin/meshchatconfig.lua
@@ -57,4 +57,4 @@ platform                   = "node"
 debug                      = 0
 extra_nodes                = {}
 protocol_version           = "1.02"
-app_version                = "2.10"
+app_version                = "2.13"
diff --git a/src/data/www/cgi-bin/meshchatlib.lua b/src/data/www/cgi-bin/meshchatlib.lua
index e8b9eaf..d2f973d 100755
--- a/src/data/www/cgi-bin/meshchatlib.lua
+++ b/src/data/www/cgi-bin/meshchatlib.lua
@@ -56,18 +56,12 @@ function node_name()
 end
 
 function zone_name()
-    local dmz_mode = uci.cursor("/etc/config.mesh"):get("aredn", "@dmz[0]", "mode")
-    local servfile = "/etc/config.mesh/_setup.services.nat"
-    if dmz_mode ~= "0" then
-        servfile = "/etc/config.mesh/_setup.services.dmz"
-    end
-    if nixio.fs.access(servfile) then
-        for line in io.lines(servfile)
-        do
-            local zone = line:match("^(.*)|.*|.*|.*|.*|meshchat$")
-            if zone then
-                return zone
-            end
+    local services = uci.cursor("/etc/config.mesh"):get("setup", "services", "service") or {}
+    for _, service in ipairs(services)
+    do
+        local zone = service:match("^(.*)%s+%[.+%]|.*|.*|.*|.*|meshchat$") or service:match("^(.*)|.*|.*|.*|.*|meshchat$")
+        if zone then
+            return zone
         end
     end
     return "MeshChat"

@aanon4
Copy link
Contributor

aanon4 commented Jan 2, 2025

I had a few minutes this afternoon to copy the fixes over as a PR against this version. I still dont know how to build this version.
#59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

3 participants