Re: [systemd-devel] [networkd] dbus interface?
On Wed, May 18 2016, Christian Hesse wrote: > Yuri D'Eliaon Mon, 2016/05/16 21:30: >> I'd like to monitor interface state changes as emitted by networkd. > > You may want to take a look at netlink-notify [0]. It does not use networkd > at all but kernel's netlink interface. It's not perfect but works pretty well > for me. And there's no polling, so no waste of resources. Very nice and simple too! Missed this in my search (damn, finding projects in github is _hard_). > BTW, probably the simplest and most straight forward monitoring on console > (so no notification popups...) is 'ip monitor'. Of course, I was hoping to get more detailed events out of networkd. I wrote something very similar for connman, where I can get events for AP reconfiguration and DHCP updates (including resolver changes) in a single spot. For a wlan link, I really want to know which ESSID wpa_supplicant attached me to. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [networkd] dbus interface?
Yuri D'Eliaon Mon, 2016/05/16 21:30: > I'd like to monitor interface state changes as emitted by networkd. You may want to take a look at netlink-notify [0]. It does not use networkd at all but kernel's netlink interface. It's not perfect but works pretty well for me. And there's no polling, so no waste of resources. BTW, probably the simplest and most straight forward monitoring on console (so no notification popups...) is 'ip monitor'. [0] https://github.com/eworm-de/netlink-notify -- main(a){char*c=/*Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/*Best regards my address:*/=0;b=c[a++];) putchar(b-1/(/*Chriscc -ox -xc - && ./x*/b/42*2-3)*42);} pgphSp2_ZjLhA.pgp Description: OpenPGP digital signature ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [networkd] dbus interface?
On Tue, May 17, 2016 at 03:00:16PM +0200, Yuri D'Elia wrote: > On Mon, May 16 2016, Lennart Poettering wrote: > >> Just as a curiosity though, is there some logic in the link numbers > >> given? All my links are _3[123]. Since I just need to emit some > >> notifications for the time being, knowing that _XY have the same > >> sequence as what is listed by networkctl would already be something. > > > > That's actually the interface index formatted as integer > > string. However, since D-Bus does not allow object path components to > > start with a number it it is escaped with an underscored followed by > > the ASCII code of the character... Hence "3" becomes "_33", because > > 0x33 is the ASCII code for the character "3"... > > That's enough for what I needed... some simple notifications of network > state changes. I was tired or running networkctl manually. > > https://raw.githubusercontent.com/wavexx/networkd-notify/master/networkd-notify > > It's cobbled together with duct-tape, but at least it's not polling. > Hopefully it's going to improve later on with a proper API. Nice. Zbyszek ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [networkd] dbus interface?
On Mon, May 16 2016, Lennart Poettering wrote: >> Just as a curiosity though, is there some logic in the link numbers >> given? All my links are _3[123]. Since I just need to emit some >> notifications for the time being, knowing that _XY have the same >> sequence as what is listed by networkctl would already be something. > > That's actually the interface index formatted as integer > string. However, since D-Bus does not allow object path components to > start with a number it it is escaped with an underscored followed by > the ASCII code of the character... Hence "3" becomes "_33", because > 0x33 is the ASCII code for the character "3"... That's enough for what I needed... some simple notifications of network state changes. I was tired or running networkctl manually. https://raw.githubusercontent.com/wavexx/networkd-notify/master/networkd-notify It's cobbled together with duct-tape, but at least it's not polling. Hopefully it's going to improve later on with a proper API. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [networkd] dbus interface?
On Tue, 17.05.16 00:14, Yuri D'Elia (wav...@thregr.org) wrote: > On Mon, May 16 2016, Lennart Poettering wrote: > > That's actually the interface index formatted as integer > > string. However, since D-Bus does not allow object path components to > > start with a number it it is escaped with an underscored followed by > > the ASCII code of the character... Hence "3" becomes "_33", because > > 0x33 is the ASCII code for the character "3"... > > *Cough* > > So the 10th interface would be _3130? No. Only the first character of each component of a dbus object path gets escaped like that, if it is a number (or actually any character outside of a-zA-Z). hence: foo → foo foo3 → foo3 3foo → _33foo 3foo3 → _33foo3 3 → _33 10 → _310 And so on... Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [networkd] dbus interface?
On Mon, May 16 2016, Lennart Poettering wrote: > That's actually the interface index formatted as integer > string. However, since D-Bus does not allow object path components to > start with a number it it is escaped with an underscored followed by > the ASCII code of the character... Hence "3" becomes "_33", because > 0x33 is the ASCII code for the character "3"... *Cough* So the 10th interface would be _3130? ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [networkd] dbus interface?
On Mon, 16.05.16 23:42, Yuri D'Elia (wav...@thregr.org) wrote: > On Mon, May 16 2016, Lennart Poettering wrote: > >> For example, the PropertyChanged signal might have a path of > >> "/org/freedesktop/network1/link/_33", however I have no clue what link > >> _33 actually refers to. > >> > >> In the node /org/freedesktop/network1/link/_33 there's nothing going > >> back to /org/freedesktop/network1/network nodes. In network nodes, > >> there's nothing referring to _33 or methods to get to the referring link > >> either. > >> > >> Can somebody shed some light? > > > > networkd does not offer any useful D-Bus interface at this time. We > > are working on it, but at this time, we simply have no runtime > > API. Sorry. > > Fair enough. > > Just as a curiosity though, is there some logic in the link numbers > given? All my links are _3[123]. Since I just need to emit some > notifications for the time being, knowing that _XY have the same > sequence as what is listed by networkctl would already be something. That's actually the interface index formatted as integer string. However, since D-Bus does not allow object path components to start with a number it it is escaped with an underscored followed by the ASCII code of the character... Hence "3" becomes "_33", because 0x33 is the ASCII code for the character "3"... Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [networkd] dbus interface?
On Mon, May 16 2016, Lennart Poettering wrote: >> For example, the PropertyChanged signal might have a path of >> "/org/freedesktop/network1/link/_33", however I have no clue what link >> _33 actually refers to. >> >> In the node /org/freedesktop/network1/link/_33 there's nothing going >> back to /org/freedesktop/network1/network nodes. In network nodes, >> there's nothing referring to _33 or methods to get to the referring link >> either. >> >> Can somebody shed some light? > > networkd does not offer any useful D-Bus interface at this time. We > are working on it, but at this time, we simply have no runtime > API. Sorry. Fair enough. Just as a curiosity though, is there some logic in the link numbers given? All my links are _3[123]. Since I just need to emit some notifications for the time being, knowing that _XY have the same sequence as what is listed by networkctl would already be something. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [networkd] dbus interface?
On Mon, 16.05.16 21:30, Yuri D'Elia (wav...@thregr.org) wrote: > I'd like to monitor interface state changes as emitted by networkd. > > By monitoring the emitted signals though, it looks like the current > interface is either next to useless or I don't understand it at all. > > For example, the PropertyChanged signal might have a path of > "/org/freedesktop/network1/link/_33", however I have no clue what link > _33 actually refers to. > > In the node /org/freedesktop/network1/link/_33 there's nothing going > back to /org/freedesktop/network1/network nodes. In network nodes, > there's nothing referring to _33 or methods to get to the referring link > either. > > Can somebody shed some light? networkd does not offer any useful D-Bus interface at this time. We are working on it, but at this time, we simply have no runtime API. Sorry. Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel