Closed ljufa closed 3 years ago
Actually, maybe I have wrong expectations from this function, I guess there is a difference btw physical and logical if up/down.
This is the output of ip a
with and without cable:
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
2: enp1s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
Yes. That's right.
is_up
is corresponding to IFF_UP
of SIOCGIFFLAGS
. https://man7.org/linux/man-pages/man7/netdevice.7.html.
It means the interfaces is enabled only. So it is true
even if the cable is unplugged.
IFF_RUNNING
represents the actual status of the interface.
I added is_running
to access the flag.
Great tnx, is_running
will help.
After the LAN cable was unplugged it kept printing.
Interface is up!
Althoughip a
command showed a change to DOWN.In the debugger, I could see that
flags
have changed.