[PATCH] Set TOS (TCLASS) bits under ipv6

Matt Johnston matt at ucc.asn.au
Wed Sep 28 20:47:50 WST 2011


Hi,

Thanks for the patch, it answers my commented question six
years later :) What are the implications of "stomping on"
the ECN bit on pre-2.6.39 kernels?

I agree flags for SCP would make sense, I'll take a look
where to do that. I'm not sure how to handle SFTP since
lookup commands should remain responsive, especially for
things like sshfs. I don't know whether changing socket
options frequently works OK.

Cheers,
Matt

On Wed, Sep 28, 2011 at 04:58:24AM -0700, Dave Taht wrote:
> Setting the TCLASS (TOS) field requires different setsockopt
> params on ipv6 than ipv4.
> 
> as per:
> 
> http://www.bufferbloat.net/projects/cerowrt/issues/249
> ---
>  dbutil.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/dbutil.c b/dbutil.c
> index b3a119f..2739d2f 100644
> --- a/dbutil.c
> +++ b/dbutil.c
> @@ -161,10 +161,12 @@ static void set_sock_priority(int sock) {
>  	val = 1;
>  	setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (void*)&val, sizeof(val));
> 
> -	/* set the TOS bit. note that this will fail for ipv6, I can't find any
> -	 * equivalent. */
> +	/* bruteforce the TOS bit for ipv4 or ipv6. Note that for versions of
> +           Linux prior to 2.6.39 this will stomp on the ECN bit under IPv6 */
> +
>  #ifdef IPTOS_LOWDELAY
>  	val = IPTOS_LOWDELAY;
> +	setsockopt(sock, IPPROTO_IPV6, IPV6_TCLASS, (void*)&val, sizeof(val));
>  	setsockopt(sock, IPPROTO_IP, IP_TOS, (void*)&val, sizeof(val));
>  #endif
> 
> -- 
> 1.7.4.1
> 
> 
> --
> Dave Täht
> SKYPE: davetaht
> US Tel: 1-239-829-5608
> http://the-edge.blogspot.com


More information about the Dropbear mailing list