mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 11:43:25 +02:00
xdp-dns UI: change running state check
Status relies on checking if xdp_dns_log is running, but xdp_dns_log could mysteriously disappear at some point, which result in XDP DNS Blocklist shows Stopped, let /etc/rc.d/init.d/xdpdns status relies on if the xdp_dns_denylist XDP program is still attached to green0 interface. two related issues https://github.com/vincentmli/BPFire/issues/50 https://github.com/vincentmli/BPFire/issues/49 Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
This commit is contained in:
@@ -184,7 +184,7 @@ my $sactive = "<table cellpadding='2' cellspacing='0' bgcolor='${Header::colourr
|
||||
|
||||
my @status = &General::system_output('/usr/local/bin/xdpdnsctrl', 'status');
|
||||
|
||||
if (grep(/is running/, @status)){
|
||||
if (grep(/is attached/, @status)){
|
||||
$sactive = "<table cellpadding='2' cellspacing='0' bgcolor='${Header::colourgreen}' width='50%'><tr><td align='center'><b><font color='#FFFFFF'>$Lang::tr{'running'}</font></b></td></tr></table>";
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,15 @@ unload_dnsblock () {
|
||||
fi
|
||||
}
|
||||
|
||||
is_xdpdns_attached () {
|
||||
/usr/sbin/xdp-loader status green0 | grep -w 'xdp_dns_denylist' >> /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "xdp_dns_denylist is attached to green0"
|
||||
else
|
||||
echo "xdp_dns_denylist is not attached to green0"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
@@ -74,7 +83,7 @@ case "$1" in
|
||||
;;
|
||||
|
||||
status)
|
||||
statusproc /usr/sbin/xdp_dns_log
|
||||
is_xdpdns_attached
|
||||
;;
|
||||
|
||||
restart)
|
||||
|
||||
Reference in New Issue
Block a user