From nobody@FreeBSD.org  Fri Apr 27 10:51:28 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id AEA691065670
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 27 Apr 2012 10:51:28 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 9775C8FC19
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 27 Apr 2012 10:51:28 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q3RApSJr075837
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 27 Apr 2012 10:51:28 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q3RApRWE075826;
	Fri, 27 Apr 2012 10:51:27 GMT
	(envelope-from nobody)
Message-Id: <201204271051.q3RApRWE075826@red.freebsd.org>
Date: Fri, 27 Apr 2012 10:51:27 GMT
From: Adri Koppes <adrik@salesmanager.nl>
To: freebsd-gnats-submit@FreeBSD.org
Subject: cc_htcp(4) module sysctl variables overwritten
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         167357
>Category:       kern
>Synopsis:       [cc_htcp] cc_htcp(4) module sysctl variables overwritten
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 27 11:00:21 UTC 2012
>Closed-Date:    Mon Jul 02 22:45:23 CEST 2012
>Last-Modified:  Mon Jul 02 22:45:23 CEST 2012
>Originator:     Adri Koppes
>Release:        8.3-RELEASE
>Organization:
SalesManager Software B.V.
>Environment:
FreeBSD mail.salesmanager.nl 8.3-RELEASE FreeBSD 8.3-RELEASE #11: Mon Apr 23 17:07:46 CEST 2012     root@mail.salesmanager.nl:/usr/obj/usr/src/sys/MAIL  amd64

>Description:
When using sysctl to change variables of the cc_htcp(4) module, changing 1 variable will also change the values of other variables.

>How-To-Repeat:
# kldload cc_htcp.ko
# sysctl net.inet.tcp.cc.htcp
net.inet.tcp.cc.htcp.rtt_scaling: 0
net.inet.tcp.cc.htcp.adaptive_backoff: 0
# sysctl net.inet.tcp.cc.htcp.rtt_scaling=1
net.inet.tcp.cc.htcp.rtt_scaling: 0 -> 1
# sysctl net.inet.tcp.cc.htcp
net.inet.tcp.cc.htcp.rtt_scaling: 1
net.inet.tcp.cc.htcp.adaptive_backoff: 0
# sysctl net.inet.tcp.cc.htcp.adaptive_backoff=1
net.inet.tcp.cc.htcp.adaptive_backoff: 0 -> 1
# sysctl net.inet.tcp.cc.htcp
net.inet.tcp.cc.htcp.rtt_scaling: 257
net.inet.tcp.cc.htcp.adaptive_backoff: 1

>Fix:
The problem is probably caused by a mismatch in variable declaration and
sysctl definition in /usr/src/sys/netinet/cc/cc_htcp.c.

Line 171:

static VNET_DEFINE(uint8_t, htcp_adaptive_backoff) = 0;
static VNET_DEFINE(uint8_t, htcp_rtt_scaling) = 0;

Line 515:

SYSCTL_VNET_UINT(_net_inet_tcp_cc_htcp, OID_AUTO, adaptive_backoff, CTLFLAG_RW,
    &VNET_NAME(htcp_adaptive_backoff), 0, "enable H-TCP adaptive backoff");
SYSCTL_VNET_UINT(_net_inet_tcp_cc_htcp, OID_AUTO, rtt_scaling, CTLFLAG_RW,
    &VNET_NAME(htcp_rtt_scaling), 0, "enable H-TCP RTT scaling");


>Release-Note:
>Audit-Trail:

