9204ec2eee
- Fix subnet calculation in mkinitrd (bsc#1035743) * adds 0516-mkinitrd-suse.sh-Fix-prefix-calculation.patch OBS-URL: https://build.opensuse.org/request/show/491030 OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=301
31 lines
877 B
Diff
31 lines
877 B
Diff
From 7cf2c21798b537a5553ecc23df5ce8cfda631e9c Mon Sep 17 00:00:00 2001
|
|
From: Daniel Molkentin <dmolkentin@suse.com>
|
|
Date: Tue, 25 Apr 2017 15:25:20 +0200
|
|
Subject: [PATCH] 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#1035743
|
|
---
|
|
mkinitrd-suse.sh | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/mkinitrd-suse.sh b/mkinitrd-suse.sh
|
|
index bc49d731..d9de81b9 100755
|
|
--- a/mkinitrd-suse.sh
|
|
+++ b/mkinitrd-suse.sh
|
|
@@ -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 ))
|
|
--
|
|
2.12.0
|
|
|