diff netio.c @ 1859:1d86a58fb52d

Leave non-interactive at default QoS class Lower class levels are less well defined, and non-interactive SSH can carry various different types of applications. This change also sets lowdelay class (AF21) earlier in an an outbound dbclient session
author Matt Johnston <matt@ucc.asn.au>
date Thu, 27 Jan 2022 14:34:10 +0800
parents 6022df862942
children 5001e9c5641f
line wrap: on
line diff
--- a/netio.c	Tue Jan 25 17:32:20 2022 +0800
+++ b/netio.c	Thu Jan 27 14:34:10 2022 +0800
@@ -20,6 +20,7 @@
 
 	char* errstring;
 	char *bind_address, *bind_port;
+	enum dropbear_prio prio;
 };
 
 /* Deallocate a progress connection. Removes from the pending list if iter!=NULL.
@@ -110,6 +111,7 @@
 
 		ses.maxfd = MAX(ses.maxfd, c->sock);
 		set_sock_nodelay(c->sock);
+		set_sock_priority(c->sock, c->prio);
 		setnonblocking(c->sock);
 
 #if DROPBEAR_CLIENT_TCP_FAST_OPEN
@@ -172,8 +174,8 @@
 
 /* Connect via TCP to a host. */
 struct dropbear_progress_connection *connect_remote(const char* remotehost, const char* remoteport,
-	connect_callback cb, void* cb_data, 
-	const char* bind_address, const char* bind_port)
+	connect_callback cb, void* cb_data,
+	const char* bind_address, const char* bind_port, enum dropbear_prio prio)
 {
 	struct dropbear_progress_connection *c = NULL;
 	int err;
@@ -185,6 +187,7 @@
 	c->sock = -1;
 	c->cb = cb;
 	c->cb_data = cb_data;
+	c->prio = prio;
 
 	list_append(&ses.conn_pending, c);
 
@@ -378,10 +381,8 @@
 	/* Set the DSCP field for outbound IP packet priority.
 	rfc4594 has some guidance to meanings.
 
-	We set AF21 as "Low-Latency" class for interactive (tty session).
-	Set AF11 "High-Throughput" for bulk data (which includes things
-	such as git over ssh). We usually want higher priority than
-	CS1/LE least effort.
+	We set AF21 as "Low-Latency" class for interactive (tty session,
+	also handshake/setup packets). Other traffic is left at the default.
 
 	OpenSSH at present uses AF21/CS1, rationale
 	https://cvsweb.openbsd.org/src/usr.bin/ssh/readconf.c#rev1.284
@@ -391,8 +392,6 @@
 	*/
 	if (prio == DROPBEAR_PRIO_LOWDELAY) {
 		val = IPTOS_DSCP_AF21;
-	} else if (prio == DROPBEAR_PRIO_BULK) {
-		val = IPTOS_DSCP_AF11;
 	} else {
 		val = 0; /* default */
 	}
@@ -412,8 +411,6 @@
 	/* Set scheduling priority within the local Linux network stack */
 	if (prio == DROPBEAR_PRIO_LOWDELAY) {
 		val = TC_PRIO_INTERACTIVE;
-	} else if (prio == DROPBEAR_PRIO_BULK) {
-		val = TC_PRIO_BULK;
 	} else {
 		val = 0;
 	}