python-ifcfg icon indicating copy to clipboard operation
python-ifcfg copied to clipboard

Downed interfaces still appear in ifcfg

Open dupouyleo opened this issue 3 years ago • 3 comments

When i launch a command like : sudo ifconfig eth0 down

and after I run ifcfg.interfaces() in a new python interpreter the eth0 interface still appears. Is it an expected behavior ?

dupouyleo avatar Sep 20 '21 14:09 dupouyleo

What do you see if you just run ifconfig from command line after sudo ifconfig eth0 down?

benjaoming avatar Sep 20 '21 20:09 benjaoming

If i run ifconfig the interface doesn't show up. But when i run ip address show the interface does show up but the flags are different from the interfaces that are not down.

In the results returned by ifcfg.interfaces() if UP is not present in the flag then it's a downed interface.

dupouyleo avatar Sep 21 '21 07:09 dupouyleo

ifconfig is the preferred command on Linux when it exists, and ip is the fallback. So this result is a bit surprising.

The somewhat strange implementation is in src/ifcfg/__init__.py:

https://github.com/ftao/python-ifcfg/blob/0f26702f9b5e647f63c30fb94817ad3c9132b43e/src/ifcfg/init.py#L23-L30

benjaoming avatar Sep 26 '21 09:09 benjaoming