Commit Graph
19 Commits
Author SHA1 Message Date
Jonas Johansson f522a26125 inetd: only restart inetd services when neccessary
Do not restart a inetd service if the listening interface is changed.
Only bring down established connection which are no longer allowed,
i.e. do not touch already allowed established connections.

Signed-off-by: Jonas Johansson <jonasj76@gmail.com>
2018-05-03 08:57:19 +02:00
Jonas Johansson af9a06466c inetd: stop inetd spawned child processes when stopping inetd service
Signed-off-by: Jonas Johansson <jonasj76@gmail.com>
2018-03-23 15:40:42 +01:00
Joachim Nilsson 2b6f00f126 Minor, whitespace
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-01-27 17:53:23 +01:00
Joachim Nilsson 2c904b5b44 service_unregister(): Also call inetd_del() for inetd services
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-01-19 16:07:22 +01:00
Joachim Nilsson 89a9d92d6c Refactor construction of inetd service connection description
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-01-10 01:41:14 +01:00
Joachim Nilsson 15cb576293 Fix v3.1 regression in start of inetd services, missing rlimit
Per service rlimit is new in v3.1.  When an inetd service connection is
created we do a selective copy from the parent inetd.  We also need to
copy the parent's rlimits, otherwise the child will be killed as soon
as the kernel starts it.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-01-10 01:36:24 +01:00
Joachim Nilsson bc35b42bd2 inet_stop(): Check argument and skip shutdown(), just close() socket
- Validate function argument
- Skip¹ shutdown() when closing a TCP socket, not needed

___
¹ also, shutdown() segfaults a late shutdown/reboot

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-28 20:46:19 +01:00
Joachim Nilsson 6f665ab283 inet_dgram_drop(): Fix control flow logic, found by Coverity Scan
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-24 10:31:19 +01:00
Joachim Nilsson 3f731aa5a3 inet_dgram_drop(): Check return value from recv()
Found by Coverity Scan.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-24 10:28:22 +01:00
Joachim Nilsson 8992e7bf2b Refactor svc_iterator() into a proper iterator, add first flag
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-22 23:56:14 +01:00
Joachim Nilsson 0f1f51b5ad Refactor, change from static array of svc_t to linked list
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-18 17:50:02 +01:00
Joachim Nilsson d7d8b8487d Refactor other iterators to use new re-entrant svc_iterator1() API
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-18 07:49:45 +01:00
Lennart Eriksson 0c75e59b77 Drop UDP packets from unwanted interfaces
Previously UDP packets were never dropped and if a request came
from a not valid interface inetd got stuck in an inifinite
loop looking at the same packet every time and not dropping it.

Signed-off-by: Lennart Eriksson <lennart.eriksson@westermo.se>
2017-12-14 10:34:07 +01:00
Joachim Nilsson 6826d7ee3f Handle event loop watcher failure modes
When alibuEv event watcher callback has `UEV_ERROR` in the events mask
we must handle the error.  Unfortunately, in most cases there is not
much we can do but ignore it or log the error.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-12 11:18:12 +01:00
Joachim Nilsson 49481053a4 Fix GCC 7 string truncation warning, too small temporary buffer
In GCC 7 the -Wall infers the new -Wformat-truncation which finds
problems with string truncation in functions like snprintf().

This patch suppresses the warning by allowing only a subset of the
parent inetd service description to be copied to the child connection.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-19 09:58:05 +02:00
Joachim Nilsson 91b3e5eeb4 inetd: Fix possible tcp socket leaks, found by Coverity Scan
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-18 22:37:21 +02:00
Joachim Nilsson 30822f0d68 Remove UNUSED() macro and disable the compiler warning instead
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-02 21:59:23 +02:00
Petrus Hellgren fafeaf661a inetd: remove ntoh on proto
getprotobyname() returns p_proto in host endian, so it should not be
converted with ntoh. (Note: getservbyname() on the other hand does
return s_port in network endian)

Signed-off-by: Petrus Hellgren <petrus.hellgren@westermo.se>
2017-04-25 10:39:09 +02:00
Joachim Nilsson fff68b7b06 Relocate source files to an src/ subdirectory
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-01-16 01:31:02 +01:00