[systemd-devel] network signals

ashok athukuri athukuriashok at gmail.com
Tue Feb 6 15:27:09 UTC 2024


Hello Mantas,

Thanks for the quick response, Here is what I get for GetLinkByName

//busctl call org.freedesktop.network1 /org/freedesktop/network1
org.freedesktop.network1.Manager GetLinkByName s wlan0
//io 4 "/org/freedesktop/network1/link/_34"

1. I am subscribing to signal like below, Does that work?
2. how can I add another like link "eth0" for signals? subscribe separately?


g_dbus_connection_signal_subscribe (connection,// GDBusConnection

/*"org.freedesktop.network1"*/ NULL,//sender name to match on (unique or
well-known name) or NULL to listen from all senders

"org.freedesktop.DBus.Properties",//D-Bus interface name to match on or
NULL to match on all interfaces

"PropertiesChanged",//D-Bus signal name to match on or NULL to match on all
signals

"*/org/freedesktop**/network1/link/_34*",//object path to match on or NULL
to match on all object paths

NULL,//contents of first string argument to match on or NULL to match on
all kinds of arguments

G_DBUS_SIGNAL_FLAGS_NONE,//GDBusSignalFlags describing how arg0 is used in
subscribing to the signal

linkStatusMonitorCallBack,//callback to invoke when there is a signal
matching the requested data

nullptr,//user data to pass to callback

NULL);//function to free user_data with when subscription is removed or
NULL

Thanks,

Ashok

On Tue, Feb 6, 2024 at 5:11 PM Mantas Mikulėnas <grawity at gmail.com> wrote:

> /org/freedesktop/network1 is the toplevel object that represents the
> networkd daemon as a whole. Interface-specific signals would be sent for
> the object paths of the individual interfaces, so you need to either:
>
> a) call *GetLinkByName()* on the toplevel object to find the interface
> object, and then subscribe for signals on that;
>
> or b) instead of filtering by path='/xx', filter by *path_namespace='/xx'
> *so that it will also match child objects.
>
> On Tue, Feb 6, 2024 at 10:30 AM ashok athukuri <athukuriashok at gmail.com>
> wrote:
>
>> Hello All,
>>
>>
>> I'm trying to use DBUS signal "PropertiesChanged" of
>> org.freedesktop.network1 /org/freedesktop/network1 *to detect network
>> interface is up or down OR the speed of the interface is changed.*
>>
>> Is it possible? using a subscription to "PropertiesChanged" signal via
>> the below interface or PATH ?
>> If yes, how to test those, Currently I don't see any anything on my
>> dbus-monitor.
>>
>> Here is how I am testing :
>>
>> *# dbus-monitor --system "type='signal',path='/org/freede*
>>
>>
>> *sktop/network1'"#ifconfig wlan0 down*
>>
>> # busctl introspect org.freedesktop.network1 /org/freedesktop/network1
>> NAME                                TYPE      SIGNATURE RESULT/VALUE FLAGS
>> org.freedesktop.DBus.Introspectable interface -         -            -
>> .Introspect                         method    -         s            -
>> org.freedesktop.DBus.Peer           interface -         -            -
>> .GetMachineId                       method    -         s            -
>> .Ping                               method    -         -            -
>> org.freedesktop.DBus.Properties     interface -         -            -
>> .Get                                method    ss        v            -
>> .GetAll                             method    s         a{sv}        -
>> .Set                                method    ssv       -            -
>> .PropertiesChanged                  signal    sa{sv}as  -            -
>> org.freedesktop.network1.Manager    interface -         -            -
>> .Describe                           method    -         s            -
>> .DescribeLink                       method    i         s            -
>> .ForceRenewLink                     method    i         -            -
>> .GetLinkByIndex                     method    i         so           -
>> .GetLinkByName                      method    s         io           -
>> .ListLinks                          method    -         a(iso)       -
>> .ReconfigureLink                    method    i         -            -
>> .Reload                             method    -         -            -
>> .RenewLink                          method    i         -            -
>> .RevertLinkDNS                      method    i         -            -
>> .RevertLinkNTP                      method    i         -            -
>> .SetLinkDNS                         method    ia(iay)   -            -
>> .SetLinkDNSEx                       method    ia(iayqs) -            -
>> .SetLinkDNSOverTLS                  method    is        -            -
>> .SetLinkDNSSEC                      method    is        -            -
>> .SetLinkDNSSECNegativeTrustAnchors  method    ias       -            -
>> .SetLinkDefaultRoute                method    ib        -            -
>> .SetLinkDomains                     method    ia(sb)    -            -
>> .SetLinkLLMNR                       method    is        -            -
>> .SetLinkMulticastDNS                method    is        -            -
>> .SetLinkNTP                         method    ias       -            -
>> .AddressState                       property  s         "routable"
>> emits-change
>> .CarrierState                       property  s         "carrier"
>>  emits-change
>> .IPv4AddressState                   property  s         "routable"
>> emits-change
>> .IPv6AddressState                   property  s         "routable"
>> emits-change
>> .NamespaceId                        property  t         4026531840   const
>> .OnlineState                        property  s         "partial"
>>  emits-change
>> .OperationalState                   property  s         "routable"
>> emits-change
>> root at MK3AC-WS100269:/var/lib/evse/cache#
>>
>> Thanks,
>> Ashok
>>
>>
>
> --
> Mantas Mikulėnas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20240206/b54c4385/attachment.htm>


More information about the systemd-devel mailing list