binhex / arch-qbittorrentvpn

Docker build script for Arch Linux base with qBittorrent, Privoxy and OpenVPN
GNU General Public License v3.0
397 stars 46 forks source link

Issue with cidr calculation #120

Open Sc0th opened 2 years ago

Sc0th commented 2 years ago

I noticed that outgoing ports were not being set correctly, seeing the error:

iptables v1.8.7 (legacy): host/network `' not found
Try `iptables -h' or 'iptables --help' for more information.

After some digging it became apparent the variable docker_network_cidr is not being set correctly here (/root/iptable.sh)

#convert netmask into cidr format
docker_network_cidr=$(ipcalc "${docker_ip}" "${docker_mask}" | grep -P -o -m 1 "(?<=Network:)\s+[^\s]+")

In my config these line resolves to

ipcalc 10.244.248.207 255.255.255.255 | grep -P -o -m 1 '(?<=Network:)\s+[^\s]+'

which produces no output, I am not really clear how this is supposed to function, maybe the output of ipcalc has changed?

Adding the var in manully to iptables.sh like this:

#convert netmask into cidr format
#docker_network_cidr=$(ipcalc "${docker_ip}" "${docker_mask}" | grep -P -o -m 1 "(?<=Network:)\s+[^\s]+")
docker_network_cidr=10.244.0.0/16

resolves the issue