ifconfig issue - #4
Open
WajeehJ wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ifconfig deprecation — cross-distro network interface collection
Problem:
LPCPU called ifconfig -a directly and unconditionally in both the before and after
snapshot blocks. ifconfig comes from the net-tools package which is deprecated and
not installed by default on modern distributions such as SLES 15 and newer RHEL/UBI
images, causing those collection steps to silently fail.
Goal:
Keep ifconfig as the preferred tool for backwards compatibility with older users who
have it installed, while automatically falling back to ip -s -s link show (iproute2)
on distributions where ifconfig is absent. The script must never hard-exit if neither
tool is available.
Changes: lpcpu/lpcpu.sh
Two boolean helper functions were added to probe for tool availability at runtime:
has_iproute2() {
command -v ip >/dev/null 2>&1 && ip -V >/dev/null 2>&1
}
has_ifconfig() {
command -v ifconfig >/dev/null 2>&1
}
Note: has_iproute2() checks both that the binary exists AND that it responds to
ip -V, ensuring it is a functional iproute2 installation and not a stub.
Replaces the bare ifconfig -a calls. Prefers ifconfig -a for backwards
compatibility; falls back to ip -s -s link show if ifconfig is not installed;
writes a message to the output file if neither is available (no exit 1).
collect_network_stats() {
local output_file="$1"
}
3. Call sites updated — before/after snapshot blocks
The two direct ifconfig -a calls were replaced with calls to the new function.
Output filenames are unchanged so existing post-processing scripts are unaffected.