tpws: disable simultaneous use of oob and disorder in BSD systems

This commit is contained in:
bol-van 2024-11-14 10:21:08 +03:00
parent 42090daf24
commit 4d47749e7c

View File

@ -499,6 +499,16 @@ void config_from_file(const char *filename)
} }
#endif #endif
#ifndef __linux__
static bool check_oob_disorder(const struct desync_profile *dp)
{
return !(
dp->oob && (dp->disorder || dp->disorder_http || dp->disorder_tls) ||
dp->oob_http && (dp->disorder || dp->disorder_http) ||
dp->oob_tls && (dp->disorder || dp->disorder_tls));
}
#endif
void parse_params(int argc, char *argv[]) void parse_params(int argc, char *argv[])
{ {
int option_index = 0; int option_index = 0;
@ -840,6 +850,13 @@ void parse_params(int argc, char *argv[])
} }
else else
dp->disorder = true; dp->disorder = true;
#ifndef __linux__
if (!check_oob_disorder(dp))
{
DLOG_ERR("--oob and --disorder work simultaneously only in linux. in this system it's guaranteed to fail.\n");
exit_clean(1);
}
#endif
break; break;
case 28: /* oob */ case 28: /* oob */
if (optarg) if (optarg)
@ -854,6 +871,13 @@ void parse_params(int argc, char *argv[])
} }
else else
dp->oob = true; dp->oob = true;
#ifndef __linux__
if (!check_oob_disorder(dp))
{
DLOG_ERR("--oob and --disorder work simultaneously only in linux. in this system it's guaranteed to fail.\n");
exit_clean(1);
}
#endif
break; break;
case 29: /* oob-data */ case 29: /* oob-data */
{ {