-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
β Have you read and understood the above guidelines?
yes
π What is the name of the script you are using?
add-iptag.sh
π What was the exact command used to execute the script?
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/add-iptag.sh)"
βοΈ What settings are you using?
- Default Settings
- Advanced Settings
π₯οΈ Which Linux distribution are you using?
Debian 12
π Provide a clear and concise description of the issue.
LXCs and VMs with IPs in 172.16.0.0/12 are NOT getting tagged, but 192.168.0.0/16 IPs are getting tagged.
The problem is in the ip_in_cidr function in the iptag script. Here's what is wrong:
- Root Cause: The function is using ipcalc -c to check if an IP is in a CIDR range (which works correctly), but then it is doing its own manual validation that only handled specific prefix lengths: /8, /16, /24, and /32.
- Specific Issue: My configuration includes 172.16.0.0/12 in the CIDR_LIST, but the manual check didn't handle /12 prefixes, so it would fall through to the default case and return false, even though ipcalc had correctly determined the IP was in the range.
- Why 192.168.5.x worked: The 192.168.5.x addresses matched against 192.168.0.0/16, and /16 was one of the handled prefix lengths in the manual check.
- The Fix: I simplified the ip_in_cidr function to only use ipcalc -c and removed the problematic manual validation. The ipcalc command handles all CIDR ranges correctly, including /12. However, the ipcalc command is returning exit code 0 even when the IP doesn't match. This seems to be because it's printing errors but still returning success. This explains why your original script had the redundant manual check - it was trying to work around this ipcalc quirk.
- It seems the best solution is to add handling of the /12 prefix to your script.
π Steps to reproduce the issue.
Installed IP Tag and a brind new, clean install of Proxmox and let it run. Anything with a 172.16.x.x IP did not get tagged.
β Paste the full error output (if available).
None captured by me.
πΌοΈ Additional context (optional).
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working