From owner-p4-projects@FreeBSD.ORG Tue Jun 21 07:23:20 2011 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5859C1065674; Tue, 21 Jun 2011 07:23:20 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 121B7106566C for ; Tue, 21 Jun 2011 07:23:20 +0000 (UTC) (envelope-from cnicutar@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id DABA08FC08 for ; Tue, 21 Jun 2011 07:23:19 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id p5L7NJ6Z027123 for ; Tue, 21 Jun 2011 07:23:19 GMT (envelope-from cnicutar@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id p5L7NJBP027120 for perforce@freebsd.org; Tue, 21 Jun 2011 07:23:19 GMT (envelope-from cnicutar@freebsd.org) Date: Tue, 21 Jun 2011 07:23:19 GMT Message-Id: <201106210723.p5L7NJBP027120@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to cnicutar@freebsd.org using -f From: Catalin Nicutar To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 195083 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2011 07:23:20 -0000 http://p4web.freebsd.org/@@195083?ac=10 Change 195083 by cnicutar@cnicutar_cronos on 2011/06/21 07:23:07 Record the received UTO for a connection. The value can be retrieved using TCP_RCVUTO_TIMEOUT. Affected files ... .. //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_input.c#2 edit Differences ... ==== //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_input.c#2 (text+ko) ==== @@ -1082,12 +1082,26 @@ * SYN appears to be valid. Create compressed TCP state * for syncache. */ + #ifdef TCPDEBUG if (so->so_options & SO_DEBUG) tcp_trace(TA_INPUT, ostate, tp, (void *)tcp_saveipgen, &tcp_savetcp, 0); #endif tcp_dooptions(&to, optp, optlen, TO_SYN); + + if (to.to_flags & TOF_UTO) { + if (tp->t_flags & TF_RCV_UTO) + tp->rcv_uto = (to.to_uto & 0x8000) ? + (to.to_uto & 0x7FFF) * 60 : to.to_uto; + + /* + * XXX-CN Using option both for send and receive. + * Clear it for syncache. + */ + to.to_flags &= ~TOF_UTO; + } + syncache_add(&inc, &to, th, inp, &so, m); /* * Entry added to syncache and mbuf consumed. @@ -1270,6 +1284,11 @@ (th->th_off << 2) - sizeof(struct tcphdr), (thflags & TH_SYN) ? TO_SYN : 0); + /* Processing received UTO. */ + if ((to.to_flags & TOF_UTO) && (tp->t_flags & TF_RCV_UTO)) + tp->rcv_uto = (to.to_uto & 0x8000) ? + (to.to_uto & 0x7FFF) * 60 : to.to_uto; + /* * If echoed timestamp is later than the current time, * fall back to non RFC1323 RTT calculation. Normalize @@ -3029,6 +3048,17 @@ to->to_sacks = cp + 2; TCPSTAT_INC(tcps_sack_rcv_blocks); break; + case TCPOPT_UTO: + if (optlen != TCPOLEN_UTO) + continue; + if (!V_uto_enable) + continue; + to->to_flags |= TOF_UTO; + bcopy((char *)cp + 2, + (char *)&to->to_uto, sizeof(to->to_uto)); + to->to_uto = htons(to->to_uto); + /* Avoid converting to seconds: it might overflow. */ + break; default: continue; }