mirror of
https://github.com/MarkusMcNugen/docker-qBittorrentvpn
synced 2024-11-25 20:14:58 +00:00
Update iptables.sh
This commit is contained in:
parent
ddb4579470
commit
80b5f90e80
@ -31,6 +31,7 @@ ip route add "${LAN_NETWORK}" via "${DEFAULT_GATEWAY}" dev eth0
|
|||||||
IFS=',' read -ra lan_network_list <<< "${LAN_NETWORKS}"
|
IFS=',' read -ra lan_network_list <<< "${LAN_NETWORKS}"
|
||||||
|
|
||||||
lancount=0
|
lancount=0
|
||||||
|
lan_network_devices=()
|
||||||
# process lan networks in the list
|
# process lan networks in the list
|
||||||
for lan_network_item in "${lan_network_list[@]}"; do
|
for lan_network_item in "${lan_network_list[@]}"; do
|
||||||
lan_network_item=$(echo "${lan_network_item}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
|
lan_network_item=$(echo "${lan_network_item}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
|
||||||
@ -41,13 +42,14 @@ for lan_network_item in "${lan_network_list[@]}"; do
|
|||||||
int_mask=$(ifconfig "${interface}" | grep -o "netmask [0-9]*\.[0-9]*\.[0-9]*\.[0-9]*" | grep -o "[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*")
|
int_mask=$(ifconfig "${interface}" | grep -o "netmask [0-9]*\.[0-9]*\.[0-9]*\.[0-9]*" | grep -o "[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*")
|
||||||
int_cidr=$(ipcalc "${int_ip}" "${int_mask}" | grep -P -o -m 1 "(?<=Network:)\s+[^\s]+" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
|
int_cidr=$(ipcalc "${int_ip}" "${int_mask}" | grep -P -o -m 1 "(?<=Network:)\s+[^\s]+" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
|
||||||
if [[ $int_cidr == $lan_network_item ]]; then
|
if [[ $int_cidr == $lan_network_item ]]; then
|
||||||
$lan_network_devices[$lancount]=$interface
|
lan_network_devices+=(${interface})
|
||||||
echo "${lan_network_devices[$lancount]}"
|
echo "$int_cidr detected on $interface interface"
|
||||||
# get default gateway of interfaces as looping through them
|
|
||||||
DEFAULT_GATEWAY=$(/sbin/ip route |grep '^default' | awk "/${$interface}/ {print $3}")
|
|
||||||
|
|
||||||
# strip whitespace from start and end of lan_network_item
|
# get default gateway of interfaces as looping through them
|
||||||
lan_network_item=$(echo "${lan_network_item}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
|
DEFAULT_GATEWAY=$(/sbin/ip route |grep '^default' | awk "/${$interface}/ {print $3}")
|
||||||
|
|
||||||
|
# strip whitespace from start and end of lan_network_item
|
||||||
|
lan_network_item=$(echo "${lan_network_item}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user