nuno 已修改 1 month ago. 還原成這個修訂版本
1 file changed, 25 insertions
gistfile1.txt(檔案已創建)
| @@ -0,0 +1,25 @@ | |||
| 1 | + | # Moved to the top of the function after rule::require_exists | |
| 2 | + | ||
| 3 | + | local peer_name | |
| 4 | + | peer_name=$(peers::find_by_ip "$client_ip") | |
| 5 | + | ||
| 6 | + | local subtype | |
| 7 | + | subtype=$(peers::get_meta "$peer_name" "subtype") | |
| 8 | + | ||
| 9 | + | local subnet | |
| 10 | + | subnet=$(config::subnet_for "$subtype") | |
| 11 | + | ||
| 12 | + | # Changed this part from -n to -z | |
| 13 | + | # Remove DNS redirect if applicable | |
| 14 | + | local dns_redirect | |
| 15 | + | dns_redirect=$(rule::get "$rule_name" "dns_redirect") | |
| 16 | + | if [[ "$dns_redirect" == "true" ]]; then | |
| 17 | + | if [[ -z "$subtype" ]]; then | |
| 18 | + | local peer_type | |
| 19 | + | peer_type=$(peers::get_type "$peer_name") || true | |
| 20 | + | [[ -z "$peer_type" ]] && peer_type="phone" # fallback | |
| 21 | + | subnet=$(config::subnet_for "$peer_type") | |
| 22 | + | fi | |
| 23 | + | ||
| 24 | + | rule::remove_dns_redirect "${subnet}.0/24" | |
| 25 | + | fi | |
上一頁
下一頁