From c9b1c6c3c7785ed179bd750d6e398ddbb1bff1c9 Mon Sep 17 00:00:00 2001 From: ume Date: Wed, 7 Aug 2002 17:03:14 +0000 Subject: Add capability for limiting the maximum number of simultaneous invocations of each service from a single IP address. Requested by: matusita Reviewed by: dwmalone Tested by: matusita on snapshots.jp.FreeBSD.org MFC after: 2 weeks --- usr.sbin/inetd/inetd.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'usr.sbin/inetd/inetd.h') diff --git a/usr.sbin/inetd/inetd.h b/usr.sbin/inetd/inetd.h index 1e0f088..3293364 100644 --- a/usr.sbin/inetd/inetd.h +++ b/usr.sbin/inetd/inetd.h @@ -36,6 +36,7 @@ #include #include #include +#include #include @@ -54,6 +55,21 @@ #define ISMUXPLUS(sep) ((sep)->se_type == MUXPLUS_TYPE) #define ISTTCP(sep) ((sep)->se_type == TTCP_TYPE) +struct procinfo { + LIST_ENTRY(procinfo) pr_link; + pid_t pr_pid; /* child pid */ + struct conninfo *pr_conn; +}; + +struct conninfo { + LIST_ENTRY(conninfo) co_link; + struct sockaddr_storage co_addr; /* source address */ + int co_numchild; /* current number of children */ + struct procinfo **co_proc; /* array of child proc entry */ +}; + +#define PERIPSIZE 256 + struct servtab { char *se_service; /* name of service */ int se_socktype; /* type of socket to use */ @@ -105,6 +121,8 @@ struct servtab { u_int se_nomapped : 1; u_int se_reset : 1; } se_flags; + int se_maxperip; /* max number of children per src */ + LIST_HEAD(, conninfo) se_conn[PERIPSIZE]; }; #define se_nomapped se_flags.se_nomapped -- cgit v1.1