aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Macku <jamacku@redhat.com>2020-06-16 09:22:43 +0200
committerGitHub <noreply@github.com>2020-06-16 09:22:43 +0200
commitc7560969dd8540fb1ee76b494d5e744ad15c5a3e (patch)
tree837ed4e357afd0a914ee203af88db6d469d5cf7c
parentf36c6214a1c0591a1aa7a4f45e3ede305ad0c555 (diff)
downloadinitscripts-c7560969dd8540fb1ee76b494d5e744ad15c5a3e.tar
initscripts-c7560969dd8540fb1ee76b494d5e744ad15c5a3e.tar.gz
initscripts-c7560969dd8540fb1ee76b494d5e744ad15c5a3e.tar.bz2
initscripts-c7560969dd8540fb1ee76b494d5e744ad15c5a3e.tar.xz
initscripts-c7560969dd8540fb1ee76b494d5e744ad15c5a3e.zip
ifup-eth: Switch to bc utility, which supports floating point computations.
backport of: 0be5319 Resolves: #1826637
-rw-r--r--initscripts.spec1
-rwxr-xr-xnetwork-scripts/ifup-eth6
2 files changed, 5 insertions, 2 deletions
diff --git a/initscripts.spec b/initscripts.spec
index 8ac1dac0..97b3225e 100644
--- a/initscripts.spec
+++ b/initscripts.spec
@@ -95,6 +95,7 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
%shared_requirements
+Requires: bc
Requires: dbus
Requires: gawk
Requires: grep
diff --git a/network-scripts/ifup-eth b/network-scripts/ifup-eth
index b49af168..1d6f18e7 100755
--- a/network-scripts/ifup-eth
+++ b/network-scripts/ifup-eth
@@ -89,9 +89,11 @@ if [ "${TYPE}" = "Bridge" ]; then
forward_delay="$(convert2sec ${forward_delay} centi)"
fi
- forward_delay=$(expr ${forward_delay} \* 2 + 7)
+ forward_delay=$(bc -q <<< "${forward_delay} * 2 + 7")
- [ 0$LINKDELAY -lt $forward_delay ] && LINKDELAY=$forward_delay
+ # It's possible we are comparing floating point numbers here, therefore
+ # we are using 'bc' for comparison. The [ ] and [[ ]] do not work.
+ (( $(bc -l <<< "${LINKDELAY:-0} < ${forward_delay}") )) && LINKDELAY=${forward_delay}
unset forward_delay
fi