Blame 0013-mkinitrd-suse.sh-Fix-prefix-calculation.patch
|
Harald Hoyer |
3763a8 |
From 7cf2c21798b537a5553ecc23df5ce8cfda631e9c Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
3763a8 |
From: Daniel Molkentin <dmolkentin@suse.com>
|
|
Harald Hoyer |
3763a8 |
Date: Tue, 25 Apr 2017 15:25:20 +0200
|
|
Harald Hoyer |
3763a8 |
Subject: [PATCH] mkinitrd-suse.sh: Fix prefix calculation
|
|
Harald Hoyer |
3763a8 |
|
|
Harald Hoyer |
3763a8 |
The previous algorithm was incorrect and would return
|
|
Harald Hoyer |
3763a8 |
incorrect results e.g. for a /20 mask. Also gets rid
|
|
Harald Hoyer |
3763a8 |
of an undocumented depencency on bc(1).
|
|
Harald Hoyer |
3763a8 |
|
|
Harald Hoyer |
3763a8 |
Reference: bsc#1035743
|
|
Harald Hoyer |
3763a8 |
---
|
|
Harald Hoyer |
3763a8 |
mkinitrd-suse.sh | 2 +-
|
|
Harald Hoyer |
3763a8 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
Harald Hoyer |
3763a8 |
|
|
Harald Hoyer |
3763a8 |
diff --git a/mkinitrd-suse.sh b/mkinitrd-suse.sh
|
|
Harald Hoyer |
3763a8 |
index bc49d731..d9de81b9 100755
|
|
Harald Hoyer |
3763a8 |
--- a/mkinitrd-suse.sh
|
|
Harald Hoyer |
3763a8 |
+++ b/mkinitrd-suse.sh
|
|
Harald Hoyer |
3763a8 |
@@ -104,7 +104,7 @@ calc_netmask() {
|
|
Harald Hoyer |
3763a8 |
local prefix=$1
|
|
Harald Hoyer |
3763a8 |
|
|
Harald Hoyer |
3763a8 |
[ -z "$prefix" ] && return
|
|
Harald Hoyer |
3763a8 |
- mask=$(echo "(2 ^ 32) - (2 ^ $prefix)" | bc -l)
|
|
Harald Hoyer |
3763a8 |
+ mask=$(( 0xffffffff << (32 - $prefix) ))
|
|
Harald Hoyer |
3763a8 |
byte1=$(( mask >> 24 ))
|
|
Harald Hoyer |
3763a8 |
byte2=$(( mask >> 16 ))
|
|
Harald Hoyer |
3763a8 |
byte3=$(( mask >> 8 ))
|