On Fri, 2020-07-31 at 11:05 +0000, Parthiban.Veerasooran--- via networkmanager-list wrote:
Hi All, Hope everyone is safe and healthy…! I have a requirement to do some configurations with respect to ethernet devices whenever they become ‘up’ (for example: $ ifconfig eth0 up). Could you please provide me the function in Network Manager source which is invoked when the device is made ‘up’. So that I can include my configurations in it. Since it is a big project I couldn’t get easily by going through the code. Your support is highly appreciated. Thanks & Regards, Parthiban V
Hi, `ifconfig eth0 up` is basically `ip link set eth0 up` (ifconfig is long deprecated). NetworkManager always sets the interface up in this manner. There is no API to do that (or prevent that from happening, short of configuring the interface as unmanaged in NetworkManager). In NetworkManager, you "connect" a device by "activating" a connection profile. For example, `nmlcli connection up "$PROFILE_NAME"`. Now, it see seems that you want to do something when NetworkManager connects a device. You have two possibilities. - write a dispatcher script in /etc/NetworkManager/dispatcher.d. See `man NetworkManager` - have an application that listens to the changes on D-Bus and react when something interesting happens. Basically, something like `nmcli device monitor`, which just pings what happens. best, Thomas
Attachment:
signature.asc
Description: This is a digitally signed message part