-SYSCTL_INT(_kern_ipc, OID_AUTO, soqlencomp, CTLFLAG_RW | CTLFLAG_LOCKED,
- &soqlencomp, 0, "Listen backlog represents only complete queue");
+/*
+ * Hack alert -- rdar://33572856
+ * A loopback test we cannot change was failing because it sets
+ * SO_SENDTIMEO to 5 seconds and that's also the value
+ * of the minimum persist timer. Because of the persist timer,
+ * the connection was not idle for 5 seconds and SO_SNDTIMEO
+ * was not triggering at 5 seconds causing the test failure.
+ * As a workaround we check the sysctl soqlencomp the test is already
+ * setting to set disable auto tuning of the receive buffer.
+ */
+
+extern u_int32_t tcp_do_autorcvbuf;
+
+static int
+sysctl_soqlencomp SYSCTL_HANDLER_ARGS
+{
+#pragma unused(oidp, arg1, arg2)
+ u_int32_t new_value;
+ int changed = 0;
+ int error = sysctl_io_number(req, soqlencomp, sizeof (u_int32_t),
+ &new_value, &changed);
+ if (!error && changed) {
+ soqlencomp = new_value;
+ if (new_value != 0) {
+ tcp_do_autorcvbuf = 0;
+ tcptv_persmin_val = 6 * TCP_RETRANSHZ;
+ }
+ }
+ return (error);
+}
+SYSCTL_PROC(_kern_ipc, OID_AUTO, soqlencomp,
+ CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_LOCKED,
+ &soqlencomp, 0, &sysctl_soqlencomp, "IU", "");