mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-28 09:02:44 +00:00
- increase TOOMANY, in line with 1.x
- add logging option from 1.x
This commit is contained in:
parent
194165de5d
commit
bee39b42f3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=2659
@ -42,6 +42,7 @@
|
||||
.Sh SYNOPSIS
|
||||
.Nm inetd
|
||||
.Op Fl d
|
||||
.Op Fl l
|
||||
.Op Fl R Ar rate
|
||||
.Op Ar configuration file
|
||||
.Sh DESCRIPTION
|
||||
@ -72,6 +73,8 @@ The options available for
|
||||
.Bl -tag -width Ds
|
||||
.It Fl d
|
||||
Turns on debugging.
|
||||
.It Fl l
|
||||
Turns on logging.
|
||||
.It Fl R Ar rate
|
||||
Specifies the maximum number of times a service can be invoked
|
||||
in one minute; the default is 1000.
|
||||
@ -299,6 +302,15 @@ details of these services, consult the appropriate
|
||||
.Tn RFC
|
||||
from the Network Information Center.
|
||||
.Pp
|
||||
When given the
|
||||
.Fl l
|
||||
option
|
||||
.Nm Inetd
|
||||
will log an entry to syslog each time an
|
||||
.Xr accept 2
|
||||
is made, which notes the
|
||||
service selected and the IP-number of the remote requestor.
|
||||
.Pp
|
||||
The
|
||||
.Nm inetd
|
||||
program
|
||||
|
@ -125,7 +125,7 @@ static char RCSid[] = "$Id";
|
||||
|
||||
#include "pathnames.h"
|
||||
|
||||
#define TOOMANY 40 /* don't start more than TOOMANY */
|
||||
#define TOOMANY 256 /* don't start more than TOOMANY */
|
||||
#define CNT_INTVL 60 /* servers in CNT_INTVL sec. */
|
||||
#define RETRYTIME (60*10) /* retry after bind or server fail */
|
||||
|
||||
@ -133,6 +133,7 @@ static char RCSid[] = "$Id";
|
||||
|
||||
|
||||
int debug = 0;
|
||||
int log = 0;
|
||||
int nsock, maxsock;
|
||||
fd_set allsock;
|
||||
int options;
|
||||
@ -249,6 +250,8 @@ main(argc, argv, envp)
|
||||
int tmpint, ch, dofork;
|
||||
pid_t pid;
|
||||
char buf[50];
|
||||
struct sockaddr_in peer;
|
||||
int i;
|
||||
|
||||
Argv = argv;
|
||||
if (envp == 0 || *envp == 0)
|
||||
@ -259,12 +262,15 @@ main(argc, argv, envp)
|
||||
|
||||
openlog("inetd", LOG_PID | LOG_NOWAIT, LOG_DAEMON);
|
||||
|
||||
while ((ch = getopt(argc, argv, "dR:")) != EOF)
|
||||
while ((ch = getopt(argc, argv, "dlR:")) != EOF)
|
||||
switch(ch) {
|
||||
case 'd':
|
||||
debug = 1;
|
||||
options |= SO_DEBUG;
|
||||
break;
|
||||
case 'l':
|
||||
log = 1;
|
||||
break;
|
||||
case 'R': { /* invocation rate */
|
||||
char *p;
|
||||
|
||||
@ -280,7 +286,7 @@ main(argc, argv, envp)
|
||||
case '?':
|
||||
default:
|
||||
syslog(LOG_ERR,
|
||||
"usage: inetd [-d] [-R rate] [conf-file]");
|
||||
"usage: inetd [-dl] [-R rate] [conf-file]");
|
||||
exit(1);
|
||||
}
|
||||
argc -= optind;
|
||||
@ -347,6 +353,19 @@ main(argc, argv, envp)
|
||||
sep->se_service);
|
||||
continue;
|
||||
}
|
||||
if(log) {
|
||||
i = sizeof peer;
|
||||
if(getpeername(ctrl, (struct sockaddr *)
|
||||
&peer, &i)) {
|
||||
syslog(LOG_WARNING,
|
||||
"getpeername(for %s): %m",
|
||||
sep->se_service);
|
||||
continue;
|
||||
}
|
||||
syslog(LOG_INFO,"%s from %s",
|
||||
sep->se_service,
|
||||
inet_ntoa(peer.sin_addr));
|
||||
}
|
||||
/*
|
||||
* Call tcpmux to find the real service to exec.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user