Re: Clarification on Network Manager source



On Fri, 2020-07-31 at 14:02 +0200, Thomas Haller wrote:
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.

Hi Thomas,

Thanks for the reply and valuable inputs. 

Yes I can go with your proposal but the requirement here is, T1S
configuration parameters should be configured from nmtui/nmcli
applications in Network Manager. They should be available in the
nmtui/nmcli application for user to configure them and they have to be
stored in the connection profile which is available in the
'/etc/NetworkManager/...' directory.

I hope you can remember the discussion which we had long back about
including T1S configurations (param1 and param2) in Network Manager.
This is the continuation of that but with different approach. So I
started this separate email thread.

When I looked into the wifi implementation, I came to know that Network
Manager communicates with 'wpa_supplicant' through the dbus interface
(fi.w1.wpa_supplicant1). So I thought the similar approach can be used
here. Instead of 'wpa_supplicant' I can have 't1s_config_service' which
is a separate application which can do the phy configuration using mdio
library.

Let user can enter 'param1 and param2' in either nmtui or nmcli user
interface applications for the corresponding ethernet device so that
they will be stored in the connection profile information.

Whenever the ethernet device 'up' or 'Network Manager restart' happens
these two params (param1 and param2) are passed to the external
application 't1s_config_service' with device name (like eth0 or eth1
etc...) through dbus interface (t1s.config.t1sInterface). So that
't1s_config_service' will do the phy configuration using mdio library.

In future, different vendors may come for different T1S phy's with
different mdio addresses for configuring 'param1 and param2' as they
are vendor specific. So it is better to keep a separate application
't1s_config_service' which has the different configuration addresses
based on the phy id's. So that we no need to touch Network Manager
instead we can include them in 't1s_config_service'.

In addition to that, one more requirement is, in case the connected
ethernet device is T1S supported then only 'param1 and param2'
configurations should be visible in the nmtui/nmcli application to be
configures by user. That check needs to be done by Network Manager by
communicating with 't1s_config_service' through dbus. Because
't1s_config_service' can check phy id of the connected ethernet device
using mdio library and can check with supported id's reported in the
application.

So the Network Manager job is to get the user input from nmtui/nmcli
user interface application and passing them to 't1s_config_service'
application through dbus interface whenever the corresponding ethernet
device 'up' or 'Network Manager restart' happens.

I hope you can get my requirements. Please let me know if you need
anything more on this.

So the question here is, the approach, what I am doing here is correct
or do you have any other better proposal.

Regards,
Parthiban V



best,
Thomas


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]