Re: [systemd-devel] Unit to test if a domain is reachable
On Thu, 17.07.14 11:37, Moviuro (movi...@gmail.com) wrote: However, everything I tried proved an utter failure: target says reached even though it doesn't even have an IP on any link; wait-online obviously didn't even check if I had a DNS whatsoever. This sounds like a shortcoming of your network stack? network-wait-online.target is supposed to be filled with meaning by your networking stack, i.e. NetworkManager or suchlike. The implementation that is networkd should get this right really. Which one are you using? Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Unit to test if a domain is reachable
On Fri, Jul 18, 2014 at 1:37 PM, Colin Guthrie gm...@colin.guthr.ie wrote: 'Twas brillig, and Moviuro at 17/07/14 11:41 did gyre and gimble: On Thursday 17 July 2014 12:12:22 you wrote: Why not just use network-online.target? http://www.freedesktop.org/software/systemd/man/systemd.special.html#network -online.target o If it succeeds, the unit that needs to reach %i gets launched and my reachable-retry@ *does not* enter SUCCESS or whatever good state you can think of: it just stays asleep until someone else wants to recheck later if the domain is still reachable (e.g. domain goes down, my ISP goes crazy, I suspend my computer...). network-online.target does not fulfill these requirements. It stays in SUCCESS across suspend/resume cycles. Therefore, it is *not* a correct indicator. I don't think any kind of unit is the right approach here. You need something active that listens to events from devices and determines the best course of action thereafter. I think anything you glue together with systemd units here will be a bit of a hack, but perhaps others will disagree. I agree. Any unit/target will necessarily just be a best-effort to try to give an estimate about when we are reasonably online. Hopefully what we have should be sufficient to satisfy legacy users that cannot be updated to do something saner. However, for a real daemon, you really want to be listening for events and reacting appropriately, depending on what your precise requirements are. You could have a look at the internals of either systemd-networkd-wait-online, systemd-resolved or systemd-timesyncd to get a few examples of how this could be achieved. You'll probably want to listen to both rtnetlink (to get kernel events) and sd-networkd (to get networkd events). The latter is not yet exported, but any early feedback would be useful. If you are not using networkd, you should hook into whatever daemon is running, NetworkManager has a dbus interface you probably can use. Cheers, Tom ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] Unit to test if a domain is reachable
Hi all! Since (from my understanding) systemd devel team did not want to interpret nor force its interpretation of network availability on systemd consumers, we have to use some other services and cross fingers (network.target, systemd- networkd-wait-online.service and so on). However, everything I tried proved an utter failure: target says reached even though it doesn't even have an IP on any link; wait-online obviously didn't even check if I had a DNS whatsoever. In the end, I had to write my own (ugly) service to test if a domain is reachable: /etc/systemd/system/reachable-retry@.service [Unit] Description=Test if %i is reachable # I'm not even sure it's useful, because it doesn't do its job After=systemd-networkd-wait-online.service [Service] Type=forking ExecStart=/usr/bin/ping -c1 %i Restart=on-failure # Needed, else the unit just goes crazy # if there are no links and systemd stops it RestartSec=2 # I don't know if the [Install] part is needed [Install] WantedBy=multi-user.target This works but using the Type=forking is an ugly hack: the result I'm waiting for would be: o Call reachable-retry@ in a unit (Requires and After); o If it fails, try again (seems OK with the Restart directive); o If it succeeds, the unit that needs to reach %i gets launched and my reachable-retry@ *does not* enter SUCCESS or whatever good state you can think of: it just stays asleep until someone else wants to recheck later if the domain is still reachable (e.g. domain goes down, my ISP goes crazy, I suspend my computer...). An other unit I could use would be reachable@ that would simply test whether or not a domain is reachable and: o In case it isn't, prevent a unit from being launched, period. o In case it is, launch the unit and don't enter any SUCCESS or good state. o If an other unit needs to test afterwards, launch the test again. Would Type=oneshot do that? Any input would be greatly appreciated. The issue was also a bit discussed here: https://bbs.archlinux.org/viewtopic.php?id=182717 And here too (in French): https://forums.archlinux.fr/topic15485.html Cheers, -- Moviuro signature.asc Description: This is a digitally signed message part. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Unit to test if a domain is reachable
On Thursday 17 July 2014 12:12:22 you wrote: Why not just use network-online.target? http://www.freedesktop.org/software/systemd/man/systemd.special.html#network -online.target o If it succeeds, the unit that needs to reach %i gets launched and my reachable-retry@ *does not* enter SUCCESS or whatever good state you can think of: it just stays asleep until someone else wants to recheck later if the domain is still reachable (e.g. domain goes down, my ISP goes crazy, I suspend my computer...). network-online.target does not fulfill these requirements. It stays in SUCCESS across suspend/resume cycles. Therefore, it is *not* a correct indicator. -- Moviuro signature.asc Description: This is a digitally signed message part. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel