mkinitrd-suse.sh: Fix prefix calculation
The previous algorithm was incorrect and would return incorrect results e.g. for a /20 mask. Also gets rid of an undocumented depencency on bc(1). Reference: bsc#1035743master
parent
11947da13f
commit
7cf2c21798
|
@ -104,7 +104,7 @@ calc_netmask() {
|
|||
local prefix=$1
|
||||
|
||||
[ -z "$prefix" ] && return
|
||||
mask=$(echo "(2 ^ 32) - (2 ^ $prefix)" | bc -l)
|
||||
mask=$(( 0xffffffff << (32 - $prefix) ))
|
||||
byte1=$(( mask >> 24 ))
|
||||
byte2=$(( mask >> 16 ))
|
||||
byte3=$(( mask >> 8 ))
|
||||
|
|
Loading…
Reference in New Issue