Handling per-network interface specific services dependancies
Currently there is no standard way to handle init.d services that depend on specific network interfaces.
However if the Openssh server is configured (in /etc/ssh/sshd_config) to bind to one or more specific IP addresses (via ListenAddress) the /etc/init.d/sshd script detects this and indicates:
You are binding an interface in ListenAddress statement in your sshd_config!
You must add rc_need="net.FOO" to your /etc/conf.d/sshd
where FOO is the interface(s) providing the following address(es):
For now, as I am using static IP addressing, I have created multiple scripts in /etc/init.d, one per interface, derived from /etc/init.d/net-online that check that the interface is up, and have added a entry to /etc/conf.d/sshd:
rc_need="net-interface-<INTERFACENAME>"
which the relevant script then provides. I have also locally added such rc_need entries in the conf.d files for other network daemons that I'm binding to specific network interfaces and it now all works as expected.
This approach obviously works in the situation of knowing which interfaces will exist ahead of time and setting up the init.d scripts for them, and so it doesn't cater for "unknown" dynamic interfaces (i.e. different machines with different numbers or names of interfaces).
In the longer term @kaniini's and @skarnet's vision of s6 and ifupdown-ng would likely give the flexibility to provide per interface services dependancies (indeed per-SSID in the case of WiFi).
In the short to medium term I'm wondering how this issue can be addressed. The fact that the Openssh server package detects the need for a per-interface dependancy implies someone else previously thought of this issue.