comparison netio.c @ 1860:5001e9c5641f default tip main master

Merge netio changes
author Matt Johnston <matt@ucc.asn.au>
date Thu, 27 Jan 2022 15:09:29 +0800
parents 1d86a58fb52d ed3326f21888
children
comparison
equal deleted inserted replaced
1859:1d86a58fb52d 1860:5001e9c5641f
375 } 375 }
376 #endif 376 #endif
377 /* Don't log ENOTSOCK errors so that this can harmlessly be called 377 /* Don't log ENOTSOCK errors so that this can harmlessly be called
378 * on a client '-J' proxy pipe */ 378 * on a client '-J' proxy pipe */
379 379
380 #ifdef IPTOS_DSCP_AF21 380 #ifdef IP_TOS
381 /* Set the DSCP field for outbound IP packet priority. 381 /* Set the DSCP field for outbound IP packet priority.
382 rfc4594 has some guidance to meanings. 382 rfc4594 has some guidance to meanings.
383 383
384 We set AF21 as "Low-Latency" class for interactive (tty session, 384 We set AF21 as "Low-Latency" class for interactive (tty session,
385 also handshake/setup packets). Other traffic is left at the default. 385 also handshake/setup packets). Other traffic is left at the default.
387 OpenSSH at present uses AF21/CS1, rationale 387 OpenSSH at present uses AF21/CS1, rationale
388 https://cvsweb.openbsd.org/src/usr.bin/ssh/readconf.c#rev1.284 388 https://cvsweb.openbsd.org/src/usr.bin/ssh/readconf.c#rev1.284
389 389
390 Old Dropbear/OpenSSH and Debian/Ubuntu OpenSSH (at Jan 2022) use 390 Old Dropbear/OpenSSH and Debian/Ubuntu OpenSSH (at Jan 2022) use
391 IPTOS_LOWDELAY/IPTOS_THROUGHPUT 391 IPTOS_LOWDELAY/IPTOS_THROUGHPUT
392
393 DSCP constants are from Linux headers, applicable to other platforms
394 such as macos.
392 */ 395 */
393 if (prio == DROPBEAR_PRIO_LOWDELAY) { 396 if (prio == DROPBEAR_PRIO_LOWDELAY) {
394 val = IPTOS_DSCP_AF21; 397 val = 0x48; /* IPTOS_DSCP_AF21 */
395 } else { 398 } else {
396 val = 0; /* default */ 399 val = 0; /* default */
397 } 400 }
398 #if defined(IPPROTO_IPV6) && defined(IPV6_TCLASS) 401 #if defined(IPPROTO_IPV6) && defined(IPV6_TCLASS)
399 rc = setsockopt(sock, IPPROTO_IPV6, IPV6_TCLASS, (void*)&val, sizeof(val)); 402 rc = setsockopt(sock, IPPROTO_IPV6, IPV6_TCLASS, (void*)&val, sizeof(val));
403 #endif 406 #endif
404 rc = setsockopt(sock, IPPROTO_IP, IP_TOS, (void*)&val, sizeof(val)); 407 rc = setsockopt(sock, IPPROTO_IP, IP_TOS, (void*)&val, sizeof(val));
405 if (rc < 0 && errno != ENOTSOCK) { 408 if (rc < 0 && errno != ENOTSOCK) {
406 TRACE(("Couldn't set IP_TOS (%s)", strerror(errno))); 409 TRACE(("Couldn't set IP_TOS (%s)", strerror(errno)));
407 } 410 }
408 #endif 411 #endif /* IP_TOS */
409 412
410 #ifdef HAVE_LINUX_PKT_SCHED_H 413 #ifdef HAVE_LINUX_PKT_SCHED_H
411 /* Set scheduling priority within the local Linux network stack */ 414 /* Set scheduling priority within the local Linux network stack */
412 if (prio == DROPBEAR_PRIO_LOWDELAY) { 415 if (prio == DROPBEAR_PRIO_LOWDELAY) {
413 val = TC_PRIO_INTERACTIVE; 416 val = TC_PRIO_INTERACTIVE;