Angs Angs - 9 months ago 50
C Question

Linux network interface management by C code

I am looking for a function/system call that can be used in C to manage network interfaces of the Linux machine. E.g., I would like to do

ip link set wlan0 down
(or up) or
ifconfig wlan0 down
, what function can be used for it, apart from

Answer Source

To access the functionality provided by the iproute2 tools from software, you can use the Linux rtnetlink API. To make it easier for you, use libraries like libnl.

In case you encounter trouble, there is already a tag called netlink