Bug #2677
openinetd service encounters problems if supplementary methods are defined
0%
Description
According to inetd(1m), if a method is specified for inetd_online this should allow for certain preparation of the operating environment before a service begins to start handling requests.
Similarly, if inetd_offline, or inetd_disable are specified, this should allow a service to be gracefully shutdown.
The author's use case for the inetd service is as a server of a VirtualBox VM on quasi-demand whereby a person connecting to inetd using rdp invokes the starting of the VM and the routing of ip traffic using netcat (/usr/bin/nc) where the user has the choice to shutdown the VM or leave it running. If the VM is shutdown, the user may log in to re-instate the VM. If the connection is merely broken however, the VM may continue to run and the user can subsequently connect to it again.
It would be useful to enable graceful shutdown of the running VM and for general housekeeping processes to take place on the inetd_online and inetd_offline / inetd_disable events.
Installing an inetd smf manifest that contains a methods as follows
<exec_method name='inetd_online' type='method' exec='script.sh' timeout_seconds='0'> <method_context> <method_credential user='root' group='root'/> </method_context> </exec> <exec_method name='inetd_offline' type='method' exec='script.sh' timeout_seconds='0'> <method_context> <method_credential user='root' group='root'/> </method_context> </exec>
On a call to script.sh that returns ${SMF_EXIT_OK} for each, the svcs --xv command reports that the service is offline** citing the following reasons --
inetd_online
Reason: Start method is running.
See: http://sun.com/msg/SMF-8000-C4
Impact: This service is not running.
inetd_offline
Reason: Transitioning to state offline.
See: http://sun.com/msg/SMF-8000-PH
Impact: This service is not running.
My understanding of the SMF/inetd documentation is that these two methods ought to allow for processes to be run on each respective event and, accordingly, I believe this may be a bug.
I have traced the potential source of the bug to void process_terminated_methods(void), which calls void process_non_start_term(instance_t *inst, int status), in (method.c) and (inetd.c) respectively. It would be helpful to clarify the intended behaviour of this part of SMF to enable an appropriate bug fix to be proposed. In any event, if the proposed behaviour is not correct, it would be helpful to amend the inetd(1m) man page to reflect any limitation of inetd method calls.
Updated by Roger Bisson about 11 years ago
The behaviour of SMF referred to above was observed on OpenIndiana 151a3.
Updated by Roger Bisson about 11 years ago
- Status changed from New to In Progress
- Assignee set to Roger Bisson