From owner-freebsd-net@FreeBSD.ORG Tue Feb 4 00:05:24 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6EEA212C for ; Tue, 4 Feb 2014 00:05:24 +0000 (UTC) Received: from mail.ijs.si (mail.ijs.si [IPv6:2001:1470:ff80::25]) by mx1.freebsd.org (Postfix) with ESMTP id 2172316C6 for ; Tue, 4 Feb 2014 00:05:24 +0000 (UTC) Received: from amavis-proxy-ori.ijs.si (localhost [IPv6:::1]) by mail.ijs.si (Postfix) with ESMTP id 3fJ5l64SyTzGN5V for ; Tue, 4 Feb 2014 01:05:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ijs.si; h= user-agent:message-id:references:in-reply-to:organization :subject:subject:from:from:date:date:content-transfer-encoding :content-type:content-type:mime-version:received:received :received:received; s=jakla2; t=1391472319; x=1394064320; bh=jY3 Cc+sKw5R/YPbsSwKXKWAbxM9MSO/ysPQ/75RKF8s=; b=DvDfGLk6VuECtwX//yC wikoLj1eSamhJEEekvg0n8zmkpwpm8fSTbtlI5ZxNRMTo7xZvN+5fvGXvMA8Ss+n dfQO8edaytJlCfrH/v97NSma5j6fKWMw2fnMQd7QXGtchRGbHBUTSOeLAHp9MAed u/RlSv3jPymRr9fVp9bqcywA= X-Virus-Scanned: amavisd-new at ijs.si Received: from mail.ijs.si ([IPv6:::1]) by amavis-proxy-ori.ijs.si (mail.ijs.si [IPv6:::1]) (amavisd-new, port 10012) with ESMTP id SUUYNzL5eyaA for ; Tue, 4 Feb 2014 01:05:19 +0100 (CET) Received: from mildred.ijs.si (mailbox.ijs.si [IPv6:2001:1470:ff80::143:1]) by mail.ijs.si (Postfix) with ESMTP for ; Tue, 4 Feb 2014 01:05:19 +0100 (CET) Received: from neli.ijs.si (neli.ijs.si [193.2.4.95]) by mildred.ijs.si (Postfix) with ESMTP id DB5A4DC3 for ; Tue, 4 Feb 2014 01:05:19 +0100 (CET) Received: from sleepy.ijs.si ([2001:1470:ff80:e001::1:1]) by neli.ijs.si with HTTP (HTTP/1.1 POST); Tue, 04 Feb 2014 01:05:19 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 04 Feb 2014 01:05:19 +0100 From: Mark Martinec To: freebsd-net@freebsd.org Subject: Re: ip6opt.c Organization: J. Stefan Institute In-Reply-To: <20140204.052625.1192023326694116318.hrs@allbsd.org> References: <20140204.052625.1192023326694116318.hrs@allbsd.org> Message-ID: <758be52b7a245c492ec80a1d3a21d79e@mailbox.ijs.si> X-Sender: Mark.Martinec+freebsd@ijs.si User-Agent: Roundcube Webmail/0.9.5 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Feb 2014 00:05:24 -0000 > Eitan Adler wrote > li> DragonFly recently committed the following change and it seems that > it > li> applies to us as well. --- ip6opt.c (revision 261405) +++ ip6opt.c (working copy) @@ -381,11 +381,8 @@ inet6_opt_init(void *extbuf, socklen_t extlen) { struct ip6_ext *ext = (struct ip6_ext *)extbuf; - if (extlen < 0 || (extlen % 8)) - return(-1); - if (ext) { - if (extlen == 0) + if (extlen == 0 || (extlen % 8)) return(-1); ext->ip6e_len = (extlen >> 3) - 1; } 2014-02-03 21:26, Hiroki Sato wrote: > Just out of curiousity, what is the problem with returning -1 when > (extbuf == NULL) && (extlen % 8) != 0? It is against the specs. The RFC 3542 is clear on this: 10.1. inet6_opt_init int inet6_opt_init(void *extbuf, socklen_t extlen); This function returns the number of bytes needed for the empty extension header i.e., without any options. If extbuf is not NULL it also initializes the extension header to have the correct length field. In that case if the extlen value is not a positive (i.e., non-zero) multiple of 8 the function fails and returns -1. li> Should I commit it? I'd say yes. Mark