-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
addrwatch: Various fixes #15899
addrwatch: Various fixes #15899
Conversation
There are still some issues with this package. When I enable both file and syslog output, I see (what looks like) correct output in the log file:
But in syslog I see this:
Some of the values (interface name, mac address) are missing (replaced with Also, if I run addrwatch_stdout at the command line (while addrwatch is running), it will segfault at the first update. @neheb would you know what is going on / how to fix these? I thought I should ask you before opening an issue upstream 😂 |
Great work, @jefferyto, thank you! |
I think upstream is the best place to do that. The issue is a null pointer passed to printf. Would need to look at the code to see what’s going on. My guess is upstream only tests glibc. |
I think the file is saved using: https://github.com/fln/addrwatch/blob/master/src/output_flatfile.c#L25 and https://github.com/fln/addrwatch/blob/master/src/addrwatch_syslog.c#L21 for syslog. https://github.com/fln/addrwatch/blob/master/src/output_shm.c#L57 is where timestamp is initialized. Sounds like a mess honestly. |
Thanks @neheb I have opened some issues upstream (fln/addrwatch#25, fln/addrwatch#26). I should note that I only tried running addrwatch_mysql to see the help message, I didn't actually set up mariadb and test if the logging works. |
(just letting you know in case you'd like to fix it before addrwatch upstream is fixed - probably in some next release...). I needed to have this working and I've made a patch t-w@3574dcc fixing the problems: fln/addrwatch#25 and fln/addrwatch#26 (using the branch https://github.com/jefferyto/openwrt-packages/tree/addrwatch-fixes). I've build manually the OpenWRT addrwatch packages and installed it on my router - logging to the stdout and to syslog works fine after patching. I have just noticed reading this thread that the abovementioned |
Sounds like it should be using PRIu64 as it differs between 32 and 64-bit. |
The appropriate way to print a But I am more concerned that in this line: e->timestamp = p->pcap_header->ts.tv_sec; the |
Just 5 more cents:
while the time for 32-bit (4 byte)
So it is the OS's problem anyway and by that time the |
@t-w It seems you are making a lot of assumptions. Unless upstream accepts your patch, I don't foresee it being included here in its current form. |
@jefferyto I have it patched, built and working on my OpenWRT router - that's hardly an assumption... If what I wrote above is not enough for you to try to test it, then I am wasting my time. Other users will just wait longer, I guess... Sorry to have bothered you. |
Without PRIu64 or casting the value, -Wformat will complain. As an aside, musl 1.2 brings 64-bit time_t to 32-bit platforms. |
Is this ready to go? |
Give me a few days, I'll try to find some time to work on a patch for the printf issues. |
0db93b2
to
241938c
Compare
v2:
|
Makefile changes include: * Remove USE_UCLIBC, as uclibc is no longer supported * Package output modules * Move main binary (back) to /usr/sbin, as it is system administration related and requires superuser privileges New patches: * 003-add-space-for-null-byte.patch - from fln/addrwatch@374cfd2 * 004-more-specific-library-linking.patch - from fln/addrwatch@27b57d9 * 005-use-c99-format-macro-constants.patch - from fln/addrwatch#28 Init script changes include: * Change from explicit disable to explicit enable, so that the service is disabled by default and on first install * Set config option default values to default values of the main binary * Fix command-line option names and format (from https://forum.openwrt.org/t/cant-start-addrwatch-service/60499/3) * Always use the --quiet command-line option, as the procd instance is not configured to capture stdout/stderr * Change the syslog config option to start the syslog output module Signed-off-by: Jeffery To <jeffery.to@gmail.com>
241938c
to
31ae85b
Compare
Maintainer: @oskar456
Compile tested: armvirt-32, 2021-06-17 snapshot sdk
Run tested: armvirt-32 (qemu), 2021-06-17 snapshot
Description:
Makefile changes include:
Remove
USE_UCLIBC
, as uclibc is no longer supportedPackage output modules
Move main binary (back) to /usr/sbin, as it is system administration related and requires superuser privileges
New patches:
003-add-space-for-null-byte.patch - from fln/addrwatch@374cfd2
004-more-specific-library-linking.patch - from fln/addrwatch@27b57d9
005-use-c99-format-macro-constants.patch - from Use C99 format macro constants for timestamp and vlan_tag fln/addrwatch#28
Init script changes include:
Change from explicit disable to explicit enable, so that the service is disabled by default and on first install
Set config option default values to default values of the main binary
Fix command-line option names and format (from https://forum.openwrt.org/t/cant-start-addrwatch-service/60499/3)
Always use the
--quiet
command-line option, as the procd instance is not configured to capture stdout/stderrChange the syslog config option to start the syslog output module
Signed-off-by: Jeffery To jeffery.to@gmail.com