From: "Adri Koppes" <adrik@salesmanager.nl>
To: <bug-followup@FreeBSD.org>
Cc:  
Subject: Re: kern/167357: [cc_htcp] cc_htcp(4) module sysctl variables overwritten
Date: Tue, 8 May 2012 11:34:28 +0200

 This is a multi-part message in MIME format.
 
 ------_=_NextPart_001_01CD2CFD.C3D6CF76
 Content-Type: text/plain;
 	charset="us-ascii"
 Content-Transfer-Encoding: quoted-printable
 
 The following patch fixes the problem:
 
 =20
 
 --- cc_htcp.c.orig             2012-04-09 18:18:55.117275946 +0200
 
 +++ cc_htcp.c   2012-05-08 11:21:14.513094522 +0200
 
 @@ -168,8 +168,8 @@
 
 static int htcp_max_diff =3D INT_MAX / ((1 << HTCP_ALPHA_INC_SHIFT) * =
 10);
 
  /* Per-netstack vars. */
 
 -static VNET_DEFINE(uint8_t, htcp_adaptive_backoff) =3D 0;
 
 -static VNET_DEFINE(uint8_t, htcp_rtt_scaling) =3D 0;
 
 +static VNET_DEFINE(u_int, htcp_adaptive_backoff) =3D 0;
 
 +static VNET_DEFINE(u_int, htcp_rtt_scaling) =3D 0;
 
 #define              V_htcp_adaptive_backoff
 VNET(htcp_adaptive_backoff)
 
 #define              V_htcp_rtt_scaling    VNET(htcp_rtt_scaling)
 
 =20
 
 =20
 
 
 ------_=_NextPart_001_01CD2CFD.C3D6CF76
 Content-Type: text/html;
 	charset="us-ascii"
 Content-Transfer-Encoding: quoted-printable
 
 <html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
 xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
 xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
 xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
 xmlns=3D"http://www.w3.org/TR/REC-html40"><head><meta =
 http-equiv=3DContent-Type content=3D"text/html; =
 charset=3Dus-ascii"><meta name=3DGenerator content=3D"Microsoft Word 14 =
 (filtered medium)"><style><!--
 /* Font Definitions */
 @font-face
 	{font-family:"Cambria Math";
 	panose-1:2 4 5 3 5 4 6 3 2 4;}
 @font-face
 	{font-family:Calibri;
 	panose-1:2 15 5 2 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
 	{margin:0cm;
 	margin-bottom:.0001pt;
 	font-size:11.0pt;
 	font-family:"Calibri","sans-serif";
 	mso-fareast-language:EN-US;}
 a:link, span.MsoHyperlink
 	{mso-style-priority:99;
 	color:blue;
 	text-decoration:underline;}
 a:visited, span.MsoHyperlinkFollowed
 	{mso-style-priority:99;
 	color:purple;
 	text-decoration:underline;}
 span.EmailStyle17
 	{mso-style-type:personal-compose;
 	font-family:"Calibri","sans-serif";
 	color:windowtext;}
 .MsoChpDefault
 	{mso-style-type:export-only;
 	font-size:10.0pt;}
 @page WordSection1
 	{size:612.0pt 792.0pt;
 	margin:70.85pt 70.85pt 70.85pt 70.85pt;}
 div.WordSection1
 	{page:WordSection1;}
 --></style><!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
 </xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext=3D"edit">
 <o:idmap v:ext=3D"edit" data=3D"1" />
 </o:shapelayout></xml><![endif]--></head><body lang=3DNL link=3Dblue =
 vlink=3Dpurple><div class=3DWordSection1><p class=3DMsoNormal><span =
 lang=3DEN-US>The following patch fixes the =
 problem:<o:p></o:p></span></p><p class=3DMsoNormal><span =
 lang=3DEN-US><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal>--- =
 cc_htcp.c.orig&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
 ;&nbsp;&nbsp; 2012-04-09 18:18:55.117275946 +0200<o:p></o:p></p><p =
 class=3DMsoNormal>+++ cc_htcp.c&nbsp;&nbsp; 2012-05-08 =
 11:21:14.513094522 +0200<o:p></o:p></p><p class=3DMsoNormal><span =
 lang=3DEN-US>@@ -168,8 +168,8 @@<o:p></o:p></span></p><p =
 class=3DMsoNormal><span lang=3DEN-US> static int htcp_max_diff =3D =
 INT_MAX / ((1 &lt;&lt; HTCP_ALPHA_INC_SHIFT) * =
 10);<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US> =
 <o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US>&nbsp;/* =
 Per-netstack vars. */<o:p></o:p></span></p><p class=3DMsoNormal><span =
 lang=3DEN-US>-static VNET_DEFINE(uint8_t, htcp_adaptive_backoff) =3D =
 0;<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US>-static =
 VNET_DEFINE(uint8_t, htcp_rtt_scaling) =3D 0;<o:p></o:p></span></p><p =
 class=3DMsoNormal><span lang=3DEN-US>+static VNET_DEFINE(u_int, =
 htcp_adaptive_backoff) =3D 0;<o:p></o:p></span></p><p =
 class=3DMsoNormal><span lang=3DEN-US>+static VNET_DEFINE(u_int, =
 htcp_rtt_scaling) =3D 0;<o:p></o:p></span></p><p class=3DMsoNormal><span =
 lang=3DEN-US> =
 #define&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 &nbsp;&nbsp; V_htcp_adaptive_backoff&nbsp;&nbsp;&nbsp; =
 VNET(htcp_adaptive_backoff)<o:p></o:p></span></p><p =
 class=3DMsoNormal><span lang=3DEN-US> =
 #define&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 &nbsp;&nbsp; V_htcp_rtt_scaling&nbsp;&nbsp;&nbsp; =
 VNET(htcp_rtt_scaling)<o:p></o:p></span></p><p class=3DMsoNormal><span =
 lang=3DEN-US><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal><span =
 lang=3DEN-US><o:p>&nbsp;</o:p></span></p></div></body></html>
 ------_=_NextPart_001_01CD2CFD.C3D6CF76--
State-Changed-From-To: open->closed 
State-Changed-By: brueffer 
State-Changed-When: Mon Jul 2 22:43:30 CEST 2012 
State-Changed-Why:  
This had been fixed in HEAD in January 2011, however not been merged 
back to RELENG_8.  This just happened in SVN r238027, so the problem 
is fixed. 

Thanks for the report! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=167357 
>Unformatted:
