Skip to content

Commit

Permalink
network-functions: Fix a bug in is_nm_handling()
Browse files Browse the repository at this point in the history
Currently the "^" anchor is applied to the "connected" case and does not
apply to the "connecting" case in the grep due to the way the brackets
() are placed. This can cause the grep statement to incorrectly return a
match.

For ex: When trying to check for eth0 using is_nm_handling(),
"bondeth0:connecting" would also match the grep and return incorrectly.

Signed-off-by: Rohit Nair <rohitnair2297@gmail.com>
  • Loading branch information
RN97 authored and lnykryn committed Sep 19, 2024
1 parent 79ec530 commit 5c61fd7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion network-scripts/network-functions
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ is_nm_active ()

is_nm_handling ()
{
LANG=C nmcli -t --fields device,state dev status 2>/dev/null | grep -q "^\(${1}:connected\)\|\(${1}:connecting.*\)$"
LANG=C nmcli -t --fields device,state dev status 2>/dev/null | grep -q "^\(${1}:connected\|${1}:connecting.*\)$"
}

is_nm_device_unmanaged ()
Expand Down

0 comments on commit 5c61fd7

Please sign in to comment.