From 99b4b3a1780de533c44a40c79eaa6bba6d3f7212 Mon Sep 17 00:00:00 2001 From: Aaron Goodman Date: Tue, 10 Nov 2020 08:44:49 -0500 Subject: [PATCH] mwan3: add logging for ipset errors Signed-off-by: Aaron Goodman --- net/mwan3/files/lib/mwan3/mwan3.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/net/mwan3/files/lib/mwan3/mwan3.sh b/net/mwan3/files/lib/mwan3/mwan3.sh index 43740e2de..5bb8a579d 100644 --- a/net/mwan3/files/lib/mwan3/mwan3.sh +++ b/net/mwan3/files/lib/mwan3/mwan3.sh @@ -153,7 +153,8 @@ mwan3_set_connected_ipv4() { local connected_network_v4 candidate_list cidr_list $IPS -! create mwan3_connected_v4 hash:net - $IPS create mwan3_connected_v4_temp hash:net + $IPS create mwan3_connected_v4_temp hash:net || + LOG notice "failed to create ipset mwan3_connected_v4_temp" candidate_list="" cidr_list="" @@ -178,10 +179,13 @@ mwan3_set_connected_ipv4() $IPS -! add mwan3_connected_v4_temp "$connected_network_v4" done - $IPS add mwan3_connected_v4_temp 224.0.0.0/3 + $IPS add mwan3_connected_v4_temp 224.0.0.0/3 || + LOG notice "failed to add 224.0.0.0/3 to mwan3_connected_v4_temp" - $IPS swap mwan3_connected_v4_temp mwan3_connected_v4 - $IPS destroy mwan3_connected_v4_temp + $IPS swap mwan3_connected_v4_temp mwan3_connected_v4 || + LOG notice "failed to swap mwan3_connected_v4_temp and mwan3_connected_v4" + $IPS destroy mwan3_connected_v4_temp || + LOG notice "failed to destroy ipset mwan3_connected_v4_temp" $IPS -! add mwan3_connected mwan3_connected_v4 } @@ -517,7 +521,8 @@ mwan3_delete_iface_ipset_entries() for setname in $(ipset -n list | grep ^mwan3_sticky_); do for entry in $(ipset list "$setname" | grep "$(mwan3_id2mask id MMX_MASK | awk '{ printf "0x%08x", $1; }')" | cut -d ' ' -f 1); do - $IPS del "$setname" $entry + $IPS del "$setname" $entry || + LOG notice "failed to delete $entry from $setname" done done }