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

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