From nobody@FreeBSD.org  Thu Apr 12 14:57:21 2007
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 2669816A400
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 12 Apr 2007 14:57:21 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [69.147.83.33])
	by mx1.freebsd.org (Postfix) with ESMTP id 0610C13C45D
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 12 Apr 2007 14:57:21 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l3CEvKiv090221
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 12 Apr 2007 14:57:20 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id l3CEqKQH079254;
	Thu, 12 Apr 2007 14:52:20 GMT
	(envelope-from nobody)
Message-Id: <200704121452.l3CEqKQH079254@www.freebsd.org>
Date: Thu, 12 Apr 2007 14:52:20 GMT
From: Thomas Karcher<thkarcher@gmx.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] in6_setscope() sets scope flags wrong
X-Send-Pr-Version: www-3.0

>Number:         111513
>Category:       kern
>Synopsis:       [netinet6] [patch] in6_setscope() sets scope flags wrong
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Apr 12 15:00:04 GMT 2007
>Closed-Date:    Thu Apr 19 05:21:52 GMT 2007
>Last-Modified:  Thu Apr 19 05:21:52 GMT 2007
>Originator:     Thomas Karcher
>Release:        RELENG_6_2_0_RELEASE
>Organization:
>Environment:
>Description:
In netinet6/scope6.c is a function called "in6_setscope()" which sets the appropriate scope flag for an IPv6 (in my case multicast) address.

I think line 475 is not correct, it looks like this:

474         if (IN6_IS_SCOPE_LINKLOCAL(in6) || IN6_IS_ADDR_MC_INTFACELOCAL(in6))
475                 in6->s6_addr16[1] = htons(zoneid & 0xffff);

The scope is usually just 8 bits after the 1111 1111 (FF) start of a multicast address. E. g. if I want to sent a multicast over a local link, the address should start with FF02 - the 2 is for link-local scope.

Unfortunately, the code above sets 16 bits in the second 16-bit-part of the address, so it starts with FF00:0002 which is simply wrong.

I didn't check other parts of the file for the same error.
>How-To-Repeat:

>Fix:
To my extent, it should be as follows:

474         if (IN6_IS_SCOPE_LINKLOCAL(in6) || IN6_IS_ADDR_MC_INTFACELOCAL(in6))
475                 in6->s6_addr8[1] = htons(zoneid & 0xff);


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: remko 
State-Changed-When: Thu Apr 19 05:21:46 UTC 2007 
State-Changed-Why:  
George and Hajimu regard this as an implementation choice and are not 
seeing a bug here. Reflect that in the ticket state -> clsoed. 

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