aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Macku <jamacku@redhat.com>2020-05-18 07:08:17 +0200
committerGitHub <noreply@github.com>2020-05-18 07:08:17 +0200
commit191af70fb19a11e45153e44751dc17407c7622ed (patch)
treeebd78cf89da2696196eb547c0a0a1e81ec859224
parentba34e517f0240df4f88635e9409a9fcd031ee4ff (diff)
downloadinitscripts-191af70fb19a11e45153e44751dc17407c7622ed.tar
initscripts-191af70fb19a11e45153e44751dc17407c7622ed.tar.gz
initscripts-191af70fb19a11e45153e44751dc17407c7622ed.tar.bz2
initscripts-191af70fb19a11e45153e44751dc17407c7622ed.tar.xz
initscripts-191af70fb19a11e45153e44751dc17407c7622ed.zip
ifup-eth: Switch to bc utility, which supports floating point computations.
-rw-r--r--initscripts.spec1
-rwxr-xr-xsysconfig/network-scripts/ifup-eth6
2 files changed, 5 insertions, 2 deletions
diff --git a/initscripts.spec b/initscripts.spec
index e3242b9c..4043a5d1 100644
--- a/initscripts.spec
+++ b/initscripts.spec
@@ -27,6 +27,7 @@ Conflicts: redhat-release < 7.5-0.11
Requires: udev >= 125-1
Requires: cpio
Requires: hostname
+Requires: bc
Conflicts: ipsec-tools < 0.8.0-2
Conflicts: NetworkManager < 0.9.9.0-37.git20140131.el7
Requires(pre): /usr/sbin/groupadd
diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth
index 1a9866c1..f39cc01a 100755
--- a/sysconfig/network-scripts/ifup-eth
+++ b/sysconfig/network-scripts/ifup-eth
@@ -86,9 +86,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