Skip to content

Commit

Permalink
Merge branch 'libremesh:master' into feature/mesh-config
Browse files Browse the repository at this point in the history
  • Loading branch information
javierbrk authored Dec 30, 2024
2 parents 8dfd090 + 6f307bb commit df89731
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ local function notifyHooks(evData, evName)
for hook in fs.dir(hooksDir) do
os.execute(
string.format( 'ACTION="%s" SERVICE="%s" %s/%s',
evName, evData.service, hooksDir, hook ) )
evName, evData.service or '', hooksDir, hook ) )
end
end

Expand Down
1 change: 1 addition & 0 deletions packages/lime-report/files/lime-report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ generate_status() {
paste_cmd df
paste_cmd logread -l 20
paste_cmd "logread | grep err"
paste_cmd iw phy
paste_cmd iw dev wlan0-mesh station dump
paste_cmd iw dev wlan1-mesh station dump
paste_cmd iw dev wlan2-mesh station dump
Expand Down
2 changes: 1 addition & 1 deletion packages/lime-system/files/usr/lib/lua/lime/network.lua
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ function network.clean()
end

function network._get_lower(dev)
local lower_if_path = utils.unsafe_shell("ls -d /sys/class/net/" .. dev .. "/lower*")
local lower_if_path = utils.unsafe_shell("ls /sys/class/net/" .. dev .. "/ | grep ^lower")
local lower_if_table = utils.split(lower_if_path, "_")
local lower_if = lower_if_table[#lower_if_table]
return lower_if and lower_if:gsub("\n", "")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
setup_hotspot_watchping() {
ifname="client-wwan"
gw=$(ip r show default dev $ifname | while read default via ip rest; do [[ $via == "via" ]] && echo $ip && break; done)
if [ -n gw ]; then
uci set system.hotspot_watchping=watchping
uci set system.hotspot_watchping.interface=$ifname
uci set system.hotspot_watchping.timeout=2m
uci set system.hotspot_watchping.pinghosts=$gw
uci set system.hotspot_watchping.pinginterval=20s
uci commit system
/etc/init.d/watchping restart
# check if interface exists before running the ip command on it
if [ -e /sys/class/net/$ifname/type ]; then
gw=$(ip r show default dev $ifname | while read default via ip rest; do [[ $via == "via" ]] && echo $ip && break; done)
if [ -n "$gw" ]; then
uci set system.hotspot_watchping=watchping
uci set system.hotspot_watchping.interface=$ifname
uci set system.hotspot_watchping.timeout=2m
uci set system.hotspot_watchping.pinghosts=$gw
uci set system.hotspot_watchping.pinginterval=20s
uci commit system
[ -e /etc/init.d/watchping ] && /etc/init.d/watchping restart
fi
fi
}

Expand Down
34 changes: 18 additions & 16 deletions packages/ubus-lime-utils/files/usr/lib/lua/lime/node_status.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,22 +134,24 @@ end

function node_status.dsa_get_link_status(ports)
for _, port in ipairs(ports) do
local dsa = utils.unsafe_shell("ip -j -p link show " .. port['num'])
local dsa_json = json.parse(dsa)

port['device'] = port['num']
port['num'] = dsa_json[1]['ifindex']
port['role'] = dsa_json[1]['link']
if dsa_json[1]['link'] == nil then
port['role'] = dsa_json[1]['ifname']
end
port['link'] = dsa_json[1]['operstate']
if dsa_json[1]['operstate'] == "LOWERLAYERDOWN" then
port['link'] = "DOWN"
end
end
return ports
end
local dsa = utils.unsafe_shell("ip link show " .. port['num'])
-- Match ifindex, ifname, link (optional), and operstate
local ifindex, ifname, link, operstate = dsa:match("^(%d+): ([^:@]+)@?([^:]*):.-state (%S+)")
if ifindex and ifname and operstate then
port['device'] = port['num']
port['num'] = tonumber(ifindex)
port['role'] = link ~= "" and link or nil -- Handle optional link field
if port['role'] == nil then
port['role'] = ifname
end
port['link'] = operstate
if operstate == "LOWERLAYERDOWN" then
port['link'] = "DOWN"
end
end
end
return ports
end


function node_status.swconfig_get_link_status(ports)
Expand Down

0 comments on commit df89731

Please sign in to comment.