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

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