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

Various segfault fixes, compiler warnings on 32 bit systems and add milli-second timers for vrrp track scripts #2478

Merged
merged 19 commits into from
Oct 8, 2024

Conversation

pqarmitage
Copy link
Collaborator

No description provided.

Commit 7cb09b2 - all: Ensure pid file exists when respawning child process

Signed-off-by: Quentin Armitage <[email protected]>
It was a long which was excessive. It cannot be negative, and
doesn't need more than 32 bits.

Signed-off-by: Quentin Armitage <[email protected]>
alloc_bfd() returns a bfd_t *, but in the case of errors it was
returning false, which clearly should have been NULL.

This issues was identified by compiling with -std=c23.

Signed-off-by: Quentin Armitage <[email protected]>
32 bit Debian uses a 32 bit TIMESIZE, whereas 32 bit Ubuntu uses
a 64 bit TIMESIZE. This means that on 32 bit Ubuntu some time types
need to be printed using "%lld", whereas on 32 bit Debian, and on
64 bit systems "%ld" is what is needed. Using the wrong format
specifier was causing compilation warnings on 32 bit Debian.

The issue impacts printing time_t, struct timeval tv_sec and tv_usec
and struct timespec tv_sec fields. Peversely, on a 32 bit system when
TIMESIZE is 64, struct timeval tv_usec is 64 bits, whereas
struct timesec tv_nsec is 32 bits.

The commit adds configure time checking of the right format specifiers
to use, and adds definitions PRI_time_t, PRI_tv_sec, PRI_ts_sec etc.

Signed-off-by: Quentin Armitage <[email protected]>
On 32 bit systems, struct statfs field f_type is unsigned on 32 bit
systems, but signed on 64 bit systems. This caused warnings on 32
bit systems about comparing signed and unsigned when comparing against
defined values with the most significat bit was set.

This commit copies the f_type field into a long long type which resolves
the warnings.

Signed-off-by: Quentin Armitage <[email protected]>
It would be good to be able to use the standardized
"[[fallthrough]];" which is added in C23, but we are a long way
from being able to specify C23 was the base standard.

Signed-off-by: Quentin Armitage <[email protected]>
The alignment calculations were not coerect, so this commit
updates addattr_l to match the iproute2 version, EXCEPT there
appears to be 1 issue in the iproute2 code when NLMSG_ALIGN
is used when RTA_ALIGN should be used. The difference is
entirely cosmetic (at the moment) since the functionality of the
2 macros is currently identical.

Signed-off-by: Quentin Armitage <[email protected]>
Previously the time was logged for memory allocation/freeing operations
in seconds. When comparing when memory was allocated/freed to debugging
logging via a log file, it was helpful, in terms of being able to
identify the sequence of events, to have the time of memory allocations
etc logged in micro-seconds.

Signed-off-by: Quentin Armitage <[email protected]>
Child process thread_t structures use two red-black trees, one for
the timeout, and the other for pids. It is important to ensure that
threads are removed from the child_pid RB tree at the correct time.
This was not happening when reloads were occurring and there was a
THREAD_CHILD_TIMEOUT thread on the ready list.

A few other instances of the thread not being removed from the
child_pid RB tree correctly, which are also resolved by this commit.

Signed-off-by: Quentin Armitage <[email protected]>
On a reload, only the configured name of a track_script was being
checked to see if the new config track_script matched the old config
track_script. If the script to be executed were changed, but the
configured named of the script were kept the same, then the status
of the old script would be transferred to the new script, despite the
scripts being completely different.

This commit now checks that the script really is the same, in terms
of the path, parameters and user executing the script.

Signed-off-by: Quentin Armitage <[email protected]>
Although running track_scripts too rapidly can have use cause heavy
system load, there are use cases for being able to run scripts more
frequently than 1 second, and also at intervals not in whole seconds.

This commit adds the option to be able to specify the interval and
timeout timers to a resolution in milli-seconds.

Signed-off-by: Quentin Armitage <[email protected]>
@pqarmitage pqarmitage merged commit 59c39af into acassen:master Oct 8, 2024
10 checks passed
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

Successfully merging this pull request may close these issues.

1 participant