summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2012-03-02 19:54:48 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2012-03-02 19:54:48 +0000
commit7a1e4ef606a814b124fc35136c2821484981e6cb (patch)
tree1c3dc8de2e34644623bf0224a9065616efaa2c0d
parent0dc9431bdb989231cfa20560d69aebebd487a926 (diff)
downloadopenrc-7a1e4ef606a814b124fc35136c2821484981e6cb.tar.gz
openrc-7a1e4ef606a814b124fc35136c2821484981e6cb.tar.bz2
openrc-7a1e4ef606a814b124fc35136c2821484981e6cb.tar.xz
Bug #405491: _exists can give a false negative since /proc/net/dev can be slow to update sometimes when interfaces are added rapidly. Use sysfs instead.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rw-r--r--net/ifconfig.sh.Linux.in2
-rw-r--r--net/iproute2.sh2
2 files changed, 2 insertions, 2 deletions
diff --git a/net/ifconfig.sh.Linux.in b/net/ifconfig.sh.Linux.in
index 80a0b98..9eaa7c5 100644
--- a/net/ifconfig.sh.Linux.in
+++ b/net/ifconfig.sh.Linux.in
@@ -19,7 +19,7 @@ _down()
_exists()
{
- grep -Eq "^[[:space:]]*${IFACE}:" /proc/net/dev
+ [ -e /sys/class/net/"$IFACE" ]
}
_ifindex()
diff --git a/net/iproute2.sh b/net/iproute2.sh
index 09912bf..e06152f 100644
--- a/net/iproute2.sh
+++ b/net/iproute2.sh
@@ -20,7 +20,7 @@ _down()
_exists()
{
- grep -Eq "^[[:space:]]*${IFACE}:" /proc/net/dev
+ [ -e /sys/class/net/"$IFACE" ]
}
_ifindex()