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

Fix realtime graphs - connections is blank on lxc #412

Open
wants to merge 2 commits into
base: openwrt-23.05
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion modules/luci-base/ucode/sys.uc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ export function conntrack_list(callback) {
etcpr.close();
}

const nfct = open('/proc/net/nf_conntrack', 'r');
let nfct;
const s = stat(`/proc/net/nf_conntrack`);
if (s?.type != 'file')
nfct = popen('/usr/sbin/conntrack -L -o extended 2>/dev/null && /usr/sbin/conntrack -L -f ipv6 -o extended 2>/dev/null');
else
nfct = open('/proc/net/nf_conntrack', 'r');
let connt;

if (nfct) {
Expand Down
13 changes: 12 additions & 1 deletion modules/luci-mod-status/src/luci-bwc.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#define LD_SCAN_PATTERN \
"%f %f %f"

#define CONNTRACK_PATH "/usr/sbin/conntrack"

struct file_map {
int fd;
Expand Down Expand Up @@ -535,7 +536,17 @@ static int run_daemon(void)
closedir(dir);
}

if ((info = fopen(ipc, "r")) != NULL)
if (!stat(ipc, &s))
{
info = fopen(ipc, "r");
}
else if (!stat(CONNTRACK_PATH, &s))
{
info = popen(CONNTRACK_PATH" -L -o extended 2>/dev/null && "
CONNTRACK_PATH" -L -f ipv6 -o extended 2>/dev/null", "r");
}

if (info != NULL)
{
udp = 0;
tcp = 0;
Expand Down