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

Nlbwmon cannot work immediately after booting on OpenWrt 23.05.3 #59

Open
LemonCrab666 opened this issue Aug 16, 2024 · 6 comments
Open

Comments

@LemonCrab666
Copy link

Nlbwmon cannot work immediately after booting on Immortalwrt 23.05.3
image
When OpenWRT is set to the 1st of the following month, nlbwmon will start working immediately, but it will cease to function after a restart.Can you please advise on how to solve this problem

@unprintable123
Copy link

I have the same issue and I find that allow_insert is always false, keeping the database empty.
So I modified the code to force it try to insert everytime.

@LemonCrab666
Copy link
Author

I have the same issue and I find that allow_insert is always false, keeping the database empty. So I modified the code to force it try to insert everytime.

I couldn't find any nlbwmo related repositories on your homepage. Can you share the ones you have modified?Thank you

@unprintable123
Copy link

I use a patch file and it may not be the best solution.
Here it is

Index: nlbwmon-2024-02-21-c7616bcf/nfnetlink.c
===================================================================
--- nlbwmon-2024-02-21-c7616bcf.orig/nfnetlink.c
+++ nlbwmon-2024-02-21-c7616bcf/nfnetlink.c
@@ -78,10 +78,9 @@ struct delayed_record {
 static void
 database_insert_immediately(struct record *r)
 {
-	if (r->count != 0)
-		database_insert(gdbh, r);
-	else
-		database_update(gdbh, r);
+	int err = 0;
+	err = database_insert(gdbh, r);
+	if (err < 0) fprintf(stderr, "failed to insert, count %lld, err %d\n", r->count, err);
 }
 
 static void

@LemonCrab666
Copy link
Author

I use a patch file and it may not be the best solution.
Here it is

Thank you for your contribution

@langit7
Copy link

langit7 commented Sep 10, 2024

I use a patch file and it may not be the best solution. Here it is

Index: nlbwmon-2024-02-21-c7616bcf/nfnetlink.c
===================================================================
--- nlbwmon-2024-02-21-c7616bcf.orig/nfnetlink.c
+++ nlbwmon-2024-02-21-c7616bcf/nfnetlink.c
@@ -78,10 +78,9 @@ struct delayed_record {
 static void
 database_insert_immediately(struct record *r)
 {
-	if (r->count != 0)
-		database_insert(gdbh, r);
-	else
-		database_update(gdbh, r);
+	int err = 0;
+	err = database_insert(gdbh, r);
+	if (err < 0) fprintf(stderr, "failed to insert, count %lld, err %d\n", r->count, err);
 }
 
 static void

Do you have connection recorded with this patch.
image

@unprintable123
Copy link

No connection count either. It seems that any new connection is not captured in my system, thus no count and insert into database.
I don't know whether it's a problem of netlink or nlbwmon.
The patch just fixes the empty db problem but i don't know how to debug the loss of new connections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants