mirror of
https://github.com/pi-hole/pi-hole
synced 2025-01-03 12:40:56 +00:00
Automatically convert legacy IP range to Class C network
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
4130af0aab
commit
093054a1eb
@ -231,12 +231,12 @@ trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC68345710423
|
|||||||
# Private network, Class A (RFC 1597 + RFC 1918)
|
# Private network, Class A (RFC 1597 + RFC 1918)
|
||||||
REV_SERVER_CIDR="10.0.0.0/8"
|
REV_SERVER_CIDR="10.0.0.0/8"
|
||||||
elif [[ "${REV_SERVER_TARGET}" =~ 192\.168\..* ]]; then
|
elif [[ "${REV_SERVER_TARGET}" =~ 192\.168\..* ]]; then
|
||||||
# Private network, Class C (RFC 1597 + RFC 1918)
|
# Private network, Class B (RFC 1597 + RFC 1918)
|
||||||
REV_SERVER_CIDR="192.168.0.0/16"
|
REV_SERVER_CIDR="192.168.0.0/16"
|
||||||
else
|
else
|
||||||
# Something else. The user will have to adapt this
|
# Something else, convert to /24 subnet (preserves legacy behavior)
|
||||||
# as we cannot know how large their subnet is
|
# This sed converts "192.168.1.2" to "192.168.1.0/24"
|
||||||
REV_SERVER_CIDR="${REV_SERVER_TARGET}/32"
|
REV_SERVER_CIDR="$(sed "s+\\.[0-9]*$+\\.0/24+" <<< "${REV_SERVER_TARGET}")"
|
||||||
fi
|
fi
|
||||||
add_setting "REV_SERVER_CIDR" "${REV_SERVER_CIDR}"
|
add_setting "REV_SERVER_CIDR" "${REV_SERVER_CIDR}"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user