From alfred@FreeBSD.org  Sat Jan 17 20:25:30 2009
Return-Path: <alfred@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 17FDC106564A
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 17 Jan 2009 20:25:30 +0000 (UTC)
	(envelope-from alfred@FreeBSD.org)
Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28])
	by mx1.freebsd.org (Postfix) with ESMTP id E013C8FC12
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 17 Jan 2009 20:25:29 +0000 (UTC)
	(envelope-from alfred@FreeBSD.org)
Received: from freefall.freebsd.org (alfred@localhost [127.0.0.1])
	by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n0HKPTpq082236
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 17 Jan 2009 20:25:29 GMT
	(envelope-from alfred@freefall.freebsd.org)
Received: (from alfred@localhost)
	by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n0HKPT8V082235;
	Sat, 17 Jan 2009 20:25:29 GMT
	(envelope-from alfred)
Message-Id: <200901172025.n0HKPT8V082235@freefall.freebsd.org>
Date: Sat, 17 Jan 2009 20:25:29 GMT
From: Alfred Perlstein <alfred@FreeBSD.org>
Reply-To: Alfred Perlstein <alfred@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: ipv6 bugfix, need review.                                         
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         130657
>Category:       kern
>Synopsis:       [ip6] [patch] ipv6 class option
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnn
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan 17 20:30:01 UTC 2009
>Closed-Date:    
>Last-Modified:  Sun May 18 05:02:06 UTC 2014
>Originator:     Alfred Perlstein
>Release:        FreeBSD 7.1-PRERELEASE i386
>Organization:
Juniper Networks
>Environment:
System: FreeBSD freefall.freebsd.org 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #36: Mon Dec 29 15:15:30 UTC 2008 simon@freefall.freebsd.org:/usr/src/sys/i386/compile/FREEFALL i386


>Description:
	This is in a private version of FreeBSD we have, but the code
        seems to be somewhat close to what we have in FreeBSD.
        
>How-To-Repeat:
	Source inspection, see email audit trail for more information.
>Fix:

Index: bsd/sys/netinet/tcp_syncache.c                                           
===================================================================             
RCS file: /cvs/junos-2008/bsd/sys/netinet/tcp_syncache.c,v                      
retrieving revision 1.24                                                        
diff -p -u -r1.24 tcp_syncache.c                                                
--- bsd/sys/netinet/tcp_syncache.c      29 Jul 2008 17:07:43 -0000      1.24    
+++ bsd/sys/netinet/tcp_syncache.c      16 Dec 2008 19:23:31 -0000              
@@ -1271,6 +1271,7 @@ syncache_respond(sc, m)                                   
        struct inpcb *inp;                                                      
 #ifdef INET6                                                                   
        struct ip6_hdr *ip6 = NULL;                                             
+       int inp_tclass;                                                         
 #endif                                                                         
        struct rt_nexthop *minmtu_nh;                                           
        struct route_table *rtb = NULL;                                         
@@ -1387,6 +1388,12 @@ syncache_respond(sc, m)                                  
                /* ip6_hlim is set after checksum */                            
                ip6->ip6_flow &= ~IPV6_FLOWLABEL_MASK;                          
                ip6->ip6_flow |= sc->sc_flowlabel;                              
+               /* Set the TC for IPv6 just like TOS for IPv4 */                
+               ip6->ip6_flow &= ~IPV6_CLASS_MASK;                              
+               if (inp) {                                                      
+                   inp_tclass = IPV6_GET_CLASS(inp->in6p_flowinfo);            
+                   ip6->ip6_flow |= IPV6_SET_CLASS(inp_tclass);                
+               }                                                               
                                                                                
                th = (struct tcphdr *)(ip6 + 1);                                
        } else                                                                  


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->bz 
Responsible-Changed-By: alfred 
Responsible-Changed-When: Sat Jan 17 20:37:13 UTC 2009 
Responsible-Changed-Why:  
Bjoern asked for this bug. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=130657 

From: Alfred Perlstein <alfred@freebsd.org>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/130657: ipv6 bugfix, need review.
Date: Sat, 17 Jan 2009 12:47:31 -0800

 adding mailing list discussion to audit trail.
 
 
 ----- Forwarded message from "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net> -----
 
 From: "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>
 To: Alfred Perlstein <alfred@freebsd.org>
 cc: net@freebsd.org
 Subject: Re: ipv6 bugfix, need review.
 Date: Wed, 24 Dec 2008 23:13:17 +0000 (UTC)
 Message-ID: <20081224230540.C97918@maildrop.int.zabbadoz.net>
 
 On Mon, 22 Dec 2008, Alfred Perlstein wrote:
 
 Hi,
 
 >Fix is small and attached.  One thing I am wondering, do we
 >need to check "if (inp)" ?  I don't think so.
 
 I am not that concerned about the inp at the moment; there are a few
 other things:
 
 1 FreeBSD to my knowledge has neither IPV6_GET_CLASS nor IPV6_SET_CLASS
   nor IPV6_CLASS_MASK
 
 2 To the best I can see this currently ignores the upper 4 TC bits that
   go with the `version field' ("vcf"), so it's a hack good enough for
   now, but not a proper fix?
 
 3 I am assuming that we'd need to fix at least one more place.
 
 
 Tha said I planned to look at the in6p_flowinfo (inp_flow) field in
 the not too distant future anyway; I should perhaps combine this
 looking into the entire TC thing as well.
 
 -- 
 Bjoern A. Zeeb                      The greatest risk is not taking one.
 
 ----- End forwarded message -----
 
 -- 
 - Alfred Perlstein

From: Alfred Perlstein <alfred@freebsd.org>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/130657: ipv6 bugfix, need review.
Date: Sat, 17 Jan 2009 12:47:19 -0800

 adding mailing list discussion to audit trail.
 
 
 ----- Forwarded message from Bruce Simpson <bms@incunabulum.net> -----
 
 From: Bruce Simpson <bms@incunabulum.net>
 To: Alfred Perlstein <alfred@freebsd.org>
 Cc: net@freebsd.org
 Subject: Re: ipv6 bugfix, need review.
 Date: Wed, 24 Dec 2008 17:43:43 +0000
 Message-ID: <495274CF.3030703@incunabulum.net>
 User-Agent: Thunderbird 2.0.0.18 (X11/20081204)
 Sender: owner-freebsd-net@freebsd.org
 
 Alfred Perlstein wrote:
 >  The traffic class byte is set to 0x00000000 in the header of some
 >  BGP packets sent between interfaces that have IPv6 addresses,
 >  instead of the correct setting 0xc0 (INTERNETCONTROL).
 
 Content free argument:
    Feels right. I had to commit a man page diff to document the TCLASS 
 socket option.
    If this isn't happening for TCP sockets, then that certainly needs 
 dealing with.
 
 
 _______________________________________________
 freebsd-net@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-net
 To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"
 
 ----- End forwarded message -----
 
 -- 
 - Alfred Perlstein
Responsible-Changed-From-To: bz->gnn 
Responsible-Changed-By: bz 
Responsible-Changed-When: Sun May 18 05:01:58 UTC 2014 
Responsible-Changed-Why:  
I shall not use bugzilla (at least until we will have a CLI). 

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