Blame SOURCES/dhcp-max-fd-value.patch

fad460
diff -up dhcp-4.2.5/includes/site.h.max-fd dhcp-4.2.5/includes/site.h
fad460
--- dhcp-4.2.5/includes/site.h.max-fd	2016-04-21 15:15:14.618846830 +0200
fad460
+++ dhcp-4.2.5/includes/site.h	2016-04-21 15:17:06.529731652 +0200
fad460
@@ -275,3 +275,9 @@
fad460
    Care should be taken before enabling this option. */
fad460
 
fad460
 /* #define SERVER_ID_CHECK */
fad460
+
fad460
+/* Limit the value of a file descriptor the serve will use
fad460
+   when accepting a connecting request.  This can be used to
fad460
+   limit the number of TCP connections that the server will
fad460
+   allow at one time.  A value of 0 means there is no limit.*/
fad460
+#define MAX_FD_VALUE 200
fad460
diff -up dhcp-4.2.5/omapip/listener.c.max-fd dhcp-4.2.5/omapip/listener.c
fad460
--- dhcp-4.2.5/omapip/listener.c.max-fd	2013-01-03 01:02:24.000000000 +0100
fad460
+++ dhcp-4.2.5/omapip/listener.c	2016-04-21 15:15:14.618846830 +0200
fad460
@@ -239,7 +239,12 @@ isc_result_t omapi_accept (omapi_object_
fad460
 			return ISC_R_NORESOURCES;
fad460
 		return ISC_R_UNEXPECTED;
fad460
 	}
fad460
-	
fad460
+
fad460
+	if ((MAX_FD_VALUE != 0) && (socket > MAX_FD_VALUE)) {
fad460
+		close(socket);
fad460
+		return (ISC_R_NORESOURCES);
fad460
+	}
fad460
+
fad460
 #if defined (TRACING)
fad460
 	/* If we're recording a trace, remember the connection. */
fad460
 	if (trace_record ()) {