Skip to content

Commit

Permalink
helperfunctions.sh: fixed broadcast address is not recognized as vali…
Browse files Browse the repository at this point in the history
…d ip in some cases.
  • Loading branch information
HappyBasher committed Aug 3, 2022
1 parent 058681f commit 11346aa
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions serverfs/usr/share/linuxmuster/linbo/helperfunctions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# helperfunctions for linbo scripts
#
# [email protected]
# 20220114
# 20220803
#

# get linuxmuster environment variables
Expand Down Expand Up @@ -38,7 +38,15 @@ isinteger(){

# check valid ip
validip(){
(expr match "$1" '\(\([1-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-4]\)\.\([0-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-4]\)\.\([0-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-4]\)\.\([1-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-4]\)$\)') &> /dev/null || return 1
local i
if expr "$1" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; then
for i in 1 2 3 4; do
[ $(echo "$1" | cut -d. -f$i) -gt 255 ] && return 1
done
return 0
else
return 1
fi
}

# test valid mac address syntax
Expand Down

0 comments on commit 11346aa

Please sign in to comment.