Make IP Type-Of-Service feature optional

Add new -z commandline option which when set, disables new IP TOS
feature.

References: https://github.com/openwrt/openwrt/issues/10405
Signed-off-by: Petr Štetiar <ynezz@true.cz>
This commit is contained in:
Petr Štetiar 2022-08-26 09:10:54 +02:00 committed by Matt Johnston
parent 0e70732e1e
commit 2864c3d154
4 changed files with 13 additions and 0 deletions

View File

@ -98,6 +98,7 @@ static void printhelp() {
#if DEBUG_TRACE
"-v verbose (repeat for more verbose)\n"
#endif
"-z disable IP Type-Of-Service feature\n"
,DROPBEAR_VERSION, cli_opts.progname,
#if DROPBEAR_CLI_PUBKEY_AUTH
DROPBEAR_DEFAULT_CLI_AUTHKEY,
@ -325,6 +326,9 @@ void cli_getopts(int argc, char ** argv) {
case 'b':
next = &bind_arg;
break;
case 'z':
opts.disable_ip_tos = 1;
break;
default:
fprintf(stderr,
"WARNING: Ignoring unknown option -%c\n", c);

View File

@ -3,6 +3,7 @@
#include "dbutil.h"
#include "session.h"
#include "debug.h"
#include "runopts.h"
struct dropbear_progress_connection {
struct addrinfo *res;
@ -377,6 +378,7 @@ void set_sock_priority(int sock, enum dropbear_prio prio) {
/* Don't log ENOTSOCK errors so that this can harmlessly be called
* on a client '-J' proxy pipe */
if (opts.disable_ip_tos == 0) {
#ifdef IP_TOS
/* Set the DSCP field for outbound IP packet priority.
rfc4594 has some guidance to meanings.
@ -409,6 +411,7 @@ void set_sock_priority(int sock, enum dropbear_prio prio) {
TRACE(("Couldn't set IP_TOS (%s)", strerror(errno)));
}
#endif /* IP_TOS */
}
#ifdef HAVE_LINUX_PKT_SCHED_H
/* Set scheduling priority within the local Linux network stack */

View File

@ -33,6 +33,7 @@
typedef struct runopts {
int disable_ip_tos;
#if DROPBEAR_SVR_REMOTETCPFWD || DROPBEAR_CLI_LOCALTCPFWD \
|| DROPBEAR_CLI_REMOTETCPFWD
int listen_fwd_all;

View File

@ -112,6 +112,7 @@ static void printhelp(const char * progname) {
#if DEBUG_TRACE
"-v verbose (repeat for more verbose)\n"
#endif
"-z disable IP Type-Of-Service feature\n"
,DROPBEAR_VERSION, progname,
#if DROPBEAR_DSS
DSS_PRIV_FILENAME,
@ -201,6 +202,7 @@ void svr_getopts(int argc, char ** argv) {
#if DROPBEAR_SVR_REMOTETCPFWD
opts.listen_fwd_all = 0;
#endif
opts.disable_ip_tos = 0;
for (i = 1; i < (unsigned int)argc; i++) {
if (argv[i][0] != '-' || argv[i][1] == '\0')
@ -324,6 +326,9 @@ void svr_getopts(int argc, char ** argv) {
print_version();
exit(EXIT_SUCCESS);
break;
case 'z':
opts.disable_ip_tos = 1;
break;
default:
fprintf(stderr, "Invalid option -%c\n", c);
printhelp(argv[0]);