<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Lennart,<div><br></div><div>There's more to it than that.  The DECnet kernel module must first be loaded so that it creates /proc/net/decnet*.  When the dnetd service is started, it parses /etc/decnet.conf and writes the DECnet host address to /proc/sys/net/decnet/node_address and the default DECnet device (interface) to /proc/sys/net/decnet/default_device.  The MAC address of all the DECnet interfaces has to be changed to a special multicast address.  This all usually must be done before IP networking is started.  I am not sure that a socket can be opened before networking is up.</div><div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Helvetica Neue'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">Larry Baker<br>US Geological Survey<br>650-329-5608<br><a href="mailto:baker@usgs.gov">baker@usgs.gov</a><br><br><br></span>
</div>
<br><div><div>On 24 Jan 2013, at 4:03 PM, Lennart Poettering wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>On Thu, 24.01.13 14:08, Larry Baker (<a href="mailto:baker@usgs.gov">baker@usgs.gov</a>) wrote:<br><br><blockquote type="cite">I am converting the init script (see below) for Linux DECnet (<a href="http://sourceforge.net/projects/linux-decnet">http://sourceforge.net/projects/linux-decnet</a>).  This is my first exposure to systemd.  Naturally, my first try failed.  So, now I am taking baby steps.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">The Linux DECnet init script can start either or both the dnetd or<br></blockquote><blockquote type="cite">phoned daemons.  (I do not use the phoned daemon.)  I think the best<br></blockquote><blockquote type="cite">thing to do with smartd is make them separate service units.  I will<br></blockquote><blockquote type="cite">create /etc/systemd/system/dnetd.service and .../phoned.service.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Prior to starting the daemons, the init script verifies the<br></blockquote><blockquote type="cite">/etc/decnet.conf configuration file exists.  I will use the [Unit]<br></blockquote><blockquote type="cite">option ConditionFileNotEmpty=/etc/decnet.conf to replicate that<br></blockquote><blockquote type="cite">behavior.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Then it looks for evidence that the decnet kernel module is loaded by<br></blockquote><blockquote type="cite">testing for the file /proc/net/decnet.  If necessary, it loads the<br></blockquote><blockquote type="cite">decnet kernel module and checks again for /proc/net/decnet.  I have<br></blockquote><blockquote type="cite">already built the decnet kernel module and I can load it with<br></blockquote><blockquote type="cite">modprobe.  I do not wish to force an unconditional load of the decnet<br></blockquote><blockquote type="cite">kernel module using /etc/modules-load.d/decnet.conf; I prefer the<br></blockquote><blockquote type="cite">services that need it (dnetd and phoned) trigger the load.  However, I<br></blockquote><blockquote type="cite">find no mention of the standard systemd "load a kernel module"<br></blockquote><blockquote type="cite">practice.  I.e., there is no "systemd.module" unit.  What is the<br></blockquote><blockquote type="cite">recommended method in the systemd framework to trigger a unit that<br></blockquote><blockquote type="cite">loads a kernel module?  If the modprobe command fails, I presume that<br></blockquote><blockquote type="cite">will cause the systemd start command to fail.  I would also like the<br></blockquote><blockquote type="cite">systemd start command to fail if /proc/net/decnet is not created (a<br></blockquote><blockquote type="cite">sign that the module has not initialized itself correctly).  Is there<br></blockquote><blockquote type="cite">a syntax in a systemd unit for that as well?<br></blockquote><br>Usually the best way to handle this is to make the module auto-loadable<br>by the kernel, which makes the whole thing entirely transparent to<br>userspace. The first process using a DECNET socket would implicitly load<br>the module, just by invoking socket() and the kernel would do the rest.<br><br>This is usually done via MODALIAS strings for "net-pf-xyz" in the kernel<br>modules. If the decnet module currently doesn't support this it should<br>be a single line change.<br><br>Currently, many other protocol families that are implemented in kernel<br>modules already do that, including bluetooth, atm, irda, nfc. For a<br>precise list, see:<br><br>grep net-pf /lib/modules/`uname -r`/modules.alias<br><br>You have a good chance that adding that one MODALIAS name to your kernel<br>module will already allow you to drop any explicit modprobes from your<br>init scripts/units.<br><br>A temporary hack to achieve the same is by adding an "alias" line to<br>/etc/modprobe.d/ for the same mapping. That said, ultimately this really<br>should be fixed in the kernel.<br><br>Lennart<br><br>-- <br>Lennart Poettering - Red Hat, Inc.<br></div></blockquote></div><br></div></body></html>