fix(rpcd): Fix shell syntax errors in RPCD handlers
- network-modes: Remove orphan code block after final esac statement - netdata-dashboard: Replace bash process substitution with POSIX awk Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
8769a60275
commit
518891d538
@ -393,17 +393,8 @@ get_stats() {
|
||||
local uptime=$(cat /proc/uptime | cut -d' ' -f1 | cut -d'.' -f1)
|
||||
json_add_int "uptime" "$uptime"
|
||||
|
||||
# Network totals
|
||||
local net_rx=0
|
||||
local net_tx=0
|
||||
while read line; do
|
||||
local iface=$(echo "$line" | awk -F: '{print $1}' | tr -d ' ')
|
||||
[ "$iface" = "lo" ] && continue
|
||||
local rx=$(echo "$line" | awk -F: '{print $2}' | awk '{print $1}')
|
||||
local tx=$(echo "$line" | awk -F: '{print $2}' | awk '{print $9}')
|
||||
net_rx=$((net_rx + rx))
|
||||
net_tx=$((net_tx + tx))
|
||||
done < <(cat /proc/net/dev | tail -n +3)
|
||||
# Network totals (using awk for POSIX sh compatibility)
|
||||
eval $(awk 'NR>2 && $1!="lo:" {rx+=$2; tx+=$10} END {printf "net_rx=%d net_tx=%d", rx, tx}' /proc/net/dev)
|
||||
|
||||
json_add_int "network_rx" "$net_rx"
|
||||
json_add_int "network_tx" "$net_tx"
|
||||
|
||||
@ -2666,63 +2666,3 @@ case "$1" in
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
dmz)
|
||||
local wan_if=$(uci -q get network-modes.dmz.wan_interface || echo "eth1")
|
||||
local wan_proto=$(uci -q get network-modes.dmz.wan_protocol || echo "dhcp")
|
||||
local lan_iface=$(uci -q get network-modes.dmz.lan_interface || echo "br-lan")
|
||||
local lan_ip=$(uci -q get network-modes.dmz.lan_ip || echo "192.168.1.1")
|
||||
local lan_mask=$(uci -q get network-modes.dmz.lan_netmask || echo "255.255.255.0")
|
||||
local dmz_iface=$(uci -q get network-modes.dmz.dmz_interface || echo "eth2")
|
||||
local dmz_ip=$(uci -q get network-modes.dmz.dmz_ip || echo "192.168.50.1")
|
||||
local dmz_mask=$(uci -q get network-modes.dmz.dmz_netmask || echo "255.255.255.0")
|
||||
config="# DMZ Mode Configuration
|
||||
# /etc/config/network
|
||||
|
||||
config interface 'wan'
|
||||
option device '$wan_if'
|
||||
option proto '$wan_proto'
|
||||
|
||||
config interface 'lan'
|
||||
option device '$lan_iface'
|
||||
option proto 'static'
|
||||
option ipaddr '$lan_ip'
|
||||
option netmask '$lan_mask'
|
||||
|
||||
config interface 'dmz'
|
||||
option device '$dmz_iface'
|
||||
option proto 'static'
|
||||
option ipaddr '$dmz_ip'
|
||||
option netmask '$dmz_mask'
|
||||
|
||||
# /etc/config/firewall
|
||||
config zone
|
||||
option name 'lan'
|
||||
option input 'ACCEPT'
|
||||
option output 'ACCEPT'
|
||||
option forward 'ACCEPT'
|
||||
list network 'lan'
|
||||
|
||||
config zone
|
||||
option name 'dmz'
|
||||
option input 'REJECT'
|
||||
option output 'ACCEPT'
|
||||
option forward 'REJECT'
|
||||
list network 'dmz'
|
||||
|
||||
config zone
|
||||
option name 'wan'
|
||||
option input 'REJECT'
|
||||
option output 'ACCEPT'
|
||||
option forward 'REJECT'
|
||||
option masq '1'
|
||||
option mtu_fix '1'
|
||||
list network 'wan'
|
||||
|
||||
config forwarding
|
||||
option src 'lan'
|
||||
option dest 'wan'
|
||||
|
||||
config forwarding
|
||||
option src 'dmz'
|
||||
option dest 'wan'"
|
||||
;;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user