Add input sanity checking

This commit is contained in:
Michel Roegl-Brunner 2025-01-21 13:47:20 +01:00
parent dffa262b88
commit 75c5eeba44

View File

@ -862,7 +862,12 @@ config_file(){
fi
if [[ ! -z "$MTU" ]]; then
echo -e "${DEFAULT}${BOLD}${DGN}Interface MTU Size: ${BGN}$MTU${CL}"
if [[ "$MTU" =~ ^-?[0-9]+$ ]]; then
echo -e "${DEFAULT}${BOLD}${DGN}Interface MTU Size: ${BGN}$MTU${CL}"
else
msg_error "MTU must be an integer"
exit
fi
else
MTU=""
echo -e "${DEFAULT}${BOLD}${DGN}Interface MTU Size: ${BGN}Default${CL}"