mwan3: add logging for ipset errors
authorAaron Goodman <redacted>
Tue, 10 Nov 2020 13:44:49 +0000 (08:44 -0500)
committerAaron Goodman <redacted>
Tue, 10 Nov 2020 13:44:49 +0000 (08:44 -0500)
Signed-off-by: Aaron Goodman <redacted>
net/mwan3/files/lib/mwan3/mwan3.sh

index 43740e2def7294a832936efb0029dd31687bc2ae..5bb8a579d715a7c6a93623c2015015101f787086 100644 (file)
@@ -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
 }
git clone https://git.99rst.org/PROJECT