diff options
author | Florian Eckert <fe@dev.tdt.de> | 2022-02-24 12:59:31 +0100 |
---|---|---|
committer | Florian Eckert <fe@dev.tdt.de> | 2022-03-14 09:34:49 +0100 |
commit | 54fad2326efb796e17ecfdfb02652ac147b3b215 (patch) | |
tree | 504ec678f265121f3cc855b09a99bcc32bdfb2ab /net/mwan3/files | |
parent | a49d0953dc13c1258fbb55630d22d56d5e1c1f70 (diff) |
mwan3: use also ipset restore for connected ipv4 sets
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Diffstat (limited to 'net/mwan3/files')
-rw-r--r-- | net/mwan3/files/lib/mwan3/mwan3.sh | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/net/mwan3/files/lib/mwan3/mwan3.sh b/net/mwan3/files/lib/mwan3/mwan3.sh index 59ae1e607..e6f75334c 100644 --- a/net/mwan3/files/lib/mwan3/mwan3.sh +++ b/net/mwan3/files/lib/mwan3/mwan3.sh @@ -147,10 +147,12 @@ mwan3_set_custom_ipset() 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 || - LOG notice "failed to create ipset mwan3_connected_v4_temp" + local connected_network_v4 error + local candidate_list cidr_list + local update="" + + mwan3_push_update -! create mwan3_connected_v4 hash:net + mwan3_push_update flush mwan3_connected_v4 candidate_list="" cidr_list="" @@ -168,22 +170,15 @@ mwan3_set_connected_ipv4() done for connected_network_v4 in $cidr_list; do - $IPS -! add mwan3_connected_v4_temp "$connected_network_v4" + mwan3_push_update -! add mwan3_connected_v4 "$connected_network_v4" done for connected_network_v4 in $candidate_list; do - ipset -q test mwan3_connected_v4_temp "$connected_network_v4" || - $IPS -! add mwan3_connected_v4_temp "$connected_network_v4" + mwan3_push_update -! add mwan3_connected_v4 "$connected_network_v4" done - $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 || - 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 - + mwan3_push_update add mwan3_connected_v4 224.0.0.0/3 + mwan3_push_update -! add mwan3_connected mwan3_connected_v4 + error=$(echo "$update" | $IPS restore 2>&1) || LOG error "set_connected_ipv4: $error" } mwan3_set_connected_ipv6() |