From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yi0-f43.google.com (mail-yi0-f43.google.com [209.85.218.43]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (verified OK)) by huchra.bufferbloat.net (Postfix) with ESMTPS id CE9BF200AE5 for ; Wed, 28 Sep 2011 06:03:03 -0700 (PDT) Received: by yib17 with SMTP id 17so9037697yib.16 for ; Wed, 28 Sep 2011 06:03:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=gNeeSbs7cpvUMLAao2BH3MWaRFvO2zAmWPKfcIYEO+Q=; b=FEBGR5JVZOEniEUmkXKeoiM3G15V02hGe5L85buFG19WRTol2tysFQWMFsc0CqktUR 9gFcLABiU7Y3wTItIHG4L8Ewbv5/n/CXeOC9pIw8bqdBRoZBBFZGLiLJJPcGb40KuHSP 6orzj+WmHYg7raIssAy9aVfOZZw58L2L1jmLE= MIME-Version: 1.0 Received: by 10.150.176.13 with SMTP id y13mr4285249ybe.67.1317214982026; Wed, 28 Sep 2011 06:03:02 -0700 (PDT) Received: by 10.150.147.5 with HTTP; Wed, 28 Sep 2011 06:03:01 -0700 (PDT) In-Reply-To: <20110928124750.GR1128@ucc.gu.uwa.edu.au> References: <20110928124750.GR1128@ucc.gu.uwa.edu.au> Date: Wed, 28 Sep 2011 06:03:01 -0700 Message-ID: Subject: Re: [PATCH] Set TOS (TCLASS) bits under ipv6 From: Dave Taht To: Dave Taht , dropbear@ucc.asn.au, bloat-devel Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: bloat-devel@lists.bufferbloat.net X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Developers working on AQM, device drivers, and networking stacks" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2011 13:03:04 -0000 On Wed, Sep 28, 2011 at 5:47 AM, Matt Johnston wrote: > Hi, > > Thanks for the patch, it answers my commented question six > years later :) I was stumped on this one for even longer than that, so I'm pushing out the knowledge (and patches) as fast as I can. > What are the implications of "stomping on" > the ECN bit on pre-2.6.39 kernels? pre-2.6.39, you could actually set the IPv6 ECN bits from userspace, which was bad in most ways (good in another, in that you could test ECN from userspace programs). Notably as ECN is a negotiated inside-of-tcp option, then passed to the outside dscp field, calling setsockopt to reset it to effectively *off* is not a problem. setting ECN to *on* (e.g IP_TOS_LOWDELAY | 3) IS a problem, but we're not doing that... I tried to find ways to determine if I could find the existing ECN setting, to or in the bits... and failed. That said, ECN is not widely deployed (yet), and losing ECN capability in this case (on older kernels) only reverts the tcp connection to the default behavior of forcing a traffic shaper, to drop, rather than ECN mark packets. So there should be no ill effect on existing code with this change, and treating ssh packets over ipv6 as interactive helps a lot in the general case (and in the case of 6to4, the encapsulated packet header is copied to the outer header, so encapsulated 6to4 packets also can get prioritized right) > I agree flags for SCP would make sense, I'll take a look > where to do that. I think openssh does half the job (the scp side sets bulk), I haven't looked at it yet (mostly working on cerowrt right now) > 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. It would be a good experiment! I've got the current patch working in a cerowrt smoketest, seeing it also do more of the right thing in a sftp environment I can easily test. The 'experimental' part is when the setsockopt change would be asserted on the flow, thus reprioritizing packets possibly in flight? > > 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 >> --- >> =A0dbutil.c | =A0 =A06 ++++-- >> =A01 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) { >> =A0 =A0 =A0 val =3D 1; >> =A0 =A0 =A0 setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (void*)&val, size= of(val)); >> >> - =A0 =A0 /* set the TOS bit. note that this will fail for ipv6, I can't= find any >> - =A0 =A0 =A0* equivalent. */ >> + =A0 =A0 /* bruteforce the TOS bit for ipv4 or ipv6. Note that for vers= ions of >> + =A0 =A0 =A0 =A0 =A0 Linux prior to 2.6.39 this will stomp on the ECN b= it under IPv6 */ >> + >> =A0#ifdef IPTOS_LOWDELAY >> =A0 =A0 =A0 val =3D IPTOS_LOWDELAY; >> + =A0 =A0 setsockopt(sock, IPPROTO_IPV6, IPV6_TCLASS, (void*)&val, sizeo= f(val)); >> =A0 =A0 =A0 setsockopt(sock, IPPROTO_IP, IP_TOS, (void*)&val, sizeof(val= )); >> =A0#endif >> >> -- >> 1.7.4.1 >> >> >> -- >> Dave T=E4ht >> SKYPE: davetaht >> US Tel: 1-239-829-5608 >> http://the-edge.blogspot.com > --=20 Dave T=E4ht SKYPE: davetaht US Tel: 1-239-829-5608 http://the-edge.blogspot.com