diff options
author | Chris <phobozad@gmail.com> | 2020-09-21 13:01:43 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-21 20:01:43 +0200 |
commit | 1d5073aac29a3f50c19b864d22688cf20447f1e9 (patch) | |
tree | 3f0b9ffbb0442857d49e9756c40dd676c979cf18 | |
parent | e38a80cec89f53bbcc5013b76b16aa712326c31f (diff) | |
download | psutil-1d5073aac29a3f50c19b864d22688cf20447f1e9.tar.gz |
Use IFF_RUNNING instead of IFF_UP for Linux (#1831)
Co-authored-by: Chris Burger <chris@boop.li>
-rw-r--r-- | psutil/_psutil_posix.c | 2 | ||||
-rwxr-xr-x | psutil/tests/test_linux.py | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/psutil/_psutil_posix.c b/psutil/_psutil_posix.c index f7f8b92d..8fe7f6b7 100644 --- a/psutil/_psutil_posix.c +++ b/psutil/_psutil_posix.c @@ -404,7 +404,7 @@ psutil_net_if_flags(PyObject *self, PyObject *args) { goto error; close(sock); - if ((ifr.ifr_flags & IFF_UP) != 0) + if ((ifr.ifr_flags & IFF_RUNNING) != 0) return Py_BuildValue("O", Py_True); else return Py_BuildValue("O", Py_False); diff --git a/psutil/tests/test_linux.py b/psutil/tests/test_linux.py index 044d440d..09461ec5 100755 --- a/psutil/tests/test_linux.py +++ b/psutil/tests/test_linux.py @@ -919,8 +919,7 @@ class TestSystemNetIfStats(PsutilTestCase): except RuntimeError: pass else: - # Not always reliable. - # self.assertEqual(stats.isup, 'RUNNING' in out, msg=out) + self.assertEqual(stats.isup, 'RUNNING' in out, msg=out) self.assertEqual(stats.mtu, int(re.findall(r'(?i)MTU[: ](\d+)', out)[0])) |