From owner-freebsd-net@FreeBSD.ORG Mon May 19 08:17:41 2008 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00CDF106567B for ; Mon, 19 May 2008 08:17:41 +0000 (UTC) (envelope-from mjl@luckie.org.nz) Received: from mailfilter14.ihug.co.nz (mailfilter14.ihug.co.nz [203.109.136.14]) by mx1.freebsd.org (Postfix) with ESMTP id 8DDF88FC14 for ; Mon, 19 May 2008 08:17:40 +0000 (UTC) (envelope-from mjl@luckie.org.nz) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AswEABHOMEh2XXmb/2dsb2JhbACBVao5 X-IronPort-AV: E=Sophos;i="4.27,508,1204455600"; d="scan'208";a="13143221" Received: from 118-93-121-155.dsl.dyn.ihug.co.nz (HELO spandex.luckie.org.nz) ([118.93.121.155]) by smtp.mailfilter6.ihug.co.nz with ESMTP/TLS/DHE-RSA-AES256-SHA; 19 May 2008 19:48:53 +1200 Received: from mjl by spandex.luckie.org.nz with local (Exim 4.69 (FreeBSD)) (envelope-from ) id 1Jy072-000GDB-Nd for freebsd-net@freebsd.org; Mon, 19 May 2008 19:48:52 +1200 Date: Mon, 19 May 2008 19:48:52 +1200 From: Matthew Luckie To: freebsd-net@freebsd.org Message-ID: <20080519074852.GA62290@spandex.luckie.org.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.3i Subject: rtadvd/rrenum.c:179 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 May 2008 08:17:41 -0000 When rtadvd is compiled on 7.0, the following warning is emitted: /usr/src/usr.sbin/rtadvd/rrenum.c:179: warning: overflow in implicit constant conversion I have not determined if the code works correct or not, but I wonder if it does. the line in question is this: struct irr_raflagmask { u_char onlink : 1; u_char autonomous : 1; u_char reserved : 6; } irr_raflagmask; irr->irr_raf_mask_onlink = (rpu->rpu_ramask & ICMP6_RR_PCOUSE_RAFLAGS_ONLINK); rpu_ramask is unsigned char, the constant is 0x80, and irr_raf_mask_onlink is a single bit value. This troubles me, and the compiler. I'm only raising this for consideration; if it can be determined that the code works correctly, maybe a commit can be made to silence the warnings. --- rrenum.c.orig 2004-03-10 21:46:39.000000000 +1300 +++ rrenum.c 2008-05-19 19:39:52.000000000 +1200 @@ -176,9 +176,9 @@ do_use_prefix(int len, struct rr_pco_mat irr->irr_u_uselen = rpu->rpu_uselen; irr->irr_u_keeplen = rpu->rpu_keeplen; irr->irr_raf_mask_onlink = - (rpu->rpu_ramask & ICMP6_RR_PCOUSE_RAFLAGS_ONLINK); + (rpu->rpu_ramask & ICMP6_RR_PCOUSE_RAFLAGS_ONLINK) == 0 ? 0 : 1; irr->irr_raf_mask_auto = - (rpu->rpu_ramask & ICMP6_RR_PCOUSE_RAFLAGS_AUTO); + (rpu->rpu_ramask & ICMP6_RR_PCOUSE_RAFLAGS_AUTO) == 0 ? 0 : 1; irr->irr_vltime = ntohl(rpu->rpu_vltime); irr->irr_pltime = ntohl(rpu->rpu_pltime); irr->irr_raf_onlink =