Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with cidr calculation #120

Closed
Sc0th opened this issue Jan 6, 2022 · 0 comments
Closed

Issue with cidr calculation #120

Sc0th opened this issue Jan 6, 2022 · 0 comments

Comments

@Sc0th
Copy link

Sc0th commented Jan 6, 2022

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

davidgibbons added a commit to davidgibbons/arch-int-vpn that referenced this issue Nov 4, 2024
Arch ipcalc doesn't include network anymore:
 $ ipcalc 10.0.0.1 255.255.255.255
Address:   10.0.0.1             00001010.00000000.00000000.00000001
Netmask:   255.255.255.255 = 32 11111111.11111111.11111111.11111111
Wildcard:  0.0.0.0              00000000.00000000.00000000.00000000
=>
Hostroute: 10.0.0.1             00001010.00000000.00000000.00000001
Hosts/Net: 1                     Class A, Private Internet

The redhat package from Aur does.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant