Closed cfunkhouser closed 4 years ago
validating the value, it has to be between 1-32 so if 0 or 33+
Is a netmask of less than 8 bits (i.e., larger than a class A network) even valid?
Another option would be to allow adding /16 to the JAIL_IP And just splitting it in the script, defaulting to /24 if no subnet is added.
I think that is a way better user experience
And just splitting it in the script, defaulting to /24 if no subnet is added.
I think I like this idea better, and will start working on it unless the PR is updated to do it first.
@danb35 From the top of my head you could do this:
JAIL_IP=*ENTER IP With or Without Mask*
NETMASK=${JAIL_IP%*/}
JAIL_IP=${JAIL_IP%/*}
That looks cleaner than what I came up with:
IP=$(echo ${JAIL_IP} | cut -f1 -d/)
NETMASK=$(echo ${JAIL_IP} | cut -f2 -d/)
if [ "${NETMASK}" = "${IP}" ]
then
NETMASK="24"
fi
Addressed with the above commit.
It was recently necessary for me to set a
/16
for aJAIL_IP
. This makes that possible.Default behavior is maintained. New option is documented.