Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use IFF_RUNNING instead of IFF_UP for Linux #1831

Merged
merged 1 commit into from Sep 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion psutil/_psutil_posix.c
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions psutil/tests/test_linux.py
Expand Up @@ -919,8 +919,7 @@ def test_against_ifconfig(self):
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]))

Expand Down